Skip to content

Commit 36aacf1

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 20c9f94 commit 36aacf1

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

flake8_async/visitors/helpers.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from collections.abc import Sized
1010
from dataclasses import dataclass
1111
from fnmatch import fnmatch
12-
from typing import TYPE_CHECKING, Generic, TypeVar, Union
12+
from typing import TYPE_CHECKING, Generic, TypeVar
1313

1414
import libcst as cst
1515
import libcst.matchers as m
@@ -35,11 +35,9 @@
3535

3636
T = TypeVar("T", bound=Flake8AsyncVisitor)
3737
T_CST = TypeVar("T_CST", bound=Flake8AsyncVisitor_cst)
38-
T_EITHER = TypeVar(
39-
"T_EITHER", bound=Union[Flake8AsyncVisitor, Flake8AsyncVisitor_cst]
40-
)
38+
T_EITHER = TypeVar("T_EITHER", bound=Flake8AsyncVisitor | Flake8AsyncVisitor_cst)
4139

42-
T_Call = TypeVar("T_Call", bound=Union[cst.Call, ast.Call])
40+
T_Call = TypeVar("T_Call", bound=cst.Call | ast.Call)
4341

4442

4543
def error_class(error_class: type[T]) -> type[T]:

tests/eval_files/async232.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ async def file_text_5(f: TextIOWrapper | None = None):
8181
f.read() # ASYNC232: 8, 'read', 'f', "trio"
8282

8383

84-
async def file_text_6(f: Optional[TextIOWrapper] = None):
84+
async def file_text_6(f: TextIOWrapper | None = None):
8585
f.read() # ASYNC232: 4, 'read', 'f', "trio"
8686
if f:
8787
f.read() # ASYNC232: 8, 'read', 'f', "trio"
@@ -227,12 +227,12 @@ async def attribute_access_on_object():
227227

228228
# The type checker is very naive, and will not do any parsing of logic pertaining
229229
# to the type
230-
async def type_restricting_1(f: Optional[TextIOWrapper] = None):
230+
async def type_restricting_1(f: TextIOWrapper | None = None):
231231
if f is None:
232232
f.read() # ASYNC232: 8, 'read', 'f', "trio"
233233

234234

235-
async def type_restricting_2(f: Optional[TextIOWrapper] = None):
235+
async def type_restricting_2(f: TextIOWrapper | None = None):
236236
if isinstance(f, TextIOWrapper):
237237
return
238238
f.read() # ASYNC232: 4, 'read', 'f', "trio"

tests/eval_files/async232_asyncio.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def file_text_5(f: TextIOWrapper | None = None):
8282
f.read() # ASYNC232_asyncio: 8, 'read', 'f'
8383

8484

85-
async def file_text_6(f: Optional[TextIOWrapper] = None):
85+
async def file_text_6(f: TextIOWrapper | None = None):
8686
f.read() # ASYNC232_asyncio: 4, 'read', 'f'
8787
if f:
8888
f.read() # ASYNC232_asyncio: 8, 'read', 'f'
@@ -228,12 +228,12 @@ async def attribute_access_on_object():
228228

229229
# The type checker is very naive, and will not do any parsing of logic pertaining
230230
# to the type
231-
async def type_restricting_1(f: Optional[TextIOWrapper] = None):
231+
async def type_restricting_1(f: TextIOWrapper | None = None):
232232
if f is None:
233233
f.read() # ASYNC232_asyncio: 8, 'read', 'f'
234234

235235

236-
async def type_restricting_2(f: Optional[TextIOWrapper] = None):
236+
async def type_restricting_2(f: TextIOWrapper | None = None):
237237
if isinstance(f, TextIOWrapper):
238238
return
239239
f.read() # ASYNC232_asyncio: 4, 'read', 'f'

0 commit comments

Comments
 (0)