Skip to content

Commit

Permalink
3.8 compat fixes 2
Browse files Browse the repository at this point in the history
  • Loading branch information
scarletcafe committed Mar 5, 2024
1 parent ae11df7 commit 6023027
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions jishaku/features/baseclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@

T = typing.TypeVar('T')
P = ParamSpec('P')
Task = asyncio.Task[typing.Any]
GenericFeature = typing.TypeVar('GenericFeature', bound='Feature')


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

index: int # type: ignore
ctx: ContextA
task: typing.Optional[Task]
task: typing.Optional['asyncio.Task[typing.Any]']


class Feature(commands.Cog):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_executorfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def sig(*args, **kwargs):
]
)
@pytest.mark.asyncio
async def test_magic_executor(args: tuple[typing.Any, ...], kwargs: dict[str, typing.Any], expected_return: tuple[int, int | None, int]):
def non_executor(a: int, b: int | None = None, *, c: int) -> tuple[int, int | None, int]:
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]):
def non_executor(a: int, b: typing.Optional[int] = None, *, c: int) -> typing.Tuple[int, typing.Optional[int], int]:
return a, b, c

exact_executor = executor_function(non_executor)

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

assert inspect.signature(non_executor) == inspect.signature(exact_executor)
Expand Down
5 changes: 3 additions & 2 deletions tests/test_repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import inspect
import random
import typing

import pytest

Expand Down Expand Up @@ -66,7 +67,7 @@ def test_scope_var():
]
)
@pytest.mark.asyncio
async def test_executor_basic(code: str, expected: list[int]):
async def test_executor_basic(code: str, expected: typing.List[int]):
return_data: list[int] = []
async for result in AsyncCodeExecutor(code):
return_data.append(result)
Expand Down Expand Up @@ -100,7 +101,7 @@ async def test_executor_basic(code: str, expected: list[int]):
]
)
@pytest.mark.asyncio
async def test_executor_advanced(code: str, expected: list[int | None], arg_dict: dict[str, int] | None, scope: Scope):
async def test_executor_advanced(code: str, expected: typing.List[typing.Optional[int]], arg_dict: typing.Optional[typing.Dict[str, int]], scope: Scope):

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

0 comments on commit 6023027

Please sign in to comment.