summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorToon Nolten <toon.nolten@student.kuleuven.be>2017-05-28 14:49:19 +0200
committerToon Nolten <toon.nolten@student.kuleuven.be>2017-05-28 14:49:19 +0200
commit743922694120cb296e3e82a1da66baa0560b5e33 (patch)
tree2567264d5672cd4921ffdc89ff33a01aa191eb41
parentbe19d0d41d6a1e3bc8c69d67cdeee8485b04251e (diff)
downloadranger-743922694120cb296e3e82a1da66baa0560b5e33.tar.gz
Resolve pylint issues
-rwxr-xr-xranger/config/commands.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 33f10b56..314d31c2 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -91,7 +91,6 @@ import re
 import subprocess
 
 from ranger.api.commands import Command
-from ranger.ext.get_executables import get_executables
 
 
 class alias(Command):
@@ -1689,36 +1688,37 @@ class yank(Command):
     }
 
     def execute(self):
-        clipboard_commands = self.clipboards()
+        def clipboards():
+            from ranger.ext.get_executables import get_executables
+            clipboard_managers = {
+                'xclip': [
+                    ['xclip'],
+                    ['xclip', '-selection', 'clipboard'],
+                ],
+                'xsel': [
+                    ['xsel'],
+                    ['xsel', '-b'],
+                ],
+                'pbcopy': [
+                    ['pbcopy'],
+                ],
+            }
+            ordered_managers = ['pbcopy', 'xclip', 'xsel']
+            executables = get_executables()
+            for manager in ordered_managers:
+                if manager in executables:
+                    return clipboard_managers[manager]
+
+            return []
+
+        clipboard_commands = clipboards()
 
         selection = self.get_selection_attr(self.modes[self.arg(1)])
-        input = "\n".join(selection)
+        input_argument = "\n".join(selection)
         for command in clipboard_commands:
-            p = subprocess.Popen(command, universal_newlines=True,
-                                 stdin=subprocess.PIPE)
-            p.communicate(input=input)
-
-    def clipboards(self):
-        clipboard_managers = {
-            'xclip': [
-                ['xclip'],
-                ['xclip', '-selection', 'clipboard'],
-            ],
-            'xsel': [
-                ['xsel'],
-                ['xsel', '-b'],
-            ],
-            'pbcopy': [
-                ['pbcopy'],
-            ],
-        }
-        ordered_managers = ['pbcopy', 'xclip', 'xsel']
-        executables = get_executables()
-        for manager in ordered_managers:
-            if manager in executables:
-                return clipboard_managers[manager]
-        else:
-            return []
+            process = subprocess.Popen(command, universal_newlines=True,
+                                       stdin=subprocess.PIPE)
+            process.communicate(input=input_argument)
 
     def get_selection_attr(self, attr):
         return [getattr(file, attr) for file in