mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Warn users in case they try to use base types as arguments
This commit is contained in:
parent
4dd068643d
commit
22d9077e2b
2 changed files with 8 additions and 1 deletions
|
|
@ -336,7 +336,8 @@ def start(format: bool = False):
|
||||||
docstring=docstring,
|
docstring=docstring,
|
||||||
name=type,
|
name=type,
|
||||||
qualname=qualtype,
|
qualname=qualtype,
|
||||||
types=", ".join([f"raw.types.{c}" for c in constructors])
|
types=", ".join([f"raw.types.{c}" for c in constructors]),
|
||||||
|
doc_name=snake(type).replace("_", "-")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,9 @@ class {name}: # type: ignore
|
||||||
"""
|
"""
|
||||||
|
|
||||||
QUALNAME = "pyrogram.raw.base.{qualname}"
|
QUALNAME = "pyrogram.raw.base.{qualname}"
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
raise TypeError("Base types can only be used for type checking purposes: "
|
||||||
|
"you tried to use a base type instance as argument, "
|
||||||
|
"but you need to instantiate one of its constructors instead. "
|
||||||
|
"More info: https://docs.pyrogram.org/telegram/base/{doc_name}")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue