Skip to content

Commit 6023027

Browse files
committed
3.8 compat fixes 2
1 parent ae11df7 commit 6023027

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

jishaku/features/baseclass.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949

5050
T = typing.TypeVar('T')
5151
P = ParamSpec('P')
52-
Task = asyncio.Task[typing.Any]
5352
GenericFeature = typing.TypeVar('GenericFeature', bound='Feature')
5453

5554

@@ -60,7 +59,7 @@ class CommandTask(typing.NamedTuple):
6059

6160
index: int # type: ignore
6261
ctx: ContextA
63-
task: typing.Optional[Task]
62+
task: typing.Optional['asyncio.Task[typing.Any]']
6463

6564

6665
class Feature(commands.Cog):

tests/test_executorfunc.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ def sig(*args, **kwargs):
3333
]
3434
)
3535
@pytest.mark.asyncio
36-
async def test_magic_executor(args: tuple[typing.Any, ...], kwargs: dict[str, typing.Any], expected_return: tuple[int, int | None, int]):
37-
def non_executor(a: int, b: int | None = None, *, c: int) -> tuple[int, int | None, int]:
36+
async def test_magic_executor(args: typing.Tuple[typing.Any, ...], kwargs: typing.Dict[str, typing.Any], expected_return: typing.Tuple[int, typing.Optional[int], int]):
37+
def non_executor(a: int, b: typing.Optional[int] = None, *, c: int) -> typing.Tuple[int, typing.Optional[int], int]:
3838
return a, b, c
3939

4040
exact_executor = executor_function(non_executor)
4141

4242
@executor_function
43-
def redefined_executor(a: int, b: int | None = None, *, c: int) -> tuple[int, int | None, int]:
43+
def redefined_executor(a: int, b: typing.Optional[int] = None, *, c: int) -> typing.Tuple[int, typing.Optional[int], int]:
4444
return a, b, c
4545

4646
assert inspect.signature(non_executor) == inspect.signature(exact_executor)

tests/test_repl.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import inspect
1313
import random
14+
import typing
1415

1516
import pytest
1617

@@ -66,7 +67,7 @@ def test_scope_var():
6667
]
6768
)
6869
@pytest.mark.asyncio
69-
async def test_executor_basic(code: str, expected: list[int]):
70+
async def test_executor_basic(code: str, expected: typing.List[int]):
7071
return_data: list[int] = []
7172
async for result in AsyncCodeExecutor(code):
7273
return_data.append(result)
@@ -100,7 +101,7 @@ async def test_executor_basic(code: str, expected: list[int]):
100101
]
101102
)
102103
@pytest.mark.asyncio
103-
async def test_executor_advanced(code: str, expected: list[int | None], arg_dict: dict[str, int] | None, scope: Scope):
104+
async def test_executor_advanced(code: str, expected: typing.List[typing.Optional[int]], arg_dict: typing.Optional[typing.Dict[str, int]], scope: Scope):
104105

105106
return_data: list[int | None] = []
106107
async for result in AsyncCodeExecutor(code, scope, arg_dict=arg_dict):

0 commit comments

Comments
 (0)