Skip to content

Commit

Permalink
set namespace's parent to adhoc module instead of Unknown
Browse files Browse the repository at this point in the history
it's a part of the campaign to get rid of non-module roots
  • Loading branch information
temyurchenko authored and DanielNoord committed Sep 10, 2024
1 parent b6d52d3 commit 20890b8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions astroid/brain/brain_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ def infer_namespace(node, context: InferenceContext | None = None):
"Namespace",
lineno=node.lineno,
col_offset=node.col_offset,
parent=nodes.Unknown(),
parent=AstroidManager().adhoc_module, # this class is not real
end_lineno=node.end_lineno,
end_col_offset=node.end_col_offset,
)
# Set parent manually until ClassDef constructor fixed:
# https://github.com/pylint-dev/astroid/issues/1490
class_node.parent = node.parent
for attr in set(callsite.keyword_arguments):
fake_node = nodes.EmptyNode()
fake_node.parent = class_node
Expand Down

0 comments on commit 20890b8

Please sign in to comment.