diff options
-rw-r--r-- | astroid/node_classes.py | 3 | ||||
-rw-r--r-- | astroid/protocols.py | 5 | ||||
-rw-r--r-- | astroid/rebuilder.py | 1 | ||||
-rw-r--r-- | requirements_test_pre_commit.txt | 2 | ||||
-rw-r--r-- | script/bump_changelog.py | 2 | ||||
-rw-r--r-- | tests/unittest_manager.py | 2 | ||||
-rw-r--r-- | tests/unittest_modutils.py | 2 | ||||
-rw-r--r-- | tests/unittest_nodes.py | 6 |
8 files changed, 10 insertions, 13 deletions
diff --git a/astroid/node_classes.py b/astroid/node_classes.py index 00c1f334..81e6f1f1 100644 --- a/astroid/node_classes.py +++ b/astroid/node_classes.py @@ -57,7 +57,6 @@ from astroid.exceptions import ( 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 @@ -611,7 +610,7 @@ class NodeNG: 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. diff --git a/astroid/protocols.py b/astroid/protocols.py index ec36611e..fb4cabcb 100644 --- a/astroid/protocols.py +++ b/astroid/protocols.py @@ -46,7 +46,6 @@ from astroid.exceptions import ( ) if sys.version_info >= (3, 8): - # pylint: disable=no-name-in-module from typing import Literal else: from typing_extensions import Literal @@ -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 @@ -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 diff --git a/astroid/rebuilder.py b/astroid/rebuilder.py index e53b427a..92988bde 100644 --- a/astroid/rebuilder.py +++ b/astroid/rebuilder.py @@ -52,7 +52,6 @@ from astroid.manager import AstroidManager 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 diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index ab46ead0..d5ee97b6 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -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 diff --git a/script/bump_changelog.py b/script/bump_changelog.py index be8d00a1..2745d0ce 100644 --- a/script/bump_changelog.py +++ b/script/bump_changelog.py @@ -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: diff --git a/tests/unittest_manager.py b/tests/unittest_manager.py index bb128474..2bed335b 100644 --- a/tests/unittest_manager.py +++ b/tests/unittest_manager.py @@ -79,7 +79,7 @@ class AstroidManagerTest( 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") diff --git a/tests/unittest_modutils.py b/tests/unittest_modutils.py index 254ada24..13268f4c 100644 --- a/tests/unittest_modutils.py +++ b/tests/unittest_modutils.py @@ -181,7 +181,7 @@ class ModPathFromFileTest(unittest.TestCase): 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) diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py index 60909bf2..d935c487 100644 --- a/tests/unittest_nodes.py +++ b/tests/unittest_nodes.py @@ -117,13 +117,13 @@ class AsStringTest(resources.SysPathSetup, unittest.TestCase): 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): @@ -215,7 +215,7 @@ y = (3).imag 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) |