Skip to content

Commit 9ad5e62

Browse files
committed
Move all imported schema objects outside TLObject
1 parent d727754 commit 9ad5e62

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

pyrogram/api/__init__.py

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

2121
from .all import objects
22-
from .core.tl_object import TLObject
2322

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

pyrogram/api/core/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,5 @@
2222
from .list import List
2323
from .message import Message
2424
from .msg_container import MsgContainer
25-
from .primitives import (
26-
Bool, BoolTrue, BoolFalse, Bytes, Double,
27-
Int, Long, Int128, Int256, Null, String, Vector
28-
)
25+
from .primitives import *
2926
from .tl_object import TLObject

pyrogram/api/core/tl_object.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020
from io import BytesIO
2121
from json import dumps
2222

23+
from ..all import objects
2324

24-
class TLObject:
25-
all = {}
2625

26+
class TLObject:
2727
__slots__ = []
2828

2929
QUALNAME = "Base"
3030

3131
@staticmethod
3232
def read(b: BytesIO, *args): # TODO: Rename b -> data
33-
return TLObject.all[int.from_bytes(b.read(4), "little")].read(b, *args)
33+
return objects[int.from_bytes(b.read(4), "little")].read(b, *args)
3434

3535
def write(self, *args) -> bytes:
3636
pass

0 commit comments

Comments
 (0)