bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def quick_open(self): from os.path import isdir, join, normpath line = parse(self.line) pwd = self.fm.env.pwd.path
def quick_open(self): from os.path import isdir, join, normpath line = parse(self.line) pwd = self.fm.env.pwd.path
455,700
def shrink_from_the_left(self, wid): fixedsize = self.fixedsize() if wid < fixedsize: raise ValueError("Cannot shrink down to that size by cutting") leftsize = self.left.sumsize() rightsize = self.right.sumsize() oversize = leftsize + rightsize - wid if oversize <= 0: return self.fill_gap(' ', wid, gapwidth=False) nonf...
def shrink_from_the_left(self, wid): fixedsize = self.fixedsize() if wid < fixedsize: raise ValueError("Cannot shrink down to that size by cutting") leftsize = self.left.sumsize() rightsize = self.right.sumsize() oversize = leftsize + rightsize - wid - 1 if oversize <= 0: return self.fill_gap(' ', wid, gapwidth=False) ...
455,701
def _search(self): self.count = 0 line = parse(self.line) cwd = self.fm.env.cwd try: arg = line.rest(1) except IndexError: return False
def _search(self): self.count = 0 line = parse(self.line) cwd = self.fm.env.cwd try: arg = line.rest(1) except IndexError: return False
455,702
def display_help(self, topic='index', narg=None): if not hasattr(self.ui, 'open_pager'): return
def display_help(self, topic='index', narg=None): if not hasattr(self.ui, 'open_pager'): return
455,703
def get_command(self, name, abbrev=True): if abbrev: lst = [cls for cmd, cls in self.commands.items() \ if cmd.startswith(name) \ and cls.allow_abbrev \ or cmd == name] if len(lst) == 0: raise KeyError if len(lst) == 1 or self.commands[name] in lst: return lst[0] raise ValueError("Ambiguous command") else: try: return ...
def get_command(self, name, abbrev=True): if abbrev: lst = [cls for cmd, cls in self.commands.items() \ if cls.allow_abbrev and cmd.startswith(name) \ or cmd == name] if len(lst) == 0: raise KeyError if len(lst) == 1 or self.commands[name] in lst: return lst[0] raise ValueError("Ambiguous command") else: try: return se...
455,704
def get_command(self, name, abbrev=True): if abbrev: lst = [cls for cmd, cls in self.commands.items() \ if cmd.startswith(name) \ and cls.allow_abbrev \ or cmd == name] if len(lst) == 0: raise KeyError if len(lst) == 1 or self.commands[name] in lst: return lst[0] raise ValueError("Ambiguous command") else: try: return ...
def get_command(self, name, abbrev=True): if abbrev: lst = [cls for cmd, cls in self.commands.items() \ if cmd.startswith(name) \ and cls.allow_abbrev \ or cmd == name] if len(lst) == 0: raise KeyError if len(lst) == 1: return lst[0] raise ValueError("Ambiguous command") else: try: return self.commands[name] except Key...
455,705
def poke(self): DisplayableContainer.poke(self)
def poke(self): DisplayableContainer.poke(self)
455,706
def load_bit_by_bit(self): """ Returns a generator which load a part of the directory in each iteration. """
def load_bit_by_bit(self): """ Returns a generator which load a part of the directory in each iteration. """
455,707
def load_content_if_outdated(self, *a, **k): """ Load the contents of the directory if it's outdated or not done yet """
def load_content_if_outdated(self, *a, **k): """ Load the contents of the directory if it's outdated or not done yet """
455,708
def app_feh(self, c): arg = {1: '--bg-scale', 2: '--bg-tile', 3: '--bg-center'}
def app_feh(self, c): arg = {1: '--bg-scale', 2: '--bg-tile', 3: '--bg-center'}
455,709
def draw(self): """Draw the statusbar"""
def draw(self): """Draw the statusbar"""
455,710
def execute(self): line = parse(self.line) try: destination = line.rest(1) except IndexError: destination = '~'
def execute(self): line = parse(self.line) destination = line.rest(1) if not destination: destination = '~'
455,711
def basename_natural(self): return [int(c) if c.isdigit() else c \ for c in _extract_number_re.split(self.basename)]
def basename_natural(self): return [int(c) if c.isdigit() else c or 0 \ for c in _extract_number_re.split(self.basename)]
455,712
def basename_natural_lower(self): return [int(c) if c.isdigit() else c \ for c in _extract_number_re.split(self.basename_lower)]
def basename_natural_lower(self): return [int(c) if c.isdigit() else c or 0 \ for c in _extract_number_re.split(self.basename_lower)]
455,713
def move(src, dst, overwrite=False): """Recursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already e...
def move(src, dst, overwrite=False): """Recursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already e...
455,714
def move(src, dst, overwrite=False): """Recursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already e...
def move(src, dst, overwrite=False): """Recursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already e...
455,715
def move(arg): arg.wdg.move(narg=arg.n, **arg.direction)
def move(arg): arg.wdg.move(narg=arg.n, **arg.direction)
455,716
def move(self, narg=None, **kw): direction = Direction(kw) if direction.horizontal(): self.startx = direction.move( direction=direction.right(), override=narg, maximum=self._get_max_width(), current=self.startx, pagesize=self.wid, offset=-self.wid) if direction.vertical(): if self.source_is_stream: self._get_line(self....
def move(self, narg=None, **kw): direction = Direction(kw) if direction.horizontal(): self.startx = direction.move( direction=direction.right(), override=narg, maximum=self._get_max_width(), current=self.startx, pagesize=self.wid, offset=-self.wid + 1) if direction.vertical(): if self.source_is_stream: self._get_line(s...
455,717
def move(self, narg=None, **kw): direction = Direction(kw) if direction.horizontal(): self.startx = direction.move( direction=direction.right(), override=narg, maximum=self._get_max_width(), current=self.startx, pagesize=self.wid, offset=-self.wid) if direction.vertical(): if self.source_is_stream: self._get_line(self....
def move(self, narg=None, **kw): direction = Direction(kw) if direction.horizontal(): self.startx = direction.move( direction=direction.right(), override=narg, maximum=self._get_max_width(), current=self.startx, pagesize=self.wid, offset=-self.wid) if direction.vertical(): if self.source_is_stream: self._get_line(self....
455,718
def _get_line(self, n, attempt_to_read=True): try: return self.lines[n] except (KeyError, IndexError): if attempt_to_read and self.source_is_stream: for l in self.source: self.lines.append(l) if len(self.lines) > n: break return self._get_line(n, attempt_to_read=False) return ""
def _get_line(self, n, attempt_to_read=True): try: return self.lines[n] except (KeyError, IndexError): if attempt_to_read and self.source_is_stream: try: for l in self.source: self.lines.append(l) if len(self.lines) > n: break except UnicodeError: pass return self._get_line(n, attempt_to_read=False) return ""
455,719
def app_zsnes(self, c): return tup("zsnes", c.file)
def app_zsnes(self, c): return tup("zsnes", c.file.path)
455,720
def app_wine(self, c): return tup("wine", c.file)
def app_wine(self, c): return tup("wine", c.file)
455,721
def all(self): """Returns a list with all application functions""" methods = self.__class__.__dict__ return [meth[4:] for meth in methods if meth.startswith('app_')]
def all(self): """Returns a list with all application functions""" methods = self.__class__.__dict__ return [meth[4:] for meth in methods if meth.startswith('app_')]
455,722
def edit_name(arg): cf = arg.fm.env.cf if cf: arg.fm.open_console(cmode.COMMAND, 'rename ' + cf.basename)
def edit_name(arg): cf = arg.fm.env.cf if cf: arg.fm.open_console(cmode.COMMAND, 'rename ' + cf.basename)
455,723
def main(): """initialize objects and run the filemanager""" try: import curses except ImportError as errormessage: print(errormessage) print('ranger requires the python curses module. Aborting.') sys.exit(1) # Ensure that a utf8 locale is set. if getdefaultlocale()[1] not in ('utf8', 'UTF-8'): for locale in ('en_US.u...
def main(): """initialize objects and run the filemanager""" try: import curses except ImportError as errormessage: print(errormessage) print('ranger requires the python curses module. Aborting.') sys.exit(1) # Ensure that a utf8 locale is set. if getdefaultlocale()[1] not in ('utf8', 'UTF-8'): for locale in ('en_US.u...
455,724
def delete(self): self.notify("Deleting!", duration=1) selected = self.env.get_selection() self.env.copy -= selected if selected: for f in selected: if os.path.isdir(f.path): try: shutil.rmtree(f.path) except OSError as err: self.notify(str(err), bad=True) else: try: os.remove(f.path) except OSError as err: self.notify...
def delete(self): self.notify("Deleting!", duration=1) selected = self.env.get_selection() self.env.copy -= selected if selected: for f in selected: if os.path.isdir(f.path) and not os.path.islink(f.path): try: shutil.rmtree(f.path) except OSError as err: self.notify(str(err), bad=True) else: try: os.remove(f.path) exc...
455,725
def _get_tab(self): try: position_of_last_space = self.line.rindex(" ") except ValueError: return (program + ' ' for program in self.fm.executables \ if program.startswith(self.line)) if position_of_last_space == len(self.line) - 1: return self.line + '%s ' else: before_word, start_of_word = self.line.rsplit(' ', 1) re...
def _get_tab(self): try: i = self.line.index('!')+1 except ValueError: return (program + ' ' for program in self.fm.executables \ if program.startswith(self.line)) if position_of_last_space == len(self.line) - 1: return self.line + '%s ' else: before_word, start_of_word = self.line.rsplit(' ', 1) return (before_word + ...
455,726
def _get_tab(self): try: position_of_last_space = self.line.rindex(" ") except ValueError: return (program + ' ' for program in self.fm.executables \ if program.startswith(self.line)) if position_of_last_space == len(self.line) - 1: return self.line + '%s ' else: before_word, start_of_word = self.line.rsplit(' ', 1) re...
def _get_tab(self): try: position_of_last_space = self.line.rindex(" ") except ValueError: line = self.line start = '' else: line = self.line[i:] start = self.line[:i] try: position_of_last_space = line.rindex(" ") except ValueError: return (start + program + ' ' for program in self.fm.executables \ if program.startsw...
455,727
def ctrl_c(arg): try: item = arg.fm.loader.queue[0] except: arg.fm.notify("Type Q or :quit<Enter> to exit Ranger") else: arg.fm.notify("Aborting: " + item.get_description()) arg.fm.loader.remove(index=0)
def ctrl_c(arg): try: item = arg.fm.loader.queue[0] except: arg.fm.notify("Type Q or :quit<Enter> to exit Ranger") else: arg.fm.notify("Aborting: " + item.get_description()) arg.fm.loader.remove(index=0)
455,728
def test_move(self): d = Direction(pages=True) self.assertEqual(3, d.move(direction=3)) self.assertEqual(5, d.move(direction=3, current=2)) self.assertEqual(15, d.move(direction=3, pagesize=5)) self.assertEqual(10, d.move(direction=3, pagesize=5, maximum=10)) self.assertEqual(18, d.move(direction=9, override=2)) d2 = D...
def test_move(self): d = Direction(pages=True) self.assertEqual(3, d.move(direction=3)) self.assertEqual(5, d.move(direction=3, current=2)) self.assertEqual(15, d.move(direction=3, pagesize=5)) self.assertEqual(9, d.move(direction=3, pagesize=5, maximum=10)) self.assertEqual(18, d.move(direction=9, override=2)) d2 = Di...
455,729
def app_default(self, c): """How to determine the default application?""" f = c.file
def app_default(self, c): """How to determine the default application?""" f = c.file
455,730
def accept_file(fname, hidden_filter, name_filter): if hidden_filter: try: if hidden_filter.search(fname): return False except: if hidden_filter in fname: return False if name_filter and name_filter not in fname: return False return True
def accept_file(fname, hidden_filter, name_filter): if hidden_filter: try: if hidden_filter.search(fname): return False except: if hidden_filter in fname: return False if name_filter and name_filter not in fname: return False return True
455,731
def _get_right_part(self, bar): right = bar.right if self.column is None: return
def _get_right_part(self, bar): right = bar.right if self.column is None: return
455,732
def addstr(self, *args): try: self.win.addstr(*args) except (_curses.error, TypeError): pass except UnicodeEncodeError: try: self.win.addstr(*(obj.encode('utf8') for obj in args)) except UnicodeEncodeError: try: self.win.addstr(*(ascii_only(obj) for obj in args)) except (_curses.error, TypeError): pass
def _addxyz_wrapper(self, function, args): try: self.win.addstr(*args) except (_curses.error, TypeError): pass except UnicodeEncodeError: try: self.win.addstr(*(obj.encode('utf8') for obj in args)) except UnicodeEncodeError: try: self.win.addstr(*(ascii_only(obj) for obj in args)) except (_curses.error, TypeError): pas...
455,733
def addstr(self, *args): try: self.win.addstr(*args) except (_curses.error, TypeError): pass except UnicodeEncodeError: try: self.win.addstr(*(obj.encode('utf8') for obj in args)) except UnicodeEncodeError: try: self.win.addstr(*(ascii_only(obj) for obj in args)) except (_curses.error, TypeError): pass
def addstr(self, *args): try: function(*args) except (_curses.error, TypeError): pass except UnicodeEncodeError: try: self.win.addstr(*(obj.encode('utf8') for obj in args)) except UnicodeEncodeError: try: self.win.addstr(*(ascii_only(obj) for obj in args)) except (_curses.error, TypeError): pass
455,734
def addstr(self, *args): try: self.win.addstr(*args) except (_curses.error, TypeError): pass except UnicodeEncodeError: try: self.win.addstr(*(obj.encode('utf8') for obj in args)) except UnicodeEncodeError: try: self.win.addstr(*(ascii_only(obj) for obj in args)) except (_curses.error, TypeError): pass
def addstr(self, *args): try: self.win.addstr(*args) except (_curses.error, TypeError): pass except UnicodeEncodeError: try: self.win.addstr(*(obj.encode('utf8') for obj in args)) except UnicodeEncodeError: try: self.win.addstr(*(ascii_only(obj) for obj in args)) except (_curses.error, TypeError): pass
455,735
def addnstr(self, *args): try: self.win.addnstr(*args) except (_curses.error, TypeError): pass except UnicodeEncodeError: try: self.win.addnstr(*(ascii_only(obj) for obj in args)) except (_curses.error, TypeError): pass
def addnstr(self, *args): try: self.win.addnstr(*args) except (_curses.error, TypeError): pass except UnicodeEncodeError: try: self.win.addnstr(*(ascii_only(obj) for obj in args)) except (_curses.error, TypeError): pass
455,736
def addch(self, *args): try: self.win.addch(*args) except (_curses.error, TypeError): pass except UnicodeEncodeError: try: self.win.addch(*(ascii_only(obj) for obj in args)) except (_curses.error, TypeError): pass
def addch(self, *args): try: self.win.addch(*args) except (_curses.error, TypeError): pass except UnicodeEncodeError: try: self.win.addch(*(ascii_only(obj) for obj in args)) except (_curses.error, TypeError): pass
455,737
def _get_left_part(self, bar): import socket, os
def _get_left_part(self, bar): import socket, os
455,738
def _get_left_part(self, bar): import socket, os
def _get_left_part(self, bar): import socket, os
455,739
def parse_keybinding(obj): """ Translate a keybinding to a sequence of integers Example: lol<CR> => (108, 111, 108, 10) """ assert isinstance(obj, (tuple, int, str)) if isinstance(obj, tuple): for char in obj: yield char elif isinstance(obj, int): yield obj elif isinstance(obj, str): in_brackets = False bracket_co...
def parse_keybinding(obj): """ Translate a keybinding to a sequence of integers Example: lol<CR> => (108, 111, 108, 10) """ assert isinstance(obj, (tuple, int, str)) if isinstance(obj, tuple): for char in obj: yield char elif isinstance(obj, int): yield obj elif isinstance(obj, str): in_brackets = False bracket_co...
455,740
def shrink_by_cutting(self, wid): fixedsize = self.fixedsize() if wid < fixedsize: raise ValueError("Cannot shrink down to that size by cutting")
def shrink_by_cutting(self, wid): fixedsize = self.fixedsize() if wid < fixedsize: raise ValueError("Cannot shrink down to that size by cutting")
455,741
def execute(self): line = parse(self.line) name = line.chunk(1) try: value = eval(line.rest(2)) except: return self.fm.settings[name] = value
def execute(self): line = parse(self.line) name = line.chunk(1) try: value = eval(line.rest(2)) except: return self.fm.settings[name] = value
455,742
def execute(self): line = parse(self.line) lastword = line.chunk(-1)
def execute(self): line = parse(self.line) lastword = line.chunk(-1)
455,743
def on_after(signal): exit = signal.process.poll() content = signal.loader.stdout_buffer data['foundpreview'] = True if exit == 0: data[(width, height)] = content elif exit == 3: data[(-1, height)] = content elif exit == 4: data[(width, -1)] = content elif exit == 5: data[(-1, -1)] = content elif exit == 1: data[(-1, -...
def on_after(signal): exit = signal.process.poll() content = signal.loader.stdout_buffer data['foundpreview'] = True if exit == 0: data[(width, height)] = content elif exit == 3: data[(-1, height)] = content elif exit == 4: data[(width, -1)] = content elif exit == 5: data[(-1, -1)] = content elif exit == 1: data[(-1, -...
455,744
def move_parent(self, n): self.enter_dir('..') self.move(down=n) self.move(right=0)
def move_parent(self, n): self.enter_dir('..') self.move(down=n) self.move(right=0)
455,745
def move_parent(self, n): parent = self.env.at_level(-1) self.env.enter_dir(parent.files[parent.pointer+n])
def move_parent(self, n): parent = self.env.at_level(-1) self.env.enter_dir(parent.files[parent.pointer+n])
455,746
def delete(self, mod): self.tab_deque = None if mod == -1 and len(self.line) == 0: self.close() pos = self.pos + mod
def delete(self, mod): self.tab_deque = None if mod == -1 and len(self.line) == 0: self.close() pos = self.pos + mod
455,747
def move(arg): arg.wdg.move(narg=arg.n, **arg.direction)
def move(arg): arg.wdg.move(narg=arg.n, **arg.direction)
455,748
def __init__(self, win): Widget.__init__(self, win) self.clear() self.histories = [] # load histories from files if not ranger.arg.clean: self.historypaths = [relpath_conf(x) for x in \ ('history', 'history_search', 'history_qopen', 'history_open')] for i, path in enumerate(self.historypaths): hist = History(self.setti...
def __init__(self, win): Widget.__init__(self, win) self.clear() self.histories = [] # load histories from files if ranger.arg.clean: for i in range(4): self.histories.append( History(self.settings.max_console_history_size)) else: self.historypaths = [relpath_conf(x) for x in \ ('history', 'history_search', 'history_qo...
455,749
def notify(self, text, duration=4, bad=False): if isinstance(text, Exception): if ranger.debug: raise text text = str(text) bad = True self.log.appendleft(text) if hasattr(self.ui, 'notify'): self.ui.notify(text, duration=duration, bad=bad)
def notify(self, text, duration=4, bad=False): if isinstance(text, Exception): if ranger.debug: raise text = str(text) bad = True self.log.appendleft(text) if hasattr(self.ui, 'notify'): self.ui.notify(text, duration=duration, bad=bad)
455,750
def foo(xyz, narg): return hash((xyz, narg))
def foo(xyz, narg): return hash((xyz, narg))
455,751
def main(): """initialize objects and run the filemanager""" try: import curses except ImportError as errormessage: print(errormessage) print('ranger requires the python curses module. Aborting.') sys.exit(1) from signal import signal, SIGINT from locale import getdefaultlocale, setlocale, LC_ALL import ranger from r...
def main(): """initialize objects and run the filemanager""" try: import curses except ImportError as errormessage: print(errormessage) print('ranger requires the python curses module. Aborting.') sys.exit(1) from signal import signal, SIGINT from locale import getdefaultlocale, setlocale, LC_ALL import ranger from r...
455,752
def notify(self, text, duration=4, bad=False): if isinstance(text, Exception): if ranger.arg.debug: raise bad = True text = str(text) self.log.appendleft(text) if hasattr(self.ui, 'notify'): self.ui.notify(text, duration=duration, bad=bad)
def notify(self, text, duration=4, bad=False): if isinstance(text, Exception): if ranger.arg.debug: raise bad = True text = str(text) self.log.appendleft(text) if hasattr(self.ui, 'notify'): self.ui.notify(text, duration=duration, bad=bad)
455,753
def execute(self): if self.mode != cmode.COMMAND_QUICK: self._search()
def execute(self): if self.mode != cmode.COMMAND_QUICK: self._search()
455,754
def remove_child(self, obj): """Remove the object from the container.""" try: container.remove(obj) except ValueError: pass else: obj.parent = None
def remove_child(self, obj): """Remove the object from the container.""" try: self.container.remove(obj) except ValueError: pass else: obj.parent = None
455,755
def print_function(string): print(string)
def print_function(string): print(string)
455,756
def print_function(string): print(string)
def print_function(string): print(string)
455,757
def generator(): return zip(range(self.hei-1), sorted_bookmarks)
def generator(): return zip(range(self.hei-1), sorted_bookmarks)
455,758
def _tab_only_directories(self): from os.path import dirname, basename, expanduser, join, isdir
def _tab_only_directories(self): from os.path import dirname, basename, expanduser, join, isdir
455,759
def _tab_directory_content(self): from os.path import dirname, basename, expanduser, join, isdir
def _tab_directory_content(self): from os.path import dirname, basename, expanduser, join, isdir
455,760
def load(self): """Load the bookmarks from path/bookmarks""" try: new_dict = self._load_dict() except OSError: return
def load(self): """Load the bookmarks from path/bookmarks""" try: new_dict = self._load_dict() except OSError: return
455,761
def update(self): """Update the bookmarks from the bookmark file. Useful if two instances are running which define different bookmarks. """ try: real_dict = self._load_dict() except OSError: return
def update(self): """Update the bookmarks from the bookmark file. Useful if two instances are running which define different bookmarks. """ try: real_dict = self._load_dict() except OSError: return
455,762
def _set_dict(self, dct): self.dct.clear() self.dct.update(dct) self.original_dict = self.dct.copy() self._update_mtime()
def _set_dict(self, dct, original): if original is None: original = {} self.dct.clear() self.dct.update(dct) self.original_dict = self.dct.copy() self._update_mtime()
455,763
def _set_dict(self, dct): self.dct.clear() self.dct.update(dct) self.original_dict = self.dct.copy() self._update_mtime()
def _set_dict(self, dct): self.dct.clear() self.dct.update(dct) self.original_dict = original self._update_mtime()
455,764
def get_command(name, abbrev=True): if abbrev: lst = [cls for cmd, cls in by_name.items() \ if cmd.startswith(name) \ and cls.allow_abbrev \ or cmd == name] if len(lst) == 0: raise KeyError if len(lst) == 1: return lst[0] raise ValueError("Ambiguous command") else: try: return by_name[name] except KeyError: return None...
def get_command(name, abbrev=True): if abbrev: lst = [cls for cmd, cls in by_name.items() \ if cmd.startswith(name) \ and cls.allow_abbrev \ or cmd == name] if len(lst) == 0: raise KeyError if len(lst) == 1 or by_name[name] in lst: return lst[0] raise ValueError("Ambiguous command") else: try: return by_name[name] exce...
455,765
def app_default(self, c): """How to determine the default application?""" f = c.file
def app_default(self, c): """How to determine the default application?""" f = c.file
455,766
def app_default(self, c): """How to determine the default application?""" f = c.file
def app_default(self, c): """How to determine the default application?""" f = c.file
455,767
def app_default(self, c): """How to determine the default application?""" f = c.file
def app_default(self, c): """How to determine the default application?""" f = c.file
455,768
def app_default(self, c): """How to determine the default application?""" f = c.file
def app_default(self, c): """How to determine the default application?""" f = c.file
455,769
def app_default(self, c): """How to determine the default application?""" f = c.file
def app_default(self, c): """How to determine the default application?""" f = c.file
455,770
def app_default(self, c): """How to determine the default application?""" f = c.file
def app_default(self, c): """How to determine the default application?""" f = c.file
455,771
def app_default(self, c): """How to determine the default application?""" f = c.file
def app_default(self, c): """How to determine the default application?""" f = c.file
455,772
def app_default(self, c): """How to determine the default application?""" f = c.file
def app_default(self, c): """How to determine the default application?""" f = c.file
455,773
def app_feh(self, c): arg = {1: '--bg-scale', 2: '--bg-tile', 3: '--bg-center'}
def app_feh(self, c): arg = {1: '--bg-scale', 2: '--bg-tile', 3: '--bg-center'}
455,774
def load(self): """ reads useful information about the filesystem-object from the filesystem and caches it for later use """ import os import stat from ranger.ext.human_readable import human_readable
def load(self): """ reads useful information about the filesystem-object from the filesystem and caches it for later use """ import os import stat from ranger.ext.human_readable import human_readable
455,775
def move(src, dst, overwrite=False): """Recursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already e...
def move(src, dst, overwrite=False): """Recursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already e...
455,776
def move(src, dst, overwrite=False): """Recursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already e...
def move(src, dst, overwrite=False): """Recursively move a file or directory to another location. This is similar to the Unix "mv" command. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already e...
455,777
def shrink_by_cutting(self, wid): fixedsize = self.fixedsize() if wid < fixedsize: raise ValueError("Cannot shrink down to that size by cutting")
def shrink_by_cutting(self, wid): fixedsize = self.fixedsize() if wid < fixedsize: raise ValueError("Cannot shrink down to that size by cutting")
455,778
def initialize_commands(map): """Initialize the commands for the main user interface""" # -------------------------------------------------------- movement _vimlike_aliases(map) map.alias(KEY_LEFT, KEY_BACKSPACE, DEL) map(KEY_DOWN, fm.move_pointer(relative=1)) map(KEY_UP, fm.move_pointer(relative=-1)) map(KEY_RIGHT, ...
def initialize_commands(map): """Initialize the commands for the main user interface""" # -------------------------------------------------------- movement _vimlike_aliases(map) map.alias(KEY_LEFT, KEY_BACKSPACE, DEL) map(KEY_DOWN, fm.move_pointer(relative=1)) map(KEY_UP, fm.move_pointer(relative=-1)) map(KEY_RIGHT, ...
455,779
def load(self): """ reads useful information about the filesystem-object from the filesystem and caches it for later use """
def load(self): """ reads useful information about the filesystem-object from the filesystem and caches it for later use """
455,780
def draw(self): if self.mode is None: return
def draw(self): if self.mode is None: return
455,781
def draw(self): """Call either _draw_file() or _draw_directory()""" if self.target != self.old_dir: self.need_redraw = True self.old_dir = self.target
def draw(self): """Call either _draw_file() or _draw_directory()""" if self.target != self.old_dir: self.need_redraw = True self.old_dir = self.target
455,782
def initialize_commands(command_list): """Initialize the commands for the main user interface""" bind, hint, alias = make_abbreviations(command_list) # -------------------------------------------------------- movement _vimlike_aliases(command_list) command_list.alias(KEY_LEFT, KEY_BACKSPACE, DEL) bind(KEY_DOWN, fm.m...
def initialize_commands(command_list): """Initialize the commands for the main user interface""" bind, hint, alias = make_abbreviations(command_list) # -------------------------------------------------------- movement _vimlike_aliases(command_list) command_list.alias(KEY_LEFT, KEY_BACKSPACE, DEL) bind(KEY_DOWN, fm.m...
455,783
def get_action(self, apps=None): """Get the action from app_xyz""" if apps is None and self.fm: apps = self.fm.apps
def get_action(self, apps=None): """Get the action from app_xyz""" if apps is None and self.fm: apps = self.fm.apps
455,784
def getdown(arg): return arg.direction.down()
def getdown(arg): return arg.direction.down()
455,785
def getdown(arg): return arg.direction.down()
def getdown(arg): return arg.direction.down()
455,786
def getdown(arg): return arg.direction.down()
def getdown(arg): return arg.direction.down()
455,787
def getdown(arg): return arg.direction.down()
def getdown(arg): return arg.direction.down()
455,788
def getdown(arg): return arg.direction.down()
def getdown(arg): return arg.direction.down()
455,789
def move(self, narg=None, **kw): """ A universal movement method.
def move(self, narg=None, **kw): """ A universal movement method.
455,790
def move(self, narg=None, **kw): """ A universal movement method.
def move(self, narg=None, **kw): """ A universal movement method.
455,791
def load(self): """ reads useful information about the filesystem-object from the filesystem and caches it for later use """
def load(self): """ reads useful information about the filesystem-object from the filesystem and caches it for later use """
455,792
def test_boundaries(self): disp = self.disp hei, wid = self.env.termsize
def test_boundaries(self): disp = self.disp hei, wid = self.env.termsize
455,793
def in_box(y, x): return (x >= box[1] and x < box[1] + box[3]) and \ (y >= box[0] and y < box[0] + box[2])
def in_box(y, x): return (x >= box[1] and x < box[1] + box[3]) and \ (y >= box[0] and y < box[0] + box[2])
455,794
def key_append(self, key): """Append a key to the keybuffer""" from ranger import log self.keybuffer.append(key)
def key_append(self, key): """Append a key to the keybuffer""" if key == curses.KEY_RESIZE: self.keybuffer.clear() self.keybuffer.append(key)
455,795
def test_move(self): d = Direction(pages=True) self.assertEqual(3, d.move(direction=3)) self.assertEqual(5, d.move(direction=3, current=2)) self.assertEqual(15, d.move(direction=3, pagesize=5)) self.assertEqual(10, d.move(direction=3, pagesize=5, maximum=10)) self.assertEqual(18, d.move(direction=9, override=2)) d2 = D...
def test_move(self): d = Direction(pages=True) self.assertEqual(3, d.move(direction=3)) self.assertEqual(5, d.move(direction=3, current=2)) self.assertEqual(15, d.move(direction=3, pagesize=5)) self.assertEqual(9, d.move(direction=3, pagesize=5, maximum=10)) self.assertEqual(18, d.move(direction=9, override=2)) d2 = Di...
455,796
def load_bit_by_bit(self): """ Returns a generator which load a part of the directory in each iteration. """
def load_bit_by_bit(self): """ Returns a generator which load a part of the directory in each iteration. """
455,797
def execute(self): num = self.line.split()[1] self.fm.tab_open(int(num))
def execute(self): num = self.line.split()[1] self.fm.tab_open(int(num))
455,798
def execute(self): if len(self.fm.tabs) <= 1: self.fm.exit() self.fm.tab_close()
def execute(self): if len(self.fm.tabs) <= 1: self.fm.exit() self.fm.tab_close()
455,799