[libc-commits] [libc] [libc] added newhdrgen class implementation (PR #96710)

via libc-commits libc-commits at lists.llvm.org
Tue Jun 25 16:07:32 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r 4f80f362a5b2b0339bf702f6ff7ae14304c76185...e50a92a43ff045e0eb3be14ce8b3f37b6b782d67 libc/newhdrgen/class_implementation/classes/enumeration.py libc/newhdrgen/class_implementation/classes/function.py libc/newhdrgen/class_implementation/classes/include.py libc/newhdrgen/class_implementation/classes/macro.py libc/newhdrgen/class_implementation/classes/object.py libc/newhdrgen/class_implementation/classes/type.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- enumeration.py	2024-06-25 22:44:16.000000 +0000
+++ enumeration.py	2024-06-25 23:07:05.560052 +0000
@@ -8,13 +8,14 @@
 #
 # ==-------------------------------------------------------------------------==#
 
 
 class Enumeration:
-     def __init__(self, name, value=None):
+    def __init__(self, name, value=None):
         self.name = name
         self.value = value
-     def __str__(self):
-         if self.value != None:
+
+    def __str__(self):
+        if self.value != None:
             return f"{self.name} = {self.value}"
-         else:
-            return f"{self.name}"      
+        else:
+            return f"{self.name}"
--- function.py	2024-06-25 22:44:16.000000 +0000
+++ function.py	2024-06-25 23:07:05.573777 +0000
@@ -11,11 +11,13 @@
 
 class Function:
     def __init__(self, return_type, name, arguments, guard=None, attributes=None):
         self.return_type = return_type
         self.name = name
-        self.arguments = [arg if isinstance(arg, str) else arg['type'] for arg in arguments]
+        self.arguments = [
+            arg if isinstance(arg, str) else arg["type"] for arg in arguments
+        ]
         self.guard = guard
         self.attributes = attributes or []
 
     def __str__(self):
         args_str = ", ".join(self.arguments)
--- macro.py	2024-06-25 22:44:16.000000 +0000
+++ macro.py	2024-06-25 23:07:05.592194 +0000
@@ -8,14 +8,14 @@
 #
 # ==-------------------------------------------------------------------------==#
 
 
 class Macro:
-    def __init__(self, name, value = None):
+    def __init__(self, name, value=None):
         self.name = name
         self.value = value
 
     def __str__(self):
         if self.value != None:
-            return f'#define {self.name} {self.value}'
+            return f"#define {self.name} {self.value}"
         else:
             return f"#define {self.name}"
--- object.py	2024-06-25 22:44:16.000000 +0000
+++ object.py	2024-06-25 23:07:05.601046 +0000
@@ -13,6 +13,6 @@
     def __init__(self, name, type):
         self.name = name
         self.type = type
 
     def __str__(self):
-        return f'extern {self.type} {self.name}'
+        return f"extern {self.type} {self.name}"

``````````

</details>


https://github.com/llvm/llvm-project/pull/96710


More information about the libc-commits mailing list