|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 | """ |
3 | 3 | Step 3 Refactor: Token class parser, exporter, and controller |
4 | | -Enhanced to capture attributes, setters, add/remove methods, and key SDK methods (to_proto/from_proto). |
| 4 | +Enhanced to capture: |
| 5 | +- Attributes from __init__ |
| 6 | +- Setters (set_/add_/remove_) |
| 7 | +- All other methods, including private SDK helpers (_build_proto_body, _get_method, _from_proto) |
| 8 | +- Optional proto conversion helpers (to_proto/from_proto) |
5 | 9 | """ |
6 | 10 |
|
7 | 11 | import ast |
@@ -35,20 +39,16 @@ def extract_classes_from_file(self, file_path: Path) -> Dict[str, Dict[str, List |
35 | 39 |
|
36 | 40 | for item in node.body: |
37 | 41 | if isinstance(item, ast.FunctionDef): |
38 | | - # Attributes from __init__ |
| 42 | + # Capture __init__ args as attributes |
39 | 43 | if item.name == "__init__": |
40 | 44 | attributes = [arg.arg for arg in item.args.args if arg.arg != "self"] |
41 | 45 |
|
42 | | - # SDK setters / repeated field methods |
| 46 | + # Setters / repeated-field helpers |
43 | 47 | elif item.name.startswith(("set_", "add_", "remove_")): |
44 | 48 | setters.append(item.name) |
45 | 49 |
|
46 | | - # Other methods (proto conversion, validation, helpers) |
47 | | - elif item.name in ("to_proto", "from_proto", "validate", "freeze", "unfreeze"): |
48 | | - others.append(item.name) |
49 | | - |
50 | | - # Optionally, include any other public methods |
51 | | - elif not item.name.startswith("_"): |
| 50 | + # All other methods (including private helpers starting with _) |
| 51 | + else: |
52 | 52 | others.append(item.name) |
53 | 53 |
|
54 | 54 | classes_info[cls_name] = { |
|
0 commit comments