From 66a5577ab978969018af86e89d8e78e223dfd63b Mon Sep 17 00:00:00 2001 From: Anton Grigoryev Date: Thu, 12 Mar 2015 03:17:43 +0300 Subject: [PATCH] Some refactor now testing.py looks almost just like i want. --- mtproto.py | 148 +++++++++++++++++++++++++++++------------------------ testing.py | 60 +--------------------- 2 files changed, 81 insertions(+), 127 deletions(-) diff --git a/mtproto.py b/mtproto.py index c9facee2..6daab00e 100644 --- a/mtproto.py +++ b/mtproto.py @@ -49,8 +49,8 @@ class TlMethod: class TL: - def __init__(self): - with open("TL_schema.JSON", 'r') as f: + def __init__(self, filename): + with open(filename, 'r') as f: TL_dict = json.load(f) # Read constructors @@ -71,79 +71,75 @@ class TL: self.method_id[z.id] = z self.method_name[z.method] = z - def method_call(self, method, **kwargs): - z = io.BytesIO() - tl_method = self.method_name[method] - z.write(struct.pack('