From 42fdb03d243badad7ae72606219c874a57ca13e2 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 16 Apr 2022 20:01:38 +0200 Subject: [PATCH] Revert "Remove unneeded parts" This reverts commit 849321e5ca7eb2e636aa9a497bd08ed71f0b89da. --- compiler/api/compiler.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/api/compiler.py b/compiler/api/compiler.py index a6514994..97dbdf0a 100644 --- a/compiler/api/compiler.py +++ b/compiler/api/compiler.py @@ -361,12 +361,14 @@ def start(format: bool = False): for i, arg in enumerate(sorted_args): arg_name, arg_type = arg + is_optional = FLAGS_RE.match(arg_type) + flag_number = is_optional.group(1) if is_optional else -1 arg_type = arg_type.split("?")[-1] docstring_args.append( "{}{}: {}".format( arg_name, - " (optional)", + " (optional)".format(flag_number) if is_optional else "", get_docstring_arg_type(arg_type, is_pyrogram_type=c.namespace == "pyrogram") ) ) @@ -411,8 +413,7 @@ def start(format: bool = False): if flag.group(3) == "true" or flag.group(3).startswith("Vector"): write_flags.append(f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} else 0") else: - write_flags.append( - f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} is not None else 0") + write_flags.append(f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} is not None else 0") write_flags = "\n ".join([ f"{arg_name} = 0",