mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add Bot API parser and code-generator
This commit is contained in:
parent
5e9d4e55d9
commit
af2573dbee
15 changed files with 3242 additions and 1 deletions
22
generator/cli.py
Normal file
22
generator/cli.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import logging
|
||||
import pathlib
|
||||
import sys
|
||||
import typing
|
||||
|
||||
from generator.generator import Generator
|
||||
from generator.parser import Parser
|
||||
|
||||
script_path = pathlib.Path(__file__).parent
|
||||
out_dir = script_path.parent / "aiogram" / "_telegram"
|
||||
|
||||
|
||||
def main(argv: typing.List[str]) -> int:
|
||||
logging.basicConfig(level=logging.ERROR, stream=sys.stdout)
|
||||
parser = Parser()
|
||||
parser.parse()
|
||||
generator = Generator(parser)
|
||||
|
||||
with (out_dir / "types.py").open("w") as f:
|
||||
f.write(generator.render_types())
|
||||
|
||||
return 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue