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 origin/main...HEAD lldb/docs/_ext/lldb_setting.py
lldb/docs/_scripts/gen-property-docs-from-json.py lldb/docs/conf.py
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- _scripts/gen-property-docs-from-json.py 2026-02-12 14:02:31.000000 +0000
+++ _scripts/gen-property-docs-from-json.py 2026-02-12 14:08:02.801512 +0000
@@ -21,47 +21,53 @@
class PropertyTree:
items: dict[str, Union["PropertyTree", Property]]
def append_group(tree: PropertyTree, group: PropertyGroup):
- segments = group['path'].split('.') if group['path'] else []
+ segments = group["path"].split(".") if group["path"] else []
subtree = tree
for segment in segments:
if segment not in subtree.items:
subtree.items[segment] = PropertyTree(items={})
subtree = subtree.items[segment]
assert isinstance(subtree, PropertyTree)
- for property in group['properties']:
- subtree.items[property['name']] = property
-
+ for property in group["properties"]:
+ subtree.items[property["name"]] = property
+
def print_property(f: TextIO, path: str, property: Property):
f.write(f"```{{lldbsetting}} {path}\n")
f.write(f":type: \"{property['type']}\"\n\n")
- f.write(property.get('description', '').strip())
- f.write('\n\n')
- if 'default' in property and property['default']:
+ f.write(property.get("description", "").strip())
+ f.write("\n\n")
+ if "default" in property and property["default"]:
f.write(f":default: {property['default']}\n")
# FIXME: add enumerations (":enum {name}: {description}")
f.write("```\n")
def print_tree(f: TextIO, level: int, prefix: str, name: str, tree:
PropertyTree):
if level > 0:
f.write(f"{'#' * (level + 2)} {name}\n\n")
-
- leafs = sorted(filter(lambda it: isinstance(it[1], dict),
tree.items.items()), key=lambda it: it[0])
+
+ leafs = sorted(
+ filter(lambda it: isinstance(it[1], dict), tree.items.items()),
+ key=lambda it: it[0],
+ )
for key, prop in leafs:
- assert isinstance(prop, dict) # only needed for typing
+ assert isinstance(prop, dict) # only needed for typing
path = f"{prefix}.{key}" if prefix else key
print_property(f, path, prop)
-
- groups = sorted(filter(lambda it: isinstance(it[1], PropertyTree),
tree.items.items()), key=lambda it: it[0])
+
+ groups = sorted(
+ filter(lambda it: isinstance(it[1], PropertyTree), tree.items.items()),
+ key=lambda it: it[0],
+ )
for key, subtree in groups:
- assert isinstance(subtree, PropertyTree) # only needed for typing
+ assert isinstance(subtree, PropertyTree) # only needed for typing
prefix = f"{name}.{key}" if name else key
print_tree(f, level + 1, prefix, key, subtree)
HEADER = """
@@ -72,26 +78,28 @@
Values can be added to arrays and dictionaries with `settings append -- <name>
<value>`.
## Root
"""
+
def main():
parser = argparse.ArgumentParser(
- prog="gen-property-docs-from-json",
- description='Generate Markdown from multiple property
docs')
- parser.add_argument('-o', '--output', help="Path to output file")
- parser.add_argument('inputs', nargs='*')
+ prog="gen-property-docs-from-json",
+ description="Generate Markdown from multiple property docs",
+ )
+ parser.add_argument("-o", "--output", help="Path to output file")
+ parser.add_argument("inputs", nargs="*")
args = parser.parse_args()
root = PropertyTree(items={})
for input in args.inputs:
with open(input) as f:
groups: list[PropertyGroup] = json.load(f)
for group in groups:
append_group(root, group)
- with open(args.output, 'w') as f:
+ with open(args.output, "w") as f:
f.write(HEADER)
print_tree(f, 0, "", "", root)
if __name__ == "__main__":
``````````
</details>
https://github.com/llvm/llvm-project/pull/168245
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits