Skip to content

Commit

Permalink
Update existing code
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Aug 19, 2021
1 parent cf09c9e commit fdde762
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pylint/checkers/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,10 +1000,10 @@ def _check_unused_private_attributes(self, node: nodes.ClassDef) -> None:
if attribute.attrname != assign_attr.attrname:
continue

if assign_attr.expr.name == "cls" and attribute.expr.name in [
if assign_attr.expr.name == "cls" and attribute.expr.name in (
"cls",
"self",
]:
):
# If assigned to cls.attrib, can be accessed by cls/self
break

Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/python3.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _in_iterating_context(node):
elif (
isinstance(parent, nodes.Compare)
and len(parent.ops) == 1
and parent.ops[0][0] in ["in", "not in"]
and parent.ops[0][0] in ("in", "not in")
):
return True
# Also if it's an `yield from`, that's fair
Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/refactoring/refactoring_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ def _check_consider_using_generator(self, node):
# remove square brackets '[]'
inside_comp = node.args[0].as_string()[1:-1]
call_name = node.func.name
if call_name in ["any", "all"]:
if call_name in ("any", "all"):
self.add_message(
"use-a-generator",
node=node,
Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def _check_redundant_assert(self, node, infer):
isinstance(infer, astroid.BoundMethod)
and node.args
and isinstance(node.args[0], nodes.Const)
and infer.name in ["assertTrue", "assertFalse"]
and infer.name in ("assertTrue", "assertFalse")
):
self.add_message(
"redundant-unittest-assert",
Expand Down
4 changes: 2 additions & 2 deletions pylint/checkers/typecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def _emit_no_member(node, owner, owner_name, ignored_mixins=True, ignored_none=T
and isinstance(owner.parent, nodes.ClassDef)
and owner.parent.name == "EnumMeta"
and owner_name == "__members__"
and node.attrname in ["items", "values", "keys"]
and node.attrname in ("items", "values", "keys")
):
# Avoid false positive on Enum.__members__.{items(), values, keys}
# See https://github.com/PyCQA/pylint/issues/4123
Expand Down Expand Up @@ -1778,7 +1778,7 @@ def visit_compare(self, node):
return

op, right = node.ops[0]
if op in ["in", "not in"]:
if op in ("in", "not in"):
self._check_membership_test(right)

@check_messages(
Expand Down
2 changes: 1 addition & 1 deletion pylint/lint/pylinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ def any_fail_on_issues(self):
def disable_noerror_messages(self):
for msgcat, msgids in self.msgs_store._msgs_by_category.items():
# enable only messages with 'error' severity and above ('fatal')
if msgcat in ["E", "F"]:
if msgcat in ("E", "F"):
for msgid in msgids:
self.enable(msgid)
else:
Expand Down
2 changes: 1 addition & 1 deletion script/bump_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def do_checks(content, next_version, version, version_type):
wn_next_version = get_whats_new(next_version)
wn_this_version = get_whats_new(version)
# There is only one field where the release date is TBA
if version_type in [VersionType.MAJOR, VersionType.MINOR]:
if version_type in (VersionType.MAJOR, VersionType.MINOR):
assert (
content.count(RELEASE_DATE_TEXT) <= 1
), f"There should be only one release date 'TBA' ({version}) {err}"
Expand Down

0 comments on commit fdde762

Please sign in to comment.