Use Optional[Type] instead of Union[Type, None]

This commit is contained in:
Dan 2022-04-11 14:34:29 +02:00
parent e8250bd576
commit 82b029c3bf
2 changed files with 2 additions and 2 deletions

View File

@ -115,7 +115,7 @@ def get_type_hint(type: str) -> str:
type = f"List[{get_type_hint(sub_type)}]"
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:
ns, name = type.split(".") if "." in type else ("", type)
type = f'"raw.base.' + ".".join([ns, name]).strip(".") + '"'

View File

@ -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 import TLObject
from pyrogram import raw
from typing import List, Union, Any
from typing import List, Optional, Any
{warning}