mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Move all imported schema objects outside TLObject
This commit is contained in:
parent
d727754ad6
commit
9ad5e62dea
@ -19,8 +19,7 @@
|
||||
from importlib import import_module
|
||||
|
||||
from .all import objects
|
||||
from .core.tl_object import TLObject
|
||||
|
||||
for k, v in objects.items():
|
||||
path, name = v.rsplit(".", 1)
|
||||
TLObject.all[k] = getattr(import_module(path), name)
|
||||
objects[k] = getattr(import_module(path), name)
|
||||
|
@ -22,8 +22,5 @@ from .gzip_packed import GzipPacked
|
||||
from .list import List
|
||||
from .message import Message
|
||||
from .msg_container import MsgContainer
|
||||
from .primitives import (
|
||||
Bool, BoolTrue, BoolFalse, Bytes, Double,
|
||||
Int, Long, Int128, Int256, Null, String, Vector
|
||||
)
|
||||
from .primitives import *
|
||||
from .tl_object import TLObject
|
||||
|
@ -20,17 +20,17 @@ from collections import OrderedDict
|
||||
from io import BytesIO
|
||||
from json import dumps
|
||||
|
||||
from ..all import objects
|
||||
|
||||
|
||||
class TLObject:
|
||||
all = {}
|
||||
|
||||
__slots__ = []
|
||||
|
||||
QUALNAME = "Base"
|
||||
|
||||
@staticmethod
|
||||
def read(b: BytesIO, *args): # TODO: Rename b -> data
|
||||
return TLObject.all[int.from_bytes(b.read(4), "little")].read(b, *args)
|
||||
return objects[int.from_bytes(b.read(4), "little")].read(b, *args)
|
||||
|
||||
def write(self, *args) -> bytes:
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user