[libc-commits] [libc] [libc] implemented add_function to yaml hdrgen (PR #97079)
via libc-commits
libc-commits at lists.llvm.org
Fri Jun 28 14:09:23 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 e17b17d86e6a9d2c77b7a63822c26bda2fa05067...19e58746f76e4d5a9bec0a9b8826b0e1acb14827 libc/newhdrgen/yaml_to_classes.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- yaml_to_classes.py 2024-06-28 21:03:25.000000 +0000
+++ yaml_to_classes.py 2024-06-28 21:08:55.471448 +0000
@@ -121,11 +121,11 @@
name=name,
standards=standards,
return_type=return_type,
arguments=arguments,
guard=guard if guard != "null" else None,
- attributes=attributes if attributes else None
+ attributes=attributes if attributes else None,
)
def add_function_to_yaml(yaml_file, function_details):
"""
@@ -134,11 +134,11 @@
Args:
yaml_file: The path to the YAML file.
function_details: A list containing function details (name, standards, return_type, arguments, guard, attributes).
"""
new_function = parse_function_details(function_details)
-
+
with open(yaml_file, "r") as f:
yaml_data = yaml.safe_load(f)
if "functions" not in yaml_data:
yaml_data["functions"] = []
@@ -161,11 +161,17 @@
class IndentYamlListDumper(yaml.Dumper):
def increase_indent(self, flow=False, indentless=False):
return super(IndentYamlListDumper, self).increase_indent(flow, False)
with open(yaml_file, "w") as f:
- yaml.dump(yaml_data, f, Dumper=IndentYamlListDumper, default_flow_style=False, sort_keys=False)
+ yaml.dump(
+ yaml_data,
+ f,
+ Dumper=IndentYamlListDumper,
+ default_flow_style=False,
+ sort_keys=False,
+ )
print(f"Added function {new_function.name} to {yaml_file}")
def main(yaml_file, h_def_file, output_dir, add_function=None):
``````````
</details>
https://github.com/llvm/llvm-project/pull/97079
More information about the libc-commits
mailing list