Split error_generator code into parsers/generators packages

This commit is contained in:
Lonami Exo
2018-04-14 13:56:39 +02:00
parent 8b2afa3530
commit 463fcedf27
6 changed files with 214 additions and 151 deletions

View File

@@ -0,0 +1,15 @@
from telethon_generator.parsers import parse_errors
from telethon_generator.generators import generate_errors
INPUT_JSON = 'errors.json'
INPUT_DESCRIPTIONS = 'error_descriptions'
OUTPUT = '../telethon/errors/rpc_error_list.py'
if __name__ == '__main__':
with open(OUTPUT, 'w', encoding='utf-8') as file:
generate_errors(
errors=list(parse_errors(INPUT_JSON, INPUT_DESCRIPTIONS)),
f=file
)