rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
cvs_command = 'cvs history -x AMR -a -D "' + cvs_date + '"' self.run_and_log(cvs_command, 'cvshistory', 'Getting CVS history') hf = open(self.working_dir + '/' + cvshistory, 'r') | hf = open(self.working_dir + '/cvshistory', 'r') | def report(self): header = """StreamIt Regression Test Summary |
print('\n'); | def report(self): header = """StreamIt Regression Test Summary | |
os.chdir(os.path.join(streamit, self.directory)) | os.chdir(os.path.join(opts.root, self.directory)) | def test(self): oldwd = os.getcwd() os.chdir(os.path.join(streamit, self.directory)) result = self.dotest() os.chdir(oldwd) return result |
result = self.runCommand("gcc -o reg-out -I" + libdir + " -L" + libdir + " reg-out.c -lstreamit") | result = self.runCommand("gcc -o reg-out %s reg-out.c -lstreamit" % opts.get_cflags()) | def dotest(self): result = self.runCommand("java at.dms.kjc.Main -s " + string.join(self.sources) + " > reg-out.c") if (result != 0): self.report("StreamIt compilation failed") return result |
self.control = os.path.join(streamit, 'regtest/control') | def __init__(self): self.checkout = 0 self.build = 0 self.test = 1 self.control = os.path.join(streamit, 'regtest/control') self.cases = [] | |
'control=', 'case=']) | 'root=', 'libdir=', 'control=', 'debug', 'profile', 'cflags=', 'case=']) | def get_options(self, args): optlist, args = getopt.getopt(args, '', ['checkout', 'nocheckout', 'build', 'nobuild', 'test', 'notest', 'control=', 'case=']) for (opt, val) in optlist: if opt == '--nocheckout': self.checkout = 0 if opt == '--checkout': self.checkout = 1 if opt == '--nobuild': self.build = 0 if opt == '--... |
backend = ['-cluster', '1'] | backend = ['--cluster', '1'] | def Run(self, context, result): """Actually run the StreamIt compiler.""" |
if (self.backend == 'cluster' and result.GetOutcome() == result.PASS): e = qm.executable.RedirectedExecutable(self.timeout) e.Run(['make', '-f', 'Makefile.cluster'], dir=test_home_dir) result['RunStrcTest.stdout_makefile'] = e.stdout result['RunStrcTest.stderr_makefile'] = e.stderr makestatus = 1 if os.access(os.p... | def Run(self, context, result): """Actually run the StreamIt compiler.""" | |
return self._RunClu(context, result) | return self._RunUni(context, result) | def Run(self, context, result): """Actually run the target program.""" |
path = os.path.join(test_home_dir, filename) itercount = str(self.iters) output = os.path.join(test_home_dir,self.own_output) errfilename = "stderr_file" errout = os.path.join(test_home_dir,errfilename) shellcmdstring = './run_cluster -i ' + itercount + ' > ' + \ self.own_output + ' 2> ' + errfilename shellcmd = ["/us... | path = os.path.join('.', filename) arguments = [path, '-i ' + str(self.runopts[1])] e = qm.executable.RedirectedExecutable(self.timeout) status = e.Run(arguments, dir=test_home_dir, path=path) f = open(os.path.join(test_home_dir,self.runopts[0]), 'w') f.write(e.stdout) f.close() result['RunProgramTest.stderr'] = e.s... | def _RunNamedFile(self, context, result, filename): # then run_cluster with path and -i test_home_dir = context_to_dir(context) |
def _RunClu(self, context, result): test_home_dir = context_to_dir(context) if os.access(os.path.join(test_home_dir,'fusion'), os.F_OK): self._RunNamedFile(context, result, 'fusion') else: self._RunNamedFile(context, result, 'run_cluster') | def _RunNamedFile(self, context, result, filename): # then run_cluster with path and -i test_home_dir = context_to_dir(context) | |
fail = 1 | failed = 1 | def Run(self, context, result): """Actually do the comparison.""" |
print "runopts[1]: ", str(self.runopts[1]), "\n" print "timeout: ", str(self.timeout), "\n" | def Run(self, context, result): """Actually run the StreamIt compiler.""" | |
if os.access('run_cluster', os.F_OK): | if os.access(os.path.join(test_home_dir,'run_cluster'), os.F_OK): | def Run(self, context, result): """Actually run the StreamIt compiler.""" |
InterpretExitCode(result, makestatus, self.exit_code, 'RunStrcTest') | InterpretExitCode(result, makestatus, self.exit_code, 'RunStrcTest_makefile') | def Run(self, context, result): """Actually run the StreamIt compiler.""" |
finame = os.path.join(test_home_dir, "cluster-config.txt") ftname = os.path.join(test_home_dir, "cluster-config.txt.tmp") hostname = socket.gethostname() fi = open(finame) ft = open(ftname, 'w') for s in fi.readlines(): ft.write(s.replace('machine-1',hostname)) | try: finame = os.path.join(test_home_dir, "cluster-config.txt") ftname = os.path.join(test_home_dir, "cluster-config.txt.tmp") hostname = socket.gethostname() fi = open(finame) ft = open(ftname, 'w') for s in fi.readlines(): ft.write(s.replace('machine-1',hostname)) fi.close() ft.close() shutil.copy(ftname,finame)... | def Run(self, context, result): """Actually run the StreamIt compiler.""" |
fi.close() ft.close() shutil.copy(ftname,finame) os.unlink(ftname) | def Run(self, context, result): """Actually run the StreamIt compiler.""" | |
print "Run: runopts[1]: ", str(self.runopts[1]), "\n" print "timeout: ", str(self.timeout), "\n" | def Run(self, context, result): """Actually run the target program.""" print "Run: runopts[1]: ", str(self.runopts[1]), "\n" print "timeout: ", str(self.timeout), "\n" if self.backend == 'raw4': return self._RunRaw(context, result) elif self.backend == 'uni': return self._RunUni(context, result) elif self.backend == '... | |
https://www2.cag.lcs.mit.edu/rt/Streamit/listing.html has full results. | https://www2.cag.lcs.mit.edu/rt/StreamIt/listing.html has full results. | def report(self): header = """StreamIt Regression Test Summary |
if len(actual) == 0 and len(expected) > 0: tag = 'CompareResultsTest.line_0' result[tag + '.expected'] = 'some output' result[tag + '.actual'] = 'no output' failed = 1 | def Run(self, context, result): """Actually do the comparison.""" | |
if not file.tags: | if file.tags is None: | def read(self): file = self._File(encode_filename(self.filename), ID3=compatid3.CompatID3) if not file.tags: file.add_tags() tags = file.tags metadata = self.metadata def read_text_frame(frame_id, name): if frame_id in tags: metadata[name] = unicode(tags[frame_id]) def read_free_text_frame(desc, name): frames = tags.... |
if url.startswith("file:///"): filename = urllib.url2pathname(url).decode("UTF-8") if filename.startswith("file://"): filename = filename[7:] if os.path.isdir(encode_filename(filename)): self.tagger.add_directory(filename) else: files.append(filename) | filename = str(url.toLocalFile()) if os.path.isdir(filename): self.tagger.add_directory(decode_filename(filename)) else: files.append(decode_filename(filename)) | def dropUrls(self, urls, target): # URL -> Unmatched Files # TODO: use the drop target to move files to specific albums/tracks/clusters files = [] for url in urls: if url.startswith("file:///"): filename = urllib.url2pathname(url).decode("UTF-8") if filename.startswith("file://"): filename = filename[7:] if os.path.isd... |
urls = data.data("text/uri-list") | urls = data.urls() | def dropMimeData(self, parent, index, data, action): target = None if parent: |
urls = [url.strip() for url in str(urls).split("\n")] | def dropMimeData(self, parent, index, data, action): target = None if parent: | |
self.log.debug(u"Moving file %r => %r", filename, new_filename + ext) | self.log.debug(u"Moving file %r => %r", old_filename, new_filename + ext) | def __rename_file(self, file): file.lock_for_read() try: filename = file.filename metadata = Metadata() metadata.copy(file.metadata) finally: file.unlock() |
if "~artwork" in self.metadata: for mime, data in self.metadata["~artwork"]: tags.add(id3.APIC(encoding=0, mime=mime, type=3, desc="", data=data)) | images = self.metadata.getall("~artwork") for mime, data in images: tags.add(id3.APIC(encoding=0, mime=mime, type=3, desc="", data=data)) | def add_free_text_frame(desc, name): if name in metadata: tags.delall("TXXX:%s" % desc.upper()) tags.add(id3.TXXX(encoding=encoding, desc=desc, text=metadata[name])) |
tagger.log.info("DirectShow decoder not found.") | tagger.log.info("DirectShow decoder not found") | def init(tagger): """Initialize the decoders.""" # DirectShow try: from picard.musicdns import directshow _decoders.append(directshow) except ImportError: tagger.log.info("DirectShow decoder not found.") # QuickTime try: from picard.musicdns import quicktime _decoders.append(quicktime) except ImportError: tagger.log.in... |
tagger.log.info("QuickTime decoder not found.") | tagger.log.info("QuickTime decoder not found") | def init(tagger): """Initialize the decoders.""" # DirectShow try: from picard.musicdns import directshow _decoders.append(directshow) except ImportError: tagger.log.info("DirectShow decoder not found.") # QuickTime try: from picard.musicdns import quicktime _decoders.append(quicktime) except ImportError: tagger.log.in... |
tagger.log.info("GStreamer decoder not found.") | tagger.log.info("GStreamer decoder not found") | def init(tagger): """Initialize the decoders.""" # DirectShow try: from picard.musicdns import directshow _decoders.append(directshow) except ImportError: tagger.log.info("DirectShow decoder not found.") # QuickTime try: from picard.musicdns import quicktime _decoders.append(quicktime) except ImportError: tagger.log.in... |
tagger.log.warning("No decoders found! Fingerprinting will be disabled.") | tagger.log.warning("No decoders found! " "Fingerprinting will be disabled") | def init(tagger): """Initialize the decoders.""" # DirectShow try: from picard.musicdns import directshow _decoders.append(directshow) except ImportError: tagger.log.info("DirectShow decoder not found.") # QuickTime try: from picard.musicdns import quicktime _decoders.append(quicktime) except ImportError: tagger.log.in... |
if url.scheme() == "file": fileName = unicode(url.toLocalFile()) fileName = unicode(QtCore.QUrl.fromPercentEncoding(QtCore.QByteArray(fileName))) if os.path.isdir(encodeFileName(fileName)): self.emit(QtCore.SIGNAL("addDirectory"), fileName) | if url.startswith("file:///"): filename = unquote(url[8:]).decode("UTF-8") if os.path.isdir(encodeFileName(filename)): self.emit(QtCore.SIGNAL("addDirectory"), filename) | def dropUrls(self, urls, target): # URL -> Unmatched Files # TODO: use the drop target to move files to specific albums/tracks/clusters for url in urls: if url.scheme() == "file": fileName = unicode(url.toLocalFile()) fileName = unicode(QtCore.QUrl.fromPercentEncoding(QtCore.QByteArray(fileName))) if os.path.isdir(enco... |
files.append(fileName) | files.append(filename) | def dropUrls(self, urls, target): # URL -> Unmatched Files # TODO: use the drop target to move files to specific albums/tracks/clusters for url in urls: if url.scheme() == "file": fileName = unicode(url.toLocalFile()) fileName = unicode(QtCore.QUrl.fromPercentEncoding(QtCore.QByteArray(fileName))) if os.path.isdir(enco... |
urls = data.urls() | urls = data.data("text/uri-list") | def dropMimeData(self, parent, index, data, action): target = None if parent: |
uic.compileUi(uifile, file(pyfile, "w"), translator="_") | uic.compileUi(uifile, file(pyfile, "w"), gettext=True) | def run(self): from PyQt4 import uic for uifile in glob.glob("ui/*.ui"): pyfile = "ui_%s.py" % os.path.splitext(os.path.basename(uifile))[0] pyfile = os.path.join("picard", "ui", pyfile) if newer(uifile, pyfile): log.info("compiling %s -> %s", uifile, pyfile) uic.compileUi(uifile, file(pyfile, "w"), translator="_") qrc... |
for match in file.matches: | def autoTag(self, files): # TODO: move to a separate thread import math # If the user selected no or only one file, use all unmatched files if len(files) < 1: self.files_mutex.lock() files = self.files.values() self.files_mutex.unlock() self.log.debug("Auto-tagging started... %r", files) # Do metadata lookups for al... | |
from urllib import unquote | def dropUrls(self, urls, target): # URL -> Unmatched Files # TODO: use the drop target to move files to specific albums/tracks/clusters from urllib import unquote | |
filename = unquote(url[8:]).decode("UTF-8") | filename = urllib.url2pathname(url).decode("UTF-8") if filename.startswith("file://"): filename = filename[7:] | def dropUrls(self, urls, target): # URL -> Unmatched Files # TODO: use the drop target to move files to specific albums/tracks/clusters from urllib import unquote |
class ComponentMeta(type): | class ComponentMeta(sip.wrappertype): | def __repr__(self): """Return a textual representation of the extension point.""" return '<ExtensionPoint %s>' % self.interface.__name__ |
new_class = type.__new__(cls, name, bases, d) | new_class = sip.wrappertype.__new__(cls, name, bases, d) | def __new__(cls, name, bases, d): """Create the component class.""" |
class QComponentMeta(ComponentMeta, sip.wrappertype): """Wrapper metaclass to aviod metaclass conflict. """ pass | def maybe_init(self, compmgr, init=init, cls=new_class): if cls not in compmgr.components: compmgr.components[cls] = self if init: init(self) | |
__metaclass__ = QComponentMeta | __metaclass__ = ComponentMeta | def implements(*interfaces): """ Can be used in the class definiton of `Component` subclasses to declare the extension points that are extended. """ import sys frame = sys._getframe(1) locals = frame.f_locals # Some sanity checks assert locals is not frame.f_globals and '__module__' in frame.f_locals, \ 'implements()... |
self.coverArt.setAlignment(QtCore.Qt.AlignTop) | self.coverArt.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignHCenter) | def __init__(self, parent): QtGui.QGroupBox.__init__(self, _("Cover Art")) self.layout = QtGui.QVBoxLayout() self.asin = None self.data = None self.shadow = QtGui.QPixmap(":/images/CoverArtShadow.png") self.coverArt = ActiveLabel(False, parent) self.coverArt.setPixmap(self.shadow) self.coverArt.setAlignment(QtCore.Qt.A... |
files.append(file) | files.append(track.linked_file) | def drop_albums(self, albums, target): # Album -> Cluster if isinstance(target, Cluster): for album in albums: for track in album.tracks: if track.linked_file: track.linked_file.move(target) # Album -> Album elif isinstance(target, Album): files = [] for album in albums: for track in album.tracks: if track.linked_file:... |
log.warning(_('using dbfile="db" by default, please remove dbfile entry in [database.%s] section of your config file') % self.id) | log.warning(_('using dbfile="db" by default, please remove dbfile entry in [database.%s] section of your config file') % databasename) | def checkoptions(): #if network.enableserver and network.server: # usage() # print "Error: cannot run both as server and as client" # sys.exit(2) # check database options basenames = [] dbenvdirs = [] if not database.getsubsections(): print "Please define at least one song database in your configuration fil... |
for nr, filter in enumerate(filters[:4]): if len(lines) > nr: lines[nr][2:3] = [_("Filter:"), filter.name] else: lines.append(["", "", _("Filter:"), filter.name]) | if filters: for nr, filter in enumerate(filters[:4]): if len(lines) > nr: lines[nr][2:3] = [_("Filter:"), filter.name] else: lines.append(["", "", _("Filter:"), filter.name]) | def _mergefilters(lines, filters): for nr, filter in enumerate(filters[:4]): if len(lines) > nr: lines[nr][2:3] = [_("Filter:"), filter.name] else: lines.append(["", "", _("Filter:"), filter.name]) return lines |
return s + self.filters.getname() | if self.filters: return s + self.filters.getname() else: return s | def getheader(self, item): if item: s = item.artist + " - " + item.album else: s = self.getname()[1:-2] return s + self.filters.getname() |
p.start() | def initplayer(id, config): """ initialize player with id defined by config return id (or None if player is turned off) """ # only the first player has a playlist if id == "main": playlistid = "main" else: playlistid = None type = config.type if type=="off": return None elif type=="internal": import players.internal ... | |
log.info("database %s: removing stale songs" % self.songdbid) | log.debug("database %s: removing stale songs" % self.songdbid) | def autoregistersongs(self, event): if self.songdbid == event.songdbid: log.info(_("database %s: scanning for songs in %s") % (self.songdbid, self.basedir)) |
debugfile.write("%s [%s] %s\n" % (_desc[level], frame[2][1][1:-3], s)) | timestamp = time.strftime("%H:%M:%S", time.localtime()) modulename = frame[2][1][pathprefixlen+1:-3] threadname = threading.currentThread().getName() debugfile.write("%s [%s|%s|%s] %s\n" % (_desc[level], timestamp, threadname, modulename, s)) | def log(s, level): if debugfile: try: frame = inspect.stack() try: debugfile.write("%s [%s] %s\n" % (_desc[level], frame[2][1][1:-3], s)) finally: del frame except: debugfile.write("%s [???] %s\n" % (_desc[level], s)) if level >= LOGLEVEL: items.append((level, time.time(), s)) if len(items) > maxitems: items.pop(0) |
self.h, self.w = screen.getmaxyx() | self.layout = config.general.layout self.h, self.w = self.getmaxyx() log.debug("h=%d, w=%d" % (self.h, self.w)) | def __init__(self, screen, songdbids, playerids, plugins): self.screen = screen self.h, self.w = screen.getmaxyx() self.channel = hub.newchannel() self.keybindings = config.keybindings.general self.layout = config.general.layout self.done = False self.statusbar = statusbar.statusbar(screen, self.h-1, self.w, self.chan... |
self.layout = config.general.layout | def __init__(self, screen, songdbids, playerids, plugins): self.screen = screen self.h, self.w = screen.getmaxyx() self.channel = hub.newchannel() self.keybindings = config.keybindings.general self.layout = config.general.layout self.done = False self.statusbar = statusbar.statusbar(screen, self.h-1, self.w, self.chan... | |
self.cdgDisplayMode = pygame.RESIZABLE | self.cdgDisplayMode = pygame.RESIZABLE | pygame.HWSURFACE | pygame.DOUBLEBUF | def __init__(self, FileName, options, errorNotifyCallback=None, doneCallback=None): Thread.__init__(self) self.FileName = FileName |
pygame.display.set_caption(self.FileName) | if self.options.title: pygame.display.set_caption(self.options.title, 'pykaraoke') else: pygame.display.set_caption(self.FileName, 'pykaraoke') | def pygame_init(self): # Fix the position at top-left of window. Note when doing this, if the # mouse was moving around as the window opened, it made the window tiny. # Have stopped doing anything for resize events until 1sec into the song # to work around this. Note there appears to be no way to find out the # current... |
self.cdgDisplayMode = pygame.FULLSCREEN | self.cdgDisplayMode = pygame.FULLSCREEN | pygame.DOUBLEBUF | pygame.HWSURFACE | def run(self): |
copyBlockActualColour = N.zeros([vScrollLeftPixels, 216]) + self.cdgColourTable[colour] copyBlockColourIndex = N.zeros([vScrollLeftPixels, 216]) + colour | copyBlockActualColour = N.zeros([hScrollLeftPixels, 216]) + self.cdgColourTable[colour] copyBlockColourIndex = N.zeros([hScrollLeftPixels, 216]) + colour | def cdgScrollCommon (self, packd, copy): |
copyBlockActualColour = N.zeros([vScrollLeftPixels, 216]) + self.cdgColourTable[colour] copyBlockColourIndex = N.zeros([vScrollLeftPixels, 216]) + colour | copyBlockActualColour = N.zeros([hScrollRightPixels, 216]) + self.cdgColourTable[colour] copyBlockColourIndex = N.zeros([hScrollRightPixels, 216]) + colour | def cdgScrollCommon (self, packd, copy): |
scrollWidth = wx.SystemSettings_GetSystemMetric(wx.SYS_VSCROLL_X) | scrollWidth = wx.SystemSettings.GetMetric(wx.SYS_VSCROLL_X) | def doResize(self): # Get the listctrl's width listWidth = self.ListPanel.GetClientSize().width # We're showing the vertical scrollbar -> allow for scrollbar width # NOTE: on GTK, the scrollbar is included in the client size, but on # Windows it is not included if wx.Platform != '__WXMSW__': if self.ListPanel.GetItemCo... |
scrollWidth = wx.SystemSettings_GetSystemMetric(wx.SYS_VSCROLL_X) | scrollWidth = wx.SystemSettings.GetMetric(wx.SYS_VSCROLL_X) | def doResize(self): # Get the listctrl's width listWidth = self.Playlist.GetClientSize().width # We're showing the vertical scrollbar -> allow for scrollbar width # NOTE: on GTK, the scrollbar is included in the client size, but on # Windows it is not included if wx.Platform != '__WXMSW__': if self.Playlist.GetItemCoun... |
pattern = re.compile (re.escape(self.FileName[:-3])) fileList = [filename for filename in os.listdir(".") if pattern.match(filename)] | path, file = os.path.split ((self.FileName[:-3])) pattern = re.compile (re.escape(file)) fileList = [filename for filename in os.listdir(path) if pattern.match(filename)] | def __init__(self, fileName, errorNotifyCallback=None, doneCallback=None): pykPlayer.__init__(self, fileName, errorNotifyCallback, doneCallback) # Allow for calls through tab-completion, where we will # get just a '.' and not the '.cdg' extension if self.FileName[len(self.FileName)-1] == '.': self.FileName = self.File... |
consider = (self.FileName[:-3] + ext).lower() | consider = (file + ext).lower() | def __init__(self, fileName, errorNotifyCallback=None, doneCallback=None): pykPlayer.__init__(self, fileName, errorNotifyCallback, doneCallback) # Allow for calls through tab-completion, where we will # get just a '.' and not the '.cdg' extension if self.FileName[len(self.FileName)-1] == '.': self.FileName = self.File... |
self.SoundFileName = fileList[i] | self.SoundFileName = os.path.join(path, fileList[i]) | def __init__(self, fileName, errorNotifyCallback=None, doneCallback=None): pykPlayer.__init__(self, fileName, errorNotifyCallback, doneCallback) # Allow for calls through tab-completion, where we will # get just a '.' and not the '.cdg' extension if self.FileName[len(self.FileName)-1] == '.': self.FileName = self.File... |
if (self.cdgBorderColourIndex == -1): self.cdgBorderColourIndex = self.cdgPresetColourIndex self.cdgPresetScreenCommon () return def cdgBorderPreset (self, packd): colour = packd['data'][0] & 0x0F self.cdgBorderColourIndex = colour if (self.cdgPresetColourIndex == -1): self.cdgPresetColourIndex = self.cdgBorderColour... | self.cdgBorderColourIndex = self.cdgPresetColourIndex | def cdgMemoryPreset (self, packd): colour = packd['data'][0] & 0x0F repeat = packd['data'][1] & 0x0F # Ignore repeat because this is a reliable data stream self.cdgPresetColourIndex = colour if (self.cdgBorderColourIndex == -1): self.cdgBorderColourIndex = self.cdgPresetColourIndex self.cdgPresetScreenCommon () return |
self.UpdatedTiles = 0xFFFFFFFF | self.UpdatedTiles = 0xFFFFFFFFL | def __init__(self, FileName, options, errorNotifyCallback=None, doneCallback=None): Thread.__init__(self) self.FileName = FileName |
self.UpdatedTiles = 0xFFFFFFFF | self.UpdatedTiles = 0xFFFFFFFFL | def main_loop(self): # Check whether the songfile has moved on, if so # get the relevant CDG data and update the screen. if self.State == STATE_PLAYING: self.curr_pos = self.GetPos() - self.TotalOffsetTime if self.cdgPacketsDue <= self.cdgReadPackets: # Check again if any display packets are due self.cdgPacketsDue = (s... |
self.UpdatedTiles = 0xFFFFFFFF | self.UpdatedTiles = 0xFFFFFFFFL | def cdgMemoryPreset (self, packd): colour = packd['data'][0] & 0x0F repeat = packd['data'][1] & 0x0F # Ignore repeat because this is a reliable data stream |
self.UpdatedTiles = 0xFFFFFFFF | self.UpdatedTiles = 0xFFFFFFFFL | def cdgScrollCommon (self, packd, copy): |
self.UpdatedTiles = 0xFFFFFFFF | self.UpdatedTiles = 0xFFFFFFFFL | def cdgLoadColourTableCommon (self, packd, table): |
parser.add_option('-t', '--title', dest = 'title', type = 'str', metavar='TITLE', | parser.add_option('-t', '--title', dest = 'title', type = 'string', metavar='TITLE', | def setupOptions(): usage = "usage: %prog [options] <CDG file>" version = "%prog " + pykversion.PYKARAOKE_VERSION_STRING parser = OptionParser(usage = usage, version = version, conflict_handler = "resolve") parser.add_option('-x', '--window-x', dest = 'pos_x', type = 'int', metavar='X', help = 'position CD+G window X p... |
debug = "%d child running %s\n" % (os.getpid(), cmd) open("/tmp/debug", 'w').write(debug) | def __init__(self, cmd, fd, bufsize = -1): PopenHi._cleanup() self.sts = -1 p2cread, p2cwrite = os.pipe() c2pread, c2pwrite = os.pipe() hiread, hiwrite = os.pipe() errout, errin = os.pipe() self.pid = os.fork() if self.pid == 0: # Child # os.setsid() # disconnect from tty os.dup2(p2cread, 0) os.dup2(c2pwrite, 1) os.dup... | |
self.timeout = timeout | self.timeout = float(timeout) | def __init__(self,udpport,httpport,timeout=2): # XXX kludge -- what we really need is a dict which # shows the "mirror list" of all known locations for # files, rather than self.req self.req = {} self.udpport = udpport self.httpport = httpport self.timeout = timeout self.lastSend = 0 self.sock = None self.fetched = {} ... |
yield kernel.sigsleep, timeout/2 | yield kernel.sigsleep, timeout/5.0 | def puller(self): tmp = "%s.tmp" % self.p.pull while True: timeout= self.timeout yield None # get list of files if not os.path.exists(self.p.pull): # hmm. we must have died while pulling if os.path.exists(tmp): old = open(tmp,'r').read() open(self.p.pull,'a').write(old) open(self.p.pull,'a') os.rename(self.p.pull,tmp)... |
expires = time.time() + timeout | expires = None if timeout is not None: expires = time.time() + timeout | def wait(self,timeout=None): expires = time.time() + timeout return kernel.siguntil, self.ready, expires |
size, actual_size, url) | (size, actual_size, url)) | def wget(self,path,url,challenge): yield None # XXX kludge to keep from beating up HTTP servers if self.fetched.get(url,0) > time.time() - 5: debug("toosoon",path,url) if self.req.has_key(path): del self.req[path] return self.fetched[path] = time.time() info("fetching", url) path = path.lstrip('/') fullpath = os.path.j... |
task = kernel.spawn(self.updateExec(msg),itermode=True) | task = kernel.spawn( self.updateExec(msg),itermode=True,name='updateExec') | def addwip(self,msg): debug("in addwip") yield kernel.sigbusy xid = "%f.%f@%s" % (time.time(),random.random(), os.environ['HOSTNAME']) msg['xid'] = xid message = self.lockmsg() msg.setheader('message', message) msg.setheader('time',int(time.time())) if msg.type() == 'snap': data = msg.data() s = sha.new(data) m = md5.n... |
debug("got from updateX", repr(res), kernel.isrunning(task.tid)) | def addwip(self,msg): debug("in addwip") yield kernel.sigbusy xid = "%f.%f@%s" % (time.time(),random.random(), os.environ['HOSTNAME']) msg['xid'] = xid message = self.lockmsg() msg.setheader('message', message) msg.setheader('time',int(time.time())) if msg.type() == 'snap': data = msg.data() s = sha.new(data) m = md5.n... | |
while True: | while len(outputs): | def updateExec(self,msg): argv = msg.data().strip().split("\n") cwd = msg['cwd'] os.chdir(cwd) info("running", str(argv)) popen = popen2.Popen3(argv,capturestderr=True) (stdin, stdout, stderr) = ( popen.tochild, popen.fromchild, popen.childerr) stdin.close() outputs = [stdout,stderr] while True: yield kernel.sigbusy fo... |
try: (r,w,e) = select.select([f],[],[f],.2) for f in r: rxd = f.read() if len(rxd) == 0: f.close() if f is stdout: outmsg = FBP.msg('stdout',rxd) self.outpin.tx(outmsg) if f is stderr: errmsg = FBP.msg('stderr',rxd) self.outpin.tx(errmsg) except: outputs.remove(f) if not len(outputs): break | rxd = '' for i in range(100): try: (r,w,e) = select.select([f],[],[f],.2) if r: newrxd = f.readline() if len(newrxd) == 0: f.close() rxd += newrxd else: break except: outputs.remove(f) break if not len(rxd): continue if f is stdout: type = 'stdout' if f is stderr: type = 'stderr' outmsg = FBP.msg(type,rxd) self.outpin.... | def updateExec(self,msg): argv = msg.data().strip().split("\n") cwd = msg['cwd'] os.chdir(cwd) info("running", str(argv)) popen = popen2.Popen3(argv,capturestderr=True) (stdin, stdout, stderr) = ( popen.tochild, popen.fromchild, popen.childerr) stdin.close() outputs = [stdout,stderr] while True: yield kernel.sigbusy fo... |
cmd = '%s ../bin/isconf -c simple.conf %s' % (coverage,args) | cmd = '%s ../bin/isconf -c simple.conf -q %s' % (coverage,args) | def isconf(self,args='',quiet=True,rc=None): coverage = os.environ.get('COVERAGE','') cmd = '%s ../bin/isconf -c simple.conf %s' % (coverage,args) print cmd popen = popen2.Popen3(cmd,capturestderr=True) (stdin, stdout, stderr) = ( popen.tochild, popen.fromchild, popen.childerr) status = popen.wait() realrc = os.WEXITST... |
self.isconf('lock -m "testing snap"') | self.isconf('-m "testing snap" lock') | def testsnap(self): file = volroot + "/tmp1" content = str(random.random()) open(file,'w').write(content) self.failUnless(os.path.exists(file)) self.isconf('lock -m "testing snap"') self.isconf("snap " + file) os.unlink(file) self.failIf(os.path.exists(file)) |
self.set_unixfrom('From fbp822 %s HMAC=%s' % (digest,date)) | self.set_unixfrom('From fbp822 %s HMAC=%s' % (date,digest)) | def hmacset(self,key): digest = self.hmac_calculated(key) date = time.ctime() self.set_unixfrom('From fbp822 %s HMAC=%s' % (digest,date)) return digest |
g(self, unixfrom=unixfrom) | g.flatten(self, unixfrom=unixfrom) | def as_string(self, unixfrom=0): """Return the entire formatted message as a string. Optional `unixfrom' when true, means include the Unix From_ envelope header. |
self.shm = {} self.msg = {} self.news = {} | def __init__(self): self._aliasidx = {} self._tasks = {} self._nextid = 1 self.shm = {} self.msg = {} self.news = {} self.HZ = 1000 | |
def msgsnd(self,key,data,cp=False): """ >>> kernel.msgsnd('foo','apple') 'apple' >>> kernel.msgsnd('bar','pear') 'pear' >>> kernel.msgrcv('foo') 'apple' >>> kernel.msgrcv('bar') 'pear' >>> >>> kernel.msgrcv('baz') """ if cp: data = copy.deepcopy(data) q = self.msg.setdefault(key,[]) q.append(data) self.HZ *= 10 retur... | def msgsnd(self,key,data,cp=False): """ >>> kernel.msgsnd('foo','apple') 'apple' >>> kernel.msgsnd('bar','pear') 'pear' >>> kernel.msgrcv('foo') 'apple' >>> kernel.msgrcv('bar') 'pear' >>> >>> kernel.msgrcv('baz') """ if cp: data = copy.deepcopy(data) q = self.msg.setdefault(key,[]) q.append(data) self.HZ *= 10 retur... | |
def shmget(self,key,default={}): return self.shm.setdefault(key,default) | def ps(self): out = '' for id in self._tasks.keys(): task = self._tasks[id] out += str(task) + "\n" return out | |
class Junk(isconf.Protocol.Protocol): | def _login(self,msg,replyto): if not msg.sigok(): kernel.event(replyto, self.error("login failed")) | |
def _whohas_rx(self,msg): path = msg['path'] if os.exists(path) and not isdir(path): self._ihave_tx(msg) def process(self,msg): func = mkdict( whohas = self._whohas_rx, ihave = self._ihave_rx, sendme = self._sendme_rx, hereis = self._hereis_rx ) op = msg['op'] if not op in func: raise "invalid op: " + op ... | # def _ihave_tx(self,replyto): | |
self.ihaveTx(path) | def ihaveRx(self,msg,ip): yield None scheme = msg['scheme'] port = msg['port'] path = msg['file'] mtime = msg.head.mtime challenge = str(random.random()) url = "%s://%s:%s/%s?challenge=%s" % (scheme,ip,port,path,challenge) path = path.lstrip('/') # simple check to ignore foreign domains # XXX probably want to make this... | |
yield kernel.sigsleep, timeout/5 | yield kernel.sigsleep, timeout/2 | def puller(self): tmp = "%s.tmp" % self.p.pull while True: timeout= self.timeout yield None # get list of files if not os.path.exists(self.p.pull): # hmm. we must have died while pulling if os.path.exists(tmp): old = open(tmp,'r').read() open(self.p.pull,'a').write(old) open(self.p.pull,'a') os.rename(self.p.pull,tmp)... |
item = tree.GetSelection() | def OnEditAccount(self, evt): tree = self.panel.tree win = AccountEditor(self, tree, -1, "Account details", size=wx.Size(500, 200), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) win.CenterOnScreen() if win.ShowModal() == wx.ID_OK: item = tree.GetSelection() account = tree.GetPyData(item) account.description = win.de... | |
if debit is None or credit is None or amount is None: super(Transaction,self).__init__(date=date, description=description) else: | super(Transaction,self).__init__(date=date, description=description) if debit and credit and amount: | def __init__(self, date, description, debit=None, credit=None, amount=None): |
super(Transaction,self).__init__(date=date, description=description) | def __init__(self, date, description, debit=None, credit=None, amount=None): | |
try: del self.changedEvent except: pass | def __getstate__(self): """ Purge state for pickleable content. """ try: del self.changedEvent except: pass return self.__dict__ | |
A200.setSuperMembers([puteaux, R3]) A300.setSuperMembers([issy, R2]) | A200.setSuperMembers([puteaux, R2]) A300.setSuperMembers([puteaux, R3]) | def makeAccounts(self): # create all accounts under the root account self.root = RootAccount(name='Accounts') # =========================================================================== # Define the "Location" Dimension for an apartment with 4 dimension members. # ===================================================... |
class SingleDimensionRoot(object): | class SingleDimensionRoots(object): """ Container for all sub-roots (asset, expense, liability, ...) under a single dimension. """ | def __init__(self, name=None, description=None): super(MultiDimensionRootAccount, self).__init__(name, description) |
self.viewAccountsUnderDimensions([self.A100]) self.viewAccountsUnderDimensions([self.puteaux]) self.viewAccountsUnderDimensions([self.zoneA]) self.viewAccountsUnderDimensions([self.puteaux, self.warrantyMember]) | def test_multi_dimension(self): # Group by dimension members #self.viewAccountsUnderDimensions([self.A100, self.A200]) | |
self.viewAccountsUnderDimensions([self.locationDim]) self.viewAccountsUnderDimensions([self.apartmentDim]) self.viewAccountsUnderDimensions([self.locationDim, self.apartmentDim]) self.viewAccountsUnderDimensions([self.locationDim, self.roomNumberDim]) | def test_multi_dimension(self): # Group by dimension members #self.viewAccountsUnderDimensions([self.A100, self.A200]) | |
self.viewAccountsUnderDimensions([self.locationDim, self.roomNumberDim, self.apartmentDim]) self.viewAccountsUnderDimensions([self.apartmentDim, self.R2]) self.viewAccountsUnderDimensions([self.warrantyMember, self.apartmentDim]) self.viewAccountsUnderDimensions([self.zoneA, self.roomNumberDim]) self.viewAccountsUnde... | def test_multi_dimension(self): # Group by dimension members #self.viewAccountsUnderDimensions([self.A100, self.A200]) | |
newRoot = SingleDimensionRoot(root, dimMember.name) self.groupAccountsByOneDimension(dimensions, accountGroup, newRoot) | roots = SingleDimensionRoots(root, dimMember.name) self.groupAccountsByOneDimension(list(dimensions), accountGroup, roots) | def groupAccountsByOneDimension(self, dimensions, accounts, root, isFirstLevel=False): if not dimensions: for account in accounts: self.createAccountLikeOriginal(account, root.subRoots[account.type]) |
Transaction(Date(2005,12,31), 'year end', visitor.equity, visitor.expense, Money(21560)) Transaction(Date(2005,12,31), 'year end', visitor.income, visitor.equity, Money(17200)) | Transaction(Date(2005,12,31), 'year end', visitor.equity, visitor.expense, visitor.expense.balance) Transaction(Date(2005,12,31), 'year end', visitor.income, visitor.equity, visitor.income.balance) | def test_real_estate(self): rootApart = MultiDimensionRootAccount(name='root for Apartment') |
self.SetSelectionBackground("LemonChiffon") | self.SetSelectionBackground(wx.Colour(255, 250, 205)) | def __init__(self, parent, account, log): super(AccountLedgerView, self).__init__(parent, -1) GridCtrlAutoWidthMixin.__init__(self) # TODO: not working perfectly |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.