mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-30 17:43:32 +00:00
Update API and Docs compiler
This commit is contained in:
parent
1cbb34f9b5
commit
1ef3fec314
@ -47,10 +47,10 @@ def get_docstring_arg_type(t: str, is_list: bool = False):
|
|||||||
return ":obj:`{}`".format(t.lower())
|
return ":obj:`{}`".format(t.lower())
|
||||||
elif t == "true":
|
elif t == "true":
|
||||||
return ":obj:`bool`"
|
return ":obj:`bool`"
|
||||||
elif t == "Object":
|
elif t == "Object" or t == "X":
|
||||||
return ":obj:`Any type`"
|
return "Any type from :obj:`pyrogram.api.types`"
|
||||||
elif t == "!X":
|
elif t == "!X":
|
||||||
return ":obj:`Any function`"
|
return "Any query from :obj:`pyrogram.api.functions`"
|
||||||
elif t.startswith("Vector"):
|
elif t.startswith("Vector"):
|
||||||
return "List of " + get_docstring_arg_type(t.split("<")[1][:-1], is_list=True)
|
return "List of " + get_docstring_arg_type(t.split("<")[1][:-1], is_list=True)
|
||||||
else:
|
else:
|
||||||
@ -272,11 +272,7 @@ def start():
|
|||||||
|
|
||||||
if c.section == "functions":
|
if c.section == "functions":
|
||||||
docstring_args += "\n\n Raises:\n :obj:`pyrogram.Error`"
|
docstring_args += "\n\n Raises:\n :obj:`pyrogram.Error`"
|
||||||
|
docstring_args += "\n\n Returns:\n " + get_docstring_arg_type(c.return_type)
|
||||||
try:
|
|
||||||
docstring_args += "\n\n Returns:\n " + get_docstring_arg_type(c.return_type)
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
references = get_references(".".join(filter(None, [c.namespace, c.name])))
|
references = get_references(".".join(filter(None, [c.namespace, c.name])))
|
||||||
|
|
||||||
|
@ -95,8 +95,8 @@ def generate(source_path, base):
|
|||||||
module = "pyrogram.api.{}".format(base)
|
module = "pyrogram.api.{}".format(base)
|
||||||
|
|
||||||
with open(destination + "/" + inner_path, "w") as f:
|
with open(destination + "/" + inner_path, "w") as f:
|
||||||
# if k == base:
|
if k == base:
|
||||||
# f.write(":tocdepth: 1\n\n")
|
f.write(":tocdepth: 1\n\n")
|
||||||
|
|
||||||
f.write(
|
f.write(
|
||||||
toctree.format(
|
toctree.format(
|
||||||
|
Loading…
Reference in New Issue
Block a user