Skip to content

Commit 8e0e36a

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 2485866 commit 8e0e36a

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

tests/test_integration.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
TYPE_CHECKING,
1111
Any,
1212
NewType,
13-
Optional,
1413
TypeVar,
1514
Union,
1615
overload,
@@ -148,10 +147,10 @@ class Class:
148147
:param z: baz
149148
"""
150149

151-
def __init__(self, x: bool, y: int, z: Optional[str] = None) -> None: # noqa: UP007
150+
def __init__(self, x: bool, y: int, z: str | None = None) -> None:
152151
pass
153152

154-
def a_method(self, x: bool, y: int, z: Optional[str] = None) -> str: # noqa: UP007
153+
def a_method(self, x: bool, y: int, z: str | None = None) -> str:
155154
"""
156155
Method docstring.
157156
@@ -182,7 +181,7 @@ def __magic_custom_method__(self, x: str) -> str: # noqa: PLW3201
182181
"""
183182

184183
@classmethod
185-
def a_classmethod(cls, x: bool, y: int, z: Optional[str] = None) -> str: # noqa: UP007
184+
def a_classmethod(cls, x: bool, y: int, z: str | None = None) -> str:
186185
"""
187186
Classmethod docstring.
188187
@@ -192,7 +191,7 @@ def a_classmethod(cls, x: bool, y: int, z: Optional[str] = None) -> str: # noqa
192191
"""
193192

194193
@staticmethod
195-
def a_staticmethod(x: bool, y: int, z: Optional[str] = None) -> str: # noqa: UP007
194+
def a_staticmethod(x: bool, y: int, z: str | None = None) -> str:
196195
"""
197196
Staticmethod docstring.
198197
@@ -270,7 +269,7 @@ def __init__(self, message: str) -> None:
270269
bytes
271270
""",
272271
)
273-
def function(x: bool, y: int, z_: Optional[str] = None) -> str: # noqa: UP007
272+
def function(x: bool, y: int, z_: str | None = None) -> str:
274273
"""
275274
Function docstring.
276275
@@ -675,7 +674,7 @@ class mod.TestClassAttributeDocs
675674
class TestClassAttributeDocs:
676675
"""A class"""
677676

678-
code: Optional[CodeType] # noqa: UP007
677+
code: CodeType | None
679678
"""An attribute"""
680679

681680

tests/test_sphinx_autodoc_typehints.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
257257
id="Union-str-Any",
258258
),
259259
pytest.param(
260-
Optional[str], # noqa: UP007
260+
Optional[str],
261261
r":py:data:`~typing.Optional`\ \[:py:class:`str`]",
262262
id="Optional-str",
263263
),
@@ -267,7 +267,7 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
267267
id="Optional-str-None",
268268
),
269269
pytest.param(
270-
Optional[str | bool], # noqa: UP007
270+
Optional[str | bool],
271271
r":py:data:`~typing.Union`\ \[:py:class:`str`, :py:class:`bool`, :py:obj:`None`]",
272272
id="Optional-Union-str-bool",
273273
),

0 commit comments

Comments
 (0)