================
@@ -0,0 +1,106 @@
+import argparse
+from typing import TypedDict, Union, Optional, TextIO, NotRequired
+from dataclasses import dataclass
+import json
+
+
+class Property(TypedDict):
+ name: str
+ type: str
+ default: NotRequired[str]
+ description: NotRequired[str]
+
+
+class PropertyGroup(TypedDict):
+ path: str
+ """The full path to this group separated by dots"""
+ properties: list[Property]
+
+
+@dataclass
+class PropertyTree:
+ items: dict[str, Union["PropertyTree", Property]]
+
+
+def append_group(tree: PropertyTree, group: PropertyGroup):
+ 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
+
+
+def print_property(f: TextIO, path: str, property: Property):
+ f.write(f"```{{lldbsetting}} {path}\n")
+ f.write(f":type: \"{property['type']}\"\n\n")
----------------
Nerixyz wrote:
Looks like it did it now. I think black didn't do it before, because it
would've used `'` inside the string (`f'foo {a['foo']}'`). That's only
available in Python 3.12 or 3.13 afaik.
https://github.com/llvm/llvm-project/pull/168245
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits