2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-09-01 06:45:39 +00:00

Rename Object to TLObject

This commit is contained in:
Dan
2019-06-03 14:19:50 +02:00
parent 4d97aae933
commit d5517f4d5f
21 changed files with 65 additions and 62 deletions

View File

@@ -53,10 +53,10 @@ def get_docstring_arg_type(t: str, is_list: bool = False, is_pyrogram_type: bool
return "``{}``".format(t.lower())
elif t == "true":
return "``bool``"
elif t == "Object" or t == "X":
return "Any object from :obj:`pyrogram.api.types`"
elif t == "TLObject" or t == "X":
return "Any object from :obj:`~pyrogram.api.types`"
elif t == "!X":
return "Any method from :obj:`pyrogram.api.functions`"
return "Any method from :obj:`~pyrogram.api.functions`"
elif t.startswith("Vector"):
return "List of " + get_docstring_arg_type(t.split("<", 1)[1][:-1], True, is_pyrogram_type)
else:
@@ -394,7 +394,7 @@ def start():
)
read_types += "\n "
read_types += "{} = Object.read(b{}) if flags & (1 << {}) else []\n ".format(
read_types += "{} = TLObject.read(b{}) if flags & (1 << {}) else []\n ".format(
arg_name, ", {}".format(sub_type.title()) if sub_type in core_types else "", index
)
else:
@@ -403,7 +403,7 @@ def start():
write_types += "b.write(self.{}.write())\n ".format(arg_name)
read_types += "\n "
read_types += "{} = Object.read(b) if flags & (1 << {}) else None\n ".format(
read_types += "{} = TLObject.read(b) if flags & (1 << {}) else None\n ".format(
arg_name, index
)
else:
@@ -422,7 +422,7 @@ def start():
)
read_types += "\n "
read_types += "{} = Object.read(b{})\n ".format(
read_types += "{} = TLObject.read(b{})\n ".format(
arg_name, ", {}".format(sub_type.title()) if sub_type in core_types else ""
)
else:
@@ -430,7 +430,7 @@ def start():
write_types += "b.write(self.{}.write())\n ".format(arg_name)
read_types += "\n "
read_types += "{} = Object.read(b)\n ".format(arg_name)
read_types += "{} = TLObject.read(b)\n ".format(arg_name)
if c.docs:
description = c.docs.split("|")[0].split("§")[1]

View File

@@ -5,7 +5,7 @@ from io import BytesIO
from pyrogram.api.core import *
class {class_name}(Object):
class {class_name}(TLObject):
"""{docstring_args}
"""