Replace .on_response with static .from_reader for all types

This commit is contained in:
Lonami Exo
2017-10-07 13:26:09 +02:00
parent a17def8026
commit 91a5d20e93
3 changed files with 36 additions and 35 deletions
+1 -5
View File
@@ -131,11 +131,7 @@ class BinaryReader:
# If there was still no luck, give up
raise TypeNotFoundError(constructor_id)
# Create an empty instance of the class and
# fill it with the read attributes
result = clazz.empty()
result.on_response(self)
return result
return clazz.from_reader(self)
def tgread_vector(self):
"""Reads a vector (a list) of Telegram objects"""
+3 -2
View File
@@ -121,5 +121,6 @@ class TLObject:
def to_bytes(self):
return b''
def on_response(self, reader):
pass
@staticmethod
def from_reader(reader):
return TLObject()