Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions pylint/checkers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1616,13 +1616,7 @@ def is_node_in_type_annotation_context(node: nodes.NodeNG) -> bool:
match parent_node:
case nodes.AnnAssign(annotation=ann) if ann == current_node:
return True
case nodes.Arguments() if current_node in (
*parent_node.annotations,
*parent_node.posonlyargs_annotations,
*parent_node.kwonlyargs_annotations,
parent_node.varargannotation,
parent_node.kwargannotation,
):
case nodes.Arguments() if current_node in parent_node.get_annotations():
return True
case nodes.FunctionDef(returns=ret) if ret == current_node:
return True
Expand Down
8 changes: 1 addition & 7 deletions pylint/checkers/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -2211,13 +2211,7 @@ def _defined_in_function_definition(
in_annotation_or_default_or_decorator = False
if isinstance(frame, nodes.FunctionDef) and node.statement() is frame:
in_annotation_or_default_or_decorator = (
(
node in frame.args.annotations
or node in frame.args.posonlyargs_annotations
or node in frame.args.kwonlyargs_annotations
or node is frame.args.varargannotation
or node is frame.args.kwargannotation
)
node in frame.args.get_annotations()
or frame.args.parent_of(node)
or (frame.decorators and frame.decorators.parent_of(node))
or (
Expand Down
Loading