[llvm] [Runtimes] Merge 'compile_commands.json' files from runtimes build (PR #116303)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 16:40:31 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 3a20a5f5108dc43f8a831013ef6a69fd484cf4d4...11aab09d95b0e752995762ec233ea21907a55a03 llvm/utils/merge-json.py
``````````

</details>

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

``````````diff
--- merge-json.py	2024-11-15 00:34:53.000000 +0000
+++ merge-json.py	2024-11-15 00:39:51.494587 +0000
@@ -7,36 +7,40 @@
 """
 
 import argparse
 import json
 
+
 def main():
     parser = argparse.ArgumentParser(description=__doc__)
     parser.add_argument(
-        "-o", type=str,
+        "-o",
+        type=str,
         help="The output file to write JSON data to",
-        default=None, nargs="?",
+        default=None,
+        nargs="?",
     )
     parser.add_argument(
-        "json_files", type=str, nargs='+', help="Input JSON files to merge"
+        "json_files", type=str, nargs="+", help="Input JSON files to merge"
     )
     args = parser.parse_args()
 
     merged_data = []
-    
+
     for json_file in args.json_files:
         try:
-            with open(json_file, 'r') as f:
+            with open(json_file, "r") as f:
                 data = json.load(f)
                 merged_data.extend(data)
         except (IOError, json.JSONDecodeError):
             continue
 
     # Deduplicate by converting each entry to a tuple of sorted key-value pairs
     unique_data = list({json.dumps(entry, sort_keys=True) for entry in merged_data})
     unique_data = [json.loads(entry) for entry in unique_data]
 
-    with open(args.o, 'w') as f:
+    with open(args.o, "w") as f:
         json.dump(unique_data, f, indent=2)
+
 
 if __name__ == "__main__":
     main()

``````````

</details>


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


More information about the llvm-commits mailing list