From 70992fbff4d434c099f60f8a54f648b37937b366 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 20:41:48 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20[pre-commit.ci]=20Auto=20format?= =?UTF-8?q?=20from=20pre-commit.com=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_ambiguous_params.py | 15 +++++---------- typer/params.py | 12 ++++-------- typer/rich_utils.py | 6 +++--- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/tests/test_ambiguous_params.py b/tests/test_ambiguous_params.py index 4dbf09b569..0693c8e9aa 100644 --- a/tests/test_ambiguous_params.py +++ b/tests/test_ambiguous_params.py @@ -29,8 +29,7 @@ def test_forbid_default_value_in_annotated_argument(): # This test case only works with `typer.Argument`. `typer.Option` uses positionals # for param_decls too. @app.command() - def cmd(my_param: Annotated[str, typer.Argument("foo")]): - ... # pragma: no cover + def cmd(my_param: Annotated[str, typer.Argument("foo")]): ... # pragma: no cover with pytest.raises(AnnotatedParamWithDefaultValueError) as excinfo: runner.invoke(app) @@ -64,8 +63,7 @@ def test_forbid_annotated_param_and_default_param(param, param_info_type): app = typer.Typer() @app.command() - def cmd(my_param: Annotated[str, param()] = param("foo")): - ... # pragma: no cover + def cmd(my_param: Annotated[str, param()] = param("foo")): ... # pragma: no cover with pytest.raises(MixedAnnotatedAndDefaultStyleError) as excinfo: runner.invoke(app) @@ -83,8 +81,7 @@ def test_forbid_multiple_typer_params_in_annotated(): @app.command() def cmd( my_param: Annotated[str, typer.Argument(), typer.Argument()], - ): - ... # pragma: no cover + ): ... # pragma: no cover with pytest.raises(MultipleTyperAnnotationsError) as excinfo: runner.invoke(app) @@ -121,8 +118,7 @@ def make_string(): @app.command() def cmd( my_param: Annotated[str, param(default_factory=make_string)] = "hello", - ): - ... # pragma: no cover + ): ... # pragma: no cover with pytest.raises(DefaultFactoryAndDefaultValueError) as excinfo: runner.invoke(app) @@ -171,8 +167,7 @@ def make_string(): @app.command() def cmd( my_param: str = param("hi", default_factory=make_string), - ): - ... # pragma: no cover + ): ... # pragma: no cover with pytest.raises(DefaultFactoryAndDefaultValueError) as excinfo: runner.invoke(app) diff --git a/typer/params.py b/typer/params.py index 710a4cf136..2fd025c90d 100644 --- a/typer/params.py +++ b/typer/params.py @@ -68,8 +68,7 @@ def Option( path_type: Union[None, Type[str], Type[bytes]] = None, # Rich settings rich_help_panel: Union[str, None] = None, -) -> Any: - ... +) -> Any: ... # Overload for Option created with custom type 'click_type' @@ -132,8 +131,7 @@ def Option( path_type: Union[None, Type[str], Type[bytes]] = None, # Rich settings rich_help_panel: Union[str, None] = None, -) -> Any: - ... +) -> Any: ... def Option( @@ -305,8 +303,7 @@ def Argument( path_type: Union[None, Type[str], Type[bytes]] = None, # Rich settings rich_help_panel: Union[str, None] = None, -) -> Any: - ... +) -> Any: ... # Overload for Argument created with custom type 'click_type' @@ -361,8 +358,7 @@ def Argument( path_type: Union[None, Type[str], Type[bytes]] = None, # Rich settings rich_help_panel: Union[str, None] = None, -) -> Any: - ... +) -> Any: ... def Argument( diff --git a/typer/rich_utils.py b/typer/rich_utils.py index cf0538e914..900f4b4e87 100644 --- a/typer/rich_utils.py +++ b/typer/rich_utils.py @@ -68,9 +68,9 @@ STYLE_ABORTED = "red" _TERMINAL_WIDTH = getenv("TERMINAL_WIDTH") MAX_WIDTH = int(_TERMINAL_WIDTH) if _TERMINAL_WIDTH else None -COLOR_SYSTEM: Optional[ - Literal["auto", "standard", "256", "truecolor", "windows"] -] = "auto" # Set to None to disable colors +COLOR_SYSTEM: Optional[Literal["auto", "standard", "256", "truecolor", "windows"]] = ( + "auto" # Set to None to disable colors +) _TYPER_FORCE_DISABLE_TERMINAL = getenv("_TYPER_FORCE_DISABLE_TERMINAL") FORCE_TERMINAL = ( True