Skip to content

Commit 20890b8

Browse files
temyurchenkoDanielNoord
authored andcommitted
set namespace's parent to adhoc module instead of Unknown
it's a part of the campaign to get rid of non-module roots
1 parent b6d52d3 commit 20890b8

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

astroid/brain/brain_argparse.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,10 @@ def infer_namespace(node, context: InferenceContext | None = None):
2121
"Namespace",
2222
lineno=node.lineno,
2323
col_offset=node.col_offset,
24-
parent=nodes.Unknown(),
24+
parent=AstroidManager().adhoc_module, # this class is not real
2525
end_lineno=node.end_lineno,
2626
end_col_offset=node.end_col_offset,
2727
)
28-
# Set parent manually until ClassDef constructor fixed:
29-
# https://github.com/pylint-dev/astroid/issues/1490
30-
class_node.parent = node.parent
3128
for attr in set(callsite.keyword_arguments):
3229
fake_node = nodes.EmptyNode()
3330
fake_node.parent = class_node

0 commit comments

Comments
 (0)