Type Hinting Fixes (#2552)

* Fixe overload signatures for ContextTypes

* more fixing for contexttypes
This commit is contained in:
Bibo-Joshi 2021-07-01 17:43:59 +02:00 committed by GitHub
parent a75dffd4a8
commit 4315225642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,9 +50,11 @@ class ContextTypes(Generic[CCT, UD, CD, BD]):
__slots__ = ('_context', '_bot_data', '_chat_data', '_user_data') __slots__ = ('_context', '_bot_data', '_chat_data', '_user_data')
# overload signatures generated with https://git.io/JtJPj
@overload @overload
def __init__( def __init__(
self: 'ContextTypes[CallbackContext, Dict, Dict, Dict]', self: 'ContextTypes[CallbackContext[Dict, Dict, Dict], Dict, Dict, Dict]',
): ):
... ...
@ -61,20 +63,26 @@ class ContextTypes(Generic[CCT, UD, CD, BD]):
... ...
@overload @overload
def __init__(self: 'ContextTypes[CallbackContext, UD, Dict, Dict]', bot_data: Type[UD]): def __init__(
... self: 'ContextTypes[CallbackContext[UD, Dict, Dict], UD, Dict, Dict]', user_data: Type[UD]
):
@overload
def __init__(self: 'ContextTypes[CallbackContext, Dict, CD, Dict]', chat_data: Type[CD]):
...
@overload
def __init__(self: 'ContextTypes[CallbackContext, Dict, Dict, BD]', user_data: Type[BD]):
... ...
@overload @overload
def __init__( def __init__(
self: 'ContextTypes[CCT, UD, Dict, Dict]', context: Type[CCT], bot_data: Type[UD] self: 'ContextTypes[CallbackContext[Dict, CD, Dict], Dict, CD, Dict]', chat_data: Type[CD]
):
...
@overload
def __init__(
self: 'ContextTypes[CallbackContext[Dict, Dict, BD], Dict, Dict, BD]', bot_data: Type[BD]
):
...
@overload
def __init__(
self: 'ContextTypes[CCT, UD, Dict, Dict]', context: Type[CCT], user_data: Type[UD]
): ):
... ...
@ -86,31 +94,31 @@ class ContextTypes(Generic[CCT, UD, CD, BD]):
@overload @overload
def __init__( def __init__(
self: 'ContextTypes[CCT, Dict, Dict, BD]', context: Type[CCT], user_data: Type[BD] self: 'ContextTypes[CCT, Dict, Dict, BD]', context: Type[CCT], bot_data: Type[BD]
): ):
... ...
@overload @overload
def __init__( def __init__(
self: 'ContextTypes[CallbackContext, UD, CD, Dict]', self: 'ContextTypes[CallbackContext[UD, CD, Dict], UD, CD, Dict]',
bot_data: Type[UD], user_data: Type[UD],
chat_data: Type[CD], chat_data: Type[CD],
): ):
... ...
@overload @overload
def __init__( def __init__(
self: 'ContextTypes[CallbackContext, UD, Dict, BD]', self: 'ContextTypes[CallbackContext[UD, Dict, BD], UD, Dict, BD]',
bot_data: Type[UD], user_data: Type[UD],
user_data: Type[BD], bot_data: Type[BD],
): ):
... ...
@overload @overload
def __init__( def __init__(
self: 'ContextTypes[CallbackContext, Dict, CD, BD]', self: 'ContextTypes[CallbackContext[Dict, CD, BD], Dict, CD, BD]',
chat_data: Type[CD], chat_data: Type[CD],
user_data: Type[BD], bot_data: Type[BD],
): ):
... ...
@ -118,7 +126,7 @@ class ContextTypes(Generic[CCT, UD, CD, BD]):
def __init__( def __init__(
self: 'ContextTypes[CCT, UD, CD, Dict]', self: 'ContextTypes[CCT, UD, CD, Dict]',
context: Type[CCT], context: Type[CCT],
bot_data: Type[UD], user_data: Type[UD],
chat_data: Type[CD], chat_data: Type[CD],
): ):
... ...
@ -127,8 +135,8 @@ class ContextTypes(Generic[CCT, UD, CD, BD]):
def __init__( def __init__(
self: 'ContextTypes[CCT, UD, Dict, BD]', self: 'ContextTypes[CCT, UD, Dict, BD]',
context: Type[CCT], context: Type[CCT],
bot_data: Type[UD], user_data: Type[UD],
user_data: Type[BD], bot_data: Type[BD],
): ):
... ...
@ -137,16 +145,16 @@ class ContextTypes(Generic[CCT, UD, CD, BD]):
self: 'ContextTypes[CCT, Dict, CD, BD]', self: 'ContextTypes[CCT, Dict, CD, BD]',
context: Type[CCT], context: Type[CCT],
chat_data: Type[CD], chat_data: Type[CD],
user_data: Type[BD], bot_data: Type[BD],
): ):
... ...
@overload @overload
def __init__( def __init__(
self: 'ContextTypes[CallbackContext, UD, CD, BD]', self: 'ContextTypes[CallbackContext[UD, CD, BD], UD, CD, BD]',
bot_data: Type[UD], user_data: Type[UD],
chat_data: Type[CD], chat_data: Type[CD],
user_data: Type[BD], bot_data: Type[BD],
): ):
... ...
@ -154,9 +162,9 @@ class ContextTypes(Generic[CCT, UD, CD, BD]):
def __init__( def __init__(
self: 'ContextTypes[CCT, UD, CD, BD]', self: 'ContextTypes[CCT, UD, CD, BD]',
context: Type[CCT], context: Type[CCT],
bot_data: Type[UD], user_data: Type[UD],
chat_data: Type[CD], chat_data: Type[CD],
user_data: Type[BD], bot_data: Type[BD],
): ):
... ...