Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use astroid.Context enum #8611

Merged
merged 1 commit into from
Apr 23, 2023
Merged
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
10 changes: 5 additions & 5 deletions pylint/checkers/typecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -1692,9 +1692,9 @@ def _check_invalid_sequence_index(self, subscript: nodes.Subscript) -> None:
# Determine what method on the parent this index will use
# The parent of this node will be a Subscript, and the parent of that
# node determines if the Subscript is a get, set, or delete operation.
if subscript.ctx is astroid.Store:
if subscript.ctx is astroid.Context.Store:
methodname = "__setitem__"
elif subscript.ctx is astroid.Del:
elif subscript.ctx is astroid.Context.Del:
methodname = "__delitem__"
else:
methodname = "__getitem__"
Expand Down Expand Up @@ -2116,13 +2116,13 @@ def visit_subscript(self, node: nodes.Subscript) -> None:
confidence=INFERENCE,
)

if node.ctx == astroid.Load:
if node.ctx == astroid.Context.Load:
supported_protocol = supports_getitem
msg = "unsubscriptable-object"
elif node.ctx == astroid.Store:
elif node.ctx == astroid.Context.Store:
supported_protocol = supports_setitem
msg = "unsupported-assignment-operation"
elif node.ctx == astroid.Del:
elif node.ctx == astroid.Context.Del:
supported_protocol = supports_delitem
msg = "unsupported-delete-operation"

Expand Down