diff options
-rw-r--r-- | examples/plugin_ipc.py | 1 | ||||
-rw-r--r-- | examples/plugin_linemode.py | 1 | ||||
-rw-r--r-- | ranger/api/commands.py | 2 | ||||
-rw-r--r-- | ranger/colorschemes/jungle.py | 1 | ||||
-rwxr-xr-x | ranger/config/commands.py | 6 | ||||
-rw-r--r-- | ranger/core/actions.py | 5 | ||||
-rw-r--r-- | ranger/core/fm.py | 1 | ||||
-rw-r--r-- | ranger/core/loader.py | 3 | ||||
-rw-r--r-- | ranger/core/main.py | 1 | ||||
-rw-r--r-- | ranger/ext/cached_function.py | 1 | ||||
-rw-r--r-- | ranger/ext/signals.py | 2 | ||||
-rw-r--r-- | ranger/gui/widgets/pager.py | 1 | ||||
-rw-r--r-- | tests/ranger/container/test_bookmarks.py | 2 |
13 files changed, 27 insertions, 0 deletions
diff --git a/examples/plugin_ipc.py b/examples/plugin_ipc.py index cda10c59..47fb1c84 100644 --- a/examples/plugin_ipc.py +++ b/examples/plugin_ipc.py @@ -24,6 +24,7 @@ def hook_init(fm): import thread except ImportError: import _thread as thread + def ipc_reader(filepath): while True: with open(filepath, 'r') as fifo: diff --git a/examples/plugin_linemode.py b/examples/plugin_linemode.py index c05ff567..851d6213 100644 --- a/examples/plugin_linemode.py +++ b/examples/plugin_linemode.py @@ -13,5 +13,6 @@ from ranger.core.linemode import LinemodeBase @ranger.api.register_linemode class MyLinemode(LinemodeBase): name = "rot13" + def filetitle(self, file, metadata): return codecs.encode(file.relative_path, "rot_13") diff --git a/ranger/api/commands.py b/ranger/api/commands.py index 6ab2c135..f42fe9f7 100644 --- a/ranger/api/commands.py +++ b/ranger/api/commands.py @@ -378,6 +378,7 @@ class FunctionCommand(Command): _based_function = None _object_name = "" _function_name = "unknown" + def execute(self): if not self._based_function: return @@ -433,6 +434,7 @@ class AliasCommand(Command): _object_name = "" _function_name = "unknown" _line = "" + def execute(self): return self._make_cmd().execute() diff --git a/ranger/colorschemes/jungle.py b/ranger/colorschemes/jungle.py index d87706e8..fbcfab7d 100644 --- a/ranger/colorschemes/jungle.py +++ b/ranger/colorschemes/jungle.py @@ -7,6 +7,7 @@ from ranger.colorschemes.default import Default class Scheme(Default): progress_bar_color = green + def use(self, context): fg, bg, attr = Default.use(self, context) diff --git a/ranger/config/commands.py b/ranger/config/commands.py index ef415d44..cb4fd3a8 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -342,6 +342,7 @@ class set_(Command): Use `:set <option>!` to toggle or cycle it, e.g. `:set flush_input!` """ name = 'set' # don't override the builtin set class + def execute(self): name = self.arg(1) name, value, _, toggle = self.parse_setting_line_v2() @@ -382,6 +383,7 @@ class setlocal(set_): Gives an option a new value. """ PATH_RE = re.compile(r'^\s*path="?(.*?)"?\s*$') + def execute(self): import os.path match = self.PATH_RE.match(self.arg(1)) @@ -607,6 +609,7 @@ class load_copy_buffer(Command): Load the copy buffer from confdir/copy_buffer """ copy_buffer_filename = 'copy_buffer' + def execute(self): from ranger.container.file import File from os.path import exists @@ -628,6 +631,7 @@ class save_copy_buffer(Command): Save the copy buffer to confdir/copy_buffer """ copy_buffer_filename = 'copy_buffer' + def execute(self): fname = None try: @@ -969,6 +973,7 @@ class help_(Command): Display ranger's manual page. """ name = 'help' + def execute(self): def callback(answer): if answer == "q": @@ -1409,6 +1414,7 @@ class prompt_metadata(Command): _command_name = "meta" _console_chain = None + def execute(self): prompt_metadata._console_chain = self.args[1:] self._process_command_stack() diff --git a/ranger/core/actions.py b/ranger/core/actions.py index c75a652d..4bfc99c1 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -969,6 +969,7 @@ class Actions(FileManagerAware, SettingsAware): path, str(width), str(height), cacheimg, str(self.settings.preview_images)], read=True, silent=True, descr="Getting preview of %s" % path) + def on_after(signal): exit = signal.process.poll() content = signal.loader.stdout_buffer @@ -1014,6 +1015,7 @@ class Actions(FileManagerAware, SettingsAware): else: pager.set_source(self.thisfile.get_preview_source( pager.wid, pager.hei)) + def on_destroy(signal): try: del self.previews[path] @@ -1166,6 +1168,7 @@ class Actions(FileManagerAware, SettingsAware): contexts = 'browser', 'console', 'pager', 'taskview' temporary_file = tempfile.NamedTemporaryFile() + def write(string): temporary_file.write(string.encode('utf-8')) @@ -1191,6 +1194,7 @@ class Actions(FileManagerAware, SettingsAware): def dump_commands(self): temporary_file = tempfile.NamedTemporaryFile() + def write(string): temporary_file.write(string.encode('utf-8')) @@ -1216,6 +1220,7 @@ class Actions(FileManagerAware, SettingsAware): def dump_settings(self): temporary_file = tempfile.NamedTemporaryFile() + def write(string): temporary_file.write(string.encode('utf-8')) diff --git a/ranger/core/fm.py b/ranger/core/fm.py index b27a0fa2..d4a24bb0 100644 --- a/ranger/core/fm.py +++ b/ranger/core/fm.py @@ -236,6 +236,7 @@ class FM(Actions, SignalDispatcher): return import shutil from errno import EEXIST + def copy(_from, to): if os.path.exists(self.confpath(to)): sys.stderr.write("already exists: %s\n" % self.confpath(to)) diff --git a/ranger/core/loader.py b/ranger/core/loader.py index 7ecfed7b..aebd6efe 100644 --- a/ranger/core/loader.py +++ b/ranger/core/loader.py @@ -21,6 +21,7 @@ except: class Loadable(object): paused = False progressbar_supported = False + def __init__(self, gen, descr): self.load_generator = gen self.description = descr @@ -44,6 +45,7 @@ class Loadable(object): class CopyLoader(Loadable, FileManagerAware): progressbar_supported = True + def __init__(self, copy_buffer, do_cut=False, overwrite=False): self.copy_buffer = tuple(copy_buffer) self.do_cut = do_cut @@ -138,6 +140,7 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware): """ finished = False process = None + def __init__(self, args, descr, silent=False, read=False, input=None, kill_on_pause=False, popenArgs=None): SignalDispatcher.__init__(self) diff --git a/ranger/core/main.py b/ranger/core/main.py index 924b3aa3..fed4a231 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -73,6 +73,7 @@ def main(): sys.stderr.write("Warning: Using ranger as a file launcher is " "deprecated.\nPlease use the standalone file launcher " "'rifle' instead.\n") + def print_function(string): print(string) from ranger.ext.rifle import Rifle diff --git a/ranger/ext/cached_function.py b/ranger/ext/cached_function.py index d2c695f9..3e500f15 100644 --- a/ranger/ext/cached_function.py +++ b/ranger/ext/cached_function.py @@ -4,6 +4,7 @@ def cached_function(fnc): cache = {} + def inner_cached_function(*args): try: return cache[args] diff --git a/ranger/ext/signals.py b/ranger/ext/signals.py index 3e536fc6..1e907b70 100644 --- a/ranger/ext/signals.py +++ b/ranger/ext/signals.py @@ -72,6 +72,7 @@ class Signal(dict): To delete a signal handler from inside a signal, raise a ReferenceError. """ stopped = False + def __init__(self, **keywords): dict.__init__(self, keywords) self.__dict__ = self @@ -91,6 +92,7 @@ class SignalHandler: "active" to False. """ active = True + def __init__(self, signal_name, function, priority, pass_signal): self._priority = max(0, min(1, priority)) self._signal_name = signal_name diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py index 8deb7cd0..e950ebf9 100644 --- a/ranger/gui/widgets/pager.py +++ b/ranger/gui/widgets/pager.py @@ -22,6 +22,7 @@ class Pager(Widget): need_clear_image = False need_redraw_image = False max_width = None + def __init__(self, win, embedded=False): Widget.__init__(self, win) self.embedded = embedded diff --git a/tests/ranger/container/test_bookmarks.py b/tests/ranger/container/test_bookmarks.py index 88791953..cfaf3ba1 100644 --- a/tests/ranger/container/test_bookmarks.py +++ b/tests/ranger/container/test_bookmarks.py @@ -37,8 +37,10 @@ def testbookmarks(tmpdir): # We don't uneccesary update when the file on disk does not change origupdate = secondstore.update + class OutOfDateException(Exception): pass + def crash(): raise OutOfDateException("Don't access me") secondstore.update = crash |