Skip to content

Commit

Permalink
Update pylint to 2.9.6 (#1114)
Browse files Browse the repository at this point in the history
* Update pylint to v2.9.6
* Code updates
  • Loading branch information
cdce8p authored Aug 2, 2021
1 parent d89e054 commit daf4f1a
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 13 deletions.
3 changes: 1 addition & 2 deletions astroid/node_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
from astroid.manager import AstroidManager

if sys.version_info >= (3, 8):
# pylint: disable=no-name-in-module
from typing import Literal
else:
from typing_extensions import Literal
Expand Down Expand Up @@ -611,7 +610,7 @@ def tolineno(self) -> Optional[int]:
if last_child is None:
return self.fromlineno

return last_child.tolineno # pylint: disable=no-member
return last_child.tolineno

def _fixed_source_line(self) -> Optional[int]:
"""Attempt to find the line that this node appears on.
Expand Down
5 changes: 2 additions & 3 deletions astroid/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
)

if sys.version_info >= (3, 8):
# pylint: disable=no-name-in-module
from typing import Literal
else:
from typing_extensions import Literal
Expand Down Expand Up @@ -796,7 +795,7 @@ def match_mapping_assigned_stmts(
is Uninferable.
"""
return
yield # pylint: disable=unreachable
yield


nodes.MatchMapping.assigned_stmts = match_mapping_assigned_stmts
Expand All @@ -813,7 +812,7 @@ def match_star_assigned_stmts(
is Uninferable.
"""
return
yield # pylint: disable=unreachable
yield


nodes.MatchStar.assigned_stmts = match_star_assigned_stmts
Expand Down
1 change: 0 additions & 1 deletion astroid/rebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
from astroid.node_classes import NodeNG

if sys.version_info >= (3, 8):
# pylint: disable=no-name-in-module
from typing import Final
else:
from typing_extensions import Final
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_pre_commit.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
black==21.7b0
pylint==2.9.3
pylint==2.9.6
isort==5.9.2
flake8==3.9.2
mypy==0.910
2 changes: 1 addition & 1 deletion script/bump_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def main() -> None:
logging.debug(f"Launching bump_changelog with args: {args}")
if "dev" in args.version:
return
with open(DEFAULT_CHANGELOG_PATH) as f:
with open(DEFAULT_CHANGELOG_PATH, encoding="utf-8") as f:
content = f.read()
content = transform_content(content, args.version)
with open(DEFAULT_CHANGELOG_PATH, "w") as f:
Expand Down
2 changes: 1 addition & 1 deletion tests/unittest_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_ast_from_string(self):
filepath = unittest.__file__
dirname = os.path.dirname(filepath)
modname = os.path.basename(dirname)
with open(filepath) as file:
with open(filepath, encoding="utf-8") as file:
data = file.read()
ast = self.manager.ast_from_string(data, modname, filepath)
self.assertEqual(ast.name, "unittest")
Expand Down
2 changes: 1 addition & 1 deletion tests/unittest_modutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def test_load_from_module_symlink_on_symlinked_paths_in_syspath(self):
self.addCleanup(os.remove, path_to_include)
except OSError:
pass
with open(real_secret_path, "w"):
with open(real_secret_path, "w", encoding="utf-8"):
pass
os.symlink(real_secret_path, symlink_secret_path)
self.addCleanup(os.remove, real_secret_path)
Expand Down
6 changes: 3 additions & 3 deletions tests/unittest_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ def test_varargs_kwargs_as_string(self):
def test_module_as_string(self):
"""check as_string on a whole module prepared to be returned identically"""
module = resources.build_file("data/module.py", "data.module")
with open(resources.find("data/module.py")) as fobj:
with open(resources.find("data/module.py"), encoding="utf-8") as fobj:
self.assertMultiLineEqual(module.as_string(), fobj.read())

def test_module2_as_string(self):
"""check as_string on a whole module prepared to be returned identically"""
module2 = resources.build_file("data/module2.py", "data.module2")
with open(resources.find("data/module2.py")) as fobj:
with open(resources.find("data/module2.py"), encoding="utf-8") as fobj:
self.assertMultiLineEqual(module2.as_string(), fobj.read())

def test_as_string(self):
Expand Down Expand Up @@ -215,7 +215,7 @@ def test_int_attribute(self):
self.assertEqual(ast.as_string().strip(), code.strip())

def test_operator_precedence(self):
with open(resources.find("data/operator_precedence.py")) as f:
with open(resources.find("data/operator_precedence.py"), encoding="utf-8") as f:
for code in f:
self.check_as_string_ast_equality(code)

Expand Down

0 comments on commit daf4f1a

Please sign in to comment.