Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: free mypy version #61

Merged
merged 2 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ name: tests

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
lint:

runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -39,6 +38,7 @@ jobs:
- py38
- py39
- py310
- py311

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extras =
develop

deps =
mypy==0.961
mypy

commands =
mypy wsrpc_aiohttp
20 changes: 10 additions & 10 deletions wsrpc_aiohttp/websocket/abc.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import asyncio
import sys
from abc import ABC, abstractmethod
from enum import IntEnum
from typing import (
Any, Callable, Coroutine, DefaultDict, Dict, Mapping, Set, Tuple, Type,
TypeVar, Union,
Any, Callable, Coroutine, DefaultDict, Dict, Mapping, Optional, Set, Tuple,
Type, TypeVar, Union,
)

from aiohttp import WSMessage
from aiohttp.web import Request
from aiohttp.web_ws import WebSocketResponse


try:
if sys.version_info >= (3, 10):
from typing import Concatenate, ParamSpec
except ImportError:
else:
from typing_extensions import Concatenate, ParamSpec


Expand Down Expand Up @@ -143,13 +143,13 @@ def __getattr__(self, item: str):
class WSRPCBase(ABC):
@abstractmethod
def __init__(
self, loop: asyncio.AbstractEventLoop = None,
timeout: Union[int, float] = None,
self, loop: Optional[asyncio.AbstractEventLoop] = None,
timeout: Optional[TimeoutType] = None,
):
raise NotImplementedError((loop, timeout))

@abstractmethod
async def close(self, message: WSMessage = None):
async def close(self, message: Optional[WSMessage] = None):
""" Cancel all pending tasks """
raise NotImplementedError

Expand Down Expand Up @@ -219,7 +219,7 @@ def resolver(self, func_name: str) -> Callable[..., Any]:

@abstractmethod
async def call(
self, func: str, timeout: Union[int, float] = None,
self, func: str, timeout: Optional[TimeoutType] = None,
**kwargs: Mapping[str, Any]
):
""" Method for call remote function
Expand Down Expand Up @@ -259,7 +259,7 @@ def remove_event_listeners(self, func: EventListenerType) -> None:
raise NotImplementedError

@classmethod
def remove_route(cls, route: str, fail=True):
def remove_route(cls, route: str, fail: bool = True):
""" Removes route by name. If `fail=True` an exception
will be raised in case the route was not found. """

Expand Down
3 changes: 1 addition & 2 deletions wsrpc_aiohttp/websocket/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .common import WSRPCBase
from .tools import Lazy, awaitable


log = logging.getLogger(__name__)
SocketType = Optional[aiohttp.ClientWebSocketResponse]

Expand All @@ -22,7 +21,7 @@ def __init__(
endpoint: Union[URL, str],
loop=None,
timeout=None,
session: aiohttp.ClientSession = None,
session: Optional[aiohttp.ClientSession] = None,
loads=json.loads, dumps=json.dumps,
**kwargs
):
Expand Down
2 changes: 1 addition & 1 deletion wsrpc_aiohttp/websocket/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _dumps(self, value: t.Any) -> t.Any:
return self._json_dumps(value, default=serializer)

def __init__(
self, loop: asyncio.AbstractEventLoop = None,
self, loop: t.Optional[asyncio.AbstractEventLoop] = None,
timeout: t.Optional[TimeoutType] = None,
loads: LoadsType = json.loads,
dumps: DumpsType = json.dumps,
Expand Down
Loading