diff options
| author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-02-17 23:22:06 +0100 |
|---|---|---|
| committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-02-17 23:51:41 +0100 |
| commit | 688876e2312ac5b43aca8e6369591897939577a9 (patch) | |
| tree | 95797640e7756c18a57c4e433e1926e2e8eed551 | |
| parent | 4d222af03b2ca48fa21832e05ce4fbba25905c8f (diff) | |
| download | astroid-git-688876e2312ac5b43aca8e6369591897939577a9.tar.gz | |
Remove redundant open mode 'r' in opens
| -rw-r--r-- | astroid/builder.py | 2 | ||||
| -rw-r--r-- | tests/unittest_manager.py | 2 | ||||
| -rw-r--r-- | tests/unittest_nodes.py | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/astroid/builder.py b/astroid/builder.py index 7c819cbf..86cba8b1 100644 --- a/astroid/builder.py +++ b/astroid/builder.py @@ -49,7 +49,7 @@ MANAGER = manager.AstroidManager() def open_source_file(filename): with open(filename, "rb") as byte_stream: encoding = detect_encoding(byte_stream.readline)[0] - stream = open(filename, "r", newline=None, encoding=encoding) + stream = open(filename, newline=None, encoding=encoding) data = stream.read() return stream, encoding, data diff --git a/tests/unittest_manager.py b/tests/unittest_manager.py index ae0941bf..4aa6e4ba 100644 --- a/tests/unittest_manager.py +++ b/tests/unittest_manager.py @@ -77,7 +77,7 @@ class AstroidManagerTest( filepath = unittest.__file__ dirname = os.path.dirname(filepath) modname = os.path.basename(dirname) - with open(filepath, "r") as file: + with open(filepath) as file: data = file.read() ast = self.manager.ast_from_string(data, modname, filepath) self.assertEqual(ast.name, "unittest") diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py index 7d53f6ac..488864f7 100644 --- a/tests/unittest_nodes.py +++ b/tests/unittest_nodes.py @@ -118,14 +118,14 @@ class AsStringTest(resources.SysPathSetup, unittest.TestCase): """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"), "r") as fobj: + with open(resources.find("data/module.py")) 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"), "r") as fobj: + with open(resources.find("data/module2.py")) as fobj: self.assertMultiLineEqual(module2.as_string(), fobj.read()) def test_as_string(self): |
