[llvm-branch-commits] [libcxx] [libc++] Adds a FTM v2 data file generator. (PR #134555)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Apr 6 10:59:19 PDT 2025
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 HEAD~1...HEAD libcxx/utils/generate_feature_test_macro_components.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- generate_feature_test_macro_components.py 2025-04-06 17:54:24.000000 +0000
+++ generate_feature_test_macro_components.py 2025-04-06 17:58:47.303988 +0000
@@ -1958,40 +1958,52 @@
table_doc_path = os.path.join(docs_path, "FeatureTestMacroTable.rst")
with open(table_doc_path, "w", newline="\n") as f:
f.write(doc_str)
+
def get_values(tc) -> str:
implemented = True if not "unimplemented" in tc.keys() else not tc["unimplemented"]
- return ",\n".join("""\
+ return ",\n".join(
+ """\
"{std}": {{
"{value}": [
{{
"implemented": {implemented}
}}
]
}}\
-""".format(std=key, value=tc["values"][key], implemented="true" if implemented else "false") for key in tc["values"].keys())
+""".format(
+ std=key,
+ value=tc["values"][key],
+ implemented="true" if implemented else "false",
+ )
+ for key in tc["values"].keys()
+ )
+
def get_headers(tc) -> str:
headers = tc["headers"]
headers.remove("version")
- return f'{headers}'.replace("'", '"')
+ return f"{headers}".replace("'", '"')
+
def get_test_suite_guard(tc) -> str:
if not "test_suite_guard" in tc.keys():
return ""
return f',\n "test_suite_guard": "{tc["test_suite_guard"]}"'
+
def get_libcxx_guard(tc) -> str:
if not "libcxx_guard" in tc.keys():
return ""
return f',\n "libcxx_guard": "{tc["libcxx_guard"]}"'
+
def get_ftm_json(tc) -> str:
- data="""\
+ data = """\
{{
"name": "{ftm}",
"values": {{
{values}
}},
@@ -2014,11 +2026,13 @@
def produce_json(file: os.path) -> None:
contents = """\
[
{data}
]
-""".format(data=get_json())
+""".format(
+ data=get_json()
+ )
with open(file, "w", newline="\n") as f:
f.write(contents)
Std = NewType("Std", str) # Standard version number
``````````
</details>
https://github.com/llvm/llvm-project/pull/134555
More information about the llvm-branch-commits
mailing list