Move tl_generator to generators/ and remove the class

This commit is contained in:
Lonami Exo
2018-04-14 18:17:59 +02:00
parent 200d3c0360
commit 0af4699994
4 changed files with 746 additions and 771 deletions

View File

@@ -1,15 +1,24 @@
from telethon_generator.parsers import parse_errors
from telethon_generator.generators import generate_errors
from telethon_generator.parsers import parse_errors, parse_tl, find_layer
from telethon_generator.generators import generate_errors, generate_tlobjects
INPUT_JSON = 'errors.json'
INPUT_DESCRIPTIONS = 'error_descriptions'
OUTPUT = '../telethon/errors/rpc_error_list.py'
ERRORS_INPUT_JSON = 'errors.json'
ERRORS_INPUT_DESC = 'error_descriptions'
ERRORS_OUTPUT = '../telethon/errors/rpc_error_list.py'
TLOBJECT_INPUT_TL = 'scheme.tl'
TLOBJECT_OUTPUT = '../telethon/tl'
if __name__ == '__main__':
with open(OUTPUT, 'w', encoding='utf-8') as file:
generate_tlobjects(
tlobjects=list(parse_tl(TLOBJECT_INPUT_TL, ignore_core=True)),
layer=find_layer((TLOBJECT_INPUT_TL)),
output_dir=TLOBJECT_OUTPUT
)
with open(ERRORS_OUTPUT, 'w', encoding='utf-8') as file:
generate_errors(
errors=list(parse_errors(INPUT_JSON, INPUT_DESCRIPTIONS)),
errors=list(parse_errors(ERRORS_INPUT_JSON, ERRORS_INPUT_DESC)),
f=file
)