mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-30 05:48:14 +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 importlib import import_module
|
||||||
|
|
||||||
from .all import objects
|
from .all import objects
|
||||||
from .core.tl_object import TLObject
|
|
||||||
|
|
||||||
for k, v in objects.items():
|
for k, v in objects.items():
|
||||||
path, name = v.rsplit(".", 1)
|
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 .list import List
|
||||||
from .message import Message
|
from .message import Message
|
||||||
from .msg_container import MsgContainer
|
from .msg_container import MsgContainer
|
||||||
from .primitives import (
|
from .primitives import *
|
||||||
Bool, BoolTrue, BoolFalse, Bytes, Double,
|
|
||||||
Int, Long, Int128, Int256, Null, String, Vector
|
|
||||||
)
|
|
||||||
from .tl_object import TLObject
|
from .tl_object import TLObject
|
||||||
|
@ -20,17 +20,17 @@ from collections import OrderedDict
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from json import dumps
|
from json import dumps
|
||||||
|
|
||||||
|
from ..all import objects
|
||||||
|
|
||||||
|
|
||||||
class TLObject:
|
class TLObject:
|
||||||
all = {}
|
|
||||||
|
|
||||||
__slots__ = []
|
__slots__ = []
|
||||||
|
|
||||||
QUALNAME = "Base"
|
QUALNAME = "Base"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read(b: BytesIO, *args): # TODO: Rename b -> data
|
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:
|
def write(self, *args) -> bytes:
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user