diff options
-rw-r--r-- | ranger/core/actions.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 417647db..6b184236 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -1044,6 +1044,9 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m if not self.settings.preview_script or not self.settings.use_preview_script: try: # XXX: properly determine file's encoding + # Disable the lint because the preview is read outside the + # local scope. + # pylint: disable=consider-using-with return codecs.open(path, 'r', errors='ignore') # IOError for Python2, OSError for Python3 except (IOError, OSError): @@ -1407,6 +1410,8 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m if not contexts: contexts = 'browser', 'console', 'pager', 'taskview' + # Disable lint because TemporaryFiles are removed on close + # pylint: disable=consider-using-with temporary_file = tempfile.NamedTemporaryFile() def write(string): # pylint: disable=redefined-outer-name @@ -1432,6 +1437,8 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m self._run_pager(temporary_file.name) def dump_commands(self): + # Disable lint because TemporaryFiles are removed on close + # pylint: disable=consider-using-with temporary_file = tempfile.NamedTemporaryFile() def write(string): # pylint: disable=redefined-outer-name @@ -1457,6 +1464,8 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m self._run_pager(temporary_file.name) def dump_settings(self): + # Disable lint because TemporaryFiles are removed on close + # pylint: disable=consider-using-with temporary_file = tempfile.NamedTemporaryFile() def write(string): # pylint: disable=redefined-outer-name |