summaryrefslogtreecommitdiff
path: root/astroid
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-24 10:03:34 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-24 11:35:53 +0200
commit0941bf3ac4684100bdb919b581d118d999463f48 (patch)
treeb1641fab500a4755f99412655d2fccb784f4e97f /astroid
parent274f001581573536fad757a8bad5a6226c32a568 (diff)
downloadastroid-git-0941bf3ac4684100bdb919b581d118d999463f48.tar.gz
Disable consider-using-with in function returning a stream
Diffstat (limited to 'astroid')
-rw-r--r--astroid/builder.py1
-rw-r--r--astroid/scoped_nodes.py1
2 files changed, 2 insertions, 0 deletions
diff --git a/astroid/builder.py b/astroid/builder.py
index 789c2c0a..de5acac1 100644
--- a/astroid/builder.py
+++ b/astroid/builder.py
@@ -50,6 +50,7 @@ MANAGER = manager.AstroidManager()
def open_source_file(filename):
+ # pylint: disable=consider-using-with
with open(filename, "rb") as byte_stream:
encoding = detect_encoding(byte_stream.readline)[0]
stream = open(filename, newline=None, encoding=encoding)
diff --git a/astroid/scoped_nodes.py b/astroid/scoped_nodes.py
index 9dff37a8..801b55ee 100644
--- a/astroid/scoped_nodes.py
+++ b/astroid/scoped_nodes.py
@@ -503,6 +503,7 @@ class Module(LocalsDictNodeNG):
if self.file_bytes is not None:
return io.BytesIO(self.file_bytes)
if self.file is not None:
+ # pylint: disable=consider-using-with
stream = open(self.file, "rb")
return stream
return None