mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-29 03:32:49 +01:00
Type Hinting Fixes (#2552)
* Fixe overload signatures for ContextTypes * more fixing for contexttypes
This commit is contained in:
parent
a75dffd4a8
commit
4315225642
1 changed files with 36 additions and 28 deletions
|
@ -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],
|
||||||
):
|
):
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue