Skip to content

Instantly share code, notes, and snippets.

@prostomarkeloff
Last active March 8, 2020 06:03
Show Gist options
  • Save prostomarkeloff/5aec6cd94750cc189f635b840778fca1 to your computer and use it in GitHub Desktop.
Save prostomarkeloff/5aec6cd94750cc189f635b840778fca1 to your computer and use it in GitHub Desktop.
Token = NewType("Token", str)
class ABCToken:
typeof: ClassVar[TokenType]
get_token_type: ClassVar[GetTokenType]
get_token: Union[GetTokenSync, GetTokenAsync]
class ABCSyncToken(ABCToken):
get_token_type = GetTokenType.SYNC
get_token: GetTokenSync
class ABCBotSyncToken(ABCBotToken, ABCSyncToken):
pass
# token.py:78: error: Signature of "get_token" incompatible with supertype "ABCToken"
class BotSyncSingleToken(ABCBotSyncToken):
def __init__(self, token: Token):
self._token: Token = token
def get_token(self, *args, **kwargs) -> Token:
return self._token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment