Fix style errors

This commit is contained in:
Boger 2020-03-25 15:57:25 +03:00
parent 7db1572fd3
commit 23c632b37b
7 changed files with 8 additions and 14 deletions

View file

@ -111,9 +111,7 @@ from ..types import (
UserProfilePhotos,
WebhookInfo,
)
from ...utils.mixins import (
ContextInstanceMixin,
)
from ...utils.mixins import ContextInstanceMixin
from ...utils.token import (
validate_token,
extract_bot_id,

View file

@ -1,6 +1,5 @@
from abc import ABC, abstractmethod
from typing import (
Optional,
TYPE_CHECKING,
Any,
Dict,

View file

@ -27,6 +27,5 @@ class MessageHandlerCommandMixin(BaseHandlerMixin[Message]):
@property
def command(self) -> Optional[CommandObject]:
if "command" in self.data:
# TODO: remove cast
return cast(CommandObject, self.data["command"])
return None

View file

@ -58,16 +58,16 @@ class ContextInstanceMixin(Generic[ContextInstance]):
@overload # noqa: F811, it's overload, not redefinition
@classmethod
def get_current(cls, no_error: Literal[True]) -> Optional[ContextInstance]:
def get_current(cls, no_error: Literal[True]) -> Optional[ContextInstance]: # noqa: F811
...
@overload # noqa: F811, it's overload, not redefinition
@overload # noqa: F811, it's overload, not redefinition
@classmethod
def get_current(cls, no_error: Literal[False]) -> ContextInstance:
def get_current(cls, no_error: Literal[False]) -> ContextInstance: # noqa: F811
...
@classmethod # noqa: F811, it's overload, not redefinition
def get_current(cls, no_error: bool = True) -> Optional[ContextInstance]:
def get_current(cls, no_error: bool = True) -> Optional[ContextInstance]: # noqa: F811
# on mypy 0.770 I catch that contextvars.ContextVar always contextvars.ContextVar[Any]
cls.__context_instance = cast(
contextvars.ContextVar[ContextInstance], cls.__context_instance