Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#472)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Sep 7, 2024
1 parent 3c1773a commit d0fa2bb
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 43 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.0
rev: 0.29.2
hooks:
- id: check-github-workflows
args: [ "--verbose" ]
Expand All @@ -20,12 +20,12 @@ repos:
- id: tox-ini-fmt
args: ["-p", "fix"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.1.4"
rev: "2.2.1"
hooks:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.14.2"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.5.4"
rev: "v0.6.3"
hooks:
- id: ruff-format
- id: ruff
Expand Down
8 changes: 4 additions & 4 deletions tests/roots/test-dummy/dummy_module_future_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@


def function_with_py310_annotations(
self, # noqa: ANN001, ARG001
x: bool | None, # noqa: ARG001
y: int | str | float, # noqa: ARG001,PYI041
z: str | None = None, # noqa: ARG001
self, # noqa: ANN001
x: bool | None,
y: int | str | float, # noqa: PYI041
z: str | None = None,
) -> str:
"""
Method docstring.
Expand Down
2 changes: 1 addition & 1 deletion tests/roots/test-dummy/dummy_module_simple.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations


def function(x: bool, y: int = 1) -> str: # noqa: ARG001
def function(x: bool, y: int = 1) -> str:
"""
Function docstring.
Expand Down
2 changes: 1 addition & 1 deletion tests/roots/test-dummy/dummy_module_simple_default_role.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations


def function(x: bool, y: int) -> str: # noqa: ARG001
def function(x: bool, y: int) -> str:
"""
Function docstring.
Expand Down
8 changes: 4 additions & 4 deletions tests/roots/test-dummy/dummy_module_simple_no_use_rtype.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations


def function_no_returns(x: bool, y: int = 1) -> str: # noqa: ARG001
def function_no_returns(x: bool, y: int = 1) -> str:
"""
Function docstring.
Expand All @@ -10,7 +10,7 @@ def function_no_returns(x: bool, y: int = 1) -> str: # noqa: ARG001
"""


def function_returns_with_type(x: bool, y: int = 1) -> str: # noqa: ARG001
def function_returns_with_type(x: bool, y: int = 1) -> str:
"""
Function docstring.
Expand All @@ -20,7 +20,7 @@ def function_returns_with_type(x: bool, y: int = 1) -> str: # noqa: ARG001
"""


def function_returns_with_compound_type(x: bool, y: int = 1) -> str: # noqa: ARG001
def function_returns_with_compound_type(x: bool, y: int = 1) -> str:
"""
Function docstring.
Expand All @@ -30,7 +30,7 @@ def function_returns_with_compound_type(x: bool, y: int = 1) -> str: # noqa: AR
"""


def function_returns_without_type(x: bool, y: int = 1) -> str: # noqa: ARG001
def function_returns_without_type(x: bool, y: int = 1) -> str:
"""
Function docstring.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations


def function_with_some_defaults_and_without_typehints(x, y=None): # noqa: ANN001, ANN201, ARG001
def function_with_some_defaults_and_without_typehints(x, y=None): # noqa: ANN001, ANN201
"""
Function docstring.
Expand All @@ -10,7 +10,7 @@ def function_with_some_defaults_and_without_typehints(x, y=None): # noqa: ANN00
"""


def function_with_some_defaults_and_some_typehints(x: int, y=None): # noqa: ANN001, ANN201, ARG001
def function_with_some_defaults_and_some_typehints(x: int, y=None): # noqa: ANN001, ANN201
"""
Function docstring.
Expand All @@ -19,7 +19,7 @@ def function_with_some_defaults_and_some_typehints(x: int, y=None): # noqa: ANN
"""


def function_with_some_defaults_and_more_typehints(x: int, y=None) -> str: # noqa: ANN001, ARG001
def function_with_some_defaults_and_more_typehints(x: int, y=None) -> str: # noqa: ANN001
"""
Function docstring.
Expand All @@ -28,7 +28,7 @@ def function_with_some_defaults_and_more_typehints(x: int, y=None) -> str: # no
"""


def function_with_defaults_and_some_typehints(x: int = 0, y=None) -> str: # noqa: ANN001, ARG001
def function_with_defaults_and_some_typehints(x: int = 0, y=None) -> str: # noqa: ANN001
"""
Function docstring.
Expand Down
42 changes: 21 additions & 21 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def dec(val: T) -> T:

@expected("mod.get_local_function()")
def get_local_function(): # noqa: ANN201
def wrapper(self) -> str: # noqa: ANN001, ARG001
def wrapper(self) -> str: # noqa: ANN001
"""
Wrapper
"""
Expand Down Expand Up @@ -271,7 +271,7 @@ def __init__(self, message: str) -> None:
bytes
""",
)
def function(x: bool, y: int, z_: Optional[str] = None) -> str: # noqa: ARG001, UP007
def function(x: bool, y: int, z_: Optional[str] = None) -> str: # noqa: UP007
"""
Function docstring.
Expand Down Expand Up @@ -299,7 +299,7 @@ def function(x: bool, y: int, z_: Optional[str] = None) -> str: # noqa: ARG001,
* ****kwargs** ("str") -- bar
""",
)
def function_with_starred_documentation_param_names(*args: int, **kwargs: str): # noqa: ANN201, ARG001
def function_with_starred_documentation_param_names(*args: int, **kwargs: str): # noqa: ANN201
r"""
Function docstring.
Expand All @@ -322,7 +322,7 @@ def function_with_starred_documentation_param_names(*args: int, **kwargs: str):
**x** ("str") -- foo
""",
)
def function_with_escaped_default(x: str = "\b"): # noqa: ANN201, ARG001
def function_with_escaped_default(x: str = "\b"): # noqa: ANN201
"""
Function docstring.
Expand All @@ -341,7 +341,7 @@ def function_with_escaped_default(x: str = "\b"): # noqa: ANN201, ARG001
**x** (a.b.c) -- foo
""",
)
def function_with_unresolvable_annotation(x: a.b.c): # noqa: ANN201, ARG001, F821
def function_with_unresolvable_annotation(x: a.b.c): # noqa: ANN201, F821
"""
Function docstring.
Expand All @@ -365,8 +365,8 @@ def function_with_unresolvable_annotation(x: a.b.c): # noqa: ANN201, ARG001, F8
""",
)
def function_with_typehint_comment( # noqa: ANN201
x, # type: int # noqa: ANN001, ARG001
y, # type: str # noqa: ANN001, ARG001
x, # type: int # noqa: ANN001
y, # type: str # noqa: ANN001
):
# type: (...) -> None
"""
Expand Down Expand Up @@ -457,7 +457,7 @@ def method_without_typehint(self, x): # noqa: ANN001, ANN201, ARG002, PLR6301
"None"
""",
)
def function_with_typehint_comment_not_inline(x=None, *y, z, **kwargs): # noqa: ANN001, ANN002, ANN003, ANN201, ARG001
def function_with_typehint_comment_not_inline(x=None, *y, z, **kwargs): # noqa: ANN001, ANN002, ANN003, ANN201
# type: (Union[str, bytes, None], *str, bytes, **int) -> None
"""
Function docstring.
Expand Down Expand Up @@ -592,7 +592,7 @@ def __init__(self, func: Callable[[int, str], str]) -> None:
**x** ("Mailbox") -- function
""",
)
def mocked_import(x: Mailbox): # noqa: ANN201, ARG001
def mocked_import(x: Mailbox): # noqa: ANN201
"""
A docstring.
Expand Down Expand Up @@ -648,7 +648,7 @@ def func_with_overload(a: str, b: str) -> None: ...
"None"
""",
)
def func_with_overload(a: Union[int, str], b: Union[int, str]) -> None: # noqa: ARG001, UP007
def func_with_overload(a: Union[int, str], b: Union[int, str]) -> None: # noqa: UP007
"""
f does the thing. The arguments can either be ints or strings but they must
both have the same type.
Expand Down Expand Up @@ -727,7 +727,7 @@ def func_with_examples_and_returns_after() -> int:
More info about the function here.
""",
)
def func_with_parameters_and_stuff_after(a: int, b: int) -> int: # noqa: ARG001
def func_with_parameters_and_stuff_after(a: int, b: int) -> int:
"""A func
:param a: a tells us something
Expand Down Expand Up @@ -761,7 +761,7 @@ def func_with_parameters_and_stuff_after(a: int, b: int) -> int: # noqa: ARG001
int
""",
)
def func_with_rtype_in_weird_spot(a: int, b: int) -> int: # noqa: ARG001
def func_with_rtype_in_weird_spot(a: int, b: int) -> int:
"""A func
:param a: a tells us something
Expand Down Expand Up @@ -809,7 +809,7 @@ def func_with_rtype_in_weird_spot(a: int, b: int) -> int: # noqa: ARG001
More stuff here.
""",
)
def empty_line_between_parameters(a: int, b: int) -> int: # noqa: ARG001
def empty_line_between_parameters(a: int, b: int) -> int:
"""A func
:param a: One of the following possibilities:
Expand Down Expand Up @@ -1002,7 +1002,7 @@ def napoleon_returns() -> CodeType:
""",
)
def google_docstrings(arg1: CodeType, arg2: ModuleType) -> CodeType: # noqa: ARG001
def google_docstrings(arg1: CodeType, arg2: ModuleType) -> CodeType:
"""Summary line.
Extended description of function.
Expand Down Expand Up @@ -1034,7 +1034,7 @@ def google_docstrings(arg1: CodeType, arg2: ModuleType) -> CodeType: # noqa: AR
""",
)
def docstring_with_multiline_note_after_params(param: int) -> None: # noqa: ARG001
def docstring_with_multiline_note_after_params(param: int) -> None:
"""Do something.
Args:
Expand Down Expand Up @@ -1065,7 +1065,7 @@ def docstring_with_multiline_note_after_params(param: int) -> None: # noqa: ARG
""",
)
def docstring_with_bullet_list_after_params(param: int) -> None: # noqa: ARG001
def docstring_with_bullet_list_after_params(param: int) -> None:
"""Do something.
Args:
Expand Down Expand Up @@ -1098,7 +1098,7 @@ def docstring_with_bullet_list_after_params(param: int) -> None: # noqa: ARG001
""",
)
def docstring_with_definition_list_after_params(param: int) -> None: # noqa: ARG001
def docstring_with_definition_list_after_params(param: int) -> None:
"""Do something.
Args:
Expand Down Expand Up @@ -1132,7 +1132,7 @@ def docstring_with_definition_list_after_params(param: int) -> None: # noqa: AR
""",
)
def docstring_with_enum_list_after_params(param: int) -> None: # noqa: ARG001
def docstring_with_enum_list_after_params(param: int) -> None:
"""Do something.
Args:
Expand Down Expand Up @@ -1167,7 +1167,7 @@ def docstring_with_enum_list_after_params(param: int) -> None: # noqa: ARG001
-[ Example ]-
""",
)
def docstring_with_definition_list_after_params_no_blank_line(param: int) -> None: # noqa: ARG001
def docstring_with_definition_list_after_params_no_blank_line(param: int) -> None:
"""Do something.
Args:
Expand Down Expand Up @@ -1292,7 +1292,7 @@ def typehints_use_signature(a: AsyncGenerator) -> AsyncGenerator:
""",
rst_prolog=prolog,
)
def docstring_with_multiline_note_after_params_prolog_replace(param: int) -> None: # noqa: ARG001
def docstring_with_multiline_note_after_params_prolog_replace(param: int) -> None:
"""Do something.
Args:
Expand Down Expand Up @@ -1329,7 +1329,7 @@ def docstring_with_multiline_note_after_params_prolog_replace(param: int) -> Non
""",
rst_epilog=epilog,
)
def docstring_with_multiline_note_after_params_epilog_replace(param: int) -> None: # noqa: ARG001
def docstring_with_multiline_note_after_params_epilog_replace(param: int) -> None:
"""Do something.
Args:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_integration_autodoc_type_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def g(s: AliasedClass) -> AliasedClass:
""",
)
def function(x: ArrayLike, y: Schema) -> str: # noqa: ARG001
def function(x: ArrayLike, y: Schema) -> str:
"""
Function docstring.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_integration_issue_384.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def dec(val: T) -> T:
""",
)
def function(x: int = 5, y: int = 10, z: int = 15) -> str: # noqa: ARG001
def function(x: int = 5, y: int = 10, z: int = 15) -> str:
"""
Function docstring.
Expand Down
6 changes: 3 additions & 3 deletions tests/test_sphinx_autodoc_typehints.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,15 +355,15 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
# Zero-length tuple remains
pytest.param(Tuple[()], ":py:data:`~typing.Tuple`", id="Tuple-p"), # noqa: UP006
# Internal single tuple with simple types is flattened in the output
pytest.param(Tuple[(int,)], r":py:data:`~typing.Tuple`\ \[:py:class:`int`]", id="Tuple-p-int"), # noqa: UP006
pytest.param(Tuple[int,], r":py:data:`~typing.Tuple`\ \[:py:class:`int`]", id="Tuple-p-int"), # noqa: UP006
pytest.param(
Tuple[(int, int)], # noqa: UP006
Tuple[int, int], # noqa: UP006
r":py:data:`~typing.Tuple`\ \[:py:class:`int`, :py:class:`int`]",
id="Tuple-p-int-int", # noqa: RUF100, UP006
),
# Ellipsis in single tuple also gets flattened
pytest.param(
Tuple[(int, ...)], # noqa: UP006
Tuple[int, ...], # noqa: UP006
r":py:data:`~typing.Tuple`\ \[:py:class:`int`, :py:data:`...<Ellipsis>`]",
id="Tuple-p-Ellipsis",
),
Expand Down

0 comments on commit d0fa2bb

Please sign in to comment.