Distinguish between mtproto/telegram TL like tdlib does

This commit is contained in:
Lonami Exo
2018-04-28 10:19:55 +02:00
parent dc273ab6bc
commit 3008ada98d
4 changed files with 116 additions and 138 deletions

View File

@@ -1,13 +1,15 @@
from telethon_generator.parsers import parse_errors, parse_tl, find_layer
from telethon_generator.generators import\
generate_errors, generate_tlobjects, generate_docs
import itertools
ERRORS_INPUT_JSON = 'data/errors.json'
ERRORS_INPUT_DESC = 'data/error_descriptions'
ERRORS_OUTPUT = '../telethon/errors/rpc_error_list.py'
TLOBJECT_INPUT_TL = 'data/scheme.tl'
TLOBJECT_INPUT_CORE_TL = 'data/mtproto_api.tl'
TLOBJECT_INPUT_TL = 'data/telegram_api.tl'
TLOBJECT_OUTPUT = '../telethon/tl'
DOCS_INPUT_RES = 'data/html'
@@ -15,7 +17,9 @@ DOCS_OUTPUT = '../docs'
if __name__ == '__main__':
tlobjects = list(parse_tl(TLOBJECT_INPUT_TL, ignore_core=True))
tlobjects = list(itertools.chain(
parse_tl(TLOBJECT_INPUT_CORE_TL), parse_tl(TLOBJECT_INPUT_TL)))
errors = list(parse_errors(ERRORS_INPUT_JSON, ERRORS_INPUT_DESC))
layer = find_layer(TLOBJECT_INPUT_TL)