rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
return self.viewOptions().font.pointSize() | return self.model().fontSize | def _getFontSize(self): return self.viewOptions().font.pointSize() |
self.loadProfiles() | def __init__(self, parent=None, status=None): super(Retriever, self).__init__(parent) self.receives = [] self.emits = ['setpreview', 'clearpreview', 'enable_preview_mode', 'writepreview'] self.wasCanceled = False self.setWindowTitle('Mass Tagging') winsettings('masstaglog', self) self._startButton = QPushButton('&Star... | |
def loadProfiles(self): | def loadSettings(self): if not os.path.exists(PROFILEDIR): os.mkdir(PROFILEDIR) | def loadProfiles(self): self.setProfiles(load_profiles(PROFILEDIR)) |
if self.filechanged: tags = self.listtotag() | if not self.filechanged: return tags = self.listtotag() | def save(self): if self.filechanged: tags = self.listtotag() if not self.piclabel.images: tags['__image'] = [] else: tags["__image"] = self.piclabel.images self.emit(SIGNAL('extendedtags'), tags) |
self.vbox = QVBoxLayout() self._grid = QGridLayout() self.setLayout(self._grid) | def __init__(self,tags = None,parent= None, status=None): self.settingsdialog = SettingsWin QGroupBox.__init__(self,parent) self.emits = ['onetomany'] self.receives = [('tagselectionchanged', self.fillCombos)] self.combos = {} self.labels = {} | |
[z.hide() for z in self.combos.values()] [z.hide() for z in self.labels.values()] self.vbox = QVBoxLayout() | vbox = self.layout() for box, control in self._hboxes: box.removeWidget(control) sip.delete(control) QApplication.processEvents() if not box.count(): vbox.removeItem(box) sip.delete(box) QApplication.processEvents() else: vbox = QVBoxLayout() | def setCombos(self, rowtags): """Creates a vertical column of comboboxes. tags are tags is usual in the (tag, backgroundvalue) case[should be enumerable]. rows are a dictionary with each key being a list of the indexes of tags that should be one one row. |
self._hboxes = [] | def setCombos(self, rowtags): """Creates a vertical column of comboboxes. tags are tags is usual in the (tag, backgroundvalue) case[should be enumerable]. rows are a dictionary with each key being a list of the indexes of tags that should be one one row. | |
self.vbox.addLayout(labelbox, 0) self.vbox.addLayout(widgetbox, 0) widgetbox.addStrut(1) self.vbox.addStretch(1) column = self._grid.columnCount() self._grid.addLayout(self.vbox, 0, column) self._grid.setSizeConstraint(self.vbox.SetMaximumSize) self.setMaximumHeight(self._grid.sizeHint().height()) | self._hboxes.append((labelbox, self.labels[tagval])) self._hboxes.append((widgetbox, self.combos[tagval])) vbox.addLayout(labelbox) vbox.addLayout(widgetbox) vbox.addStrut(0) self.setLayout(vbox) QApplication.processEvents() self.setMaximumHeight(self.sizeHint().height()) | def setCombos(self, rowtags): """Creates a vertical column of comboboxes. tags are tags is usual in the (tag, backgroundvalue) case[should be enumerable]. rows are a dictionary with each key being a list of the indexes of tags that should be one one row. |
images.append(preview.get('__image', {})) | image = preview.get('__image', []) if not image: image = audio['__image'] if audio['__image'] else [] | def commontags(audios, usepreview=False): images = [] imagetags = set() combined = {} tags = {} images = [] imagetags = set() for audio in audios: if usepreview: preview = audio.preview.copy() else: preview = {} if audio.IMAGETAGS: if usepreview: images.append(preview.get('__image', {})) else: images.append(audio['__im... |
images.append(audio['__image'] if audio['__image'] else {}) else: images.append({}) | image = audio['__image'] if audio['__image'] else [] else: image = [] images.append(image) | def commontags(audios, usepreview=False): images = [] imagetags = set() combined = {} tags = {} images = [] imagetags = set() for audio in audios: if usepreview: preview = audio.preview.copy() else: preview = {} if audio.IMAGETAGS: if usepreview: images.append(preview.get('__image', {})) else: images.append(audio['__im... |
pdb.set_trace() | def selectionChanged(self, selected=None, deselected=None): if selected or deselected: QTreeView.selectionChanged(self, selected, deselected) model = self.model() isTrack = model.isTrack | |
'Save as...',self.lastfilename, u';;'.join(sorted(filters))) | 'Save as...', tempfilename , u';;'.join(sorted(filters))) | def saveToFile(self): """Opens a dialog that allows the user to save, the image in the current file to disk.""" filters = {'PNG(*.png)': 'PNG', 'JPEG(*.jpg)': 'JPG'} if self.currentImage > -1: filedlg = QFileDialog() filedlg.setNameFilters(filters.keys()) if self.lastfilename: tempfilename = os.path.splitext(self.lastf... |
elif curtext == "u<keep>": pass | elif curtext == u"<keep>": pass | def save(self): """Writes the tags of the selected files to the values in self.combogroup.combos.""" combos = self.combos tags = {} |
func.args = arguments | newargs = [] for i, (control, arg) in enumerate(zip(func.controls, arguments)): if control == CHECKBOX: if arg == u'False': newargs.append(False) else: newargs.append(True) else: newargs.append(arg) func.args = newargs | def load_action(filename): modules = defaultdict(lambda: defaultdict(lambda: {})) for function in functions.values(): if isinstance(function, PluginFunction): f = function.function modules[f.__module__][f.__name__] = function else: modules[function.__module__][function.__name__] = function cparser = PuddleConfig(filena... |
'Save as...',self.lastfilename, u';;'.join(filters)) | 'Save as...',self.lastfilename, u';;'.join(sorted(filters))) | def saveToFile(self): """Opens a dialog that allows the user to save, the image in the current file to disk.""" filters = {'PNG(*.png)': 'PNG', 'JPEG(*.jpg)': 'JPG'} if self.currentImage > -1: filedlg = QFileDialog() filedlg.setNameFilters(filters.keys()) filename = filedlg.getSaveFileName(self, 'Save as...',self.lastf... |
if not tag.img: values.append('') | values.append('') | def get_track(trackinfo, keys): tags = trackinfo.find_all('td', {'class':'cell'}) if not tags: return {} values = [] for tag in tags: if text(tag): values.append(text(tag)) else: if not tag.img: values.append('') try: track = int(values[0]) return dict([(key, value) for key, value in zip(['track'] + keys, values) if v... |
return dict([(key, value) for key, value in zip(['track'] + keys, values) if value]) | if not keys[0]: return dict([(key, value) for key, value in zip(['track'] + keys[1:], values) if value]) else: return dict([(key, value) for key, value in zip(['track'] + keys, values) if value]) | def get_track(trackinfo, keys): tags = trackinfo.find_all('td', {'class':'cell'}) if not tags: return {} values = [] for tag in tags: if text(tag): values.append(text(tag)) else: if not tag.img: values.append('') try: track = int(values[0]) return dict([(key, value) for key, value in zip(['track'] + keys, values) if v... |
return dict([(key, value) for key, value in zip(keys, values)]) | return dict([(key, value) for key, value in zip(keys, values) if key or value]) | def get_track(trackinfo, keys): tags = trackinfo.find_all('td', {'class':'cell'}) if not tags: return {} values = [] for tag in tags: if text(tag): values.append(text(tag)) else: if not tag.img: values.append('') try: track = int(values[0]) return dict([(key, value) for key, value in zip(['track'] + keys, values) if v... |
headers = [text(z) for z in soup.find('table', {'id': 'ExpansionTable1'} ).find_all('td', {'class': 'passive'})] | table = soup.find('table', {'id': 'ExpansionTable1'}) headers = [text(z) for z in table.find_all('td', {'id':"content-list-title"})] | def parse_tracks(soup): try: headers = [text(z) for z in soup.find('table', {'id': 'ExpansionTable1'} ).find_all('td', {'class': 'passive'})] except AttributeError: return None keys = [spanmap.get(key, key) for key in headers] tracks = filter(None, [get_track(trackinfo, keys) for trackinfo in soup.find_all('tr', {'id':... |
tracks = filter(None, [get_track(trackinfo, keys) for trackinfo in soup.find_all('tr', {'id':"trlink"})]) | tracks = filter(None, [get_track(trackinfo, keys) for trackinfo in table.find_all('tr')]) | def parse_tracks(soup): try: headers = [text(z) for z in soup.find('table', {'id': 'ExpansionTable1'} ).find_all('td', {'class': 'passive'})] except AttributeError: return None keys = [spanmap.get(key, key) for key in headers] tracks = filter(None, [get_track(trackinfo, keys) for trackinfo in soup.find_all('tr', {'id':... |
page = urllib2.urlopen(filename).read() [print_track(t) for t in parse_albumpage(page)[1]] | print retrieve_album('file:///home/keith/fandango.htm') | def applyPrefs(self, args): self._getcover = args[0] self.preferences[0][2] = self._getcover cparser = PuddleConfig() cparser.set('amg', 'retrievecovers', self._getcover) |
album_page = urlopen(url) | def retrieve_album(url, coverurl=None): write_log('Opening Album Page - %s' % url) #album_page = urlopen(url) #to_file(album_page, 'retr.htm') album_page = open('album.htm', 'r').read() info, tracks = parse_albumpage(album_page) try: info['amgsqlid'] = sqlre.search(url).groups()[0] except AttributeError: pass if coveru... | |
album_page = open('album.htm', 'r').read() | def retrieve_album(url, coverurl=None): write_log('Opening Album Page - %s' % url) #album_page = urlopen(url) #to_file(album_page, 'retr.htm') album_page = open('album.htm', 'r').read() info, tracks = parse_albumpage(album_page) try: info['amgsqlid'] = sqlre.search(url).groups()[0] except AttributeError: pass if coveru... | |
searchpage = search(album) | def search(self, audios=None, params=None): ret = [] check_matches = False if not params: params = split_by_tag(audios, 'album', 'artist') check_matches = True else: d = defaultdict(lambda:[]) for artist, albums in params.items(): [d[album].append(artist) for album in albums] params = d for album, artists in params.ite... | |
searchpage = open('spainsearch.htm').read() | def search(self, audios=None, params=None): ret = [] check_matches = False if not params: params = split_by_tag(audios, 'album', 'artist') check_matches = True else: d = defaultdict(lambda:[]) for artist, albums in params.items(): [d[album].append(artist) for album in albums] params = d for album, artists in params.ite... | |
cparser.set("main", "lastfolder", self.lastfolder) | settings.setValue("main/lastfolder", QVariant(self.lastfolder)) | def closeEvent(self, event): """Save settings and close.""" cparser = puddlesettings.PuddleConfig() settings = QSettings(cparser.filename, QSettings.IniFormat) |
filename = filename.decode('utf8') | filename = unicode(filename, 'utf8') | def openFolder(self, filename = None, append = False): """Opens a folder. If filename != None, then the table is filled with the folder. |
field = g.find('h3').string.strip() | try: field = g.find('h3').string.strip() except AttributeError: continue | def parse_albumpage(page, artist=None, album=None): album_soup = parse_html.SoupWrapper(parse_html.parse(page)) artist_group = album_soup.find('div', {'class': 'left-sidebar'}) find = artist_group.find_all info = {} values = find('p') for field in find('h3'): if field.element.attrib: continue value = field.element.... |
info = AllMusic | info = AllMusic if __name__ == '__main__': f = open(sys.argv[1], 'r').read() print parse_albumpage(f) | def applyPrefs(self, args): self._getcover = args[0] self._useid = args[1] self._id_field = args[2] |
yield e.filename, e.strerror, len(rows) | m = 'An error occured while writing to <b>%s</b>. (%s)' % ( e.filename, e.strerror) if row == rows[-1]: yield m, 1 else: yield m, len(rows) | def func(): for row in rows: try: update = setRowData(row, d, undo=True) if update: lib_updates.append(update) yield None except (IOError, OSError), e: yield e.filename, e.strerror, len(rows) |
return info, get_tracks(r_id)[0] | return info, get_tracks(r_id, self._track_field)[0] | def retrieve(self, info): a_id = info['#artistid'] r_id = info['#albumid'] return info, get_tracks(r_id)[0] |
if modelpreviewMode: | if model.previewMode: | def _setext(self, val): if modelpreviewMode: if val: val = to_string(val) self.filepath = u'%s%s%s' % (path.splitext( self.filepath)[0], path.extsep, val) else: self.filepath = path.splitext(self.filepath)[0] else: Kind[1].ext.fset(self, val) |
arguments.append(int(userargs[argno])) | if userargs and argno < len(userargs): arguments.append(int(userargs[argno])) | def __init__(self, funcname, showcombo = False, userargs = None, defaulttags = None, parent = None, example = None, text = None): """funcname is name the function you want to use(can be either string, or functions.py function). if combotags is true then a combobox with tags that the user can choose from are shown. user... |
try: ret.append(dict([(key, list(set(to_list(value)))) for key, value in track.items()])) except: print track raise | ret.append(dict([(key, remove_dupes(value)) for key, value in track.items()])) | def retrieve(results): tracks = [] info = {} for tagsource, matches, files, config in results: fields = config[3] if not matches: operation = config[1] if operation == CONTINUE: set_status('<b>%s</b>: No matches, trying other sources.' % tagsource.name) continue elif operation == STOP: set_status('<b>%s</b>: No matches... |
Kind[1].ext.fget(self) | return Kind[1].ext.fget(self) | def _getext(self): if model.previewMode and EXTENSION in self.preview: return self.preview[EXTENSION] else: Kind[1].ext.fget(self) |
pdb.set_trace() | def search(self, audios=None, params=None): ret = [] check_matches = False if not params: params = split_by_tag(audios) check_matches = True for artist, albums in params.items(): all_tracks = None if check_matches: all_tracks = [] [all_tracks.extend(z) for z in albums.values()] | |
if (len(images) == 1 or len(table.selectedRows) == 1): | if (len(images) == 1 or len(audios) == 1): | def fillCombos(self, audios): combos = self.combos for z in combos: if z == "__image": combos[z].setImages(None) else: combos[z].clear() combos[z].setEnabled(False) |
return self.search(artist) | return self.search(text) | def keyword_search(self, text): return self.search(artist) |
audio_str = stringtags(audio) | def runAction(funcs, audio, state = None, quick_action=None): """Runs an action on audio funcs can be a list of Function objects or a filename of an action file (see getAction). audio must dictionary-like object.""" if isinstance(funcs, basestring): funcs = getAction(funcs)[0] if state is None: state = {} audio_str ... | |
temp = func.runFunction(val, audio, state, audio_str) | temp = func.runFunction(val, audio, state) | def runAction(funcs, audio, state = None, quick_action=None): """Runs an action on audio funcs can be a list of Function objects or a filename of an action file (see getAction). audio must dictionary-like object.""" if isinstance(funcs, basestring): funcs = getAction(funcs)[0] if state is None: state = {} audio_str ... |
tag.update(f.usertags) | tag.update(f.tags.copy()) | def split_files(audios, pattern): dir_groups = split_by_tag(audios, '__dirpath', None) tag_groups = [] for dirpath, files in dir_groups.items(): tags = [] for f in files: if pattern: tag = filenametotag(pattern, f.filepath, True) if tag: tag.update(f.usertags) else: tag = f.usertags.copy() else: tag = f.usertags.copy(... |
tag = f.usertags.copy() | tag = f.tags.copy() | def split_files(audios, pattern): dir_groups = split_by_tag(audios, '__dirpath', None) tag_groups = [] for dirpath, files in dir_groups.items(): tags = [] for f in files: if pattern: tag = filenametotag(pattern, f.filepath, True) if tag: tag.update(f.usertags) else: tag = f.usertags.copy() else: tag = f.usertags.copy(... |
key, val = filter(None, map(text, item.find_all('td'))) info[keys[key]] = val | values = filter(None, map(text, item.find_all('td'))) middle = len(values) / 2 fields = [keys[key] if key in spanmap else key for key in values[:middle]] info.update(zip(fields, values[middle:])) | def parse_albumpage(page): album_soup = parse_html.SoupWrapper(parse_html.parse(page)) artist_group = album_soup.find_all('td', 'artist') info = {} for item in artist_group: key = item.find('span').all_text().strip() if key in keys: if callable(keys[key]): info.update(keys[key](item)) else: key, val = filter(None, map(... |
releasetype = [parse_album_element(t) for t in album_soup.find_all('table', width="342", cellpadding="0", cellspacing="0")[0][1:]] | def parse_albumpage(page): album_soup = parse_html.SoupWrapper(parse_html.parse(page)) artist_group = album_soup.find_all('td', 'artist') info = {} for item in artist_group: key = item.find('span').all_text().strip() if key in keys: if callable(keys[key]): info.update(keys[key](item)) else: key, val = filter(None, map(... | |
name = 'AllMusic.com' | name = 'AllMusic.com' if __name__ == '__main__': filename = 'uriah.htm' page = urllib2.urlopen(filename).read() print parse_albumpage(page)[0] | def applyPrefs(self, args): self._getcover = args[0] self.preferences[0][2] = self._getcover cparser = PuddleConfig() cparser.set('amg', 'retrievecovers', self._getcover) |
for z in tagsources] | for z in self._tagsources] | def __init__(self, status, parent = None): QWidget.__init__(self, parent) self.settingsdialog = SettingsDialog self.emits = ['writepreview', 'setpreview', 'clearpreview', 'enable_preview_mode', 'logappend', 'disable_preview_mode'] self.receives = [] self.setWindowTitle("Tag Sources") self.mapping = audioinfo.mapping se... |
func, fin, rows = self._write(tagiter, rows) s = progress(func, 'Writing ', len(rows), fin) s(self) | ret = self._write(tagiter, rows) if ret is None: return else: func, fin, rows = ret s = progress(func, 'Writing ', len(rows), fin) s(self) | def writeTags(self, tagiter, rows=None): func, fin, rows = self._write(tagiter, rows) s = progress(func, 'Writing ', len(rows), fin) s(self) |
self.ui.in_rbutton.set_active(rule.direction == 'in') | if rule.direction == 'in': self.ui.in_rbutton.set_active(True) else: self.ui.out_rbutton.set_active(True) | def _load_rule_to_dialog(self, rule): self._restore_rule_dialog_defaults() # When editing, max position should be equal to the number of rules self.ui.position_adjustment.set_upper(len(self.ui.rules_model)) # action self._set_combobox_value('action_cbox', rule.action) # direction self.ui.in_rbutton.set_active(rule.dire... |
for r in self.backend.get_rules(): | rules = self.backend.get_rules() for r in rules: | def refresh_rules_model(self): self.rules_model.clear() app_rules = [] i = 1 for r in self.backend.get_rules(): if r.dapp or r.sapp: t = r.get_app_tuple() if t in app_rules: continue else: app_rules.append(t) protocol = '-' else: protocol = r.protocol |
row = [i, r.action.upper(), r.direction.upper(), protocol, src, sport, dst, dport] | row = [i, r.action.upper(), r.direction.upper(), protocol, src, sport, dst, dport, rules.index(r)] | def refresh_rules_model(self): self.rules_model.clear() app_rules = [] i = 1 for r in self.backend.get_rules(): if r.dapp or r.sapp: t = r.get_app_tuple() if t in app_rules: continue else: app_rules.append(t) protocol = '-' else: protocol = r.protocol |
for i in self.selection.get_selected_rows()[1]: | rows = self.selection.get_selected_rows()[1] rows.reverse() for i in rows: | def on_delete_rule_clicked(self, widget): if self.backend._is_enabled(): for i in self.selection.get_selected_rows()[1]: self.delete_rule(i[0] + 1, True) self.refresh_rules_model() |
def on_rule_ok_clicked(self, widget): | def create_rule_from_ui(self): | def on_rule_ok_clicked(self, widget): action = self._get_combobox_value('action_cbox').lower() protocol = self._get_combobox_value('protocol_cbox').lower() |
ip_version = 'v4' self.set_rule(rule, ip_version) self.refresh_rules_model() | return rule def select_item_from_combobox(self, name, item): values = map(str.lower, self.get_cbox_values(name)) i = values.index(item.lower()) cbox = self.ui.get_object(name) cbox.set_active(i) def load_rule_to_ui(self, rule): self.select_item_from_combobox('action_cbox', rule.action) in_rbutton = self.ui.get_obj... | def on_rule_ok_clicked(self, widget): action = self._get_combobox_value('action_cbox').lower() protocol = self._get_combobox_value('protocol_cbox').lower() |
response = self.rule_dialog.run() if response: | if self.rule_dialog.run(): | def on_insert_rule_clicked(self, widget): if self.backend._is_enabled(): response = self.rule_dialog.run() if response: rule = self.create_rule_from_ui() self.set_rule(rule) self.refresh_rules_model() self.rule_dialog.hide() |
response = self.rule_dialog.run() if response: | if self.rule_dialog.run(): | def on_rules_view_row_activated(self, widget, itr, path): rules = self.backend.get_rules() i = self.rules_model[itr[0]][8] self.load_rule_to_ui(rules[i]) response = self.rule_dialog.run() if response: pos = itr[0] + 1 self.delete_rule(pos, True) if pos > len(self.rules_model) - 1: pos -= 1 rule = self.create_rule_from_... |
pos -= 1 | pos = 0 | def on_rules_view_row_activated(self, widget, itr, path): rules = self.backend.get_rules() i = self.rules_model[itr[0]][8] self.load_rule_to_ui(rules[i]) response = self.rule_dialog.run() if response: pos = itr[0] + 1 self.delete_rule(pos, True) if pos > len(self.rules_model) - 1: pos -= 1 rule = self.create_rule_from_... |
res = self.prefs_dialog.run() if res: | if self.prefs_dialog.run(): | def on_prefs_menu_activate(self, widget): res = self.prefs_dialog.run() if res: self._process_prefs() self.prefs_dialog.hide() |
level = self._get_combobox_value('logging_cbox') | level = self._get_combobox_value('logging_cbox').lower() | def _process_prefs(self): # loglevel level = self._get_combobox_value('logging_cbox') self.set_loglevel(level) # default incoming policy = self._get_combobox_value('incoming_policy_cbox') self.backend.set_default_policy(policy, 'incoming') # default outgoing policy = self._get_combobox_value('outgoing_policy_cbox') sel... |
policy = self._get_combobox_value('incoming_policy_cbox') | policy = self._get_combobox_value('incoming_policy_cbox').lower() | def _process_prefs(self): # loglevel level = self._get_combobox_value('logging_cbox') self.set_loglevel(level) # default incoming policy = self._get_combobox_value('incoming_policy_cbox') self.backend.set_default_policy(policy, 'incoming') # default outgoing policy = self._get_combobox_value('outgoing_policy_cbox') sel... |
policy = self._get_combobox_value('outgoing_policy_cbox') | policy = self._get_combobox_value('outgoing_policy_cbox').lower() | def _process_prefs(self): # loglevel level = self._get_combobox_value('logging_cbox') self.set_loglevel(level) # default incoming policy = self._get_combobox_value('incoming_policy_cbox') self.backend.set_default_policy(policy, 'incoming') # default outgoing policy = self._get_combobox_value('outgoing_policy_cbox') sel... |
current_residue_field = [] | current_residue_field = [line] | def readParamFile(param_file): """ Read a UHBD "full" parameter file and place individual amino acid data in AminoAcidParameters instances. Use this class to determine which atoms are different between the charged and netural forms of each amino acid. This is returned as a dictionary that can be read by prepareFull. ... |
current_residue_field = [] | current_residue_field = [line] | def readParamFile(param_file): """ Read a UHBD "full" parameter file and place individual amino acid data in AminoAcidParameters instances. Use this class to determine which atoms are different between the charged and netural forms of each amino acid. This is returned as a dictionary that can be read by prepareFull. ... |
query.addBindValue( str(p) if p != None else QVariant() ) | query.addBindValue( "%s" % p if p != None else QVariant() ) | def getQuery(self): query = ConnectionManager.getNewQuery() if query == None: return query.prepare(self.query) for p in self.params: query.addBindValue( str(p) if p != None else QVariant() ) |
return "'%s'" % str(value).replace("'","''") | value = "%s" % value return "'%s'" % value.replace("'","''") | def _getDBStrValue(self, value): if isinstance(value, bool): return '1' if value else '0' if value == None: return "NULL" return "'%s'" % str(value).replace("'","''") |
'Detailed Documentation\n' '**********************\n' + '\n' + read('collective', 'localrolespanel', 'README.txt') | def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() | |
version = '0.1' | version = '0.2dev' | def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() |
return {"success":True,"reasion":'well done'} | return {"success":True,"reason":'well done'} | def fileexist(filename): path = os.path.join(os.getcwd(),filename) if os.path.exists(path): fileinfo = os.stat(path) current = time.strftime('%Y%m%d',time.localtime(time.time())) filetime = time.strftime('%Y%m%d',time.localtime(fileinfo.st_mtime)) if current == filetime: return {"success":True,"reasion":'well done'} e... |
self.m_cam_inited = True | def __init__(self, espia_dev_nb): self.m_edev = Espia.Dev(espia_dev_nb) self.m_acq = Espia.Acq(self.m_edev) self.m_buffer_cb_mgr = Espia.BufferMgr(self.m_acq) self.m_eserline = Espia.SerialLine(self.m_edev) self.m_cam = Frelon.Camera(self.m_eserline) self.m_buffer_mgr = BufferCtrlMg... | |
del self.m_ct_buffer, self.m_ct_image, self.m_ct_saving, self.m_ct_acq del self.m_ct; gc.collect() | if self.m_cam_inited: del self.m_ct_display, self.m_ct_buffer, self.m_ct_image, \ self.m_ct_saving, self.m_ct_acq del self.m_ct; gc.collect() | def __del__(self): del self.m_ct_buffer, self.m_ct_image, self.m_ct_saving, self.m_ct_acq del self.m_ct; gc.collect() |
time.sleep(0.25) | time.sleep(0.5) | def getValues( cmdstr ): tn.write(cmdstr) time.sleep(0.25) buffer = tn.read_very_eager() bufdecode = buffer.decode('utf8') lines = bufdecode.splitlines() return lines |
self.base_url = 'http://www.endicia.com/' self.base_namespace = 'www.endicia.com/' | self.base_url = 'http://LabelServer.endicia.com/' self.base_namespace = 'LabelServer.endicia.com/' | def __init__(self, requesterid, accountid, passphrase, test, **kwargs): """ Validates RequesterID, AccountID and passphrase |
'CustomsFormType', | def __init__(self, label_request, weight_oz, partner_customer_id, partner_transaction_id, mail_class='First', **kwargs): """ :param label_request: Label request object :param weight_oz: *(Numeric, 4.1)* Weight of the package, in ounces. :param partner_customer_id: *(Text, 25)* A unique identifier for the partner's end-... | |
self.base_url = 'http://LabelServer.Endicia.com/' | self.base_url = 'https://LabelServer.Endicia.com/' | def __init__(self, requesterid, accountid, passphrase, test, **kwargs): """ Validates RequesterID, AccountID and passphrase |
'CustomsItems', | 'CustomsInfo', | def __init__(self, label_request, weight_oz, partner_customer_id, partner_transaction_id, mail_class='First', **kwargs): """ :param label_request: Label request object :param weight_oz: *(Numeric, 4.1)* Weight of the package, in ounces. :param partner_customer_id: *(Text, 25)* A unique identifier for the partner's end-... |
'FromName', 'FromCompany', 'ReturnAddress2', 'ReturnAddress3', 'ReturnAddress4', 'FromPhone', 'FromEMail' 'ToName', 'ToCompany', 'ToCountry', 'ToCountryCode', 'ToPhone', 'ToEMail' | 'FromName', 'FromCompany', 'ReturnAddress2', 'ReturnAddress3', 'ReturnAddress4', 'FromPhone', 'FromEMail' 'ToName', 'ToCompany', 'ToCountry', 'ToCountryCode', 'ToPhone', 'ToEMail', 'ToAddress2', 'ToAddress3', | def __init__(self, label_request, weight_oz, partner_customer_id, partner_transaction_id, mail_class='First', **kwargs): """ :param label_request: Label request object :param weight_oz: *(Numeric, 4.1)* Weight of the package, in ounces. :param partner_customer_id: *(Text, 25)* A unique identifier for the partner's end-... |
self.url = self.base_url + "LabelService/EwsLabelService.asmx/GetPostageLabelXML" | self.url = self.base_url + \ "LabelService/EwsLabelService.asmx/GetPostageLabelXML" | def __init__(self, label_request, weight_oz, partner_customer_id, partner_transaction_id, mail_class='First', **kwargs): """ :param label_request: Label request object :param weight_oz: *(Numeric, 4.1)* Weight of the package, in ounces. :param partner_customer_id: *(Text, 25)* A unique identifier for the partner's end-... |
'InsuredValue', 'CODAmount', 'Description', 'CustomsFormType', 'IntegratedFormType', 'CustomsFormType', 'CustomsFormImageFormat', 'CustomsFormImageResolution', 'OriginCountry', 'ContentsType', 'ContentsExplanation', 'NonDeliveryOption', 'ReferenceID', | def __init__(self, label_request, weight_oz, partner_customer_id, partner_transaction_id, mail_class='First', **kwargs): """ :param label_request: Label request object :param weight_oz: *(Numeric, 4.1)* Weight of the package, in ounces. :param partner_customer_id: *(Text, 25)* A unique identifier for the partner's end-... | |
if not getattr(self, key) is None: | if hasattr(self, key) and getattr(self, key) is not None: | def data(self): _data = {} for key in self.keys: if not getattr(self, key) is None: _data[key] = getattr(self, key) return _data |
cmdrStr = ".%s " % (self.connection.cmdr) | cmdrStr = "%s.%s " % (self.connection.cmdr, self.connection.cmdr) | def executeCmd(self, cmdVar): """Execute a command (of type opscore.actor.keyvar.CmdVar). Performs the following tasks: - Sets the command ID number - Sets the start time - Puts the command on the keyword dispatcher queue - Sends the command to the server |
cmdr = ".%s" % (self.connection.cmdr,) | cmdr = "%s.%s" % (self.connection.cmdr, self.connection.cmdr) | def makeReply(self, cmdr = None, cmdID = 0, actor = None, msgCode = "F", dataStr = "", |
cnv=_cnvPVTPosCard, | cnv=float, | def tccCards(models, cmd=None): cards = [] tccDict = models['tcc'].keyVarDict try: objSys = tccDict['objSys'] objSysName = str(objSys[0]) objSysDate = float(objSys[1]) except Exception, e: objSysName = 'unknown' objSysDate = 0.0 if cmd: cmd.warn('text="could not get objsys and epoch from tcc.objSys=%s"' % (objSys)) c... |
self.keys = { } | self.keys = RO.Alg.OrderedDict() | def __init__(self,name,version,*keys): """ Creates a new named keys dictionary Overwrites any existing dictionary with the same name. The version should be specified as a (major,minor) tuple of integers. Dictionary names must be lower case. """ self.name = name try: (major,minor) = map(int,version) except (ValueError,... |
- includeName: if True then self.name is prepended to all commands sent to the hub, or if cmdVar.forUserCmd is present, then the prefix is <cmdVar.forUserCmd.cmdr>.<self.name>. | - includeName: if True then the commander name is prepended to all commands sent to the hub. The commander name is <self.connection.cmdr>.<self.connection.cmdr> unless cmdVar.forUserCmd is present, in which case the prefix is <cmdVar.forUserCmd.cmdr>.<self.connection.cmdr>. This option is used for "internal" actors tha... | def __init__(self, name = "CmdKeyVarDispatcher", connection = None, logFunc = None, includeName = True, delayCallbacks = False, |
namePrefix = "%s.%s " % (cmdVar.forUserCmd.cmdr, self.name) | cmdrStr = "%s.%s " % (cmdVar.forUserCmd.cmdr, self.connection.cmdr) | def executeCmd(self, cmdVar): """Execute a command (of type opscore.actor.keyvar.CmdVar). Performs the following tasks: - Sets the command ID number - Sets the start time - Puts the command on the keyword dispatcher queue - Sends the command to the server |
namePrefix = "%s.%s " % (self.name, self.name) | cmdrStr = ".%s " % (self.connection.cmdr) | def executeCmd(self, cmdVar): """Execute a command (of type opscore.actor.keyvar.CmdVar). Performs the following tasks: - Sets the command ID number - Sets the start time - Puts the command on the keyword dispatcher queue - Sends the command to the server |
namePrefix = "" fullCmdStr = "%s%d %s %s" % (namePrefix, cmdVar.cmdID, cmdVar.actor, cmdVar.cmdStr) | cmdrStr = "" fullCmdStr = "%s%d %s %s" % (cmdrStr, cmdVar.cmdID, cmdVar.actor, cmdVar.cmdStr) | def executeCmd(self, cmdVar): """Execute a command (of type opscore.actor.keyvar.CmdVar). Performs the following tasks: - Sets the command ID number - Sets the start time - Puts the command on the keyword dispatcher queue - Sends the command to the server |
cmdr = self.connection.cmdr or "me.me" | if self.includeName: cmdr = ".%s" % (self.connection.cmdr,) else: cmdr = self.connection.cmdr or "me.me" | def makeReply(self, cmdr = None, cmdID = 0, actor = None, msgCode = "F", dataStr = "", |
cnv=float, | cnv=_cnvPVTPosCard, | def tccCards(models, cmd=None): cards = [] tccDict = models['tcc'].keyVarDict try: objSys = tccDict['objSys'] objSysName = str(objSys[0]) objSysDate = float(objSys[1]) except Exception, e: objSysName = 'unknown' objSysDate = 0.0 if cmd: cmd.warn('text="could not get objsys and epoch from tcc.objSys=%s"' % (objSys)) c... |
if abs(fvalue) > 3.4028234663852886e+38: | if abs(fvalue) > 3.4028234663852886e+38 and abs(fvalue) != float('inf'): | def new(cls,value): fvalue = float(cls.validate(value)) # the limit value is float(340282346638528859811704183484516925440) # where 3402... is (2 - 2^(-23)) 2^127 if abs(fvalue) > 3.4028234663852886e+38: raise OverflowError('Invalid literal for Float: %r' % value) return float.__new__(cls,fvalue) |
currVal, isCurrent = keyVar.get() if isCurrent: | if keyVar.isCurrent: | def getKeyVar(self, keyVar, ind=0, defVal=Exception, |
retVal = currVal[ind] | retVal = keyVar[ind] | def getKeyVar(self, keyVar, ind=0, defVal=Exception, |
retVal = currVal | retVal = keyVar.valueList | def getKeyVar(self, keyVar, ind=0, defVal=Exception, |
if self.keyVar.isCurrent() and not self.waitNext: | if self.keyVar.isCurrent and not self.waitNext: | def __init__(self, scriptRunner, keyVar, ind, defVal, waitNext, |
description = models.TextField(help_text='Description of the artist. This field uses Markdown to render the description. See: <a href="http://en.wikipedia.org/wiki/Markdown">Markdown on Wikipedia</a>.') | description = models.TextField( help_text="""Description of the artist. This field uses Markdown to render the description. See: <a href="http://en.wikipedia.org/wiki/Markdown"> Markdown on Wikipedia</a>.""") | def upload_to(instance, filename): """ Given an instance of a Photo or Video as well as the filename, generate an appropriate storage location for this photo. """ return "artist/%s/%s" % (instance.artist.name, filename) |
email_address = models.EmailField(help_text='Email address used to contact artist.') telephone_number = PhoneNumberField(help_text='Telephone number where the artist can be reached.') pay_to_the_order_of = models.CharField(max_length=128, help_text='Name the check should be made out to.') address1 = models.CharField(m... | pay_to_the_order_of = models.CharField( max_length=128, help_text='Name the check should be made out to.') address1 = models.CharField( max_length=512, help_text='Address line 1 to mail check to.') address2 = models.CharField( max_length=512, blank=True, null=True, help_text='Address line 2 to mail check to.') city = m... | def upload_to(instance, filename): """ Given an instance of a Photo or Video as well as the filename, generate an appropriate storage location for this photo. """ return "artist/%s/%s" % (instance.artist.name, filename) |
return self.name | lower_name = self.name.lower() if lower_name.endswith(', the'): basename = self.name[:-5] the = self.name[-3:] return the+' '+basename else: return self.name | def __unicode__(self): return self.name |
def save(self): """ """ lower_name = self.name.lower() if lower_name.startswith('the '): name = self.name basename = name[4:].strip() the = name[:3] name = basename + ', ' + the self.name = name super(Artist, self).save() | # def save(self): | |
jukebox.credits_load() | credits_load() | def on_press(self, actor, event): """ Toplevel callback for when buttons are pressed. """ if event.keyval == clutter.keysyms.Escape: logging.info('Escape button pressed. Quitting jukebox.') clutter.main_quit() elif event.keyval == clutter.keysyms.space: logging.debug('Space button pressed which means credit insert.') l... |
ordering = ('-added_on',) | ordering = ('added_on',) | def __str__(self): return self.__unicode__() |
return redirect_to(request, reverse('artist_update', args=[artist.id])) | return redirect_to(request, reverse('artist_detail', args=[artist.id])) | def artist_create(request): """ Create a new artist. """ artist = Artist(user=request.user) if request.method == 'POST': form = ArtistForm(request.POST, instance=artist) if form.is_valid(): artist = form.save() return redirect_to(request, reverse('artist_update', args=[artist.id])) else: form = ArtistForm(instance=arti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.