Skip to content

Commit d5517f4

Browse files
committed
Rename Object to TLObject
1 parent 4d97aae commit d5517f4

File tree

21 files changed

+65
-62
lines changed

21 files changed

+65
-62
lines changed

compiler/api/compiler.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ def get_docstring_arg_type(t: str, is_list: bool = False, is_pyrogram_type: bool
5353
return "``{}``".format(t.lower())
5454
elif t == "true":
5555
return "``bool``"
56-
elif t == "Object" or t == "X":
57-
return "Any object from :obj:`pyrogram.api.types`"
56+
elif t == "TLObject" or t == "X":
57+
return "Any object from :obj:`~pyrogram.api.types`"
5858
elif t == "!X":
59-
return "Any method from :obj:`pyrogram.api.functions`"
59+
return "Any method from :obj:`~pyrogram.api.functions`"
6060
elif t.startswith("Vector"):
6161
return "List of " + get_docstring_arg_type(t.split("<", 1)[1][:-1], True, is_pyrogram_type)
6262
else:
@@ -394,7 +394,7 @@ def start():
394394
)
395395

396396
read_types += "\n "
397-
read_types += "{} = Object.read(b{}) if flags & (1 << {}) else []\n ".format(
397+
read_types += "{} = TLObject.read(b{}) if flags & (1 << {}) else []\n ".format(
398398
arg_name, ", {}".format(sub_type.title()) if sub_type in core_types else "", index
399399
)
400400
else:
@@ -403,7 +403,7 @@ def start():
403403
write_types += "b.write(self.{}.write())\n ".format(arg_name)
404404

405405
read_types += "\n "
406-
read_types += "{} = Object.read(b) if flags & (1 << {}) else None\n ".format(
406+
read_types += "{} = TLObject.read(b) if flags & (1 << {}) else None\n ".format(
407407
arg_name, index
408408
)
409409
else:
@@ -422,15 +422,15 @@ def start():
422422
)
423423

424424
read_types += "\n "
425-
read_types += "{} = Object.read(b{})\n ".format(
425+
read_types += "{} = TLObject.read(b{})\n ".format(
426426
arg_name, ", {}".format(sub_type.title()) if sub_type in core_types else ""
427427
)
428428
else:
429429
write_types += "\n "
430430
write_types += "b.write(self.{}.write())\n ".format(arg_name)
431431

432432
read_types += "\n "
433-
read_types += "{} = Object.read(b)\n ".format(arg_name)
433+
read_types += "{} = TLObject.read(b)\n ".format(arg_name)
434434

435435
if c.docs:
436436
description = c.docs.split("|")[0].split("§")[1]

compiler/api/template/mtproto.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.api.core import *
66

77

8-
class {class_name}(Object):
8+
class {class_name}(TLObject):
99
"""{docstring_args}
1010
"""
1111

pyrogram/api/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
from importlib import import_module
2020

2121
from .all import objects
22-
from .core.object import Object
22+
from .core.tl_object import TLObject
2323

2424
for k, v in objects.items():
2525
path, name = v.rsplit(".", 1)
26-
Object.all[k] = getattr(import_module(path), name)
26+
TLObject.all[k] = getattr(import_module(path), name)

pyrogram/api/core/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from .list import List
2323
from .message import Message
2424
from .msg_container import MsgContainer
25-
from .object import Object
25+
from .tl_object import TLObject
2626
from .primitives import (
2727
Bool, BoolTrue, BoolFalse, Bytes, Double,
2828
Int, Long, Int128, Int256, Null, String, Vector

pyrogram/api/core/future_salt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818

1919
from io import BytesIO
2020

21-
from .object import Object
21+
from .tl_object import TLObject
2222
from .primitives import Int, Long
2323

2424

25-
class FutureSalt(Object):
25+
class FutureSalt(TLObject):
2626
ID = 0x0949d9dc
2727

2828
__slots__ = ["valid_since", "valid_until", "salt"]

pyrogram/api/core/future_salts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
from io import BytesIO
2020

2121
from . import FutureSalt
22-
from .object import Object
22+
from .tl_object import TLObject
2323
from .primitives import Int, Long
2424

2525

26-
class FutureSalts(Object):
26+
class FutureSalts(TLObject):
2727
ID = 0xae500895
2828

2929
__slots__ = ["req_msg_id", "now", "salts"]

pyrogram/api/core/gzip_packed.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@
1919
from gzip import compress, decompress
2020
from io import BytesIO
2121

22-
from .object import Object
22+
from .tl_object import TLObject
2323
from .primitives import Int, Bytes
2424

2525

26-
class GzipPacked(Object):
26+
class GzipPacked(TLObject):
2727
ID = 0x3072cfa1
2828

2929
__slots__ = ["packed_data"]
3030

3131
QUALNAME = "GzipPacked"
3232

33-
def __init__(self, packed_data: Object):
33+
def __init__(self, packed_data: TLObject):
3434
self.packed_data = packed_data
3535

3636
@staticmethod
3737
def read(b: BytesIO, *args) -> "GzipPacked":
3838
# Return the Object itself instead of a GzipPacked wrapping it
39-
return Object.read(
39+
return TLObject.read(
4040
BytesIO(
4141
decompress(
4242
Bytes.read(b)

pyrogram/api/core/list.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from .object import Object
19+
from .tl_object import TLObject
2020

2121

22-
class List(list, Object):
22+
class List(list, TLObject):
2323
__slots__ = []
2424

2525
def __repr__(self):
2626
return "pyrogram.api.core.List([{}])".format(
27-
",".join(Object.__repr__(i) for i in self)
27+
",".join(TLObject.__repr__(i) for i in self)
2828
)

pyrogram/api/core/message.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818

1919
from io import BytesIO
2020

21-
from .object import Object
21+
from .tl_object import TLObject
2222
from .primitives import Int, Long
2323

2424

25-
class Message(Object):
25+
class Message(TLObject):
2626
ID = 0x5bb8e511 # hex(crc32(b"message msg_id:long seqno:int bytes:int body:Object = Message"))
2727

2828
__slots__ = ["msg_id", "seq_no", "length", "body"]
2929

3030
QUALNAME = "Message"
3131

32-
def __init__(self, body: Object, msg_id: int, seq_no: int, length: int):
32+
def __init__(self, body: TLObject, msg_id: int, seq_no: int, length: int):
3333
self.msg_id = msg_id
3434
self.seq_no = seq_no
3535
self.length = length
@@ -42,7 +42,7 @@ def read(b: BytesIO, *args) -> "Message":
4242
length = Int.read(b)
4343
body = b.read(length)
4444

45-
return Message(Object.read(BytesIO(body)), msg_id, seq_no, length)
45+
return Message(TLObject.read(BytesIO(body)), msg_id, seq_no, length)
4646

4747
def write(self) -> bytes:
4848
b = BytesIO()

pyrogram/api/core/msg_container.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
from io import BytesIO
2020

2121
from .message import Message
22-
from .object import Object
22+
from .tl_object import TLObject
2323
from .primitives import Int
2424

2525

26-
class MsgContainer(Object):
26+
class MsgContainer(TLObject):
2727
ID = 0x73f1f8dc
2828

2929
__slots__ = ["messages"]

0 commit comments

Comments
 (0)