2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 05:18:10 +00:00

Change type/desc separator

This commit is contained in:
Dan 2018-04-01 13:27:05 +02:00
parent c54730b8ab
commit 1bbb282dab
2 changed files with 20 additions and 21 deletions

View File

@ -268,6 +268,7 @@ def start():
) if c.args else "pass" ) if c.args else "pass"
docstring_args = [] docstring_args = []
docs = c.docs.split("|")[1:] if c.docs else None
for i, arg in enumerate(sorted_args): for i, arg in enumerate(sorted_args):
arg_name, arg_type = arg arg_name, arg_type = arg
@ -275,15 +276,13 @@ def start():
flag_number = is_optional.group(1) if is_optional else -1 flag_number = is_optional.group(1) if is_optional else -1
arg_type = arg_type.split("?")[-1] arg_type = arg_type.split("?")[-1]
docs = c.docs.split("|")[1:] if c.docs else None
if docs: if docs:
docstring_args.append( docstring_args.append(
"{} ({}{}):\n {}\n".format( "{} ({}{}):\n {}\n".format(
arg_name, arg_name,
get_docstring_arg_type(arg_type), get_docstring_arg_type(arg_type),
", optional" if "Optional" in docs[i] else "", ", optional" if "Optional" in docs[i] else "",
re.sub("Optional\. ", "", docs[i].split(":")[1]) re.sub("Optional\. ", "", docs[i].split("§")[1].rstrip(".") + ".")
) )
) )
else: else:
@ -397,7 +396,7 @@ def start():
read_types += "{} = Object.read(b)\n ".format(arg_name) read_types += "{} = Object.read(b)\n ".format(arg_name)
if c.docs: if c.docs:
description = c.docs.split("|")[0].split(":")[1] description = c.docs.split("|")[0].split("§")[1]
docstring_args = description + "\n\n " + docstring_args docstring_args = description + "\n\n " + docstring_args
with open("{}/{}.py".format(path, snek(c.name)), "w", encoding="utf-8") as f: with open("{}/{}.py".format(path, snek(c.name)), "w", encoding="utf-8") as f:

File diff suppressed because one or more lines are too long