Skip to content

Commit 00836c6

Browse files
committed
fix: additional methods
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
1 parent 5804d63 commit 00836c6

File tree

2 files changed

+166
-9
lines changed

2 files changed

+166
-9
lines changed

scripts/src_vs_proto/steps_3_extract_setters_attributes2.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#!/usr/bin/env python3
22
"""
33
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)
59
"""
610

711
import ast
@@ -35,20 +39,16 @@ def extract_classes_from_file(self, file_path: Path) -> Dict[str, Dict[str, List
3539

3640
for item in node.body:
3741
if isinstance(item, ast.FunctionDef):
38-
# Attributes from __init__
42+
# Capture __init__ args as attributes
3943
if item.name == "__init__":
4044
attributes = [arg.arg for arg in item.args.args if arg.arg != "self"]
4145

42-
# SDK setters / repeated field methods
46+
# Setters / repeated-field helpers
4347
elif item.name.startswith(("set_", "add_", "remove_")):
4448
setters.append(item.name)
4549

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:
5252
others.append(item.name)
5353

5454
classes_info[cls_name] = {

0 commit comments

Comments
 (0)