Skip to content

Commit 50701ec

Browse files
committed
style: lint
1 parent a772a93 commit 50701ec

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

nextcore/common/dispatcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from typing import Union # pylint: disable=outdated-typing-union
3737
from typing import Any, Awaitable, Callable, Final
3838

39-
from typing_extensions import Unpack, ParamSpec, Concatenate
39+
from typing_extensions import Concatenate, ParamSpec, Unpack
4040

4141
T = TypeVar("T")
4242
P = ParamSpec("P")
@@ -151,7 +151,7 @@ async def join_handler(username: str) -> None:
151151
event_name:
152152
The event name to register the listener to. If this is :data:`None`, the listener is considered a global event.
153153
"""
154-
154+
155155
# EventCallback also includes GlobalEventCallback, so TODO decide if its better if we are verbose here and add GlobalEventCallback here too.
156156
def decorator(
157157
callback: EventCallback,

nextcore/common/json.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from typing import Any, Final
2828

2929
try:
30-
import orjson # type: ignore [reportMissingImports] # orjson is optional
30+
import orjson # type: ignore [reportMissingImports] # orjson is optional
3131

3232
_has_orjson: bool = True
3333
except ImportError:
@@ -55,7 +55,7 @@ def json_loads(data: str) -> Any:
5555
data must be a :class:`str`
5656
"""
5757
if _has_orjson:
58-
return orjson.loads(data) # type: ignore [reportUnknownMemberType] # this will never be ran if it does not exist
58+
return orjson.loads(data) # type: ignore [reportUnknownMemberType] # this will never be ran if it does not exist
5959
return json.loads(data)
6060

6161

@@ -68,5 +68,5 @@ def json_dumps(to_dump: Any) -> str:
6868
The python object to dump.
6969
"""
7070
if _has_orjson:
71-
return orjson.dumps(to_dump).decode("utf-8") # type: ignore [reportUnknownMemberType] # this will never be ran if this does not exist
71+
return orjson.dumps(to_dump).decode("utf-8") # type: ignore [reportUnknownMemberType] # this will never be ran if this does not exist
7272
return json.dumps(to_dump)

nextcore/common/maybe_coro.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,24 @@
2222
from __future__ import annotations
2323

2424
from asyncio import iscoroutine
25-
from typing import TYPE_CHECKING, overload, cast
25+
from typing import TYPE_CHECKING, cast, overload
2626

2727
if TYPE_CHECKING:
28-
from typing import Callable, Final, TypeVar, Coroutine, Any
28+
from typing import Any, Callable, Coroutine, Final, TypeVar
29+
2930
from typing_extensions import ParamSpec
3031

3132
P = ParamSpec("P")
3233
T = TypeVar("T")
3334

3435
__all__: Final[tuple[str, ...]] = ("maybe_coro",)
3536

37+
3638
@overload
3739
async def maybe_coro(coro: Callable[P, Coroutine[Any, Any, T]], *args: P.args, **kwargs: P.kwargs) -> T:
3840
...
3941

42+
4043
@overload
4144
async def maybe_coro(coro: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> T:
4245
...
@@ -66,5 +69,5 @@ async def maybe_coro(coro: Callable[P, T | Coroutine[Any, Any, T]], *args: P.arg
6669
return await result
6770

6871
# Not a async function, just return the result
69-
result = cast("T", result) # The case where this is Coroutine[Any, Any, T] is handled by iscouroutine.
72+
result = cast("T", result) # The case where this is Coroutine[Any, Any, T] is handled by iscouroutine.
7073
return result

0 commit comments

Comments
 (0)