Skip to content

Commit 82b029c

Browse files
committed
Use Optional[Type] instead of Union[Type, None]
1 parent e8250bd commit 82b029c

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

compiler/api/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def get_type_hint(type: str) -> str:
115115
type = f"List[{get_type_hint(sub_type)}]"
116116

117117
if is_core:
118-
return f"Union[None, {type}] = None" if is_flag else type
118+
return f"Optional[{type}] = None" if is_flag else type
119119
else:
120120
ns, name = type.split(".") if "." in type else ("", type)
121121
type = f'"raw.base.' + ".".join([ns, name]).strip(".") + '"'

compiler/api/template/combinator.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from io import BytesIO
55
from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
66
from pyrogram.raw.core import TLObject
77
from pyrogram import raw
8-
from typing import List, Union, Any
8+
from typing import List, Optional, Any
99

1010
{warning}
1111

0 commit comments

Comments
 (0)