Coverage for src/fastapi_new/utils/cli.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.11.2, created at 2026-11-04 19:57 +0000

1import logging 1abcdefgh

2 

3from rich_toolkit import RichToolkit, RichToolkitTheme 1abcdefgh

4from rich_toolkit.styles import MinimalStyle, TaggedStyle 1abcdefgh

5 

6logger = logging.getLogger(__name__) 1abcdefgh

7 

8 

9class FastAPIStyle(TaggedStyle): 1abcdefgh

10 def __init__(self, tag_width: int = 11): 1abcdefgh

11 super().__init__(tag_width=tag_width) 2i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 ! # $ % ' ( ) * + , - . / : ; = ? @ [ ] ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblbmbnbobpbqbrbsbtbubvbwbxbybzbAbBbCbDbEb

12 

13 

14def get_rich_toolkit(minimal: bool = False) -> RichToolkit: 1abcdefgh

15 style = MinimalStyle() if minimal else FastAPIStyle(tag_width=11) 2i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 ! # $ % ' ( ) * + , - . / : ; = ? @ [ ] ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblbmbnbobpbqbrbsbtbubvbwbxbybzbAbBbCbDbEb

16 

17 theme = RichToolkitTheme( 2i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 ! # $ % ' ( ) * + , - . / : ; = ? @ [ ] ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblbmbnbobpbqbrbsbtbubvbwbxbybzbAbBbCbDbEb

18 style=style, 

19 theme={ 

20 "tag.title": "white on #009485", 

21 "tag": "white on #007166", 

22 "placeholder": "grey85", 

23 "text": "white", 

24 "selected": "#007166", 

25 "result": "grey85", 

26 "progress": "on #007166", 

27 "error": "red", 

28 }, 

29 ) 

30 

31 return RichToolkit(theme=theme) 2i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 ! # $ % ' ( ) * + , - . / : ; = ? @ [ ] ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblbmbnbobpbqbrbsbtbubvbwbxbybzbAbBbCbDbEb