pyrofork/compiler/api/template/combinator.txt
wulan17 8353e5a2a2
Pyrofork: Full rebrand
Signed-off-by: wulan17 <wulan17@nusantararom.org>
2024-02-06 04:41:59 +07:00

35 lines
743 B
Text

{notice}
from io import BytesIO
from pyrofork.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
from pyrofork.raw.core import TLObject
from pyrofork import raw
from typing import List, Optional, Any
{warning}
class {name}(TLObject): # type: ignore
"""{docstring}
"""
__slots__: List[str] = [{slots}]
ID = {id}
QUALNAME = "{qualname}"
def __init__(self{arguments}) -> None:
{fields}
@staticmethod
def read(b: BytesIO, *args: Any) -> "{name}":
{read_types}
return {name}({return_arguments})
def write(self, *args) -> bytes:
b = BytesIO()
b.write(Int(self.ID, False))
{write_types}
return b.getvalue()