From 1ef3fec314b84998bad788d3a2846224be1a43bc Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 8 Jan 2018 07:15:38 +0100 Subject: [PATCH] Update API and Docs compiler --- compiler/api/compiler.py | 12 ++++-------- compiler/docs/compiler.py | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/compiler/api/compiler.py b/compiler/api/compiler.py index b7ae4a49..7cce2752 100644 --- a/compiler/api/compiler.py +++ b/compiler/api/compiler.py @@ -47,10 +47,10 @@ def get_docstring_arg_type(t: str, is_list: bool = False): return ":obj:`{}`".format(t.lower()) elif t == "true": return ":obj:`bool`" - elif t == "Object": - return ":obj:`Any type`" + elif t == "Object" or t == "X": + return "Any type from :obj:`pyrogram.api.types`" elif t == "!X": - return ":obj:`Any function`" + return "Any query from :obj:`pyrogram.api.functions`" elif t.startswith("Vector"): return "List of " + get_docstring_arg_type(t.split("<")[1][:-1], is_list=True) else: @@ -272,11 +272,7 @@ def start(): if c.section == "functions": docstring_args += "\n\n Raises:\n :obj:`pyrogram.Error`" - - try: - docstring_args += "\n\n Returns:\n " + get_docstring_arg_type(c.return_type) - except KeyError: - pass + docstring_args += "\n\n Returns:\n " + get_docstring_arg_type(c.return_type) else: references = get_references(".".join(filter(None, [c.namespace, c.name]))) diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index 63d41a00..58dc3e2a 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -95,8 +95,8 @@ def generate(source_path, base): module = "pyrogram.api.{}".format(base) with open(destination + "/" + inner_path, "w") as f: - # if k == base: - # f.write(":tocdepth: 1\n\n") + if k == base: + f.write(":tocdepth: 1\n\n") f.write( toctree.format(