[libc-commits] [libc] [libc][docgen] simplify posix links (PR #119595)

via libc-commits libc-commits at lists.llvm.org
Wed Dec 11 09:37:36 PST 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 8c3a8c2619122488812cf050a903314f466b07fb...e9487c24bbb44e524ef0bda279505ffc3a1ecadf libc/utils/docgen/docgen.py
``````````

</details>

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

``````````diff
--- docgen.py	2024-12-11 17:29:48.000000 +0000
+++ docgen.py	2024-12-11 17:37:08.445976 +0000
@@ -67,12 +67,12 @@
             )
 
         macros = api["macros"]
 
         for name, obj in macros.items():
-            if (not any(k in obj.keys() for k in possible_keys)):
-                err = f'error: Macro {name} does not contain at least one required property: {possible_keys}'
+            if not any(k in obj.keys() for k in possible_keys):
+                err = f"error: Macro {name} does not contain at least one required property: {possible_keys}"
                 errors.append(err)
 
     # Validate functions
     if "functions" in api:
         if not header.fns_dir_exists():
@@ -81,12 +81,12 @@
                 file=sys.stderr,
             )
 
         fns = api["functions"]
         for name, obj in fns.items():
-          if (not any(k in obj.keys() for k in possible_keys)):
-                err = f'error: function {name} does not contain at least one required property: {possible_keys}'
+            if not any(k in obj.keys() for k in possible_keys):
+                err = f"error: function {name} does not contain at least one required property: {possible_keys}"
                 errors.append(err)
 
     if errors:
         raise DocgenAPIFormatError("\n".join(errors))
 
@@ -130,13 +130,17 @@
             print(f'    - {functions[name]["c-definition"]}')
         else:
             print("    -")
 
         if "in-latest-posix" in functions[name]:
-            print(f'    - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/{name}.html>`__')
+            print(
+                f"    - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/{name}.html>`__"
+            )
         elif "removed-in-posix-2008" in functions[name]:
-            print(f'    - `removed in POSIX.1-2008 <https://pubs.opengroup.org/onlinepubs/007904875/functions/{name}.html>`__')
+            print(
+                f"    - `removed in POSIX.1-2008 <https://pubs.opengroup.org/onlinepubs/007904875/functions/{name}.html>`__"
+            )
         else:
             print("    -")
 
 
 def print_macros_rst(header: Header, macros: Dict):
@@ -158,11 +162,13 @@
             print(f'    - {macros[name]["c-definition"]}')
         else:
             print("    -")
 
         if "in-latest-posix" in macros[name]:
-            print(f'    - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/{header.name}.html>`__')
+            print(
+                f"    - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/{header.name}.html>`__"
+            )
         else:
             print("    -")
     print()
 
 
@@ -182,11 +188,13 @@
         print_functions_rst(header, api["functions"])
 
 
 def parse_args() -> Namespace:
     parser = ArgumentParser()
-    choices = sorted([p.with_suffix(".h").name for p in Path(__file__).parent.glob("*.json")])
+    choices = sorted(
+        [p.with_suffix(".h").name for p in Path(__file__).parent.glob("*.json")]
+    )
     parser.add_argument("header_name", choices=choices)
     return parser.parse_args()
 
 
 if __name__ == "__main__":

``````````

</details>


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


More information about the libc-commits mailing list