Skip to content

Commit 5e77e13

Browse files
committed
rename the «adhoc module» to «synthetic root»
1 parent 7a702eb commit 5e77e13

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

astroid/brain/brain_argparse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def infer_namespace(node, context: InferenceContext | None = None):
2121
"Namespace",
2222
lineno=node.lineno,
2323
col_offset=node.col_offset,
24-
parent=AstroidManager().adhoc_module, # this class is not real
24+
parent=AstroidManager().synthetic_root, # this class is not real
2525
end_lineno=node.end_lineno,
2626
end_col_offset=node.end_col_offset,
2727
)

astroid/brain/brain_builtin_inference.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def _extend_builtins(class_transforms):
165165

166166
def on_bootstrap():
167167
"""Called by astroid_bootstrapping()."""
168-
AstroidManager().cache_module(build_module("__astroid_adhoc"))
168+
AstroidManager().cache_module(build_module("__astroid_synthetic"))
169169

170170
_extend_builtins(
171171
{
@@ -653,7 +653,7 @@ def infer_property(
653653
# node.frame. It's somewhere in the builtins module, but we are special
654654
# casing it for each "property()" call, so we are making up the
655655
# definition on the spot, ad-hoc.
656-
parent=AstroidManager().adhoc_module,
656+
parent=AstroidManager().synthetic_root,
657657
)
658658
prop_func.postinit(
659659
body=[],

astroid/brain/brain_namedtuple_enum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def infer_named_tuple(
194194
"""Specific inference function for namedtuple Call node."""
195195
tuple_base: nodes.Name = _extract_single_node("tuple")
196196
class_node, name, attributes = infer_func_form(
197-
node, tuple_base, parent=AstroidManager().adhoc_module, context=context
197+
node, tuple_base, parent=AstroidManager().synthetic_root, context=context
198198
)
199199

200200
call_site = arguments.CallSite.from_call(node, context=context)
@@ -360,7 +360,7 @@ def value(self):
360360
class_node = infer_func_form(
361361
node,
362362
enum_meta,
363-
parent=AstroidManager().adhoc_module,
363+
parent=AstroidManager().synthetic_root,
364364
context=context,
365365
enum=True,
366366
)[0]

astroid/manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ def builtins_module(self) -> nodes.Module:
116116
return self.astroid_cache["builtins"]
117117

118118
@property
119-
def adhoc_module(self) -> nodes.Module:
120-
return self.astroid_cache["__astroid_adhoc"]
119+
def synthetic_root(self) -> nodes.Module:
120+
return self.astroid_cache["__astroid_synthetic"]
121121

122122
@property
123123
def prefer_stubs(self) -> bool:

astroid/nodes/scoped_nodes/scoped_nodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,7 @@ def infer_call_result(
16021602
col_offset=0,
16031603
end_lineno=0,
16041604
end_col_offset=0,
1605-
parent=AstroidManager().adhoc_module,
1605+
parent=AstroidManager().synthetic_root,
16061606
)
16071607
new_class.hide = True
16081608
new_class.postinit(

astroid/objects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def __init__(self, call, name=None, lineno=None, col_offset=None, parent=None):
279279
name,
280280
lineno=lineno,
281281
col_offset=col_offset,
282-
parent=AstroidManager().adhoc_module,
282+
parent=AstroidManager().synthetic_root,
283283
end_col_offset=0,
284284
end_lineno=0,
285285
)

tests/test_nodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ def test_str_repr_no_warnings(node):
19621962
continue
19631963

19641964
if name == "parent" and "NodeNG" in param_type.annotation:
1965-
args[name] = AstroidManager().adhoc_module
1965+
args[name] = AstroidManager().synthetic_root
19661966
elif "int" in param_type.annotation:
19671967
args[name] = random.randint(0, 50)
19681968
elif (

0 commit comments

Comments
 (0)