bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
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,800
def move(self, direction, override=None, minimum=0, maximum=9999, current=0, pagesize=1, offset=0): """ Calculates the new position in a given boundary.
def move(self, direction, override=None, minimum=0, maximum=9999, current=0, pagesize=1, offset=0): """ Calculates the new position in a given boundary.
455,801
def chunk(self, n, otherwise=''): """Chunks are pieces of the command seperated by spaces""" if self._chunks is None: self._chunks = line.split()
def chunk(self, n, otherwise=''): """Chunks are pieces of the command seperated by spaces""" if self._chunks is None: self._chunks = line.split()
455,802
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,803
def basename_natural(self): return [int(c) if c.isdigit() else c or 0 \ 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,804
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)]
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,805
def allow(name): for re in args: if re.search(name): return True else: return False
def allow(name): for re in args: if re.search(name): return True else: return False
455,806
def app_pager(self, c): return tup('less', *c)
def app_pager(self, c): return tup('less', *c)
455,807
def is_scheme(x): return isclass(x) and issubclass(x, ColorScheme)
def is_scheme(x): return isclass(x) and issubclass(x, ColorScheme)
455,808
def is_scheme(x): return isclass(x) and issubclass(x, ColorScheme)
def is_scheme(x): return isclass(x) and issubclass(x, ColorScheme)
455,809
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,810
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,811
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,812
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,813
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,814
def filepaths(self): if hasattr(self, files): return [f.path for f in self.files] return []
def filepaths(self): try: return [f.path for f in self.files] return []
455,815
def filepaths(self): if hasattr(self, files): return [f.path for f in self.files] return []
def filepaths(self): if hasattr(self, files): return [f.path for f in self.files] return []
455,816
def __iter__(self): """Iterate over file paths""" return iter(self.filepaths)
def __iter__(self): """Iterate over file paths""" return iter(self.filepaths)
455,817
def __call__(self, action=None, try_app_first=False, app='default', files=None, mode=0, flags='', wait=True, **popen_kws): """ Run the application in the way specified by the options.
def __call__(self, action=None, try_app_first=False, app='default', files=None, mode=0, flags='', wait=True, **popen_kws): """ Run the application in the way specified by the options.
455,818
def click(self, event): n = event.ctrl() and 5 or 1 direction = event.mouse_wheel_direction() if direction: self.main_column.scroll(direction) else: DisplayableContainer.click(self, event)
def click(self, event): n = event.ctrl() and 5 or 1 direction = event.mouse_wheel_direction() * n if direction: self.main_column.scroll(direction) else: DisplayableContainer.click(self, event)
455,819
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 setlocale, LC_ALL import ranger from ranger.ext import c...
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 setlocale, LC_ALL import ranger from ranger.ext import c...
455,820
def __setattr__(self, name, value): if name[0] == '_': self.__dict__[name] = value else: assert name in self._settings, "No such setting: {0}!".format(name) assert self._check_type(name, value) kws = dict(setting=name, value=value, previous=self._settings[name]) self.signal_bind('setopt.'+name, self._raw_set_with_signa...
def __setattr__(self, name, value): if name[0] == '_': self.__dict__[name] = value else: assert name in self._settings, "No such setting: {0}!".format(name) assert self._check_type(name, value) kws = dict(setting=name, value=value, previous=self._settings[name]) self.signal_emit('setopt', **kws) self.signal_emit('setop...
455,821
def move(self, relative=0, absolute=None, pages=False): i = self.scroll_begin if isinstance(absolute, int): i = absolute
def move(self, relative=0, absolute=None, pages=False): i = self.scroll_begin if isinstance(absolute, int): i = absolute
455,822
def move(self, relative=0, absolute=None, pages=False): i = self.scroll_begin if isinstance(absolute, int): i = absolute
def move(self, relative=0, absolute=None, pages=False): i = self.scroll_begin if isinstance(absolute, int): i = absolute
455,823
def resize(self, y, x, hei, wid): """Resize all the columns according to the given ratio""" DisplayableContainer.resize(self, y, x, hei, wid) borders = self.settings.draw_borders pad = 1 if borders else 0 left = pad
def resize(self, y, x, hei, wid): """Resize all the columns according to the given ratio""" DisplayableContainer.resize(self, y, x, hei, wid) borders = self.settings.draw_borders pad = 1 if borders else 0 left = pad
455,824
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
455,825
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
455,826
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
455,827
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
455,828
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
455,829
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
455,830
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
455,831
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
455,832
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
def draw(self): base_clr = deque() base_clr.append('in_taskview') lst = self.get_list()
455,833
def alias(**kw): for key, value in kw.items(): by_name[key] = value
def alias(**kw): for key, value in kw.items(): by_name[key] = value
455,834
def app_editor(self, c): try: default_editor = os.environ['EDITOR'] except KeyError: pass else: parts = default_editor.split() exe_name = os.path.basename(parts[0]) if exe_name in get_executables(): return tuple(parts) + tuple(c)
def app_editor(self, c): try: default_editor = os.environ['EDITOR'] except KeyError: pass else: parts = default_editor.split() exe_name = os.path.basename(parts[0]) if exe_name in get_executables(): return tuple(parts) + tuple(c)
455,835
def draw(self): """Erase the window, then draw all objects in the container""" self.win.touchwin() DisplayableContainer.draw(self) if self.settings.update_title: hostname = str(socket.gethostname()) try: cwd = self.fm.env.pwd.path except: cwd = ' - ranger' sys.stdout.write("\033]2;" + hostname + \ self.fm.env.pwd.path ...
def draw(self): """Erase the window, then draw all objects in the container""" self.win.touchwin() DisplayableContainer.draw(self) if self.settings.update_title: hostname = str(socket.gethostname()) try: cwd = self.fm.env.pwd.path except: cwd = ' - ranger' sys.stdout.write("\033]2;" + hostname + cwd + "\007") self.win....
455,836
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,837
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,838
def bar(self): result = [...] return result
def bar(self): result = [...] return result
455,839
def has_preview(self): if not self.fm.settings.preview_files: return False if self.is_socket or self.is_fifo or self.is_device: return False if not self.accessible: return False if self.image or self.container: return True if PREVIEW_WHITELIST.search(self.basename): return True if PREVIEW_BLACKLIST.search(self.basename...
def has_preview(self): if not self.fm.settings.preview_files: return False if self.is_socket or self.is_fifo or self.is_device: return False if not self.accessible: return False if self.image or self.container: return False if PREVIEW_WHITELIST.search(self.basename): return False if PREVIEW_BLACKLIST.search(self.basena...
455,840
def signal_emit(self, signal_name, **kw): assert isinstance(signal_name, str) try: handlers = self._signals[signal_name] except: return if not handlers: return
def signal_emit(self, signal_name, **kw): assert isinstance(signal_name, str) if signal_name not in self._signals: return True handlers = self._signals[signal_name] if not handlers: return
455,841
def signal_emit(self, signal_name, **kw): assert isinstance(signal_name, str) try: handlers = self._signals[signal_name] except: return if not handlers: return
def signal_emit(self, signal_name, **kw): assert isinstance(signal_name, str) try: handlers = self._signals[signal_name] except: return True if not handlers: return
455,842
def signal_emit(self, signal_name, **kw): assert isinstance(signal_name, str) try: handlers = self._signals[signal_name] except: return if not handlers: return
def signal_emit(self, signal_name, **kw): assert isinstance(signal_name, str) try: handlers = self._signals[signal_name] except: return False if not handlers: return
455,843
def has_preview(self): if self.fm.settings.preview_script: return True if not self.fm.settings.preview_files: return False if self.is_socket or self.is_fifo or self.is_device: return False if not self.accessible: return False if self.image or self.container: return False if PREVIEW_WHITELIST.search(self.basename): retu...
def has_preview(self): if not self.fm.settings.preview_files: return False if self.is_socket or self.is_fifo or self.is_device: return False if not self.accessible: return False if self.image or self.container: return False if PREVIEW_WHITELIST.search(self.basename): return True if PREVIEW_BLACKLIST.search(self.basenam...
455,844
def on_after(signal): self.notify("%s complete" % path) exit = signal.process.poll() content = signal.loader.stdout_buffer content += signal.process.stdout.read() 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[(...
def on_after(signal): exit = signal.process.poll() content = signal.loader.stdout_buffer content += signal.process.stdout.read() 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 else: data[(-1,...
455,845
def _collapse(self): # Should the last column be cut off? (Because there is no preview) result = self.settings.collapse_preview and self.preview and \ not self.columns[-1].has_preview() and self.stretch_ratios if result: return True if self.columns[-1].target: target = self.columns[-1].target try: result = not self.fm....
def _collapse(self): # Should the last column be cut off? (Because there is no preview) if not self.settings.collapse_preview or not self.preview \ or not self.stretch_ratios: return False result = not self.columns[-1].has_preview() target = self.columns[-1].target if not result and target and target.is_file: try: resu...
455,846
def _draw_borders(self): win = self.win self.color('in_browser', 'border')
def _draw_borders(self): win = self.win self.color('in_browser', 'border')
455,847
def resize(self, y, x, hei, wid): """Resize all the columns according to the given ratio""" DisplayableContainer.resize(self, y, x, hei, wid) borders = self.settings.draw_borders pad = 1 if borders else 0 left = pad
def resize(self, y, x, hei, wid): """Resize all the columns according to the given ratio""" DisplayableContainer.resize(self, y, x, hei, wid) borders = self.settings.draw_borders pad = 1 if borders else 0 left = pad
455,848
def generate(self): self.process = process = Popen(self.args, stdout=open(os.devnull, 'w'), stderr=PIPE) if self.begin_hook: self.begin_hook(process) while process.poll() is None: rd, _, __ = select.select( [process.stderr], [], [], 0.05) if rd: self.notify(process.stderr.readline(), bad=True) sleep(0.02) yield if self...
def generate(self): self.process = process = Popen(self.args, stdout=open(os.devnull, 'w'), stderr=PIPE) if self.begin_hook: self.begin_hook(process) while process.poll() is None: rd, _, __ = select.select( [process.stderr], [], [], 0.05) if rd: self.notify(process.stderr.readline(), bad=True) sleep(0.02) yield if self...
455,849
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] 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: return lst[0] raise ValueError("Ambiguous command") else: try: return by_name[name] except KeyError: return None...
455,850
def move(self, relative=0, absolute=None, pages=False): i = self.scroll_begin if isinstance(absolute, int): i = absolute
def move(self, relative=0, absolute=None, pages=False): i = self.scroll_begin if isinstance(absolute, int): i = absolute
455,851
def _do_eval_quantifier(self, key): if self.eval_command: tree = self.tree_pointer else: tree = self.dir_tree_pointer if chr(key) in digits and ANYKEY not in tree: attr = self.eval_command and 'quant' or 'direction_quant' if getattr(self, attr) is None: setattr(self, attr, 0) setattr(self, attr, getattr(self, attr) * 1...
def _do_eval_quantifier(self, key): if self.eval_command: tree = self.tree_pointer else: tree = self.dir_tree_pointer if key in digitlist and ANYKEY not in tree: attr = self.eval_command and 'quant' or 'direction_quant' if getattr(self, attr) is None: setattr(self, attr, 0) setattr(self, attr, getattr(self, attr) * 10 ...
455,852
def _do_eval_command(self, key): assert isinstance(self.tree_pointer, dict), self.tree_pointer try: self.tree_pointer = self.tree_pointer[key] except TypeError: self.failure = True return None except KeyError: try: chr(key) in digits or self.direction_keys._tree[key] self.tree_pointer = self.tree_pointer[DIRKEY] except...
def _do_eval_command(self, key): assert isinstance(self.tree_pointer, dict), self.tree_pointer try: self.tree_pointer = self.tree_pointer[key] except TypeError: self.failure = True return None except KeyError: try: key in digitlist or self.direction_keys._tree[key] self.tree_pointer = self.tree_pointer[DIRKEY] except K...
455,853
def run(self): """ Run the application in the way specified by the options.
def run(self): """ Run the application in the way specified by the options.
455,854
def __del__(self): log("freeing {0}".format(self)) for handler in self.handlers: self.settings.signal_unbind(handler)
def __del__(self): for handler in self.handlers: self.settings.signal_unbind(handler)
455,855
def request_reload(self):
defrequest_reload(self):
455,856
def parse_keybinding(obj): """ Translate a keybinding to a sequence of integers Example: lol<CR> => (ord('l'), ord('o'), ord('l'), ord('\n')) => (108, 111, 108, 10) x<A-Left> => (120, (27, curses.KEY_LEFT)) """ assert isinstance(obj, (tuple, int, str)) if isinstance(obj, tuple): for char in obj: yield char eli...
def parse_keybinding(obj): """ Translate a keybinding to a sequence of integers Example: lol<CR> => (ord('l'), ord('o'), ord('l'), ord('\n')) => (108, 111, 108, 10) x<A-Left> => (120, (27, curses.KEY_LEFT)) """ assert isinstance(obj, (tuple, int, str)) if isinstance(obj, tuple): for char in obj: yield char eli...
455,857
def app_editor(self, c): default_editor = os.environ['EDITOR'] parts = default_editor.split() exe_name = os.path.basename(parts[0])
def app_editor(self, c): default_editor = os.environ['EDITOR'] parts = default_editor.split() exe_name = os.path.basename(parts[0])
455,858
def app_editor(self, c): default_editor = os.environ['EDITOR'] parts = default_editor.split() exe_name = os.path.basename(parts[0])
def app_editor(self, c): default_editor = os.environ['EDITOR'] parts = default_editor.split() exe_name = os.path.basename(parts[0])
455,859
def click(self, event): """Handle a MouseEvent""" direction = event.mouse_wheel_direction() if direction: self.fm.tab_move(direction) self.need_redraw = True return True
def click(self, event): """Handle a MouseEvent""" direction = event.mouse_wheel_direction() if direction: self.fm.tab_move(direction) self.need_redraw = True return True
455,860
def open_console(self, mode=':', string='', prompt=None): """Open the console if the current UI supports that""" if hasattr(self.ui, 'open_console'): self.ui.open_console(mode, string, prompt=prompt)
def open_console(self, mode=cmode.COMMAND, string='', prompt=None): """Open the console if the current UI supports that""" if hasattr(self.ui, 'open_console'): self.ui.open_console(mode, string, prompt=prompt)
455,861
def move(arg): arg.wdg.move(narg=arg.n, **arg.direction)
def move(arg): arg.wdg.move(narg=arg.n, **arg.direction)
455,862
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,863
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,864
def draw(self): """Draw the statusbar"""
def draw(self): """Draw the statusbar"""
455,865
def refresh(_): cwd = self.env.get_directory(original_path) cwd.load_content()
def refresh(_): cwd = self.env.get_directory(original_path) cwd.load_content()
455,866
def refresh(_): cwd = self.env.get_directory(original_path) cwd.load_content()
def refresh(_): cwd = self.env.get_directory(original_path) cwd.load_content()
455,867
def refresh(_): cwd = self.env.get_directory(original_path) cwd.load_content()
def refresh(_): cwd = self.env.get_directory(original_path) cwd.load_content()
455,868
def notify(self, text, duration=4, bad=False): if isinstance(text, Exception): if ranger.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,869
def plotHistogram(coaddName, chiSqOrder): coadd = pyfits.open(coaddName) coaddData = coadd[0].data # undo normalization coaddData *= float(chiSqOrder) # get rid of nans and infs goodData = numpy.extract(numpy.isfinite(coaddData.flat), coaddData.flat) goodData = numpy.extract(goodData < 50, goodData) hist, binEdges = n...
def plotHistogram(coaddName, chiSqOrder): coadd = pyfits.open(coaddName) coaddData = coadd[0].data # undo normalization coaddData *= float(chiSqOrder) # get rid of nans and infs goodData = numpy.extract(numpy.isfinite(coaddData.flat), coaddData.flat) goodData = numpy.extract(goodData < 50, goodData) hist, binEdges = n...
455,870
def plotHistogram(coaddName, chiSqOrder): coadd = pyfits.open(coaddName) coaddData = coadd[0].data # undo normalization coaddData *= float(chiSqOrder) # get rid of nans and infs goodData = numpy.extract(numpy.isfinite(coaddData.flat), coaddData.flat) goodData = numpy.extract(goodData < 50, goodData) hist, binEdges = n...
def plotHistogram(coaddName, chiSqOrder): coadd = pyfits.open(coaddName) coaddData = coadd[0].data # undo normalization coaddData *= float(chiSqOrder) # get rid of nans and infs goodData = numpy.extract(numpy.isfinite(coaddData.flat), coaddData.flat) goodData = numpy.extract(goodData < 50, goodData) hist, binEdges = n...
455,871
def plotHistogram(coaddName, chiSqOrder): coadd = pyfits.open(coaddName) coaddData = coadd[0].data # undo normalization coaddData *= float(chiSqOrder) # get rid of nans and infs goodData = numpy.extract(numpy.isfinite(coaddData.flat), coaddData.flat) goodData = numpy.extract(goodData < 50, goodData) hist, binEdges = n...
def plotHistogram(coaddName, chiSqOrder): coadd = pyfits.open(coaddName) coaddData = coadd[0].data # undo normalization coaddData *= float(chiSqOrder) # get rid of nans and infs goodData = numpy.extract(numpy.isfinite(coaddData.flat), coaddData.flat) goodData = numpy.extract(goodData < 50, goodData) hist, binEdges = n...
455,872
def __init__( self, http_archive_filename, use_deterministic_script, real_dns_lookup, host='localhost', port=80): self.use_deterministic_script = use_deterministic_script self.archive_filename = http_archive_filename self.real_http_request = RealHttpRequest(real_dns_lookup)
def __init__( self, http_archive_filename, use_deterministic_script, real_dns_lookup, host='localhost', port=80): self.use_deterministic_script = use_deterministic_script self.archive_filename = http_archive_filename self.real_http_request = RealHttpRequest(real_dns_lookup)
455,873
def __init__(self, http_archive_filename, use_deterministic_script, host='localhost', port=80): self.use_deterministic_script = use_deterministic_script self.http_archive = httparchive.HttpArchive.Create(http_archive_filename) logging.info('Loaded %d responses from %s', len(self.http_archive), http_archive_filename) Ba...
def __init__(self, http_archive_filename, use_deterministic_script, host='localhost', port=80): self.use_deterministic_script = use_deterministic_script self.http_archive = httparchive.HttpArchive.Create(http_archive_filename) logging.info('Loaded %d responses from %s', len(self.http_archive), http_archive_filename) tr...
455,874
def do_set_search(self): query = models.TestSet.all(); query.order("-date")
def do_set_search(self): query = models.TestSet.all(); query.order("-date")
455,875
def set_traffic_shaping(self, up_bandwidth = '0', down_bandwidth = '0', delay_ms = '0', packet_loss_rate = '0'): """Start shaping traffic.
def set_traffic_shaping(self, up_bandwidth = '0', down_bandwidth = '0', delay_ms = '0', packet_loss_rate = '0'): """Start shaping traffic.
455,876
def __init__(self, host='127.0.0.1', port=53, platform_settings=platformsettings.get_platform_settings()): self.host = host self.platform_settings = platform_settings try: SocketServer.ThreadingUDPServer.__init__( self, (host, port), UdpDnsHandler) except socket.error, (error_number, msg): if error_number == errno.EACC...
def __init__(self, host='127.0.0.1', port=53, platform_settings=None): if not platformsettings: platformsettings.get_platform_settings() self.host = host self.platform_settings = platform_settings try: SocketServer.ThreadingUDPServer.__init__( self, (host, port), UdpDnsHandler) except socket.error, (error_number, msg):...
455,877
def __init__(self, host='127.0.0.1', port=53, platform_settings=platformsettings.get_platform_settings()): self.host = host self.platform_settings = platform_settings try: SocketServer.ThreadingUDPServer.__init__( self, (host, port), UdpDnsHandler) except socket.error, (error_number, msg): if error_number == errno.EACC...
def __init__(self, host='127.0.0.1', port=53, platform_settings=platformsettings.get_platform_settings()): self.host = host self.restore_primary_dns = platform_settings.restore_primary_dns try: SocketServer.ThreadingUDPServer.__init__( self, (host, port), UdpDnsHandler) except socket.error, (error_number, msg): if erro...
455,878
def send_archived_http_response(self, response): try: # We need to set the server name before we start the response. # Take a scan through the response headers here use_chunked = False has_content_length = False server_name = "WebPageReplay" for header, value in response.headers: if header == "server": server_name = va...
def send_archived_http_response(self, response): try: # We need to set the server name before we start the response. # Take a scan through the response headers here use_chunked = False has_content_length = False server_name = "WebPageReplay" for header, value in response.headers: if header == "server": server_name = va...
455,879
def set_traffic_shaping(self, up_bandwidth = '0', down_bandwidth = '0', delay_ms = '0', packet_loss_rate = '0'): """Start shaping traffic.
def set_traffic_shaping(self, up_bandwidth = '0', down_bandwidth = '0', delay_ms = '0', packet_loss_rate = '0'): """Start shaping traffic.
455,880
def main(options, replay_file): # Verify correct flags are passed in. if options.spdy and options.record: logging.critical('--spdy and --record can\'t be used together.') return platform_settings = platformsettings.get_platform_settings() try: dns_server = dnsproxy.DnsProxyServer( is_private_passthrough=options.dns_pr...
def main(options, replay_file): # Verify correct flags are passed in. if options.spdy and options.record: logging.critical('--spdy and --record can\'t be used together.') return platform_settings = platformsettings.get_platform_settings() try: dns_server = dnsproxy.DnsProxyServer( is_private_passthrough=options.dns_pr...
455,881
def format_description(self, description): if description: return description + '\n' else: return ''
def format_description(self, description): if description: return description + '\n' else: return ''
455,882
def format_description(self, description): if description: return description + '\n' else: return ''
defformat_description(self,description):ifdescription:returndescription+'\n'else:return''
455,883
def __call_(self, request, headers): logging.debug('RealHttpRequest: %s %s', request.host, request.path) host_ip = self._real_dns_lookup(request.host) connection = httplib.HTTPConnection(host_ip) connection.request( request.command, request.path, request.request_body, headers) response = connection.getresponse() connec...
def __call__(self, request, headers): logging.debug('RealHttpRequest: %s %s', request.host, request.path) host_ip = self._real_dns_lookup(request.host) connection = httplib.HTTPConnection(host_ip) connection.request( request.command, request.path, request.request_body, headers) response = connection.getresponse() conne...
455,884
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
455,885
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
455,886
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
455,887
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
455,888
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
455,889
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
455,890
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
455,891
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self._RULE_SET]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return
455,892
def StartProxy(self): logging.debug("Starting Web-Page-Replay") log_level = "info" if self.log_level: log_level = self.log_level cmdline = [ replay_path, "-x", # Disables DNS intercepting "-d", str(self.config["download_bandwidth_kbps"]) + "KBit/s", "-u", str(self.config["upload_bandwidth_kbps"]) + "KBit/s", "-m", str...
def StartProxy(self): logging.debug("Starting Web-Page-Replay") log_level = "info" if self.log_level: log_level = self.log_level cmdline = [ replay_path, "-x", # Disables DNS intercepting "-d", str(self.config["download_bandwidth_kbps"]) + "KBit/s", "-u", str(self.config["upload_bandwidth_kbps"]) + "KBit/s", "-m", str...
455,893
def send_json_error(self, format, *args): """Send a fatal request error to the error log and json output.""" logging.error(format, *args) json_error = {} json_error.error = format % args self.response.out.write(json.dumps(json_error))
def send_json_error(self, format, *args): """Send a fatal request error to the error log and json output.""" logging.error(format, *args) json_error = {} json_error.error = format % args self.response.out.write(json.dumps(json_error))
455,894
def do_set(self): """Lookup a specific TestSet.""" set_id = self.request.get("id") if not set_id: self.send_json_error("Bad request, no id param") return test_set = models.TestSet.get(db.Key(set_id)) if not test_set: self.send_json_error("Could not find id: ", id) return
def do_set(self): """Lookup a specific TestSet.""" set_id = self.request.get("id") if not set_id: self.send_json_error("Bad request, no id param") return test_set = models.TestSet.get(db.Key(set_id)) if not test_set: self.send_json_error("Could not find id: ", id) return
455,895
def do_summary(self): """ Lookup a specific TestSummary""" set_id = self.request.get("id") if not set_id: self.send_json_error("Bad request, no id param") return test_summary = models.TestSummary.get(db.Key(set_id)) if not test_summary: self.send_json_error("Could not find id: ", id) return
def do_summary(self): """ Lookup a specific TestSummary""" set_id = self.request.get("id") if not set_id: self.send_json_error("Bad request, no id param") return test_summary = models.TestSummary.get(db.Key(set_id)) if not test_summary: self.send_json_error("Could not find id: ", id) return
455,896
def do_summary(self): """ Lookup a specific TestSummary""" set_id = self.request.get("id") if not set_id: self.send_json_error("Bad request, no id param") return test_summary = models.TestSummary.get(db.Key(set_id)) if not test_summary: self.send_json_error("Could not find id: ", id) return
def do_summary(self): """ Lookup a specific TestSummary""" set_id = self.request.get("id") if not set_id: self.send_json_error("Bad request, no id param") return test_summary = models.TestSummary.get(db.Key(set_id)) if not test_summary: self.send_json_error("Could not find id: ", id) return
455,897
def remove_header(self, key): for i, (k, v) in enumerate(self.headers): if key == k: self.headers.pop(i) return
def remove_header(self, key): for i, (k, v) in enumerate(self.headers): if key == k: self.headers.pop(i) return
455,898
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self.pipe_set]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return try: upload_pipe = '1' # The IPFW pipe for upload rules. download_pipe = '2' # The...
def __enter__(self): if self.is_traffic_shaping: self.platformsettings.ipfw(['delete', self.pipe_set]) if (self.up_bandwidth == '0' and self.down_bandwidth == '0' and self.delay_ms == '0' and self.packet_loss_rate == '0'): return try: upload_pipe = '1' # The IPFW pipe for upload rules. download_pipe = '2' # The...
455,899