Skip to content

Commit 3db6e23

Browse files
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
1 parent 9eb5553 commit 3db6e23

File tree

3 files changed

+12
-21
lines changed

3 files changed

+12
-21
lines changed

tests/test_ambiguous_params.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ def test_forbid_default_value_in_annotated_argument():
2929
# This test case only works with `typer.Argument`. `typer.Option` uses positionals
3030
# for param_decls too.
3131
@app.command()
32-
def cmd(my_param: Annotated[str, typer.Argument("foo")]):
33-
... # pragma: no cover
32+
def cmd(my_param: Annotated[str, typer.Argument("foo")]): ... # pragma: no cover
3433

3534
with pytest.raises(AnnotatedParamWithDefaultValueError) as excinfo:
3635
runner.invoke(app)
@@ -64,8 +63,7 @@ def test_forbid_annotated_param_and_default_param(param, param_info_type):
6463
app = typer.Typer()
6564

6665
@app.command()
67-
def cmd(my_param: Annotated[str, param()] = param("foo")):
68-
... # pragma: no cover
66+
def cmd(my_param: Annotated[str, param()] = param("foo")): ... # pragma: no cover
6967

7068
with pytest.raises(MixedAnnotatedAndDefaultStyleError) as excinfo:
7169
runner.invoke(app)
@@ -83,8 +81,7 @@ def test_forbid_multiple_typer_params_in_annotated():
8381
@app.command()
8482
def cmd(
8583
my_param: Annotated[str, typer.Argument(), typer.Argument()],
86-
):
87-
... # pragma: no cover
84+
): ... # pragma: no cover
8885

8986
with pytest.raises(MultipleTyperAnnotationsError) as excinfo:
9087
runner.invoke(app)
@@ -121,8 +118,7 @@ def make_string():
121118
@app.command()
122119
def cmd(
123120
my_param: Annotated[str, param(default_factory=make_string)] = "hello",
124-
):
125-
... # pragma: no cover
121+
): ... # pragma: no cover
126122

127123
with pytest.raises(DefaultFactoryAndDefaultValueError) as excinfo:
128124
runner.invoke(app)
@@ -171,8 +167,7 @@ def make_string():
171167
@app.command()
172168
def cmd(
173169
my_param: str = param("hi", default_factory=make_string),
174-
):
175-
... # pragma: no cover
170+
): ... # pragma: no cover
176171

177172
with pytest.raises(DefaultFactoryAndDefaultValueError) as excinfo:
178173
runner.invoke(app)

typer/params.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ def Option(
6868
path_type: Union[None, Type[str], Type[bytes]] = None,
6969
# Rich settings
7070
rich_help_panel: Union[str, None] = None,
71-
) -> Any:
72-
...
71+
) -> Any: ...
7372

7473

7574
# Overload for Option created with custom type 'click_type'
@@ -132,8 +131,7 @@ def Option(
132131
path_type: Union[None, Type[str], Type[bytes]] = None,
133132
# Rich settings
134133
rich_help_panel: Union[str, None] = None,
135-
) -> Any:
136-
...
134+
) -> Any: ...
137135

138136

139137
def Option(
@@ -305,8 +303,7 @@ def Argument(
305303
path_type: Union[None, Type[str], Type[bytes]] = None,
306304
# Rich settings
307305
rich_help_panel: Union[str, None] = None,
308-
) -> Any:
309-
...
306+
) -> Any: ...
310307

311308

312309
# Overload for Argument created with custom type 'click_type'
@@ -361,8 +358,7 @@ def Argument(
361358
path_type: Union[None, Type[str], Type[bytes]] = None,
362359
# Rich settings
363360
rich_help_panel: Union[str, None] = None,
364-
) -> Any:
365-
...
361+
) -> Any: ...
366362

367363

368364
def Argument(

typer/rich_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@
6868
STYLE_ABORTED = "red"
6969
_TERMINAL_WIDTH = getenv("TERMINAL_WIDTH")
7070
MAX_WIDTH = int(_TERMINAL_WIDTH) if _TERMINAL_WIDTH else None
71-
COLOR_SYSTEM: Optional[
72-
Literal["auto", "standard", "256", "truecolor", "windows"]
73-
] = "auto" # Set to None to disable colors
71+
COLOR_SYSTEM: Optional[Literal["auto", "standard", "256", "truecolor", "windows"]] = (
72+
"auto" # Set to None to disable colors
73+
)
7474
_TYPER_FORCE_DISABLE_TERMINAL = getenv("_TYPER_FORCE_DISABLE_TERMINAL")
7575
FORCE_TERMINAL = (
7676
True

0 commit comments

Comments
 (0)