From 90f5a35b4ac5643d5351e676aee20a70f03374ff Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 25 Mar 2018 21:58:27 +0200 Subject: [PATCH] Update compiler --- compiler/api/compiler.py | 18 +++++++++--------- compiler/error/template/class.txt | 2 +- compiler/error/template/sub_class.txt | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/compiler/api/compiler.py b/compiler/api/compiler.py index 556ee931..d4acf087 100644 --- a/compiler/api/compiler.py +++ b/compiler/api/compiler.py @@ -41,20 +41,20 @@ constructors_to_functions = {} def get_docstring_arg_type(t: str, is_list: bool = False): if t in core_types: if t == "long": - return ":obj:`int` :obj:`64-bit`" + return "``int`` ``64-bit``" elif "int" in t: size = INT_RE.match(t) - return ":obj:`int` :obj:`{}-bit`".format(size.group(1)) if size else ":obj:`int` :obj:`32-bit`" + return "``int`` ``{}-bit``".format(size.group(1)) if size else "``int`` ``32-bit``" elif t == "double": - return ":obj:`float` :obj:`64-bit`" + return "``float`` ``64-bit``" elif t == "string": - return ":obj:`str`" + return "``str``" else: - return ":obj:`{}`".format(t.lower()) + return "``{}``".format(t.lower()) elif t == "true": - return ":obj:`bool`" + return "``bool``" elif t == "Object" or t == "X": - return "Any type from :obj:`pyrogram.api.types`" + return "Any object from :obj:`pyrogram.api.types`" elif t == "!X": return "Any method from :obj:`pyrogram.api.functions`" elif t.startswith("Vector"): @@ -262,9 +262,9 @@ def start(): arg_type = arg_type.split("?")[-1] docstring_args.append( - "{}: {}{}".format( + "{}{}: {}".format( arg_name, - "``optional`` ".format(flag_number) if is_optional else "", + " (optional)".format(flag_number) if is_optional else "", get_docstring_arg_type(arg_type) ) ) diff --git a/compiler/error/template/class.txt b/compiler/error/template/class.txt index fd240f4b..e520d80c 100644 --- a/compiler/error/template/class.txt +++ b/compiler/error/template/class.txt @@ -6,7 +6,7 @@ from ..error import Error class {super_class}(Error): {docstring} CODE = {code} - """:obj:`int`: Error Code""" + """``int``: Error Code""" NAME = __doc__ diff --git a/compiler/error/template/sub_class.txt b/compiler/error/template/sub_class.txt index a33503ec..e13e4cf2 100644 --- a/compiler/error/template/sub_class.txt +++ b/compiler/error/template/sub_class.txt @@ -1,7 +1,7 @@ class {sub_class}({super_class}): {docstring} ID = {id} - """:obj:`str`: Error ID""" + """``str``: Error ID""" MESSAGE = __doc__