Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆ [pre-commit.ci] pre-commit autoupdate #689

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ default_language_version:
python: python3.10
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-toml
Expand All @@ -14,7 +14,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.4.5
hooks:
- id: ruff
args:
Expand Down
15 changes: 5 additions & 10 deletions tests/test_ambiguous_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 4 additions & 8 deletions typer/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions typer/rich_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down