rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
assert(isinstance(min_, int)) assert(isinstance(max_, int)) | AssertInt32(min_) AssertInt32(max_) | def SetFilterRange (self, attribute, min_, max_, exclude=0 ): """ Set range filter. Only match records if 'attribute' value is beetwen 'min_' and 'max_' (inclusive). """ assert(isinstance(attribute, str)) assert(isinstance(min_, int)) assert(isinstance(max_, int)) assert(min_<=max_) |
assert ( isinstance ( docid, int ) ) | AssertUInt32(docid) | def UpdateAttributes ( self, index, attrs, values, mva=False ): """ Update given attribute values on given documents in given indexes. Returns amount of updated documents (0 or more) on success, or -1 on failure. |
assert ( isinstance ( vals, int )) | AssertInt32(vals) | def UpdateAttributes ( self, index, attrs, values, mva=False ): """ Update given attribute values on given documents in given indexes. Returns amount of updated documents (0 or more) on success, or -1 on failure. |
assert ( isinstance ( val, int ) ) | AssertInt32(val) | def UpdateAttributes ( self, index, attrs, values, mva=False ): """ Update given attribute values on given documents in given indexes. Returns amount of updated documents (0 or more) on success, or -1 on failure. |
req.append ( pack('>L',count(val) if mva else val) ) | req.append ( pack('>L',len(val) if mva else val) ) | def UpdateAttributes ( self, index, attrs, values, mva=False ): """ Update given attribute values on given documents in given indexes. Returns amount of updated documents (0 or more) on success, or -1 on failure. |
req.append ( pack('>L', 1 if mva else 0 ) ) | req.append ( pack('>L', mva_attr ) ) | def UpdateAttributes ( self, index, attrs, values, mva=False ): """ Update given attribute values on given documents in given indexes. Returns amount of updated documents (0 or more) on success, or -1 on failure. |
req.append ( pack('>L',len(val) if mva else val) ) | val_len = val if mva: val_len = len ( val ) req.append ( pack('>L',val_len ) ) | def UpdateAttributes ( self, index, attrs, values, mva=False ): """ Update given attribute values on given documents in given indexes. Returns amount of updated documents (0 or more) on success, or -1 on failure. |
return None | return -1 | def FlushAttributes(self): sock = self._Connect() if not sock: return None |
while self._peek('END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') != 'END': | while self._peek('END', 'LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') != 'END': | def goal(self): template = TemplateNode() while self._peek('END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') != 'END': block = self.block(start=True) template.append(block) END = self._scan('END') return template |
while self._peek('END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') != 'END': | while self._peek('END', 'LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') != 'END': | def fragment_goal(self): fragment = FragmentNode() while self._peek('END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') != 'END': block = self.block(start=True) fragment.append(block) END = self._scan('END') return fragment |
while self._peek('END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') != 'END': | while self._peek('END', 'LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') != 'END': | def i18n_goal(self): fragment = FragmentNode() start_pos = 0 while self._peek('END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') != 'END': text_or_placeholders = self.text_or_placeholders(start=True) end_pos = self._scanner.tokens[self._pos-1][1] fragment.append(text_or_pl... |
_token_ = self._peek('SINGLE_LINE_COMMENT', 'MULTI_LINE_COMMENT', "'block'", "'i18n'", "'def'", "'for[ \\t]*'", "'strip_lines'", "'if'", "'implements'", "'extends'", "'absolute_extends'", "'from'", "'import'", "'slurp'", "'break'", "'continue'", "'attr'", "'filter'", "'set'", "'echo'", 'END', 'LITERAL_DOLLAR_SIGN', 'ST... | _token_ = self._peek('SINGLE_LINE_COMMENT', 'MULTI_LINE_COMMENT', "'block'", "'i18n'", "'def'", "'for[ \\t]*'", "'strip_lines'", "'if'", "'implements'", "'extends'", "'absolute_extends'", "'from'", "'import'", "'slurp'", "'break'", "'continue'", "'attr'", "'filter'", "'set'", "'echo'", 'END', 'LITERAL_DOLLAR_SIGN', 'LI... | def directive(self): START_DIRECTIVE = self._scan('START_DIRECTIVE') _node_list = NodeList() _token_ = self._peek('SINGLE_LINE_COMMENT', 'MULTI_LINE_COMMENT', "'block'", "'i18n'", "'def'", "'for[ \\t]*'", "'strip_lines'", "'if'", "'implements'", "'extends'", "'absolute_extends'", "'from'", "'import'", "'slurp'", "'brea... |
while self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', 'TEXT') != 'END_DIRECTIVE': | while self._peek('LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', 'TEXT') != 'END_DIRECTIVE': | def directive(self): START_DIRECTIVE = self._scan('START_DIRECTIVE') _node_list = NodeList() _token_ = self._peek('SINGLE_LINE_COMMENT', 'MULTI_LINE_COMMENT', "'block'", "'i18n'", "'def'", "'for[ \\t]*'", "'strip_lines'", "'if'", "'implements'", "'extends'", "'absolute_extends'", "'from'", "'import'", "'slurp'", "'brea... |
while self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', 'TEXT') != 'END_DIRECTIVE': | while self._peek('LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', 'TEXT') != 'END_DIRECTIVE': | _def = DefNode(ID) |
while self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT', 'END_DIRECTIVE') != 'END_DIRECTIVE': | while self._peek('LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT', 'END_DIRECTIVE') != 'END_DIRECTIVE': | _def = DefNode(ID) |
while self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', "' | while self._peek('LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', "' | _def = DefNode(ID) |
while self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT', "' | while self._peek('LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT', "' | _def = DefNode(ID) |
elif _token_ not in ['END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', "' | elif _token_ not in ['END', 'LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', "' | _def = DefNode(ID) |
_token_ = self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') | _token_ = self._peek('LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') | def block(self, start=False): _token_ = self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') if _token_ == 'LITERAL_DOLLAR_SIGN': LITERAL_DOLLAR_SIGN = self._scan('LITERAL_DOLLAR_SIGN') return TextNode(LITERAL_DOLLAR_SIGN) elif _token_ == 'START_DIRECTIVE': directive = s... |
if self._peek('START_DIRECTIVE', 'END', 'LITERAL_DOLLAR_SIGN', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', "' | if self._peek('START_DIRECTIVE', 'END', 'LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', "' | def block(self, start=False): _token_ = self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') if _token_ == 'LITERAL_DOLLAR_SIGN': LITERAL_DOLLAR_SIGN = self._scan('LITERAL_DOLLAR_SIGN') return TextNode(LITERAL_DOLLAR_SIGN) elif _token_ == 'START_DIRECTIVE': directive = s... |
if self._peek('SPACE', 'END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', "' | if self._peek('SPACE', 'END', 'LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', "' | def block(self, start=False): _token_ = self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') if _token_ == 'LITERAL_DOLLAR_SIGN': LITERAL_DOLLAR_SIGN = self._scan('LITERAL_DOLLAR_SIGN') return TextNode(LITERAL_DOLLAR_SIGN) elif _token_ == 'START_DIRECTIVE': directive = s... |
if self._peek('PLACEHOLDER_OPEN_BRACE', 'ID', 'END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', "' | if self._peek('PLACEHOLDER_OPEN_BRACE', 'ID', 'END', 'LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', "' | def block(self, start=False): _token_ = self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') if _token_ == 'LITERAL_DOLLAR_SIGN': LITERAL_DOLLAR_SIGN = self._scan('LITERAL_DOLLAR_SIGN') return TextNode(LITERAL_DOLLAR_SIGN) elif _token_ == 'START_DIRECTIVE': directive = s... |
_token_ = self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') | _token_ = self._peek('LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') | def text_or_placeholders(self, start=False): _token_ = self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') if _token_ == 'LITERAL_DOLLAR_SIGN': LITERAL_DOLLAR_SIGN = self._scan('LITERAL_DOLLAR_SIGN') return TextNode(LITERAL_DOLLAR_SIGN) elif _token_ == 'START_DIRECTIVE'... |
if self._peek('SPACE', 'END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') == 'SPACE': | if self._peek('SPACE', 'END', 'LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') == 'SPACE': | def text_or_placeholders(self, start=False): _token_ = self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') if _token_ == 'LITERAL_DOLLAR_SIGN': LITERAL_DOLLAR_SIGN = self._scan('LITERAL_DOLLAR_SIGN') return TextNode(LITERAL_DOLLAR_SIGN) elif _token_ == 'START_DIRECTIVE'... |
if self._peek('PLACEHOLDER_OPEN_BRACE', 'ID', 'END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') in ['PLACEHOLDER_OPEN_BRACE', 'ID']: | if self._peek('PLACEHOLDER_OPEN_BRACE', 'ID', 'END', 'LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') in ['PLACEHOLDER_OPEN_BRACE', 'ID']: | def text_or_placeholders(self, start=False): _token_ = self._peek('LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'TEXT') if _token_ == 'LITERAL_DOLLAR_SIGN': LITERAL_DOLLAR_SIGN = self._scan('LITERAL_DOLLAR_SIGN') return TextNode(LITERAL_DOLLAR_SIGN) elif _token_ == 'START_DIRECTIVE'... |
while self._peek('DOT', 'PLACEHOLDER_OPEN_PAREN', 'OPEN_BRACKET', 'PIPE', 'PLACEHOLDER_CLOSE_BRACE', 'END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', "' | while self._peek('DOT', 'PLACEHOLDER_OPEN_PAREN', 'OPEN_BRACKET', 'PIPE', 'PLACEHOLDER_CLOSE_BRACE', 'END', 'LITERAL_DOLLAR_SIGN', 'LITERAL_FOWARD_SLASH', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', "' | def placeholder_in_text(self): ID = self._scan('ID') _primary = PlaceholderNode(ID) while self._peek('DOT', 'PLACEHOLDER_OPEN_PAREN', 'OPEN_BRACKET', 'PIPE', 'PLACEHOLDER_CLOSE_BRACE', 'END', 'LITERAL_DOLLAR_SIGN', 'START_DIRECTIVE', 'SPACE', 'NEWLINE', 'START_PLACEHOLDER', 'END_DIRECTIVE', "'#elif'", 'TEXT', "'#else'"... |
return not loop_node.loop_variant_set.intersection(node_dependency_set) | node_dependency_set_except_node_tree = node_dependency_set - set(flatten_tree(node)) dependencies_within_loop = set(flatten_tree(loop_node)).intersection( node_dependency_set_except_node_tree) depends_on_loop_variants = bool(loop_node.loop_variant_set.intersection( node_dependency_set)) if not depends_on_loop_variants ... | def is_loop_invariant(self, node, loop_node): node_dependency_set = self.get_node_dependencies(node) |
if n.operator == 'and': | if n.operator == 'and' or n.operator == 'or': | def analyzeBinOpNode(self, n): # if you are trying to use short-circuit behavior, these two optimizations # can sabotage correct execution since the rhs may be hoisted above the # IfNode and cause it to get executed prior to passing the lhs check. if n.operator == 'and': cache_placeholders = self.options.cache_resolved... |
self.assertRaises(Exception, test_view('country')) | test_view('country') | def test0005views(self): ''' Test views. ''' self.assertRaises(Exception, test_view('country')) |
drink['date'] = datetime.date.today() | drink['date'] = str(datetime.date.today()) | def todec(s): try: return Decimal(str(round(float(s),3))) except: return 0 |
drink['others'] = raw_input('others: ') | nutr['others'] = raw_input('others: ') | def todec(s): try: return Decimal(str(round(float(s),3))) except: return 0 |
parser.add_option('-m', '--mime-type', action="store_true", dest="batch_mime", | parser.add_option('-m', '--mime-type', action="store", dest="batch_mime", | def parse_command_line(): parser = OptionParser() parser.add_option('-b', '--batch', dest='mode', action='callback', callback=mode_callback, callback_kwargs={'mode':'batch'}, help=_('Convert in batch mode, from command line, ' 'without a graphical user\n interface. You ' 'can use this from, say, shell scripts.')) parse... |
folder = root | folder = os.path.join(root, basefolder) | def get_target_name(self, sound_file): |
result = os.path.join(folder, basefolder, urllib.quote(result)) | result = os.path.join(folder, urllib.quote(result)) | def get_target_name(self, sound_file): |
log('Queue done in %.3fs (%s tasks)' % (time.time() - self.start_time, self.count)) | log('\nQueue done in %.3fs (%s tasks)' % (time.time() - self.start_time, self.count)) | def finished(self): """ BackgroundTask finish callback """ log('Queue done in %.3fs (%s tasks)' % (time.time() - self.start_time, self.count)) self.queue_ended() self.running = False |
t.setup() while t.do_work(): pass t.finish() | t.start() while t.running: gtk_sleep(0.1) | def cli_tags_main(input_files): global error error = ErrorPrinter() for input_file in input_files: input_file = SoundFile(input_file) if not get_option('quiet'): print input_file.get_uri() t = TagReader(input_file) t.setup() while t.do_work(): pass t.finish() if not get_option('quiet'): keys = input_file.keys() keys.so... |
keys = input_file.keys() | keys = input_file.tags.keys() | def cli_tags_main(input_files): global error error = ErrorPrinter() for input_file in input_files: input_file = SoundFile(input_file) if not get_option('quiet'): print input_file.get_uri() t = TagReader(input_file) t.setup() while t.do_work(): pass t.finish() if not get_option('quiet'): keys = input_file.keys() keys.so... |
for input_file in input_files: input_file = SoundFile(input_file) | for input_name in input_files: input_file = SoundFile(input_name) | def cli_convert_main(input_files): global error error = ErrorPrinter() output_type = get_option('cli-output-type') output_suffix = get_option('cli-output-suffix') generator = TargetNameGenerator() generator.set_target_suffix(output_suffix) progress = CliProgress() queue = TaskQueue() for input_file in input_files: ... |
queue.add(c) | queue.add_task(c) | def cli_convert_main(input_files): global error error = ErrorPrinter() output_type = get_option('cli-output-type') output_suffix = get_option('cli-output-suffix') generator = TargetNameGenerator() generator.set_target_suffix(output_suffix) progress = CliProgress() queue = TaskQueue() for input_file in input_files: ... |
queue.run() | queue.start() | def cli_convert_main(input_files): global error error = ErrorPrinter() output_type = get_option('cli-output-type') output_suffix = get_option('cli-output-suffix') generator = TargetNameGenerator() generator.set_target_suffix(output_suffix) progress = CliProgress() queue = TaskQueue() for input_file in input_files: ... |
def abort(self): self.stop_pipeline() BackgroundTask.abort(self) | def abort(self): self.stop_pipeline() BackgroundTask.abort(self) | |
def on_error(self, error): pass | def on_error(self, error): # Yes, we know this isn't *right*, but stop reporting errors... # the fakesink was removed from the pipeline since it's about 10 times faster. # but gstreamer ends pipelines with an error. We know. And we don't care. pass # self.error = error | |
w.set_active(5) | def set_widget_initial_values(self, glade): | |
} self.hscale_mp3.set_range(0,range_[mode]) range_ = { "cbr": 14, "abr": 14, "vbr": 10, | def change_mp3_mode(self, mode): | |
glade.signal_autoconnect(self) | def __init__(self, glade): GladeWindow.__init__(self, glade) | |
('faac', 'AAC')) | ('faac', 'AAC'), ('mp4mux', 'AAC'), ) | def __filename_escape(str): return str.replace("'","\'").replace("\"","\\\"").replace('!','\\!') |
return 'faac profile=2 bitrate=%s ! ffmux_mp4' % \ | return 'faac profile=2 bitrate=%s ! mp4mux' % \ | def add_aac_encoder(self): return 'faac profile=2 bitrate=%s ! ffmux_mp4' % \ (self.aac_quality * 1000) |
def add_uris(self, uris, base=None, filter=None): | def add_uris(self, uris, base=None, extensions=None): | def add_uris(self, uris, base=None, filter=None): files = [] self.window.set_status(_('Adding files...')) |
if filter: filelist = [f for f in filelist if f.lower().endswith(filter)] | accepted = [] if extensions: for f in filelist: for extension in extensions: if f.lower().endswith(extension): accepted.append(f) filelist = accepted | def add_uris(self, uris, base=None, filter=None): files = [] self.window.set_status(_('Adding files...')) |
filter = None | extensions = None | def on_addfolder_activate(self, *args): last_folder = self.prefs.get_string('last-used-folder') if last_folder: self.addfolderchooser.set_current_folder_uri(last_folder) |
filter = os.path.splitext(filepattern[self.combo.get_active()] [1]) [1] self.filelist.add_uris(folders, filter=filter) | patterns = filepattern[self.combo.get_active()][1].split(';') extensions = [os.path.splitext(p)[1] for p in patterns] self.filelist.add_uris(folders, extensions=extensions) | def on_addfolder_activate(self, *args): last_folder = self.prefs.get_string('last-used-folder') if last_folder: self.addfolderchooser.set_current_folder_uri(last_folder) |
self.progress = float(self.finished_tasks) / ( len(self.waiting_tasks) + self.finished_tasks) | total = len(self.waiting_tasks) + self.finished_tasks self.progress = float(self.finished_tasks) / total if total else 0 | def start_next_task(self): to_start = get_option('jobs') - len(self.running_tasks) for i in range(to_start): try: task = self.waiting_tasks.pop(0) except IndexError: if not self.running_tasks: self.done() return self.running_tasks.append(task) task.add_listener('finished', self.task_finished) task.start() self.count +=... |
self.progressbar.set_text(_('Converting file %d of %d (%s)') % ( done, total, remaining )) | self.progressbar.set_text(_('Converting file %d of %d (%s)') % ( done + 1, total, remaining )) | def display_progress(self, remaining): done = self.converter.finished_tasks total = done + len(self.converter.waiting_tasks) + len(self.converter.running_tasks) self.progressbar.set_text(_('Converting file %d of %d (%s)') % ( done, total, remaining )) |
glade.signal_autoconnect(self) | def __init__(self, glade): self.glade = glade | |
self.run_finish_time = time.time() | def done(self): """Call to end normally the task.""" #self.run_finish_time = time.time() if self.running: self.running = False self.emit('finished') | |
if not self.running_tasks: | if not self.running_tasks and self.finished_tasks: | def start_next_task(self): #print 'start next tasks:' to_start = get_option('jobs') - len(self.running_tasks) for i in range(to_start): try: task = self.waiting_tasks.pop(0) except IndexError: if not self.running_tasks: self.done() return print 'starting:', task.sound_file.get_filename_for_display() self.running_tasks.... |
pass | self.sound_file.add_tags(taglist) self.sound_file.have_tags = True try: self.sound_file.duration = self.pipeline.query_duration(gst.FORMAT_TIME)[0] / gst.SECOND except gst.QueryError: pass | def found_tag(self, decoder, something, taglist): pass |
def found_tag(self, decoder, something, taglist): | def __found_tag(self, decoder, something, taglist): | def found_tag(self, decoder, something, taglist): #debug("found_tags:", self.sound_file.get_filename_for_display()) #debug("\ttitle=%s" % (taglist["title"])) """for k in taglist.keys(): debug("\t%s=%s" % (k, taglist[k])) if isinstance(taglist[k], gst.Date): taglist["year"] = taglist[k].year taglist["date"] = "%04d-%02d... |
def finish(self): | def finished(self): print 'Converter.finished' | def finish(self): self.converting = False Pipeline.finish(self) |
Pipeline.finish(self) | Pipeline.finished(self) | def finish(self): self.converting = False Pipeline.finish(self) |
def finish(self): TaskQueue.finish(self) | def finished(self): print 'ConverterQueue.finished' TaskQueue.finished(self) | def finish(self): TaskQueue.finish(self) self.reset_counters() self.window.set_progress(0, 0) self.window.set_sensitive() self.window.conversion_ended() total_time = self.run_finish_time - self.run_start_time |
self.converter.add(sound_file) | if sound_file.tags_read: self.converter.add(sound_file) else: self.read_tags(sound_file) | def do_convert(self): try: for sound_file in self.filelist.get_files(): self.converter.add(sound_file) except ConverterQueueCanceled: log("cancelling conversion.") self.conversion_ended() self.set_status(_("Conversion cancelled")) else: self.set_status("") self.converter.start() self.convertion_waiting = False self.set... |
self.done() | def have_type(self, typefind, probability, caps): mime_type = caps.to_string() debug('have_type:', mime_type, self.sound_file.get_filename_for_display()) self.sound_file.mime_type = None #self.sound_file.mime_type = mime_type for t in mime_whitelist: if t in mime_type: self.sound_file.mime_type = mime_type if not self.... | |
self.tagread = False | def __init__(self, sound_file): Decoder.__init__(self, sound_file) self.found_tag_hook = None self.found_tags = False self.run_start_time = 0 self.add_command('fakesink') self.add_signal(None, 'message::state-changed', self.on_state_changed) self.tagread = False self.tagread = False | |
template_skiptags = '%(filename)s' | def format_cell(self, sound_file): template_tags = '%(artist)s - <i>%(album)s</i> - <b>%(title)s</b>\n<small>%(filename)s</small>' template_loading = '<i>%s</i>\n<small>%%(filename)s</small>' \ % _('loading tags...') template_notags = '<span foreground=\'red\'>%s</span>\n<small>%%(filename)s</small>' \ % _('no tags') ... | |
def __getattr__(self, attribute): '''Allow direct use of window widget.''' widget = self.glade.get_widget(attribute) if widget is None: raise AttributeError("Widget '%s' not found" % attribute) self.__dict__[attribute] = widget return widget | def __getattr__(self, attribute): '''Allow direct use of window widget.''' widget = self.glade.get_widget(attribute) if widget is None: raise AttributeError("Widget '%s' not found" % attribute) self.__dict__[attribute] = widget # cache result return widget | |
n = pynotify.Notification(NAME, message) n.show() except ImportError: | try: n = pynotify.Notification(NAME, message) n.show() except: pass except: | def notification(message): n = pynotify.Notification(NAME, message) n.show() |
class QTIAssessment(QTIMetadataContainer): | class QTIAssessment(QTIObjectV1): | def SetAttribute_ident (self,id): pass |
print "***Outcome declared on section: %s: %s" % (decvar.identifier,decvar.data) | self.PrintWarning("***Warning: Outcomes not supported on sections: %s: %s" % (decvar.identifier,decvar.data)) def PrintWarning (self,warning,force=0): if not self.warnings.has_key(warning): self.msg=self.msg+warning+'\n' self.warnings[warning]=1 if force: self.parent.PrintWarning(warning,1) | def DeclareOutcome (self,decvar): print "***Outcome declared on section: %s: %s" % (decvar.identifier,decvar.data) |
class QTISection(QTIMetadataContainer): | class QTISection(QTIObjectV1): | def CloseObject (self): # Fix up the title if self.assessment.title: self.resource.GetLOM().GetGeneral().SetTitle(LOMLangString(self.assessment.title,self.assessment.language)) self.GenerateQTIMetadata() # Add the resource to the root thing - and therefore the content package self.GetRoot().AddResource(self.resource) #... |
print "***Outcome declared on section: %s: %s" % (decvar.identifier,decvar.data) | print "Outcome declared on section: %s: %s" % (decvar.identifier,decvar.data) | def DeclareOutcome (self,decvar): print "***Outcome declared on section: %s: %s" % (decvar.identifier,decvar.data) |
print "Warning: selection/ordering on assessment not supported." | self.PrintWarning("Warning: selection/ordering on assessment not supported.") | def __init__(self,name,attrs,parent): self.parent=parent self.data="" assert isinstance(self.parent,(QTISection, QTIAssessment)),QTIException(eInvalidStructure,"<selection_ordering>") if isinstance(self.parent,QTISection): self.process=True self.ParseAttributes(attrs) else: print "Warning: selection/ordering on assessm... |
f.write(' identifier="'+XMLString(self.identifier)+'"') f.write(' href="'+XMLString(self.href)+'"') | f.write(' identifier="%s"' % XMLString(self.identifier)) f.write(' href="../%s"' % XMLString(self.href)) | def WriteXML(self,f): #<assessmentItemRef identifier="set01" href="rtest01-set01.xml"/> f.write('\n<assessmentItemRef') f.write(' identifier="'+XMLString(self.identifier)+'"') f.write(' href="'+XMLString(self.href)+'"') if self.weight: f.write(">") f.write('\n<weight identifier="%s" value="%s"/>' % (0, self.weight)) f.... |
for mass, num in zip(masses, nparts): if num > 0: if mass == 0: pmass.append(readu(f, precision, num)) else: pmass.append(mass) else: pmass.append(0) | def read_snapshot_file(filename, physical=False, ics=False, cooling=False): """ Reads a binary gadget file """ f = open(filename, mode='rb') res = {} # dictionary to hold data # read the header header = read_header(f) nparts = header['npart'] masses = header['mass'] print 'Particles', nparts print 'Masses', masses ... | |
precision = float64 | precision = float32 | def write_snapshot_file(filename, header, pos, vel, ids, masses=None, extra_data=None): """ Write a binary gadget file (unformatted fortran) """ # do some checks on the header for name, size in zip(header_names, header_sizes): if name not in header: print 'Missing %s in header file' % name raise Exception('Missing %s ... |
return h * 3.2407764868e-18 | return h * 3.2407764868e-18 * iccpy.constants.UNIT_TIME | def hubble_0(h=h): return h * 3.2407764868e-18 |
return hubble_0(h) * iccpy.constants.UNIT_TIME * _hubble_func(a) | return hubble_0(h) * _hubble_func(a) | def hubble_param(a, h=h): return hubble_0(h) * iccpy.constants.UNIT_TIME * _hubble_func(a) |
params = f.getNode(f.root, 'simulation parameters') | name = 'simulation parameters' if name not in f.root: name = 'real scalars' params = f.getNode(f.root, name) | def read_flash_names(filename, names): """ read arrays of the given names in a flash file """ f = openFile(filename, 'r') res = {} params = f.getNode(f.root, 'simulation parameters') res['time'] = params[0][1] for name in names: res[name] = f.getNode(f.root, name).read() f.close() return res |
mass_block = pmass.append(readu(f, precision, mass_len)) | mass_block = readu(f, precision, mass_len) | def read_snapshot_file(filename, gas=False, ics=False, cooling=False): """ Reads a binary gadget file """ f = open(filename, mode='rb') res = {} # dictionary to hold data # read the header header = read_header(f) nparts = header['npart'] masses = header['mass'] print 'Particles', nparts print 'Masses', masses tota... |
pmass.append(readu(f, precision, num)) | pmass.append(mass_block[offset:offset+num]) offset += num | def read_snapshot_file(filename, physical=False, ics=False, cooling=False): """ Reads a binary gadget file """ f = open(filename, mode='rb') res = {} # dictionary to hold data # read the header header = read_header(f) nparts = header['npart'] masses = header['mass'] print 'Particles', nparts print 'Masses', masses ... |
init = [('pos', float32, total * 3), ('vel', float32, total * 3), \ ('id', uint32, total)] | if header['flag_doubleprecision']==0: init = [('pos', float32, total * 3), ('vel', float32, total * 3), ('id', uint32, total)] else: init = [('pos', float64, total * 3), ('vel', float64, total * 3), ('id', uint64, total)] | def write_snapshot_file(filename, header, data, physical=True, cooling=False, ics=False, gamma=1.66667): """ Write a binary gadget file (unformatted fortran) """ # do some checks on the header for name, size in zip(header_names, header_sizes): if name not in header: print 'Missing %s in header file' % name raise Excep... |
date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False) | date_invoice=False, payment_term=False, partner_bank=False, company_id=False) | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): """ Extend the onchange to use the supplier payment terms if this is a purchase invoice. """ |
debt = min(debt - paid, max(0.0, unreconciled - paid)) | debt = min(debt - paid, max(0.0, unreconciled)) | def amount_to_pay(self, cr, uid, ids, name, arg={}, context={}): """ Return amount pending to be paid taking into account payment lines and the reconciliation. Note that the amount to pay can be due to negative supplier refund invoices or customer invoices. """ |
debt = max(debt - paid, min(0.0, unreconciled - paid)) | debt = max(debt - paid, min(0.0, unreconciled)) | def amount_to_pay(self, cr, uid, ids, name, arg={}, context={}): """ Return amount pending to be paid taking into account payment lines and the reconciliation. Note that the amount to pay can be due to negative supplier refund invoices or customer invoices. """ |
def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False): | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False): # Copy partner data to invoice, also the new field payment_type result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id, date_invoice, payment_term, partner_bank... |
result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id, date_invoice, payment_term, partner_bank_id) | result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id, date_invoice, payment_term, partner_bank_id, company_id) | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False): # Copy partner data to invoice, also the new field payment_type result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id, date_invoice, payment_term, partner_bank... |
account_id = self.on_change_partner_id(cr, uid, line_id, res['type'], partner_id) | account_id = self.cash_line_on_change_partner_id(cr, uid, line_id, res['type'], partner_id) | def cash_line_on_change_line_type_id(self, cr, uid, line_id, partner_id, original_type, line_type_id, context=None): """ Update the type, account and partner when the line type changes. """ res = {} |
def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank=False, company_id=False): | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): # Copy partner data to invoice, also the new field payment_type result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id, date_invoice, payment_... |
result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id, date_invoice, payment_term, partner_bank_id, company_id) | result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id, date_invoice, payment_term, partner_bank, company_id) | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): # Copy partner data to invoice, also the new field payment_type result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id, date_invoice, payment_... |
vals['partner_bank'] = order.partner_bank.id | vals['partner_bank_id'] = order.partner_bank.id | def action_invoice_create(self, cr, uid, ids, *args): """ Extend the invoice creation action to preset the payment options. """ # Create the invoice as usual. invoice_id = super(purchase_order, self).action_invoice_create(cr, uid, ids, args) |
vals['partner_bank'] = order.partner_bank.id | vals['partner_bank_id'] = order.partner_bank.id | def action_invoice_create(self, cr, uid, ids, journal_id=False, group=False, type='out_invoice', context=None): """ Extend the invoice creation action to set the price type if needed. """ # Create the invoices as usual- res = super(stock_picking, self).action_invoice_create(cr, uid, ids, journal_id=journal_id, group=gr... |
date_invoice=False, payment_term=False, partner_bank=False, company_id=False) | date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False) | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): """ Extend the onchange to use the supplier payment terms if this is a purchase invoice. """ |
if partner_payment_term: | if partner_payment_term_id: | def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): """ Extend the onchange to use the supplier payment terms if this is a purchase invoice. """ |
'f': "DataFormat"} | 'f': "AvailableDataFormats"} | def _callService(self, method, *args, **kwargs): """ Wrap the call to the SOAP service with some error checking """ from urllib2 import URLError try: return method(*args, **kwargs) except URLError, e: try: status, msg = e.reason except ValueError: status = 500 msg = str(e.reason) raise DWSError('Connecting to the Dis... |
lookup = template_lookup(environ) template = lookup.get_template('/ajax/search.html') from pprint import pformat kwargs = dict(title='Search', request_uri=environ['REQUEST_URI'], environ=pformat(environ)) | template = get_template(environ, 'search.html') kwargs = get_template_kwargs(environ, 'Search') | def search(environ, start_response): lookup = template_lookup(environ) template = lookup.get_template('/ajax/search.html') from pprint import pformat kwargs = dict(title='Search', request_uri=environ['REQUEST_URI'], environ=pformat(environ)) start_response('200 OK', [('Content-type', 'text/html')]) return [template.r... |
lookup = template_lookup(environ) template = lookup.get_template('/ajax/results.html') | template = get_template(environ, 'results.html') kwargs = get_template_kwargs(environ, 'Results') | def results(environ, start_response): lookup = template_lookup(environ) template = lookup.get_template('/ajax/results.html') start_response('200 OK', [('Content-type', 'text/html')]) return [template.render(title='Results')] |
return [template.render(title='Results')] | return [template.render(**kwargs)] | def results(environ, start_response): lookup = template_lookup(environ) template = lookup.get_template('/ajax/results.html') start_response('200 OK', [('Content-type', 'text/html')]) return [template.render(title='Results')] |
write_element(writer, 4, 'Resource type', metadata.resource_type) | row = metadata.resource_type if row and not isinstance(row, Exception): row = [vocab2row(row, [])] writer.writerows(iter_element_values(4, 'Resource type', row)) | def write_element(writer, number, name, element): if isinstance(element, Exception): row = [number, name, 'ERROR', element.message, element.detail] else: row = [number, name, element] |
entry = [] if defn: if 'error' in defn: entry.append(defn['error']) elif defn['long'] != defn['short']: entry.extend((defn['short'], defn['long'])) else: entry.append(defn['short']) else: entry.append(keyword) | entry = vocab2row(defn, [keyword]) | def write_element(writer, number, name, element): if isinstance(element, Exception): row = [number, name, 'ERROR', element.message, element.detail] else: row = [number, name, element] |
if defn: if 'error' in defn: entry.append(defn['error']) elif defn['long'] != defn['short']: entry.extend((defn['short'], defn['long'])) else: entry.append(defn['short']) else: entry.append(keyword) | entry.extend(vocab2row(defn, [keyword])) | def write_element(writer, number, name, element): if isinstance(element, Exception): row = [number, name, 'ERROR', element.message, element.detail] else: row = [number, name, element] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.