rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
poster = Poster(conf, newsgroup) | poster = Poster(conf) | def main(): # Parse our command line options parser = OptionParser(usage='usage: %prog [options] dir1 dir2 ... dirN') parser.add_option('-g', '--group', dest='group', help='post to a different group than the default', ) parser.add_option('-p', '--profile', dest='profile', action='store_true', default=False, help='run w... |
prof.runcall(poster.post, dirs) | prof.runcall(poster.post, newsgroup, dirs) | def main(): # Parse our command line options parser = OptionParser(usage='usage: %prog [options] dir1 dir2 ... dirN') parser.add_option('-g', '--group', dest='group', help='post to a different group than the default', ) parser.add_option('-p', '--profile', dest='profile', action='store_true', default=False, help='run w... |
poster.post(dirs) | poster.post(newsgroup, dirs) | def main(): # Parse our command line options parser = OptionParser(usage='usage: %prog [options] dir1 dir2 ... dirN') parser.add_option('-g', '--group', dest='group', help='post to a different group than the default', ) parser.add_option('-p', '--profile', dest='profile', action='store_true', default=False, help='run w... |
def yEncode(data, linelen=256): | def yEncode(postfile, data, linelen=256): | def yEncode(data, linelen=256): 'Encode data into yEnc format' translated = data.translate(YENC_TRANS) # escape =, NUL, LF, CR for i in (61, 0, 10, 13): j = '=%c' % (i + 64) translated = translated.replace(chr(i), j) # split the rest of it into lines lines = [] start = 0 end = 0 datalen = len(translated) while end ... |
end = start + linelen | end = min(datalen, start + linelen) | def yEncode(data, linelen=256): 'Encode data into yEnc format' translated = data.translate(YENC_TRANS) # escape =, NUL, LF, CR for i in (61, 0, 10, 13): j = '=%c' % (i + 64) translated = translated.replace(chr(i), j) # split the rest of it into lines lines = [] start = 0 end = 0 datalen = len(translated) while end ... |
if translated[end] == '.': lines.append('.' + translated[start:end]) | if translated[end-1] == '.': postfile.write('.' + translated[start:end]) | def yEncode(data, linelen=256): 'Encode data into yEnc format' translated = data.translate(YENC_TRANS) # escape =, NUL, LF, CR for i in (61, 0, 10, 13): j = '=%c' % (i + 64) translated = translated.replace(chr(i), j) # split the rest of it into lines lines = [] start = 0 end = 0 datalen = len(translated) while end ... |
lines.append(translated[start:end]) | postfile.write(translated[start:end]) postfile.write('\n') | def yEncode(data, linelen=256): 'Encode data into yEnc format' translated = data.translate(YENC_TRANS) # escape =, NUL, LF, CR for i in (61, 0, 10, 13): j = '=%c' % (i + 64) translated = translated.replace(chr(i), j) # split the rest of it into lines lines = [] start = 0 end = 0 datalen = len(translated) while end ... |
return '\n'.join(lines) | def yEncode(data, linelen=256): 'Encode data into yEnc format' translated = data.translate(YENC_TRANS) # escape =, NUL, LF, CR for i in (61, 0, 10, 13): j = '=%c' % (i + 64) translated = translated.replace(chr(i), j) # split the rest of it into lines lines = [] start = 0 end = 0 datalen = len(translated) while end ... | |
c = Poster(conf, newsgroup) | poster = Poster(conf, newsgroup) | def main(): # Parse our command line options parser = OptionParser(usage='usage: %prog [options] dir1 dir2 ... dirN') parser.add_option('-g', '--group', dest='group', help='post to a different group than the default', ) parser.add_option('-p', '--profile', dest='profile', action='store_true', default=False, help='run w... |
prof.runcall(c.post, dirs) | prof.runcall(poster.post, dirs) | def main(): # Parse our command line options parser = OptionParser(usage='usage: %prog [options] dir1 dir2 ... dirN') parser.add_option('-g', '--group', dest='group', help='post to a different group than the default', ) parser.add_option('-p', '--profile', dest='profile', action='store_true', default=False, help='run w... |
c.post(dirs) | poster.post(dirs) | def main(): # Parse our command line options parser = OptionParser(usage='usage: %prog [options] dir1 dir2 ... dirN') parser.add_option('-g', '--group', dest='group', help='post to a different group than the default', ) parser.add_option('-p', '--profile', dest='profile', action='store_true', default=False, help='run w... |
else: self._pointer += sent | def handle_write(self): #self.logger.debug('%d wants to write!', self._fileno) if not self.writable(): # We don't have any buffer, silly thing asyncore.poller.register(self._fileno, select.POLLIN) return sent = asyncore.dispatcher.send(self, self._writebuf[self._pointer:]) # We've run out of data if self._pointer == ... | |
self.logger.warning('%d: unknown response from server - "%s"', | self.logger.warning('%d: unknown response while MODE_AUTH - "%s"', | def handle_read(self): try: self._readbuf += self.recv(16384) except socket.error, msg: self.really_close(msg) return # Split the buffer into lines. Last line is always incomplete. lines = self._readbuf.split('\r\n') self._readbuf = lines.pop() # Do something useful here for line in lines: # Initial login stuff if se... |
post_title, filenum, len(files), real_filename, temp, parts | post_title, filenum, len(goodfiles), real_filename, temp, parts | def _gal_files(self, post_title, files, basepath=''): article_size = self.conf['posting']['article_size'] goodfiles = [] for filename in files: filepath = os.path.abspath(os.path.join(basepath, filename)) # Skip non-files and empty files if not os.path.isfile(filepath): continue if filename in self.conf['posting']['s... |
print len(self._writebuf) | def handle_write(self): #self.logger.info('%d wants to write!', self._fileno) if not self.writable(): # We don't have any buffer, silly thing #print '%d has no data!' % self._fileno asyncore.poller.register(self._fileno, select.POLLIN) return sent = asyncore.dispatcher.send(self, self._writebuf) self._writebuf = sel... | |
line = '=ypart begin=%d end=%d\r\n' % (begin, end) | line = '=ypart begin=%d end=%d\r\n' % (begin+1, end) | def build_article(self, postfile, article): (fileinfo, subject, partnum) = article # Read the chunk of data from the file f = self._files.get(fileinfo['filepath'], None) if f is None: self._files[fileinfo['filepath']] = f = open(fileinfo['filepath'], 'rb') begin = f.tell() data = f.read(self.conf['posting']['article_... |
msgid = '%.5f,%d@%s' % (time.time(), partnum, self.conf['server']['hostname']) | msgid = '%.5f.%d@%s' % (time.time(), partnum, self.conf['server']['hostname']) | def build_article(self, postfile, article): (fileinfo, subject, partnum) = article # Read the chunk of data from the file f = self._files.get(fileinfo['filepath'], None) if f is None: self._files[fileinfo['filepath']] = f = open(fileinfo['filepath'], 'rb') begin = f.tell() data = f.read(self.conf['posting']['article_... |
line = '=ybegin part=%d total=%d line=256 size=%d name=%s\r\n' % ( | line = '=ybegin part=%d total=%d line=128 size=%d name=%s\r\n' % ( | def build_article(self, postfile, article): (fileinfo, subject, partnum) = article # Read the chunk of data from the file f = self._files.get(fileinfo['filepath'], None) if f is None: self._files[fileinfo['filepath']] = f = open(fileinfo['filepath'], 'rb') begin = f.tell() data = f.read(self.conf['posting']['article_... |
self.parent._bytes += sent | def handle_write(self): #self.logger.debug('%d wants to write!', self._fileno) if not self.writable(): # We don't have any buffer, silly thing #print '%d has no data!' % self._fileno asyncore.poller.register(self._fileno, select.POLLIN) return sent = asyncore.dispatcher.send(self, self._writebuf) self._writebuf = se... | |
if len(self._writebuf) <= POST_BUFFER_MIN and self.mode == MODE_POST_DATA: self.post_data() | if self.mode == MODE_POST_DATA: self.parent._bytes += sent if len(self._writebuf) <= POST_BUFFER_MIN: self.post_data() | def handle_write(self): #self.logger.debug('%d wants to write!', self._fileno) if not self.writable(): # We don't have any buffer, silly thing #print '%d has no data!' % self._fileno asyncore.poller.register(self._fileno, select.POLLIN) return sent = asyncore.dispatcher.send(self, self._writebuf) self._writebuf = se... |
for newsgroup in self.newsgroup.split(',') | for newsgroup in self.newsgroup.split(','): | def generate_nzb(self): filename = 'newsmangler_%s.nzb' % (SafeFilename(self._current_dir)) nzbfile = open(filename, 'w') nzbfile.write('<?xml version="1.0" encoding="iso-8859-1" ?>\n') nzbfile.write('<!DOCTYPE nzb PUBLIC "-//newzBin//DTD NZB 1.0//EN" "http://www.newzbin.com/DTD/nzb/nzb-1.0.dtd">\n') nzbfile.write('<n... |
def render(self, request): """Intercept the normal rendering operations to check our stats target's modification time. If the browser already has a recent copy of this feed, we can get away without rendering at all. """ self.target.getMTime().addCallback( self._render, request ).addErrback(request.processingFailed) ret... | def parent(self): parentTarget = self.target.parent() if parentTarget: return self.__class__(self.component, parentTarget) | |
return tag('table', _class="columns")[[ tag('tr')[[ tag('td', _class="main")[ | return tag('table', _class="sectionGrid")[[ tag('tr', _class="sectionGrid")[[ tag('td', _class="sectionGrid")[ | def SectionGrid(*rows): """Create a grid of sections, for layouts showing a lot of small boxes in a regular pattern. """ # FIXME: this CSS is crufty return tag('table', _class="columns")[[ tag('tr')[[ tag('td', _class="main")[ cell ] for cell in row ]] for row in rows ]] |
window.hide() | window.destroy() | def close( window, event, user_data ): window.hide() |
f = getattr(self, 'param_'+tag.name, None) | f = getattr(self, 'param_'+tag.nodeName, None) | def loadParametersFrom(self, xml): """This is given a <formatter> element possibly containing extra parameters for the formatter to process and store. Any problems should be signalled with an XML.XMLValidityError. |
z = Numeric.matrixmultiply(inverse(A), b) | Ainv = inverse(A) z = [Numeric.matrixmultiply(Ainv, x) for x in b] | def spline(data, quality): """Return an interpolated trajectory from data. The returned value will be either an AMC object or a Numeric array, depending on what type the original data is. quality is the number of interpolated points to insert between each point in the initial data. """ # Special case: The input data is... |
self.backingPixmap.draw_drawable(self.get_style().fg_gc[gtk.STATE_NORMAL], self.backingPixmap, newPixels, 0, 0, 0, self.width - newPixels, self.height) | if self.useTemporaryPixmap: self.tempPixmap.draw_drawable(self.get_style().fg_gc[gtk.STATE_NORMAL], self.backingPixmap, newPixels, 0, 0, 0, self.width - newPixels, self.height) self.backingPixmap.draw_drawable(self.get_style().fg_gc[gtk.STATE_NORMAL], self.tempPixmap, 0, 0, 0, 0, self.width - newPixels, self.height) ... | def integrate(self, dt): """Update the graph, given a time delta from the last call to this function""" # Calculate the new gridPhase and the number of freshly exposed pixels, # correctly accounting for subpixel gridPhase changes. oldGridPhase = self.gridPhase self.gridPhase += dt * self.scrollRate newPixels = int(self... |
XML.bury(xml, "message", "body").appendChild(colorText) | XML.bury(xml, "message", "body").appendChild(xml.importNode(colorText, True)) | def command_Announce(self, project): """Old-style announcements: Announce <project> in the subject line. The body of the email contained the message's text, marked up with {color} tags but with no metadata. """ xml = XML.createRootNode() |
return "%s %s" % (self.score, self.identity) | return "%s : %s" % (self.score, self.identity) | def __str__(self): return "%s %s" % (self.score, self.identity) |
times = Numeric.arange(2, 3, 1. / quality) | times = Numeric.arange(2, 3, 1. / quality)[:-1] | def spline(data, quality): """Interpolate a trajectory using natural cubic splines. Arguments: data -- a list or AMC object containing the data to be interpolated quality -- the number of new points to insert between data points """ # Special case: The input data is an AMC object. For each bone in the AMC # object cre... |
map(f(z[degree][:4]), Numeric.arange(1, 2, 1. / quality)) | map(f(z[degree][:4]), Numeric.arange(1, 2, 1. / quality)[:-1]) | def spline(data, quality): """Interpolate a trajectory using natural cubic splines. Arguments: data -- a list or AMC object containing the data to be interpolated quality -- the number of new points to insert between data points """ # Special case: The input data is an AMC object. For each bone in the AMC # object cre... |
map(f(z[degree][-4:]), Numeric.arange(3, 4, 1. / quality)) | map(f(z[degree][-4:]), Numeric.arange(3, 4, 1. / quality)[:-1]) | def spline(data, quality): """Interpolate a trajectory using natural cubic splines. Arguments: data -- a list or AMC object containing the data to be interpolated quality -- the number of new points to insert between data points """ # Special case: The input data is an AMC object. For each bone in the AMC # object cre... |
raise MnetError("No response") | raise MnetError("No response: %s" % pktInfo) | def mnetSend(self, data, source=10, destination=2, timeout=0.2): """Sends a packet in the Citizen Explorer 'micronet' format, receives and validates a response, and returns the data. All data is expressed as a list of byte values. |
raise MnetError("Packet too short: %s" % retPacket) | raise MnetError("Packet too short: %s" % pktInfo) | def mnetSend(self, data, source=10, destination=2, timeout=0.2): """Sends a packet in the Citizen Explorer 'micronet' format, receives and validates a response, and returns the data. All data is expressed as a list of byte values. |
raise MnetError("Incorrect source/destination: %s" % retPacket) | raise MnetError("Incorrect source/destination: %s" % pktInfo) | def mnetSend(self, data, source=10, destination=2, timeout=0.2): """Sends a packet in the Citizen Explorer 'micronet' format, receives and validates a response, and returns the data. All data is expressed as a list of byte values. |
raise MnetError("Received too many bytes: %s" % retPacket) | raise MnetError("Received too many bytes: %s" % pktInfo) | def mnetSend(self, data, source=10, destination=2, timeout=0.2): """Sends a packet in the Citizen Explorer 'micronet' format, receives and validates a response, and returns the data. All data is expressed as a list of byte values. |
raise MnetError("Received too few bytes: %s" % retPacket) | raise MnetError("Received too few bytes: %s" % pktInfo) | def mnetSend(self, data, source=10, destination=2, timeout=0.2): """Sends a packet in the Citizen Explorer 'micronet' format, receives and validates a response, and returns the data. All data is expressed as a list of byte values. |
raise MnetError("Incorrect checksum: %s" % retPacket) | raise MnetError("Incorrect checksum: %s" % pktInfo) | def mnetSend(self, data, source=10, destination=2, timeout=0.2): """Sends a packet in the Citizen Explorer 'micronet' format, receives and validates a response, and returns the data. All data is expressed as a list of byte values. |
menuItems.append(Menu.Item(VideoSwitch.getInputDict()[channel])) | menuItems.append(VideoInput(channel)) | def __init__(self, book, hardware): self.hardware = hardware |
def onSelected(self, item): if self.hardware.mi6k: self.hardware.mi6k.vfd.powerOn() self.hardware.mi6k.vfd.writeScreen(item.icon.text) print item.icon.text | def onSelected(self, item): # Debuggative cruft if self.hardware.mi6k: self.hardware.mi6k.vfd.powerOn() self.hardware.mi6k.vfd.writeScreen(item.icon.text) print item.icon.text | |
self.inputVolume = 8e4 self.bars = None | self.reset() | def __init__(self): self.inputVolume = 8e4 self.bars = None |
alpha = 0.001 | alpha = 0.0025 | def transform(self, inputSignal): # Automatic gain control gain = 0.4e5 / self.inputVolume |
rw = RasterBargraph() self.mpav.onIdle = rw.clear | self.rw = RasterBargraph() self.mpav.onIdle = self.onIdle | def run(self): self.mpav = MPAVClient() rw = RasterBargraph() self.mpav.onIdle = rw.clear delayed = Delay(30, self.mpav.waitForBuffer) viz = Visualizer() while not self.stop: rw.writeBars(viz.transform(delayed())) rw.clear() |
viz = Visualizer() | self.viz = Visualizer() | def run(self): self.mpav = MPAVClient() rw = RasterBargraph() self.mpav.onIdle = rw.clear delayed = Delay(30, self.mpav.waitForBuffer) viz = Visualizer() while not self.stop: rw.writeBars(viz.transform(delayed())) rw.clear() |
rw.writeBars(viz.transform(delayed())) rw.clear() | self.rw.writeBars(self.viz.transform(delayed())) self.rw.clear() def onIdle(self): self.rw.clear() self.viz.reset() | def run(self): self.mpav = MPAVClient() rw = RasterBargraph() self.mpav.onIdle = rw.clear delayed = Delay(30, self.mpav.waitForBuffer) viz = Visualizer() while not self.stop: rw.writeBars(viz.transform(delayed())) rw.clear() |
def linear_interp (start, end, pos, len): | def linear_interp(start, end, pos, length): | def linear_interp (start, end, pos, len): result = [] for i in range (len (start)): compstart = start[i] compend = end[i] pos = compstart + ((compend - compstart) * (float(pos) / float(len))) result.append (pos) return result |
pos = compstart + ((compend - compstart) * (float(pos) / float(len))) result.append (pos) | pos = compstart + ((compend - compstart) * (float(pos) / float(length))) result.append(pos) | def linear_interp (start, end, pos, len): result = [] for i in range (len (start)): compstart = start[i] compend = end[i] pos = compstart + ((compend - compstart) * (float(pos) / float(len))) result.append (pos) return result |
for bone in paths.keys(): node = paths[bone][i] center = node.center () | for bone in paths[i].data.keys(): node = paths[i].data[bone] center = node.center | def build_order(asf): order = ['root'] pos = 0 while pos < len(order): for group in asf.hierarchy: if len(group) and group[0] == order[pos]: order.extend(group[1:]) pos += 1 return order |
position = linear_interp (rootstart, rootend, i, len (paths['root'])) | position = linear_interp (rootstart, rootend, i, len(paths)) | def build_order(asf): order = ['root'] pos = 0 while pos < len(order): for group in asf.hierarchy: if len(group) and group[0] == order[pos]: order.extend(group[1:]) pos += 1 return order |
sequence.insert (frame, index) | sequence.insert (frame, boundary) | def build_order(asf): order = ['root'] pos = 0 while pos < len(order): for group in asf.hierarchy: if len(group) and group[0] == order[pos]: order.extend(group[1:]) pos += 1 return order |
print "print step %i" % step | print "printing step %i" % step | def run (self): """Execute a heuristic search of a graph. Returns: A list of nodes that is the path from the source to the goal or ``None`` if there is no path. """ if self.path: return self.path |
self.xml.get_widget('RevertButton').set_sensitive(gtk.FALSE) self.xml.get_widget('ApplyButton').set_sensitive(gtk.FALSE) | self.xml.get_widget('RevertButton').set_sensitive(False) self.xml.get_widget('ApplyButton').set_sensitive(False) | def setCurrentURI(self, uri): """Change the current URI displayed by our editor""" self.currentURI = uri |
self.buffer.set_modified(gtk.FALSE) | self.buffer.set_modified(False) | def setCurrentURI(self, uri): """Change the current URI displayed by our editor""" self.currentURI = uri |
self.buffer.set_modified(gtk.FALSE) | self.buffer.set_modified(False) | def on_ApplyButton_clicked(self, button): """Send a modified ruleset to the server""" ruleset = self.buffer.get_text(*self.buffer.get_bounds()) self.client.setRuleset(ruleset, self.currentURI) self.buffer.set_modified(gtk.FALSE) |
self.factory.quit() reactor.stop() | if hasattr(self.factory, 'client'): self.factory.quit() reactor.stop() | def on_quit_activate(self, widget, data=None): self.factory.quit() reactor.stop() gtk.main_quit() |
print "pathsegments %r, treeDepth %r" % (pathSegments, treeDepth) | def findRootPath(self, request, additionalDepth=0): """Find the URL path referring to the root of the current stats tree The returned path begins and ends with a slash. | |
print self.test(key, capability), capability | def faultIfMissing(self, key, *capabilities): """Raise a fault if the given key doesn't match any of the given capabilities""" for capability in capabilities: print self.test(key, capability), capability if self.test(key, capability): return import xmlrpclib raise xmlrpclib.Fault("SecurityException", "One of the follow... | |
for i in range (n-1): col = 4 * i | for i in range (1, n): col = 4 * (i - 1) | def __createMatrices (self, data): """Generate the two matrices for the system of linear equations used to create the spline. """ n = len (data) - 1 |
cos = math.cos(self.rotation * math.pi / 180.0) sin = math.sin(self.rotation * math.pi / 180.0) | theta = self.rotation * math.pi / 180.0 cos = math.cos(theta) sin = math.sin(theta) | def transformBlenderObject(self, obj): """Set the transformation on the given Blender object to match our position, size, and rotation. This will be used both by the Box object and by other objects with similar interfaces that subclass Box. """ mat = Blender.Mathutils.Matrix( [self.size[0], 0, 0, ... |
print mat | self.position = list(mat.translationPart()) mat = mat.rotationPart() euler = mat.toEuler() self.rotation = euler[2] self.size = [ math.sqrt(mat[0][0]**2 + mat[0][1]**2 + mat[0][2]**2), math.sqrt(mat[1][0]**2 + mat[1][1]**2 + mat[1][2]**2), math.sqrt(mat[2][0]**2 + mat[2][1]**2 + mat[2][2]**2)] | def loadBlenderTransform(self, obj): """Retrieves the object's position, size, and rotation from a Blender object- the inverse of transformBlenderObject(). """ mat = obj.mat * self.world.getBlendToBzMatrix() print mat |
<autoHide><n:h1>Modified Files</n:h1><files/></autoHide> | <n:h1>Modified Files</n:h1><files/> | def component_log(self, element, args): """Convert the log message to HTML. If the message seems to be preformatted (it has some lines with indentation) it is stuck into a <pre>. Otherwise it is converted to HTML by replacing newlines with <br> tags and converting bulletted lists. """ log = XML.dig(args.message.xml, "m... |
if xmlFiles: for fileTag in XML.getChildElements(xmlFiles): if fileTag.nodeName == 'file': node = [None, fileTree] for segment in XML.shallowText(fileTag).split('/'): node = node[1].setdefault(segment, [None, {}]) node[0] = fileTag | for fileTag in XML.getChildElements(files): if fileTag.nodeName == 'file': node = [None, fileTree] for segment in XML.shallowText(fileTag).split('/'): node = node[1].setdefault(segment, [None, {}]) node[0] = fileTag | def component_files(self, element, args): """Format the contents of our <files> tag as a tree with nested lists""" from LibCIA.Web import Template |
uri = fileTag.getAttributeNS(None, 'uri') | uri = fileTag.getAttribute('uri') | def format_file(self, name, fileTag=None): """Given the short name of a file, and optionally its XML tag, return a Nouvelle-serializable representation. """ if fileTag: |
actionIcon = self.actionIcons.get(fileTag.getAttributeNS(None, 'action')) | actionIcon = self.actionIcons.get(fileTag.getAttribute('action')) | def format_file(self, name, fileTag=None): """Given the short name of a file, and optionally its XML tag, return a Nouvelle-serializable representation. """ if fileTag: |
result = self.app.server.debug.eval(self.app.key, source) | try: result = self.app.server.debug.eval(self.app.key, source) except socket.error: print "Communications Error: %s" % sys.exc_info()[1] return False | def runsource(self, source, filename=None): result = self.app.server.debug.eval(self.app.key, source) if result is False: return True else: sys.stdout.write(result) if result and result[-1] != '\n': sys.stdout.write('\n') return False |
Security.User(key=key).getCapabilities().addCallback( self._makeCapabilityList, result).addErrback( result.errback) | if key: Security.User(key=key).getCapabilities().addBoth( self._makeCapabilityList, result) else: result.callback([]) | def makeCapabilityList(self, key): result = defer.Deferred() Security.User(key=key).getCapabilities().addCallback( self._makeCapabilityList, result).addErrback( result.errback) return result |
if caps: | if type(caps) is list: | def _makeCapabilityList(self, caps, result): if caps: result.callback([ "Available capabilities:", tag('ul')[[ tag('li')[ cap ] for cap in caps ]], ]) else: result.callback([]) |
import IRC self.formatter = IRC.ColortextFormatter() | from IRC.Formatting import ColortextFormatter self.formatter = ColortextFormatter() | def __init__(self): import IRC self.formatter = IRC.ColortextFormatter() |
import IRC return IRC.format(CommitFormatter.format_author(self, author), 'green') | from IRC.Formatting import format return format(CommitFormatter.format_author(self, author), 'green') | def format_author(self, author): import IRC return IRC.format(CommitFormatter.format_author(self, author), 'green') |
import IRC return IRC.format(str(version).strip(), 'bold') | from IRC.Formatting import format return format(str(version).strip(), 'bold') | def format_version(self, version): import IRC return IRC.format(str(version).strip(), 'bold') |
import IRC return 'r' + IRC.format(str(rev).strip(), 'bold') | from IRC.Formatting import format return 'r' + format(str(rev).strip(), 'bold') | def format_revision(self, rev): import IRC return 'r' + IRC.format(str(rev).strip(), 'bold') |
import IRC return IRC.format(CommitFormatter.format_module(self, module), 'aqua') | from IRC.Formatting import format return format(CommitFormatter.format_module(self, module), 'aqua') | def format_module(self, module): import IRC return IRC.format(CommitFormatter.format_module(self, module), 'aqua') |
import IRC return IRC.format(CommitFormatter.format_branch(self, branch), 'orange') | from IRC.Formatting import format return format(CommitFormatter.format_branch(self, branch), 'orange') | def format_branch(self, branch): import IRC return IRC.format(CommitFormatter.format_branch(self, branch), 'orange') |
import IRC return "%s%s %s" % (" ".join(metadata), IRC.format(':', 'bold'), log) | from IRC.Formatting import format return "%s%s %s" % (" ".join(metadata), format(':', 'bold'), log) | def joinMessage(self, metadata, log): import IRC return "%s%s %s" % (" ".join(metadata), IRC.format(':', 'bold'), log) |
import IRC prefix = IRC.format("%s:" % message.xml.source.project, 'bold') + " " | from IRC.Formatting import format prefix = format("%s:" % message.xml.source.project, 'bold') + " " | def format(self, message, input): if not input: return if message.xml.source and message.xml.source.project: import IRC prefix = IRC.format("%s:" % message.xml.source.project, 'bold') + " " return "\n".join([prefix + line for line in input.split("\n")]) else: return input |
if __name__ == "__main__": s = Spline ((0, 1, 4)) print s.interpolate (4) | class BoneSpline: """A class for interpolating a single bone from an AMC file.""" def __init__ (self, bone): self.data = bone self.splines = [] for i in range (Numeric.size (bone, 1)): self.splines.append (Spline (self.data[,i])) def interpolate (self, points): smoothed = [] for spline in splines: smoothed.append (s... | def interpolate (self, points): """Return a list representing the interpolated data with `points' additional inserted inbetween the data. """ step = 1. / (points + 1) smoothed = [self.data[0]] |
result.callback([xml(content) for id, content in messages]) | result.callback([self.formatItem(content) for id, content in messages]) def formatItem(self, content): if content.startswith("<?"): content = content.split(">", 1)[1] return xml(content) | def formatItems(self, messages, context, result): result.callback([xml(content) for id, content in messages]) |
fullPath = os.path.join(self.path, event.filename) | fullPath = os.path.join(self.path, filename) | def onMonitorEvent(self, event): code = event.code2str() |
del self.dirCache[event.filename] | del self.dirCache[filename] | def onMonitorEvent(self, event): code = event.code2str() |
self.dirCache[event.filename] = self.getChild(event.filename).fileHandle | self.dirCache[filename] = self.getChild(filename).fileHandle | def onMonitorEvent(self, event): code = event.code2str() |
"brown" : "\x0305", | "light red" : "\x0304", "dark red" : "\x0305", | def msg(self, server, channel, text): """Send text to the given channel on the given server. This will generate an exception if the server and/or channel isn't currently occupied by one of our bots. Multiple lines of text are split into multiple IRC messages. """ for line in text.split("\n"): self.servers[tuple(server)... |
self.assertEqual(b, Numeric.reshape( Numeric.array([[1,2,2,4,4,7,0,0,0,0,0,0], [3,3,3,2,2,5,0,0,0,0,0,0]]), (12,2))) | self.assertEqual(b, self.b) | def testMatrices(self): """Test the creation of matrices""" A, b = Interpolate._getMatrix(self.data, 2) self.assertEqual(b, Numeric.reshape( Numeric.array([[1,2,2,4,4,7,0,0,0,0,0,0], [3,3,3,2,2,5,0,0,0,0,0,0]]), (12,2))) self.assertEqual(A, self.A) |
glColor(1, 1, 1, 0.5) | glColor(1, 1, 1, 0.2) | def setup(self): video_flags = OPENGL|DOUBLEBUF |
pass | weight = 0 path = [] adjacency = graph.representations[AdjacencyList] v = None u = random.choice ([u for u in adjacency.iterU ()]) path.append (u.center ()) for i in range (len): for edge in adjacency.query (u): if edge.weight >= weight: v = edge.v weight = edge.weight path.append (v.center ()) u = v weight = 0 ret... | def clicheWalk (graph, len): """Find a path in graph of length len by following the edges with the highest probabilities. """ pass |
parser.add_option ("--cliche", dest="cliche", default=false, | parser.add_option ("--cliche", dest="cliche", default=False, | def randomWalk (graph, len): """Find a path in graph of langth len by following a random edge.""" pass |
graphs = pickle.load (open (args[1])) | graphs = pickle.load (open (args[0])) bones = {} for bone in graphs.keys (): if opts.cliche: bones[bone] = clicheWalk (graphs[bone], opts.len) else: bones[bone] = randomWalk (graphs[bone], opts.len) print bones | def randomWalk (graph, len): """Find a path in graph of langth len by following a random edge.""" pass |
def MessageFormat(self, user, msg, action=False): ''' Format an incoming message. ''' text = '' | def __init__(self): ''' Create the layout tree from the .glade file and connect everything. ''' self.tree = gtk.glade.XML('palantirMain.glade') | |
text = self.MessageFormat(user, msg, True) | nick = '* ' + self.GetNick(user) if self.tree.get_widget('time_stamps').get_active(): time = self.GetFormattedTime() else: time = '' if msg.find(self.factory.nickname) is not -1: addressed = True else: addressed = False self.chatWindow.DisplayText(time, nick, msg, addressed) | def meReceive(self, user, channel, msg): ''' When someone does a '/me' display the action. ''' text = self.MessageFormat(user, msg, True) #self.PrintText(text) |
text = self.MessageFormat(None, oldNick + ' is now known as ' + newNick) | if self.tree.get_widget('time_stamps').get_active(): time = self.GetFormattedTime() else: time = '' self.chatWindow.DisplayText(time, '', oldNick + ' is now known as ' + newNick) | def nickReceive(self, oldNick, channel, newNick): ''' When someone changes a nick display it. ''' text = self.MessageFormat(None, oldNick + ' is now known as ' + newNick) #self.PrintText(text) |
print messages | def ctcpReceive(self, user, channel, messages): nick = re.search('([^!]*).*', user).group(1) # If the ctcp message is a dice roll format the message to display the roll. if 'ROLL' in messages[0]: data = re.search('(\[.*\]) ([0-9]*) ([0-9]*)', messages[0][1]) text = nick + ' rolled a ' + str(len(data.group(1).split())) ... | |
def PrintText(self, text): ''' Print the text in the chat buffer. ''' print text | def PrintText(self, text): ''' Print the text in the chat buffer. ''' print text | |
self.PrintText(time + 'You rolled a ' + str(len(rolls)) + 'd' + str(sides) + ': ' + str(rolls) + ' => ' + str(total) + '\n') | self.chatWindow.DisplayText(time, '', 'You rolled a ' + str(len(rolls)) + 'd' + str(sides) + ': ' + str(rolls) + ' => ' + str(total) + '\n') | def SendRoll(self, times, sides, rolls, total): ''' Implemented for the DieRoller used when loading character sheets. Sends a CTCP to the channel with the roll information and displays the information on your |
path.append (u.center ()) | path.append (u.center) | def clicheWalk (graph, len): """Find a path in graph of length len by following the edges with the highest probabilities. """ weight = 0 path = [] adjacency = graph.representations[AdjacencyList] v = None u = random.choice ([u for u in adjacency.iterU ()]) path.append (u.center ()) for i in range (len): for edge in a... |
help="Set length of paths") | type="int", help="Set length of paths") | def randomWalk (graph, len): """Find a path in graph of langth len by following a random edge.""" pass |
paths = MotionGraph.search_graphs (graphs, starts, ends, opts.depth) | paths = algorithms_c.aStarSearch (adjacency, starts, ends, f) | def linear_interp (start, end, pos, len): result = [] for i in range (len (start)): compstart = start[i] compend = end[i] pos = compstart + ((compend - compstart) * (float(pos) / float(len))) result.append (pos) return result |
while self.updater.isAlive(): self.updater.stop = True | while self.thread.isAlive(): self.thread.stop = True | def shutdown(self): while self.updater.isAlive(): self.updater.stop = True time.sleep(0.1) |
""" def __init__(self, graph, channels, autoColor=True, valueUpdateInterval=50): | If valueUpdateInterval is specified, the channel values are displayed in the list and updated every valueUpdateInterval milliseconds. """ def __init__(self, graph, channels, autoColor=True, valueUpdateInterval=None): | def initGrid(self, drawable, width, height): """Draw a grid to the given drawable at the given size""" drawable.draw_rectangle(self.bgGc, gtk.TRUE, 0, 0, width, height) |
self.oldValueStr = {} for channel in self.channels: self.oldValueStr[channel] = None self.updateValues() self.valueUpdateTimeout = gtk.timeout_add(self.valueUpdateInterval, self.updateValues) | if self.valueUpdateInterval: self.oldValueStr = {} for channel in self.channels: self.oldValueStr[channel] = None self.updateValues() self.valueUpdateTimeout = gtk.timeout_add(self.valueUpdateInterval, self.updateValues) | def fillModel(self): """Fills the model with data, must be called after self.window is valid""" for channel in self.channels: i = self.model.append() self.model.set(i, 0, channel, 1, str(channel), 2, gtk.FALSE, 3, gtk.TRUE, 4, self.makeColorSamplePixbuf(channel), 5, "", |
self.append_column(gtk.TreeViewColumn("Value", gtk.CellRendererText(), text=5)) | if self.valueUpdateInterval: self.append_column(gtk.TreeViewColumn("Value", gtk.CellRendererText(), text=5)) | def initView(self): """Initializes all columns in the model viewed by this class""" # Read/write toggle for channel visibility renderer = gtk.CellRendererToggle() renderer.connect('toggled', self.visibilityToggleCallback, self.model) self.append_column(gtk.TreeViewColumn("Visible", renderer, active=2, activatable=3)) |
If the supplied graph is None, this creates a default HScrollLineGraph instance. """ def __init__(self, channels, graph=None): | If the supplied graph is None, this creates a default HScrollLineGraph instance. Automatically generates new colors for each channel if autoColor is true. If valueUpdateInterval is specified, the channel values are displayed in the list and updated every valueUpdateInterval milliseconds. """ def __init__(self, channel... | def updateValues(self): """Update the 'value' column for all channels""" row = 0 for channel in self.channels: s = str(channel.strValue()) # Only set the model value if our string has changed if s != self.oldValueStr[channel]: i = self.model.get_iter(row) self.model.set_value(i, 5, s) self.oldValueStr[channel] = s row ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.