Skip to content

Commit 1ef3fec

Browse files
committed
Update API and Docs compiler
1 parent 1cbb34f commit 1ef3fec

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

compiler/api/compiler.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ def get_docstring_arg_type(t: str, is_list: bool = False):
4747
return ":obj:`{}`".format(t.lower())
4848
elif t == "true":
4949
return ":obj:`bool`"
50-
elif t == "Object":
51-
return ":obj:`Any type`"
50+
elif t == "Object" or t == "X":
51+
return "Any type from :obj:`pyrogram.api.types`"
5252
elif t == "!X":
53-
return ":obj:`Any function`"
53+
return "Any query from :obj:`pyrogram.api.functions`"
5454
elif t.startswith("Vector"):
5555
return "List of " + get_docstring_arg_type(t.split("<")[1][:-1], is_list=True)
5656
else:
@@ -272,11 +272,7 @@ def start():
272272

273273
if c.section == "functions":
274274
docstring_args += "\n\n Raises:\n :obj:`pyrogram.Error`"
275-
276-
try:
277-
docstring_args += "\n\n Returns:\n " + get_docstring_arg_type(c.return_type)
278-
except KeyError:
279-
pass
275+
docstring_args += "\n\n Returns:\n " + get_docstring_arg_type(c.return_type)
280276
else:
281277
references = get_references(".".join(filter(None, [c.namespace, c.name])))
282278

compiler/docs/compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ def build(path, level=0):
9595
module = "pyrogram.api.{}".format(base)
9696

9797
with open(destination + "/" + inner_path, "w") as f:
98-
# if k == base:
99-
# f.write(":tocdepth: 1\n\n")
98+
if k == base:
99+
f.write(":tocdepth: 1\n\n")
100100

101101
f.write(
102102
toctree.format(

0 commit comments

Comments
 (0)