diff libervia/backend/bridge/bridge_constructor/base_constructor.py @ 4270:0d7bb4df2343

Reformatted code base using black.
author Goffi <goffi@goffi.org>
date Wed, 19 Jun 2024 18:44:57 +0200
parents 4b842c1fb686
children
line wrap: on
line diff
--- a/libervia/backend/bridge/bridge_constructor/base_constructor.py	Tue Jun 18 12:06:45 2024 +0200
+++ b/libervia/backend/bridge/bridge_constructor/base_constructor.py	Wed Jun 19 18:44:57 2024 +0200
@@ -77,7 +77,8 @@
     def get_default(self, name):
         """Return default values of a function in a dict
         @param name: Name of the function to get
-        @return: dict, each key is the integer param number (no key if no default value)"""
+        @return: dict, each key is the integer param number (no key if no default value)
+        """
         default_dict = {}
         def_re = re.compile(r"param_(\d+)_default")
 
@@ -109,7 +110,8 @@
     def get_arguments_doc(self, name):
         """Return documentation of arguments
         @param name: Name of the function to get
-        @return: dict, each key is the integer param number (no key if no argument doc), value is a tuple (name, doc)"""
+        @return: dict, each key is the integer param number (no key if no argument doc), value is a tuple (name, doc)
+        """
         doc_dict = {}
         option_re = re.compile(r"doc_param_(\d+)")
         value_re = re.compile(r"^(\w+): (.*)$", re.MULTILINE | re.DOTALL)
@@ -145,8 +147,19 @@
         i = 0
 
         while i < len(signature):
-            if signature[i] not in ["b", "y", "n", "i", "x", "q", "u", "t", "d", "s",
-                                    "a"]:
+            if signature[i] not in [
+                "b",
+                "y",
+                "n",
+                "i",
+                "x",
+                "q",
+                "u",
+                "t",
+                "d",
+                "s",
+                "a",
+            ]:
                 raise ParseError("Unmanaged attribute type [%c]" % signature[i])
 
             if signature[i] == "a":
@@ -293,8 +306,9 @@
             extend_method(completion, function, default, arg_doc, async_)
 
             for part, fmt in FORMATS.items():
-                if (part.startswith(function["type"])
-                    or part.startswith(f"async_{function['type']}")):
+                if part.startswith(function["type"]) or part.startswith(
+                    f"async_{function['type']}"
+                ):
                     parts[part.upper()].append(fmt.format(**completion))
 
         # at this point, signals_part, methods_part and direct_calls should be filled,
@@ -350,10 +364,12 @@
                 os.mkdir(self.args.dest_dir)
             full_path = os.path.join(self.args.dest_dir, filename)
             if os.path.exists(full_path) and not self.args.force:
-                print((
-                    "The destination file [%s] already exists ! Use --force to overwrite it"
-                    % full_path
-                ))
+                print(
+                    (
+                        "The destination file [%s] already exists ! Use --force to overwrite it"
+                        % full_path
+                    )
+                )
             try:
                 with open(full_path, "w") as dest_file:
                     dest_file.write("\n".join(file_buf))