mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-28 00:56:19 +00:00
Use Optional[Type] instead of Union[Type, None]
This commit is contained in:
parent
e8250bd576
commit
82b029c3bf
@ -115,7 +115,7 @@ def get_type_hint(type: str) -> str:
|
|||||||
type = f"List[{get_type_hint(sub_type)}]"
|
type = f"List[{get_type_hint(sub_type)}]"
|
||||||
|
|
||||||
if is_core:
|
if is_core:
|
||||||
return f"Union[None, {type}] = None" if is_flag else type
|
return f"Optional[{type}] = None" if is_flag else type
|
||||||
else:
|
else:
|
||||||
ns, name = type.split(".") if "." in type else ("", type)
|
ns, name = type.split(".") if "." in type else ("", type)
|
||||||
type = f'"raw.base.' + ".".join([ns, name]).strip(".") + '"'
|
type = f'"raw.base.' + ".".join([ns, name]).strip(".") + '"'
|
||||||
|
@ -5,7 +5,7 @@ from io import BytesIO
|
|||||||
from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
|
from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
|
||||||
from pyrogram.raw.core import TLObject
|
from pyrogram.raw.core import TLObject
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from typing import List, Union, Any
|
from typing import List, Optional, Any
|
||||||
|
|
||||||
{warning}
|
{warning}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user