mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 20:59:29 +00:00
Revert "Log unknown constructors"
This reverts commit 0b6b598
This fixes #128
This commit is contained in:
parent
9023d999b8
commit
3cbffd93f2
@ -16,7 +16,6 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import logging
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
@ -24,23 +23,13 @@ from json import JSONEncoder, dumps
|
|||||||
|
|
||||||
from ..all import objects
|
from ..all import objects
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class Object:
|
class Object:
|
||||||
all = {}
|
all = {}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read(b: BytesIO, *args):
|
def read(b: BytesIO, *args):
|
||||||
constructor_id = int.from_bytes(b.read(4), "little")
|
return Object.all[int.from_bytes(b.read(4), "little")].read(b, *args)
|
||||||
|
|
||||||
try:
|
|
||||||
return Object.all[constructor_id].read(b, *args)
|
|
||||||
except KeyError:
|
|
||||||
log.error("Unknown constructor found: {}. Full data: {}".format(
|
|
||||||
hex(constructor_id),
|
|
||||||
b.getvalue().hex())
|
|
||||||
)
|
|
||||||
|
|
||||||
def write(self, *args) -> bytes:
|
def write(self, *args) -> bytes:
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user