bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def setup_menu(self, uimanager): | def setup_menu(self, uimanager): | 445,200 |
def setup_menu(self, uimanager): | def setup_menu(self, uimanager): | 445,201 |
def setup_menu(self, uimanager): | def setup_menu(self, uimanager): | 445,202 |
def setup_menu(self, uimanager): | def setup_menu(self, uimanager): | 445,203 |
def setup_menu(self, uimanager): | def setup_menu(self, uimanager): | 445,204 |
def update(ui, font): widget = ui.widget.get_proxies()[0] widget.set_active(font.par_type == "bullet") | def update(ui, font): widget = ui.widget.get_proxies()[0] widget.set_active(font.par_type == "bullet") | 445,205 |
def update(ui, font): widget = ui.widget.get_proxies()[0] widget.set_active(font.par_type == "bullet") | def update(ui, font): widget = ui.widget.get_proxies()[0] widget.set_active(font.par_type == "bullet") | 445,206 |
def update(ui, font): widget = ui.widget.get_proxies()[0] widget.set_active(font.par_type == "bullet") | def update(ui, font): widget = ui.widget.get_proxies()[0] widget.set_active(font.par_type == "bullet") | 445,207 |
def update(ui, font): widget = ui.widget.get_proxies()[0] widget.set_active(font.par_type == "bullet") | def update(ui, font): widget = ui.widget.get_proxies()[0] widget.set_active(font.par_type == "bullet") | 445,208 |
def update(ui, font): widget = ui.widget.get_proxies()[0] widget.set_active(font.par_type == "bullet") | def update(ui, font): widget = ui.widget.get_proxies()[0] widget.set_active(font.par_type == "bullet") | 445,209 |
def view_image(self, image_filename): current_page = self.get_current_page() if current_page is None: return | def view_image(self, image_filename): current_page = self.get_current_page() if current_page is None: return | 445,210 |
def _on_edit_image(self, menuitem): """Edit image in Image Editor""" | def_on_edit_image(self,menuitem):"""EditimageinImageEditor""" | 445,211 |
def _on_edit_image(self, menuitem): """Edit image in Image Editor""" | def _on_edit_image(self, menuitem): """Edit image in Image Editor""" | 445,212 |
def BothAction(name1, *args): return [Action(name1, *args), ToggleAction(name1 + " Tool", *args)] | def BothAction(name1, *args): return [Action(name1, *args), ToggleAction(name1 + " Tool", *args)] | 445,213 |
def BothAction(name1, *args): return [Action(name1, *args), ToggleAction(name1 + " Tool", *args)] | def BothAction(name1, *args): return [Action(name1, *args), ToggleAction(name1 + " Tool", *args)] | 445,214 |
def update_toggle(ui, active): if len(ui.widget.get_proxies()) > 0: widget = ui.widget.get_proxies()[0] widget.set_active(active) | def update_toggle(ui, active): if len(ui.widget.get_proxies()) > 0: widget = ui.widget.get_proxies()[0] widget.set_active(active) | 445,215 |
def update_toggle(ui, active): if len(ui.widget.get_proxies()) > 0: widget = ui.widget.get_proxies()[0] widget.set_active(active) | def update_toggle(ui, active): if len(ui.widget.get_proxies()) > 0: widget = ui.widget.get_proxies()[0] widget.set_active(active) | 445,216 |
def update_toggle(ui, active): if len(ui.widget.get_proxies()) > 0: widget = ui.widget.get_proxies()[0] widget.set_active(active) | def update_toggle(ui, active): if len(ui.widget.get_proxies()) > 0: widget = ui.widget.get_proxies()[0] widget.set_active(active) | 445,217 |
def update_toggle(ui, active): if len(ui.widget.get_proxies()) > 0: widget = ui.widget.get_proxies()[0] widget.set_active(active) | def update_toggle(ui, active): if len(ui.widget.get_proxies()) > 0: widget = ui.widget.get_proxies()[0] widget.set_active(active) | 445,218 |
def on_copy(self): """Copy tree callback""" widget = self.get_focus() if gobject.signal_lookup("copy-tree-clipboard", widget) != 0: widget.emit("copy-tree-clipboard") | def on_copy_tree(self): """Copy tree callback""" widget = self.get_focus() if gobject.signal_lookup("copy-tree-clipboard", widget) != 0: widget.emit("copy-tree-clipboard") | 445,219 |
def load(self, filename=None): """Load the NoteBook from the file-system""" | def load(self, filename=None): """Load the NoteBook from the file-system""" | 445,220 |
def load(self, filename=None): """Load the NoteBook from the file-system""" | def load(self, filename=None): """Load the NoteBook from the file-system""" | 445,221 |
def load(self, filename=None): """Load the NoteBook from the file-system""" | defload(self,filename=None):"""LoadtheNoteBookfromthefile-system""" | 445,222 |
def _create_renderer_spin(self, widget, digits, editable, lower, upper): renderer = gtk.CellRendererSpin() renderer.connect('edited', self._on_renderer_value_changed) if not editable: renderer.props.foreground = widget.get_style().text[gtk.STATE_INSENSITIVE] else: renderer.props.foreground = widget.get_style().text[gtk... | def _create_renderer_spin(self, widget, digits, editable, lower, upper): renderer = gtk.CellRendererSpin() renderer.connect('edited', self._on_renderer_value_changed) if not editable: renderer.props.foreground = widget.get_style().text[gtk.STATE_INSENSITIVE] else: renderer.props.foreground = widget.get_style().text[gtk... | 445,223 |
def _on_button_pressed(self, widget, event): if event.button == 1: # Left button (x, y) = event.get_coords() if self.get_canvas().get_items_at(x, y, False) == None: self.gst_object.plugster_selection.clear() return False | def _on_button_pressed(self, widget, event): if event.button == 1: # Left button (x, y) = event.get_coords() if self.get_canvas().get_items_at(x, y, False) == None: self.gst_object.plugster_selection.clear() return False | 445,224 |
def __init__(self, gst_element, layer): AbstractElementAdapter.__init__(self, gst_element, layer) | def __init__(self, gst_element, layer): AbstractElementAdapter.__init__(self, gst_element, layer) | 445,225 |
def _get_current_renderer(self, widget): pspec = self.props.property_param_spec renderer = None if pspec in self._renderers: renderer = self._renderers[pspec] editable = pspec.flags & gobject.PARAM_WRITABLE and not pspec.flags & gobject.PARAM_CONSTRUCT_ONLY | def _get_current_renderer(self, widget): pspec = self.props.property_param_spec renderer = None if pspec in self._renderers: renderer = self._renderers[pspec] editable = pspec.flags & gobject.PARAM_WRITABLE and not pspec.flags & gobject.PARAM_CONSTRUCT_ONLY | 445,226 |
def __init__(self, gst_pad, elt_adapter): AbstractAdapter.__init__(self, gst_pad, elt_adapter) | def __init__(self, gst_pad, elt_adapter): AbstractAdapter.__init__(self, gst_pad, elt_adapter) | 445,227 |
def _update_renderer_bool_value(self, renderer): val = self.props.property_value if isinstance(val, bool): if val: renderer.props.text = "No" else: renderer.props.text = "Yes" else: renderer.props.text = "---" | def _update_renderer_bool_value(self, renderer): val = self.props.property_value if isinstance(val, bool): if val: renderer.props.text = "No" else: renderer.props.text = "---" | 445,228 |
def start_editing(self, event, widget, path, background_area, cell_area, flags): menu = gtk.Menu() val = int(self._property_value) for index, flag_name in enumerate(self._property_value.value_names): item = gtk.CheckMenuItem(label = flag_name) item.set_active((val >> index) & 0x01 == 1) item.index = index item.path = p... | def start_editing(self, event, widget, path, background_area, cell_area, flags): menu = gtk.Menu() val = int(self._property_value) flags_class = type(self._property_value) for mask, flag in flags_class.__flags_values__.iteritems(): item = gtk.CheckMenuItem(label = flag.first_value_name) item.set_active(val & mask == ma... | 445,229 |
def _on_selection_changed(self, selection): self.buffer.delete(self.buffer.get_start_iter(), self.buffer.get_end_iter()) if len(selection.selected_elements) == 1: element = selection.selected_elements[0] factory = element.get_factory() self.buffer.insert_with_tags(self.buffer.get_end_iter(), factory.get_longname(), sel... | def _on_selection_changed(self, selection): self.buffer.delete(self.buffer.get_start_iter(), self.buffer.get_end_iter()) if len(selection.selected_elements) == 1: element = selection.selected_elements[0] factory = element.get_factory() self.buffer.insert_with_tags(self.buffer.get_end_iter(), factory.get_longname(), sel... | 445,230 |
def _on_selection_changed(self, selection): self.buffer.delete(self.buffer.get_start_iter(), self.buffer.get_end_iter()) if len(selection.selected_elements) == 1: element = selection.selected_elements[0] factory = element.get_factory() self.buffer.insert_with_tags(self.buffer.get_end_iter(), factory.get_longname(), sel... | def _on_selection_changed(self, selection): self.buffer.delete(self.buffer.get_start_iter(), self.buffer.get_end_iter()) if len(selection.selected_elements) == 1: element = selection.selected_elements[0] factory = element.get_factory() self.buffer.insert_with_tags(self.buffer.get_end_iter(), factory.get_longname(), sel... | 445,231 |
def disconnect_signals(self): for child in self.gst_object: child.plugster_adapter.disconnect_signals() | def disconnect_signals(self): for child in self.gst_object: child.plugster_adapter.disconnect_signals() | 445,232 |
def __init__(self, gst_object, parent): goocanvas.Group.__init__(self, parent = parent) self.gst_object = weakref.proxy(gst_object, self._on_object_deleted) gst_object.plugster_adapter = weakref.proxy(self) font_desc = self.get_canvas().get_pango_context().get_font_description() self.props.font_desc = font_desc if Abst... | def __init__(self, gst_object, parent): goocanvas.Group.__init__(self, parent = parent) self.gst_object = weakref.proxy(gst_object, self._on_object_deleted) gst_object.plugster_adapter = weakref.proxy(self) font_desc = self.get_canvas().get_pango_context().get_font_description() self.props.font_desc = font_desc if Abst... | 445,233 |
def _on_start_drag(self, adapter, widget, event): if event.button == 1: # Left button if event.state & (gtk.gdk.CONTROL_MASK | gtk.gdk.BUTTON1_MASK): self.get_selection().toggle(self.gst_object) else: self.get_selection().select(self.gst_object) self.raise_(None) | def _on_start_drag(self, adapter, widget, event): if event.button == 1: # Left button if event.state & (gtk.gdk.CONTROL_MASK | gtk.gdk.BUTTON1_MASK): self.get_selection().toggle(self.gst_object) else: self.get_selection().select(self.gst_object) self.raise_(None) | 445,234 |
def _on_start_drag(self, adapter, widget, event): if event.button == 1: # Left button if event.state & (gtk.gdk.CONTROL_MASK | gtk.gdk.BUTTON1_MASK): self.get_selection().toggle(self.gst_object) else: self.get_selection().select(self.gst_object) self.raise_(None) | def _on_start_drag(self, adapter, widget, event): if event.button == 1: # Left button if event.state & (gtk.gdk.CONTROL_MASK | gtk.gdk.BUTTON1_MASK): self.get_selection().toggle(self.gst_object) else: self.get_selection().select(self.gst_object) self.raise_(None) | 445,235 |
def save(self): return self._file.save() | def save(self): return self._file.save() | 445,236 |
def query(self, query, klass=None): """Sends a reqeust to the server based on a query""" query = urllib.quote(query) url = self.action['query'] % (self.url, self.name, self.name, query) response, content = self.request.post(url, data={}) | def query(self, query, klass=None): """Sends a reqeust to the server based on a query""" query = urllib.quote(query) url = self.action['query'] % (self.url, self.name, self.name, query) response, content = self.request.post(url, data={}) | 445,237 |
def define_documents(self, documents=None): if documents is None: documents = {} keys = self.data.keys() for data in documents: if data[RECORD_ID] not in keys: self.data[data[RECORD_ID]] = Document(data['@rid'], data, klass=self) | def define_documents(self, documents=None, reset=False): if documents is None: documents = {} keys = self.data.keys() for data in documents: if data[RECORD_ID] not in keys: self.data[data[RECORD_ID]] = Document(data['@rid'], data, klass=self) | 445,238 |
def show(entry): if not isinstance(entry, Entry): entry = b(entry.replace('h', "'")) if entry not in entries: metaphor = b(compound_to_metaphor(entry, affixes)) if metaphor in metaphors: print('warning: {0!r} is defined as {1!r}' .format(entry, b(metaphors[metaphor].word)), file=sys.stderr) entry = metaphors[metaphor] ... | def show(entry): if not isinstance(entry, Entry): entry = b(entry.replace('h', "'")) if entry not in entries: metaphor = b(compound_to_metaphor(entry, affixes)) if metaphor in metaphors: print('warning: {0!r} is defined as {1!r}' .format(entry, b(metaphors[metaphor].word)), file=sys.stderr) entry = metaphors[metaphor] ... | 445,239 |
def show(entry, entries): entry = b(entry.replace('h', "'")) if entry not in entries: print('error: {0!r} is not defined'.format(entry), file=sys.stderr) return entry = entries[entry] if ESCAPES: print(bold(entry)) for line in entry.definition.splitlines(): print(wrapper.fill(line)) if entry.notes is not None: print() ... | def show(entry, entries): entry = b(entry.replace('h', "'")) if entry not in entries: print('error: {0!r} is not defined'.format(entry), file=sys.stderr) return entry = entries[entry] if ESCAPES: if entry.affixes: print(bold(entry), '-' + '-'.join(entry.affixes) + '-') else: print(bold(entry)) for line in entry.definit... | 445,240 |
def show(entry, entries): entry = b(entry.replace('h', "'")) if entry not in entries: print('error: {0!r} is not defined'.format(entry), file=sys.stderr) return entry = entries[entry] if ESCAPES: print(bold(entry)) for line in entry.definition.splitlines(): print(wrapper.fill(line)) if entry.notes is not None: print() ... | def show(entry, entries): entry = b(entry.replace('h', "'")) if entry not in entries: print('error: {0!r} is not defined'.format(entry), file=sys.stderr) return entry = entries[entry] if ESCAPES: print(bold(entry)) for line in entry.definition.splitlines(): print(wrapper.fill(line)) if entry.notes is not None: print() ... | 445,241 |
def process_entries(element): entry = Entry(u(element.get('word')), u(element.get('type'))) for subelement in element: case = lambda tag: subelement.tag == tag | def process_entries(element): entry = Entry(u(element.get('word')), u(element.get('type'))) for subelement in element: case = lambda tag: subelement.tag == tag | 445,242 |
def show(entry, entries): entry = b(entry.replace('h', "'")) | def show(entry, entries): entry = b(entry.replace('h', "'")) | 445,243 |
def show(entry, entries): entry = b(entry.replace('h', "'")) | def show(entry, entries): entry = b(entry.replace('h', "'")) | 445,244 |
def show(entry, entries): entry = b(entry.replace('h', "'")) | def show(entry, entries): entry = b(entry.replace('h', "'")) | 445,245 |
def shell(): """Interactive shell with databases loaded.""" import code banner = 'jbo 0.1\nDatabase instances: entries, tokens, classes' with dbopenbuild('entries') as entries: with dbopen('tokens') as tokens: with dbopen('classes') as classes: context = dict(entries=entries, tokens=tokens, classes=classes) code.intera... | def shell(): """Interactive shell with databases loaded.""" import code banner = 'jbo 0.1\nDatabase instances: entries, tokens, classes, affixes' with dbopenbuild('entries') as entries: with dbopen('tokens') as tokens: with dbopen('classes') as classes: context = dict(entries=entries, tokens=tokens, classes=classes) co... | 445,246 |
def shell(): """Interactive shell with databases loaded.""" import code banner = 'jbo 0.1\nDatabase instances: entries, tokens, classes' with dbopenbuild('entries') as entries: with dbopen('tokens') as tokens: with dbopen('classes') as classes: context = dict(entries=entries, tokens=tokens, classes=classes) code.intera... | def shell(): """Interactive shell with databases loaded.""" import code banner = 'jbo 0.1\nDatabase instances: entries, tokens, classes' with dbopenbuild('entries') as entries: with dbopen('tokens') as tokens: with dbopen('classes') as classes: with dbopen('affixes') as affixes: context = dict(entries=entries, tokens=t... | 445,247 |
def math(m): t = [] for x in m.group(1).split('='): x = x.replace('{', '').replace('}', '') x = x.replace('*', '×') for digit, sub in zip('0123456789', '₀₁₂₃₄₅₆₇₈₉'): x = x.replace('_' + digit, sub) for digit, sup in zip('0123456789', '⁰¹²³⁴⁵⁶⁷⁸⁹'): # FIXME x = x.replace('^' + digit, sup) t.append(x) return '='.join(t... | def math(m): t = [] for x in m.group(1).split('='): x = x.replace('{', '').replace('}', '') x = x.replace('*', '×') for digit, sub in zip('0123456789', '₀₁₂₃₄₅₆₇₈₉'): x = x.replace('_' + digit, sub) for digit, sup in zip('0123456789', '⁰¹²³⁴⁵⁶⁷⁸⁹'): # FIXME x = x.replace('^' + digit, sup) t.append(x) return '='.join(t... | 445,248 |
def dst(self, dt): return timedelta(0) | def dst(self, dt): return timedelta(0) | 445,249 |
def _convert_to_mbox_msg(self, msg): file_ids = list(msg.objectIds('File')) encoding = "utf-8" | def _convert_to_mbox_msg(self, msg): file_ids = list(msg.objectIds('File')) encoding = "utf-8" | 445,250 |
def _get_pending_list(self, pending_list): list_out = [] for user_email in pending_list.get_user_emails(): posts = pending_list.get_posts(user_email) user_name = pending_list.get_user_name(user_email) + ' <' + user_email + '>' for post in posts: header = post['header'] body = post['body'] subject = decode_header(header... | def _get_pending_list(self, pending_list): list_out = [] for user_email in pending_list.get_user_emails(): posts = pending_list.get_posts(user_email) user_name = pending_list.get_user_name(user_email) + ' <' + user_email + '>' for post in posts: header = post['header'] body = post['body'] subject = header.get("subject"... | 445,251 |
def consume_digest(self): digest = list(self.digest) del self.digest[:] return digest | def consume_digest(self): digest = list(self.digest) del self.digest[:] return digest | 445,252 |
def consume_digest(self): digest = list(self.digest) del self.digest[:] return digest | def consume_digest(self): digest = list(self.digest) del self.digest[:] return digest | 445,253 |
def consume_digest(self): digest = list(self.digest) del self.digest[:] return digest | def consume_digest(self): digest = list(self.digest) del self.digest[:] return digest | 445,254 |
def consume_digest(self): digest = list(self.digest) del self.digest[:] return digest | def consume_digest(self): digest = list(self.digest) del self.digest[:] return digest | 445,255 |
def consume_digest(self): digest = list(self.digest) del self.digest[:] return digest | def consume_digest(self): digest = list(self.digest) del self.digest[:] return digest | 445,256 |
def saveTable(self, table, outfile): """Dump a table from the current DB with mysqldump, save to a gzipped sql file.""" command = "mysqldump -h %s -u %s %s --extended-insert --skip-opt --quick --create-options --add-drop-table --extended-insert --set-charset --quote-names %s %s | gzip" % shellEscape(( self.dbServer, ... | def saveTable(self, table, outfile): """Dump a table from the current DB with mysqldump, save to a gzipped sql file.""" command = "mysqldump -h %s -u %s %s --extended-insert --skip-opt --quick --create-options --add-drop-table --extended-insert --set-charset --quote-names %s %s | gzip" % shellEscape(( self.dbServer, ... | 445,257 |
def __init__(self): home = os.path.dirname(sys.argv[0]) files = [ os.path.join(home, "wikidump.conf"), "/etc/wikidump.conf", os.path.join(os.getenv("HOME"), ".wikidump.conf")] defaults = { #"wiki": { "dblist": "", "privatelist": "", "biglist": "", "dir": "", "forcenormal": "0", "halt": "0", #"output": { "public": "/dum... | def __init__(self): home = os.path.dirname(sys.argv[0]) files = [ os.path.join(home, "wikidump.conf"), "/etc/wikidump.conf", os.path.join(os.getenv("HOME"), ".wikidump.conf")] defaults = { #"wiki": { "dblist": "", "privatelist": "", "biglist": "", "dir": "", "forcenormal": "0", "halt": "0", #"output": { "public": "/dum... | 445,258 |
def hasFlaggedRevs(self): retrn self.dbName in self.config.flaggedRevsList | def hasFlaggedRevs(self): return self.dbName in self.config.flaggedRevsList | 445,259 |
def run(self): self.makeDir(join(self.wiki.publicDir(), self.date)) self.makeDir(join(self.wiki.privateDir(), self.date)) self.status("Cleaning up old dumps for %s" % self.dbName) self.cleanOldDumps() self.status("Starting backup of %s" % self.dbName) self.selectDatabaseServer() self.items = [PrivateTable("user", "U... | def run(self): self.makeDir(join(self.wiki.publicDir(), self.date)) self.makeDir(join(self.wiki.privateDir(), self.date)) self.status("Cleaning up old dumps for %s" % self.dbName) self.cleanOldDumps() self.status("Starting backup of %s" % self.dbName) self.selectDatabaseServer() self.items = [PrivateTable("user", "U... | 445,260 |
def run(self): while True: job = self.input_queue.get() # # Worker threads continue running until explicitly told to stop with # a special job. # if job.is_break: return # # If the global interrupt handler sets the thread_exit variable, # we stop doing real work and just report back a "break" in the # normal command pr... | def run(self): while True: job = self.input_queue.get() # # Worker threads continue running until explicitly told to stop with # a special job. # if job.is_break: continue # # If the global interrupt handler sets the thread_exit variable, # we stop doing real work and just report back a "break" in the # normal command ... | 445,261 |
def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | 445,262 |
def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | 445,263 |
def main(argv): parser = optparse.OptionParser() parser.add_option("-c", "--constrain", action="store", type="string", dest="constrain", default="", metavar="KIND", help="constrain the test-runner by kind of test") parser.add_option("-e", "--example", action="store", type="string", dest="example", default="", metavar=... | def main(argv): parser = optparse.OptionParser() parser.add_option("-c", "--constrain", action="store", type="string", dest="constrain", default="", metavar="KIND", help="constrain the test-runner by kind of test") parser.add_option("-e", "--example", action="store", type="string", dest="example", default="", metavar=... | 445,264 |
def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | 445,265 |
def run_job_synchronously(shell_command, directory, valgrind): path_cmd = os.path.join (NS3_BUILDDIR, NS3_ACTIVE_VARIANT, shell_command) if valgrind: cmd = "valgrind --leak-check=full --error-exitcode=2 %s" % path_cmd else: cmd = path_cmd if options.verbose: print "Synchronously execute %s" % cmd start_time = time.ti... | def run_job_synchronously(shell_command, directory, valgrind): path_cmd = os.path.join (NS3_BUILDDIR, NS3_ACTIVE_VARIANT, shell_command) if valgrind: cmd = "valgrind --suppressions=%s --leak-check=full --error-exitcode=2 %s" % (suppressions_path, path_cmd) else: cmd = path_cmd if options.verbose: print "Synchronously ... | 445,266 |
def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | 445,267 |
def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | 445,268 |
def main(argv): # # First, we declare and initialize a few local variables that control some # simulation parameters. # backboneNodes = 10 infraNodes = 5 lanNodes = 5 stopTime = 10 # # Simulation defaults are typically set next, before command line # arguments are parsed. # ns3.Config.SetDefault("ns3::OnOffApplica... | def main(argv): # # First, we declare and initialize a few local variables that control some # simulation parameters. # backboneNodes = 10 infraNodes = 5 lanNodes = 5 stopTime = 10 # # Simulation defaults are typically set next, before command line # arguments are parsed. # ns3.Config.SetDefault("ns3::OnOffApplica... | 445,269 |
def run(self): while True: job = self.input_queue.get() # # Worker threads continue running until explicitly told to stop with # a special job. # if job.is_break: return # # If the global interrupt handler sets the thread_exit variable, # we stop doing real work and just report back a "break" in the # normal command pr... | def run(self): while True: job = self.input_queue.get() # # Worker threads continue running until explicitly told to stop with # a special job. # if job.is_break: return # # If the global interrupt handler sets the thread_exit variable, # we stop doing real work and just report back a "break" in the # normal command pr... | 445,270 |
def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | 445,271 |
def main(): out = MyMultiSectionFactory(sys.argv[1], sys.argv[3:]) root_module = module_init() root_module.add_include('"everything.h"') register_types(root_module) ns3modulegen_core_customizations.Simulator_customizations(root_module) ns3modulegen_core_customizations.CommandLine_customizations(root_module) ns3module... | def main(): out = MyMultiSectionFactory(sys.argv[1], sys.argv[3:]) root_module = module_init() root_module.add_include('"everything.h"') register_types(root_module) ns3modulegen_core_customizations.Simulator_customizations(root_module) ns3modulegen_core_customizations.CommandLine_customizations(root_module) ns3module... | 445,272 |
def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | def run_tests(): # # Run waf to make sure that everything is built, configured and ready to go # unless we are explicitly told not to. We want to be careful about causing # our users pain while waiting for extraneous stuff to compile and link, so # we allow users that know what they''re doing to not invoke waf at all.... | 445,273 |
def run_argv(argv, env, os_env=None, cwd=None, force_no_valgrind=False): proc_env = get_proc_env(os_env) if Options.options.valgrind and not force_no_valgrind: if Options.options.command_template: raise Utils.WafError("Options --command-template and --valgrind are conflicting") if not env['VALGRIND']: raise Utils.WafEr... | def run_argv(argv, env, os_env=None, cwd=None, force_no_valgrind=False): proc_env = get_proc_env(os_env) if Options.options.valgrind and not force_no_valgrind: if Options.options.command_template: raise Utils.WafError("Options --command-template and --valgrind are conflicting") if not env['VALGRIND']: raise Utils.WafEr... | 445,274 |
def get_description(): readme = read('README.txt') readme = readme.replace('example.png', 'http://packages.python.org/imgdiff/example.png') changelog = read('CHANGES.txt') return readme + '\n\n\n' + changelog | def get_description(): readme = read('README.txt') readme = readme.replace('.. figure:: ', '.. figure:: http://packages.python.org/imgdiff/') changelog = read('CHANGES.txt') return readme + '\n\n\n' + changelog | 445,275 |
def simple_highlight(img1, img2, opts): """Try to align the two images to minimize pixel differences. Produces two masks for img1 and img2. """ diff, ((x1, y1), (x2, y2)) = best_diff(img1, img2) diff = tweak_diff(diff, opts.opacity) diff = diff.filter(ImageFilter.MaxFilter(9)) mask1 = Image.new('L', img1.size) mask2 =... | def simple_highlight(img1, img2, opts): """Try to align the two images to minimize pixel differences. Produces two masks for img1 and img2. """ diff, ((x1, y1), (x2, y2)) = best_diff(img1, img2) diff = tweak_diff(diff, opts.opacity) diff = diff.filter(ImageFilter.MaxFilter(9)) mask1 = Image.new('L', img1.size, opts.op... | 445,276 |
def main(): parser = optparse.OptionParser('%prog image1 image2', description='Compare two images side-by-side') parser.add_option('-o', dest='outfile', help='write the combined image to a file' ' instead of showing it') parser.add_option('--viewer', default='builtin', help='use an external program to view an image' ' ... | def main(): parser = optparse.OptionParser('%prog image1 image2', description='Compare two images side-by-side') parser.add_option('-o', dest='outfile', help='write the combined image to a file' ' instead of showing it') parser.add_option('--viewer', default='builtin', help='use an external program to view an image' ' ... | 445,277 |
def main(): parser = optparse.OptionParser('%prog image1 image2', description='Compare two images side-by-side') parser.add_option('-o', dest='outfile', help='write the combined image to a file' ' instead of showing it') parser.add_option('--viewer', default='builtin', help='use an external program to view an image' ' ... | def main(): parser = optparse.OptionParser('%prog image1 image2', description='Compare two images side-by-side') parser.add_option('-o', dest='outfile', help='write the combined image to a file' ' instead of showing it') parser.add_option('--viewer', default='builtin', help='use an external program to view an image' ' ... | 445,278 |
def best_diff(img1, img2): w1, h1 = img1.size w2, h2 = img2.size w, h = min(w1, w2), min(h1, h2) best = None best_value = 255 * w * h + 1 for x in range(abs(w1 - w2) + 1): if w1 > w2: x1, x2 = x, 0 else: x1, x2 = 0, x for y in range(abs(h1 - h2) + 1): if h1 > h2: y1, y2 = y, 0 else: y1, y2 = 0, y this = diff(img1, img2... | def best_diff(img1, img2, bgcolor): w1, h1 = img1.size w2, h2 = img2.size w, h = min(w1, w2), min(h1, h2) best = None best_value = 255 * w * h + 1 for x in range(abs(w1 - w2) + 1): if w1 > w2: x1, x2 = x, 0 else: x1, x2 = 0, x for y in range(abs(h1 - h2) + 1): if h1 > h2: y1, y2 = y, 0 else: y1, y2 = 0, y this = diff(... | 445,279 |
def best_diff(img1, img2): w1, h1 = img1.size w2, h2 = img2.size w, h = min(w1, w2), min(h1, h2) best = None best_value = 255 * w * h + 1 for x in range(abs(w1 - w2) + 1): if w1 > w2: x1, x2 = x, 0 else: x1, x2 = 0, x for y in range(abs(h1 - h2) + 1): if h1 > h2: y1, y2 = y, 0 else: y1, y2 = 0, y this = diff(img1, img2... | def best_diff(img1, img2): w1, h1 = img1.size w2, h2 = img2.size W, H = max(w1, w2), max(h1, h2) pimg1 = Image.new('RGB', (W, H), bgcolor) pimg2 = Image.new('RGB', (W, H), bgcolor) pimg1.paste(img1, (0, 0)) pimg2.paste(img2, (0, 0)) diff = Image.new('L', (W, H), 255) xr = abs(w1 - w2) + 1 yr = abs(h1 - h2) + 1 for... | 445,280 |
def best_diff(img1, img2): w1, h1 = img1.size w2, h2 = img2.size w, h = min(w1, w2), min(h1, h2) best = None best_value = 255 * w * h + 1 for x in range(abs(w1 - w2) + 1): if w1 > w2: x1, x2 = x, 0 else: x1, x2 = 0, x for y in range(abs(h1 - h2) + 1): if h1 > h2: y1, y2 = y, 0 else: y1, y2 = 0, y this = diff(img1, img2... | def best_diff(img1, img2): w1, h1 = img1.size w2, h2 = img2.size w, h = min(w1, w2), min(h1, h2) best = None best_value = 255 * w * h + 1 for x in range(abs(w1 - w2) + 1): if w1 > w2: pimg2 = ImageChops.offset(pimg2, 1, 0) else: x1, x2 = 0, x for y in range(abs(h1 - h2) + 1): if h1 > h2: y1, y2 = y, 0 else: y1, y2 = 0,... | 445,281 |
def best_diff(img1, img2): w1, h1 = img1.size w2, h2 = img2.size w, h = min(w1, w2), min(h1, h2) best = None best_value = 255 * w * h + 1 for x in range(abs(w1 - w2) + 1): if w1 > w2: x1, x2 = x, 0 else: x1, x2 = 0, x for y in range(abs(h1 - h2) + 1): if h1 > h2: y1, y2 = y, 0 else: y1, y2 = 0, y this = diff(img1, img2... | def best_diff(img1, img2): w1, h1 = img1.size w2, h2 = img2.size w, h = min(w1, w2), min(h1, h2) best = None best_value = 255 * w * h + 1 for x in range(abs(w1 - w2) + 1): if w1 > w2: x1, x2 = x, 0 else: pimg1 = ImageChops.offset(pimg1, 1, 0) diff1 = diff.crop((0, 0, w1, h1)) diff2 = diff.crop((0, 0, w2, h2)) return t... | 445,282 |
def io_sample_handler(name, packet): print "Samples Received: ", packet['samples'] | def io_sample_handler(name, packet): print "Samples Received: ", packet['samples'] | 445,283 |
def io_sample_handler(name, packet): print "Samples Received: ", packet['samples'] | def io_sample_handler(name, packet): print "Samples Received: ", packet['samples'] | 445,284 |
def __init__(self, ser=None, xbee=None): if xbee: self.xbee = xbee elif ser: self.xbee = XBee(ser) else: raise ValueError("Either a serial port or an XBee must be provided to construct a Dispatch") self.handlers = [] | def __init__(self, ser=None, xbee=None): if xbee: self.xbee = xbee elif ser: self.xbee = XBee(ser) self.handlers = [] | 445,285 |
def _write(self, data): """ _write: binary data -> None Packages the given binary data in an API frame and _writes the result to the serial port """ self.serial._write(APIFrame(data).output()) | def _write(self, data): """ _write: binary data -> None Packages the given binary data in an API frame and writes the result to the serial port """ self.serial._write(APIFrame(data).output()) | 445,286 |
def _write(self, data): """ _write: binary data -> None Packages the given binary data in an API frame and _writes the result to the serial port """ self.serial._write(APIFrame(data).output()) | def _write(self, data): """ _write: binary data -> None Packages the given binary data in an API frame and _writes the result to the serial port """ self.serial.write(APIFrame(data).output()) | 445,287 |
def callback(name, data): self.count += 1 | def test_callback_not_called_when_filter_not_satisfied(self): """ After registerring a callback function with a filter function, the callback should not be called if a packet which does not satisfy the callback's filter arrives. """ self.dispatch.register("test1", self.callback_check.call, lambda data: False) self.disp... | 445,288 |
def callback(name, data): self.count += 1 | def callback(name, data): self.count += 1 | 445,289 |
def callback(name, data): self.count += 1 | def callback(name, data): self.count += 1 | 445,290 |
def tochar(number): s = chr(int(number[2:], 16))+chr(int(number[:2], 16)) return s.decode('UTF-16') | def tochar(number): s = chr(int(number[2:], 16))+chr(int(number[:2], 16)) return s.decode('UTF-16') | 445,291 |
def write_accent(f, s): try: char = s.split(';')[0] if len(char) > 4: return try: char = tochar(char) except UnicodeError: return accent = unicodedata.decomposition(char) if len(accent) != 9: return base, accent = accent.split(' ') bases = find_chars(tochar(base)) accents = find_accents(tochar(accent)) for base in ba... | def write_accent(f, s): try: char = s.split(';')[0] if len(char) > 4: return try: char = tochar(char) except UnicodeError: return accent = unicodedata.decomposition(char) if len(accent) != 9: return base, accent = accent.split(' ') bases = find_chars(tochar(base)) accents = find_accents(tochar(accent)) for base in ba... | 445,292 |
def _compile_latex(self): os.chdir(self.subdir) o = Popen(self.LATEX_CMD_P % self.name, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) outdata, errdata = o.communicate() returncode = o.wait() assert returncode == 0 | def _compile_latex(self): o = Popen(self.LATEX_CMD_P % self.name, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) outdata, errdata = o.communicate() returncode = o.wait() assert returncode == 0 | 445,293 |
def _check_result(self): return self.output | def _get_result(self): return self.output | 445,294 |
def __call__(self): try: self._make_source() self._compile_latex() self._compile_lxir() return self._check_result() finally: self._cleanup() | def __call__(self): try: self._make_source() self._compile_latex() self._compile_lxir() return self._get_result() finally: self._cleanup() | 445,295 |
def _check_result(self): doc = NonvalidatingReader.parseString(self.output, self.URI_P % self.name) ctxt = Context(doc, processorNss=NSS) nodes = Evaluate("//mml:math", context=ctxt) assert len(nodes) == 1 node = nodes[0] node.removeAttributeNS(None, u'begin-id') node.removeAttributeNS(None, u'end-id') o = StringIO.Str... | IMAGE_CMD_LIST = [ "dvips -q {0} -o {0}.ps", "ps2eps -P -l -H -f -q {0}.ps", "gs -dEPSCrop -dSAFER -dBATCH -dNOPAUSE -r250 -sDEVICE=pngalpha -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=../{0}.png {0}.eps" ] def __init__(self, name, src): Test.__init__(self, name, src) self.compile_image = False def _compile_im... | 445,296 |
def genLaTeXSource(self, formula, file, lxir): o = open(file, "w") if lxir: o.write("\\RequirePackage{lxir}") o.write("\\documentclass" + self.className + "\n") for symbol in self.symbols: o.write("\\usepackage{" + symbol + "}\n") if symbol == "amsmath" and not lxir: o.write("""%% The following force equation numbers N... | def genLaTeXSource(self, formula, file, lxir): o = open(file, "w") if lxir: o.write("\\RequirePackage{lxir}\n") o.write("\\documentclass" + self.className + "\n") for symbol in self.symbols: o.write("\\usepackage{" + symbol + "}\n") if symbol == "amsmath" and not lxir: o.write("""%% The following force equation numbers... | 445,297 |
def _makeMathML(self, formula): prefix = os.path.join(self.base_path, "img" + str(self.index) + "_lxir") remove(prefix + ".tex", True) remove(prefix + ".aux", True) remove(prefix + ".log", True) remove(prefix + ".dvi", True) remove(prefix + ".xhtml", True) self.genLaTeXSource(formula, prefix + ".tex", True) self.system... | def _makeMathML(self, formula): prefix = os.path.join(self.base_path, "img" + str(self.index) + "_lxir") remove(prefix + ".tex", True) remove(prefix + ".aux", True) remove(prefix + ".log", True) remove(prefix + ".dvi", True) remove(prefix + ".xhtml", True) self.genLaTeXSource(formula, prefix + ".tex", True) self.system... | 445,298 |
def _makeMathML(self, formula): prefix = os.path.join(self.base_path, "img" + str(self.index) + "_lxir") remove(prefix + ".tex", True) remove(prefix + ".aux", True) remove(prefix + ".log", True) remove(prefix + ".dvi", True) remove(prefix + ".xhtml", True) self.genLaTeXSource(formula, prefix + ".tex", True) self.system... | def _makeMathML(self, formula): prefix = os.path.join(self.base_path, "img" + str(self.index) + "_lxir") remove(prefix + ".tex", True) remove(prefix + ".aux", True) remove(prefix + ".log", True) remove(prefix + ".dvi", True) remove(prefix + ".xhtml", True) self.genLaTeXSource(formula, prefix + ".tex", True) self.system... | 445,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.