Skip to content

Commit a103967

Browse files
committed
refactor: Attach parent to more objects
1 parent f9d3818 commit a103967

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

src/griffe_typedoc/decoder.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@ def wrapper(obj_dict: dict[str, Any], symbol_id_map: dict[int, Any]) -> Any:
7676
with suppress(AttributeError): # ints in groups
7777
child.parent = obj
7878

79+
if "signatures" in obj_dict:
80+
for signature in obj.signatures:
81+
signature.parent = obj
82+
83+
if "parameters" in obj_dict:
84+
for parameter in obj.parameters:
85+
parameter.parent = obj
86+
87+
if "set_signature" in obj_dict:
88+
obj.set_signature.parent = obj
89+
90+
if "get_signature" in obj_dict:
91+
obj.get_signature.parent = obj
92+
93+
if "sources" in obj_dict:
94+
for source in obj.sources:
95+
source.parent = obj
96+
7997
return obj
8098

8199
return wrapper
@@ -113,10 +131,7 @@ def _load_variable(obj_dict: dict) -> Variable:
113131

114132
@_loader
115133
def _load_function(obj_dict: dict) -> Function:
116-
function = Function(**obj_dict)
117-
for signature in function.signatures:
118-
signature.parent = function
119-
return function
134+
return Function(**obj_dict)
120135

121136

122137
@_loader

0 commit comments

Comments
 (0)