Skip to content

Commit

Permalink
⬆ Bump ruff from 0.2.0 to 0.6.1 (#938)
Browse files Browse the repository at this point in the history
* ⬆ Bump ruff from 0.2.0 to 0.6.1

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.2.0 to 0.6.1.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@v0.2.0...0.6.1)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: svlandeg <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 28, 2024
1 parent ae82de0 commit 7d6db83
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.1
hooks:
- id: ruff
args:
Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ coverage[toml] >=6.2,<8.0
pytest-xdist >=1.32.0,<4.0.0
pytest-sugar >=0.9.4,<1.1.0
mypy ==1.4.1
ruff ==0.2.0
ruff ==0.6.1
# Needed explicitly by typer-slim
rich >=10.11.0
shellingham >=1.3.0
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
8 changes: 4 additions & 4 deletions typer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,9 +715,9 @@ def get_click_type(
elif parameter_info.parser is not None:
return click.types.FuncParamType(parameter_info.parser)

elif annotation == str:
elif annotation is str:
return click.STRING
elif annotation == int:
elif annotation is int:
if parameter_info.min is not None or parameter_info.max is not None:
min_ = None
max_ = None
Expand All @@ -728,7 +728,7 @@ def get_click_type(
return click.IntRange(min=min_, max=max_, clamp=parameter_info.clamp)
else:
return click.INT
elif annotation == float:
elif annotation is float:
if parameter_info.min is not None or parameter_info.max is not None:
return click.FloatRange(
min=parameter_info.min,
Expand All @@ -737,7 +737,7 @@ def get_click_type(
)
else:
return click.FLOAT
elif annotation == bool:
elif annotation is bool:
return click.BOOL
elif annotation == UUID:
return click.UUID
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

0 comments on commit 7d6db83

Please sign in to comment.