diff options
author | toonn <toonn@toonn.io> | 2022-02-05 16:41:02 +0100 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2022-02-05 16:41:02 +0100 |
commit | 035eecbcfb0f1812d695a53b0929b3c6500f83ed (patch) | |
tree | 77a612653a140ba9c1be2338e8f72b70ad5cd7f1 | |
parent | 6c21d145298da1e5a05bb220d1a3c1973ebefac3 (diff) | |
parent | 8372a7602d93eb7fc3d18c8ac071ea9cd6349501 (diff) | |
download | ranger-035eecbcfb0f1812d695a53b0929b3c6500f83ed.tar.gz |
Merge branch 'pylint'
-rwxr-xr-x | doc/tools/convert_papermode_to_metadata.py | 2 | ||||
-rw-r--r-- | examples/plugin_ipc.py | 1 | ||||
-rw-r--r-- | ranger/container/tags.py | 1 | ||||
-rw-r--r-- | ranger/core/actions.py | 5 | ||||
-rw-r--r-- | ranger/core/loader.py | 1 | ||||
-rw-r--r-- | ranger/core/runner.py | 2 | ||||
-rw-r--r-- | ranger/ext/img_display.py | 2 | ||||
-rw-r--r-- | ranger/ext/macrodict.py | 2 | ||||
-rw-r--r-- | ranger/ext/popen_forked.py | 2 | ||||
-rwxr-xr-x | ranger/ext/rifle.py | 4 | ||||
-rw-r--r-- | ranger/ext/vcs/vcs.py | 2 | ||||
-rwxr-xr-x | tests/manpage_completion_test.py | 1 |
12 files changed, 3 insertions, 22 deletions
diff --git a/doc/tools/convert_papermode_to_metadata.py b/doc/tools/convert_papermode_to_metadata.py index 58371193..0a1b21ce 100755 --- a/doc/tools/convert_papermode_to_metadata.py +++ b/doc/tools/convert_papermode_to_metadata.py @@ -39,7 +39,6 @@ def replace(source, target): result = {} # Read the input file and convert it to a dictionary - # pylint: disable=unspecified-encoding with open(".paperinfo", "r") as infile: reader = csv.reader(infile, skipinitialspace=True) for lineno, row in enumerate(reader): @@ -62,7 +61,6 @@ def replace(source, target): if result: # There's no way to specify encoding in 2.x even though in this case we # could choose to write in UTF-8. - # pylint: disable=unspecified-encoding with open(".metadata.json", "w") as outfile: json.dump(result, outfile, indent=2) else: diff --git a/examples/plugin_ipc.py b/examples/plugin_ipc.py index 0e7de3bb..da6a19b0 100644 --- a/examples/plugin_ipc.py +++ b/examples/plugin_ipc.py @@ -32,7 +32,6 @@ def hook_init(fm): while True: # The IPC encoding depends on the system locale so we can't # guess here. - # pylint: disable=unspecified-encoding with open(filepath, 'r') as fifo: line = fifo.read() fm.execute_console(line.strip()) diff --git a/ranger/container/tags.py b/ranger/container/tags.py index 4d4e6c59..e1ceec6f 100644 --- a/ranger/container/tags.py +++ b/ranger/container/tags.py @@ -123,7 +123,6 @@ class Tags(FileManagerAware): elif path.startswith(path_old + sep): pnew = path_new + path[len(path_old):] if pnew: - # pylint: disable=unnecessary-dict-index-lookup del self.tags[path] self.tags[pnew] = tag changed = True diff --git a/ranger/core/actions.py b/ranger/core/actions.py index a552e328..6cbc9ef7 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -372,7 +372,6 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m """ filename = os.path.expanduser(filename) LOG.debug("Sourcing config file '%s'", filename) - # pylint: disable=unspecified-encoding with open(filename, 'r', encoding="utf-8") as fobj: for line in fobj: line = line.strip(" \r\n") @@ -1054,7 +1053,6 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m # 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): @@ -1440,7 +1438,6 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m 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 @@ -1467,7 +1464,6 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m 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 @@ -1494,7 +1490,6 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m 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 diff --git a/ranger/core/loader.py b/ranger/core/loader.py index 5c9e28a5..866902fb 100644 --- a/ranger/core/loader.py +++ b/ranger/core/loader.py @@ -175,7 +175,6 @@ class CommandLoader( # pylint: disable=too-many-instance-attributes # pylint: disable=too-many-branches,too-many-statements # TODO: Check whether we can afford to wait for processes and use a # with-statement for Popen. - # pylint: disable=consider-using-with popenargs = {} if self.popenArgs is None else self.popenArgs popenargs['stdout'] = popenargs['stderr'] = PIPE popenargs['stdin'] = ( diff --git a/ranger/core/runner.py b/ranger/core/runner.py index 1d2b91f7..acd85fb8 100644 --- a/ranger/core/runner.py +++ b/ranger/core/runner.py @@ -193,7 +193,6 @@ class Runner(object): # pylint: disable=too-few-public-methods context.wait = False if 's' in context.flags: # Using a with-statement for these is inconvenient. - # pylint: disable=consider-using-with devnull_writable = open(os.devnull, 'w', encoding="utf-8") devnull_readable = open(os.devnull, 'r', encoding="utf-8") for key in ('stdout', 'stderr'): @@ -244,7 +243,6 @@ class Runner(object): # pylint: disable=too-few-public-methods if 'f' in context.flags and 'r' not in context.flags: # This can fail and return False if os.fork() is not # supported, but we assume it is, since curses is used. - # pylint: disable=consider-using-with Popen_forked(**popen_kws) else: process = Popen(**popen_kws) diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index 43e4203d..97b8f43f 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -143,7 +143,6 @@ class W3MImageDisplayer(ImageDisplayer, FileManagerAware): self.binary_path = None self.binary_path = self._find_w3mimgdisplay_executable() # may crash # We cannot close the process because that stops the preview. - # pylint: disable=consider-using-with self.process = Popen([self.binary_path] + W3MIMGDISPLAY_OPTIONS, cwd=self.working_dir, stdin=PIPE, stdout=PIPE, universal_newlines=True) self.is_initialized = True @@ -745,7 +744,6 @@ class UeberzugImageDisplayer(ImageDisplayer): return # We cannot close the process because that stops the preview. - # pylint: disable=consider-using-with self.process = Popen(['ueberzug', 'layer', '--silent'], cwd=self.working_dir, stdin=PIPE, universal_newlines=True) self.is_initialized = True diff --git a/ranger/ext/macrodict.py b/ranger/ext/macrodict.py index 924fe5a9..b4613fbc 100644 --- a/ranger/ext/macrodict.py +++ b/ranger/ext/macrodict.py @@ -15,7 +15,7 @@ def macro_val(thunk, fallback=MACRO_FAIL): try: from collections.abc import MutableMapping # pylint: disable=no-name-in-module except ImportError: - from collections import MutableMapping # pylint: disable=deprecated-class + from collections import MutableMapping class MacroDict(MutableMapping): diff --git a/ranger/ext/popen_forked.py b/ranger/ext/popen_forked.py index 40a5b833..46054e9c 100644 --- a/ranger/ext/popen_forked.py +++ b/ranger/ext/popen_forked.py @@ -24,7 +24,7 @@ def Popen_forked(*args, **kwargs): # pylint: disable=invalid-name ) as null_w: kwargs['stdin'] = null_r kwargs['stdout'] = kwargs['stderr'] = null_w - Popen(*args, **kwargs) # pylint: disable=consider-using-with + Popen(*args, **kwargs) os._exit(0) # pylint: disable=protected-access else: os.wait() diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py index fbfe7c5a..53800ed6 100755 --- a/ranger/ext/rifle.py +++ b/ranger/ext/rifle.py @@ -141,13 +141,12 @@ except ImportError: return False if pid == 0: os.setsid() - # pylint: disable=unspecified-encoding with open(os.devnull, "r") as null_r, open( os.devnull, "w" ) as null_w: kwargs["stdin"] = null_r kwargs["stdout"] = kwargs["stderr"] = null_w - Popen(*args, **kwargs) # pylint: disable=consider-using-with + Popen(*args, **kwargs) os._exit(0) # pylint: disable=protected-access return True @@ -224,7 +223,6 @@ class Rifle(object): # pylint: disable=too-many-instance-attributes """Replace the current configuration with the one in config_file""" if config_file is None: config_file = self.config_file - # pylint: disable=unspecified-encoding with open(config_file, "r") as fobj: self.rules = [] for line in fobj: diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py index 5619ed19..455bd175 100644 --- a/ranger/ext/vcs/vcs.py +++ b/ranger/ext/vcs/vcs.py @@ -88,7 +88,6 @@ class Vcs(object): # pylint: disable=too-many-instance-attributes if self.root: if self.is_root: self.rootvcs = self - # pylint: disable=invalid-class-object self.__class__ = globals()[self.REPOTYPES[self.repotype]['class'] + 'Root'] if not os.access(self.repodir, os.R_OK): @@ -102,7 +101,6 @@ class Vcs(object): # pylint: disable=too-many-instance-attributes if self.rootvcs is None or self.rootvcs.root is None: return self.rootvcs.links |= self.links - # pylint: disable=invalid-class-object self.__class__ = globals()[self.REPOTYPES[self.repotype]['class']] self.track = self.rootvcs.track diff --git a/tests/manpage_completion_test.py b/tests/manpage_completion_test.py index 1a01f944..3b067b46 100755 --- a/tests/manpage_completion_test.py +++ b/tests/manpage_completion_test.py @@ -26,7 +26,6 @@ def get_path_of_man_page(): def read_manpage(): path = get_path_of_man_page() - # pylint: disable=unspecified-encoding with open(path, 'r') as man_page: return man_page.read() |