rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
print ' depth = %2d, match!' % i
print ' depth = %2d, match!' % i + 1
def search_graphs (graphs, starts, ends, depth): paths = {} for bone in graphs.keys(): print ' searching',bone adjacency = graphs[bone].representations[AdjacencyList] edges = graphs[bone].representations[EdgeList] paths[bone] = algorithms_c.depthLimitedSearch (adjacency, edges, starts[bone], ends[bone], depth) ...
print ' depth = %2d, coverage = %2d/%2d, no match' % (i, coverage, len (graphs.keys ()))
print ' depth = %2d, coverage = %2d/%2d, no match' % (i + 1, coverage, len (graphs.keys ()))
def search_graphs (graphs, starts, ends, depth): paths = {} for bone in graphs.keys(): print ' searching',bone adjacency = graphs[bone].representations[AdjacencyList] edges = graphs[bone].representations[EdgeList] paths[bone] = algorithms_c.depthLimitedSearch (adjacency, edges, starts[bone], ends[bone], depth) ...
if new_prob > EPSILON and probability > 0.01:
if new_prob > EPSILON and probability > 0.15:
def find(list, item): for i in range(len(list)): if list[i] == item: return i return -1
<n:p style='padding: 0em; margin: 0.5em 0em;'>
<n:div style='padding: 0em; margin: 0.5em 0em;'>
def format(self, args): log = XML.dig(args.message.xml, "message", "body", "commit", "log") if log: return Util.extractSummary(log)
</n:p>
</n:div>
def format(self, args): log = XML.dig(args.message.xml, "message", "body", "commit", "log") if log: return Util.extractSummary(log)
content.append(tag('ul')[[ tag('li')[item] for item in listItems ]])
content = [ tag('p')[ content ], tag('ul')[[ tag('li')[item] for item in listItems ]], ]
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...
<n:p class='messageBody'><log/></n:p>
<n:div class='messageBody'><log/></n:div>
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...
re.compile (r'^start\W+([\w,]*)$'): setStart, \ re.compile (r'^end\W+([\w,]*)$'): setEnd}
re.compile (r"^start:\s+(.*)$"): setStart, \ re.compile (r"^end:\s+(.*)$"): setEnd}
def setEnd (match): global end end = match.group (1)
if start and end: start = eval (start) end = eval (end)
def setEnd (match): global end end = match.group (1)
[self.size[0], 0, 0, 0], [0, self.size[1], 0, 0], [0, 0, self.size[2], 0], [0, 0, 0, 1])
[size[0], 0, 0, 0], [0, size[1], 0, 0], [0, 0, size[2], 0], [0, 0, 0, 1])
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. """ if not self.world: return
Blender.Mathutils.Vector(self.position))
Blender.Mathutils.Vector(position))
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. """ if not self.world: return
byte = byte | (1<<y)
byte = byte | (1<<(7-y))
def encodePattern(self, pattern): w = len(pattern[0]) bytes = [] for x in xrange(w): byte = 0 for y in xrange(8): if pattern[y][x] != " ": byte = byte | (1<<y) bytes.append(chr(byte)) return "".join(bytes)
return "%s %s" % (IRCColor.format("%s:" % message.xml.source.project, 'bold'), input)
prefix = IRCColor.format("%s:" % message.xml.source.project, 'bold') + " " return "\n".join([prefix + line for line in input.split("\n")])
def format(self, message, input): import IRCColor return "%s %s" % (IRCColor.format("%s:" % message.xml.source.project, 'bold'), input)
if search.match: done = True if done:
if not search.match: match = False if match:
def search (self): bfsObjects = {} for key in self.starts.keys (): start = self.starts[key] end = self.ends[key] bfsObjects[key] = ParallelBFSSearch (key, start, end)
laststep = self.paths self.paths = [] for path in laststep:
newpaths = [] for path in self.paths:
def step (self): laststep = self.paths self.paths = [] for path in laststep: node = path[-1] for edge in self.adjacency.query (node): if edge.u is node: self.paths.append (path + edge.v)
self.paths.append (path + edge.v)
newpaths.append (list (path + [edge.v])) print 'added path', newpaths[-1] self.paths = newpaths
def step (self): laststep = self.paths self.paths = [] for path in laststep: node = path[-1] for edge in self.adjacency.query (node): if edge.u is node: self.paths.append (path + edge.v)
print 'looking at path', path, ' probability is', pathProbability
def getBestPath (self): bestProbability = 0.0 bestPath = None
index += len(self.callables)
index += len(self.callables) + 1
def observe(self, callback, index=-1): """Call the supplied calllback with the same arguments when this event is called. Callbacks are referenced weakly, so their observation ends when the callback is not used anywhere else.
index += len(self.callables)
index += len(self.callables) + 1
def strongObserve(self, callback, index=-1): """Like observe(), but use a normal reference rather than a weak ref. This is necessary for using lambdas or other types of temporary functions as obsrvers. The only way for these observers to be removed is explicitly calling unobserve(). """ if not self.clients.has_key(hash...
self.general = GenPrefs(self.tree) self.general.Set(self.prefs)
def __init__(self, tree): self.tree = tree dialog = tree.get_widget('Preferences') self.SetUpNav()
navigation.append_column(gtk.TreeViewColumn('Pages', gtk.CellRendererText(), text=1))
navigation.append_column(gtk.TreeViewColumn('Pages', cell, text=0))
def SetUpNav(self): ''' SetUpNav creates the list of pages in the navigation list from the pages in the notebook. ''' navigation = self.tree.get_widget('prefs navigation') notebook = self.tree.get_widget('pref notebook')
print num, pageName
store.set(store.append(), 0, pageName)
def SetUpNav(self): ''' SetUpNav creates the list of pages in the navigation list from the pages in the notebook. ''' navigation = self.tree.get_widget('prefs navigation') notebook = self.tree.get_widget('pref notebook')
graph["root"].representations[EdgeList],
def f (path, goal): """Calculate the f-cost of a path""" # cost of current path g = len (path) h = 0 # cost to goal h = len (algorithms_c.dijkstraSearch (adjacency, path[-1], goal)) return g + h
'<colorText><color bg="dark blue"><color fg="yellow"><b>hello</b></color></color><u> world</u></colorText>'
"<colorText><color bg='dark blue'><color fg='yellow'><b>hello</b></color></color><u> world</u></colorText>"
def reverseVideo(self): """Swap foreground and background colors""" self.fgColor, self.bgColor = self.bgColor, self.fgColor
'<colorText>&lt;b&gt;</colorText>'
'<colorText>&lt;b></colorText>'
def reverseVideo(self): """Swap foreground and background colors""" self.fgColor, self.bgColor = self.bgColor, self.fgColor
def __init__(self):
def __init__(self, nickFormat):
def __init__(self): self.requests = []
self.gcBots()
def msg(*args): pass
def __init__(self): self.requests = []
protocol, hostname, port = req.host
port = req.host[2] hostname = req.getRequestHostname()
def getURL(self, context): # Make this an absolute URL- currently it's required for # links placed in the RSS and XML feeds, and won't # hurt elsewhere. req = context['request'] protocol, hostname, port = req.host if req.isSecure(): default = 443 else: default = 80 if port == default: hostport = '' else: hostport = ':%...
print self.model
def reset(self): """Reset I/O-related registers to their power-on state. Automatically called in AvailableDevice.open() unless the 'reset' flag is set to False. """ rcpod_Reset(self.dev)
devices = []
del devices[:]
def scanForDevices(): """Scans for available rcpod devices, updates the 'devices' list""" global devices pyrcpod_findDevices() # Convert librcpod's linked list into a python list, wrapping # each device in an AvailableDevice instance llist = rcpod_GetDevices() devices = [] while llist: devices.append(AvailableDevice(l...
return bool(cursor.execute(self._createTestQuery(_getUid(cursor, key), capabilities)))
return bool(cursor.execute(self._createTestQuery(self._getUid(cursor), capabilities)))
def _test(self, cursor, *capabilities): return bool(cursor.execute(self._createTestQuery(_getUid(cursor, key), capabilities)))
return Database.pool.runInteraction(self._getCapabilities, uid)
return Database.pool.runInteraction(self._getCapabilities)
def getCapabilities(self): """Return a list of capability names (strings) that this user has, via a Deferred""" return Database.pool.runInteraction(self._getCapabilities, uid)
class StaticJoiner(static.File):
class File(static.File): """A local subclass of static.File that overrides the default MIME type map""" print static.File.contentTypes contentTypes = { '.png': 'image/png', '.ico': 'image/png', '.jpeg': 'image/jpeg', '.jpg': 'image/jpeg', '.gif': 'image/gif', '.xml': 'text/xml', '.html': 'text/html', '.css'...
def process(self): # Count this request, yay server.Request.process(self) self.site.requestCount += 1
def __init__(self, path, indexPage, defaultType="text/html", ignoredExts=(), registry=None, allowExt=0):
def __init__(self, path, indexPage, defaultType = "text/plain", ignoredExts = (), registry = None, allowExt = 0):
def __init__(self, path, indexPage, defaultType="text/html", ignoredExts=(), registry=None, allowExt=0): self.indexPage = indexPage static.File.__init__(self, path, defaultType, ignoredExts, registry, allowExt)
f = static.File(path, self.defaultType, self.ignoredExts, self.registry)
f = File(path, self.defaultType, self.ignoredExts, self.registry)
def createSimilarFile(self, path): f = static.File(path, self.defaultType, self.ignoredExts, self.registry) f.processors = self.processors f.indexNames = self.indexNames[:] return f
path='/gallery/gallery_remote2.php'):
path='/gallery/gallery_remote2.php', proxy=None):
def __init__(self, host, username, password, path='/gallery/gallery_remote2.php'): self.host = host self.path = path self.cookies = {} self.http = ProxyConnection(host) self.login(username, password)
self.http = ProxyConnection(host)
if proxy: self.http = ProxyConnection(host, proxy) else: self.http = httplib.HTTPConnection(host)
def __init__(self, host, username, password, path='/gallery/gallery_remote2.php'): self.host = host self.path = path self.cookies = {} self.http = ProxyConnection(host) self.login(username, password)
userfile=(name + ".jpeg", "image/jpeg", data))
userfile=(name, "image/jpeg", data))
def add(self, album, name, data): self.command('add-item', set_albumName=album, userfile=(name + ".jpeg", "image/jpeg", data))
if 1: import camera, appuifw, e32
def upload(inpath, outpath, host, username, password, gallery, proxy=None): print "Logging in..." g = Gallery(host, username, password, proxy=proxy) print "Gallery connected"
def encodeMultipartFormdata(kw): """This is from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306, slightly modified. Encode a MIME multipart/form-data message from a dictionary of keywords. Normal fields have a string value, filenames should have a (filename, mime-type, data) tuple. """ BOUNDARY = '-----...
print "Taking photo..." photo = camera.take_photo() print "Resizing and saving" savedRes = (320, 240) name = time.strftime("%Y%m%d-%H%M%S") path = "E:\\Images\\gallery-%s.jpg" % name photo.resize(savedRes).save(path) del photo print "Logging in..." g = Gallery("zero.navi.cx", "admin", "password-goes-here") print "Gal...
for file in os.listdir(inpath): print "Sending %r" % file g.add(gallery, file, open(os.path.join(inpath, file)).read()) print "Moving %r to %r" % (file, outpath) os.rename(os.path.join(inpath, file), os.path.join(outpath, file))
def encodeMultipartFormdata(kw): """This is from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306, slightly modified. Encode a MIME multipart/form-data message from a dictionary of keywords. Normal fields have a string value, filenames should have a (filename, mime-type, data) tuple. """ BOUNDARY = '-----...
self.center.append (maxs[i] - mins[i])
self.center.append (mins[i] + (maxs[i] - mins[i]) / 2.0)
def __init__ (self, mins, maxs): self.mins = mins self.maxs = maxs self.center = []
def center (self): return self.center
def inside (self, point): if len (point) != len (self.mins): raise AttributeError ("dimension doesn't match! %d vs %d" % (len (point), len (self.mins))) for i in range (len (point)): if point[i] < self.mins[i] or point[i] > self.maxs[i]: return False return True
def __init__(self, server, selectionCallback, updateInterval=60*10):
def __init__(self, server, selectionCallback):
def __init__(self, server, selectionCallback, updateInterval=60*10): gtk.Menu.__init__(self) self.server = server self.columns = ColumnSet() self.widgets = [] self.selectionCallback = selectionCallback self.updateInterval = updateInterval
self.updateInterval = updateInterval
def __init__(self, server, selectionCallback, updateInterval=60*10): gtk.Menu.__init__(self) self.server = server self.columns = ColumnSet() self.widgets = [] self.selectionCallback = selectionCallback self.updateInterval = updateInterval
reactor.callLater(self.updateInterval, self.updateSources)
def updateSources(self): self.retrievingSources.show() self.server.iterSources().addCallback(self.setSources) reactor.callLater(self.updateInterval, self.updateSources)
if content.startswith("<?"): content = content.split(">", 1)[1] return xml(content)
return xml(XML.toString(content.childNodes[0]))
def formatItem(self, content): # Format one message. The hackishness here chops off XML declarations # if they are present. It would be much cleaner but much slower to use the DOM for this. if content.startswith("<?"): content = content.split(">", 1)[1] return xml(content)
print prevTarget, target
def message(self, uri, message, content): """Appends 'content' to the path represented by the given URI and delivers a message to its associated stats target.
query = [int(random.uniform(dataset[0], dataset[-1]) + 0.5)
query = [int(random.uniform(dataset[0] - 100, dataset[-1] + 200) + 0.5)
def test_fid(dataset, fd): query = [int(random.uniform(dataset[0], dataset[-1]) + 0.5) for i in xrange(1000)] query.sort() while 1: r1 = _fidtool.query_samples(fd, query) r2 = [reference_query(dataset, q) for q in query] if r1 == r2: print "Success" elif len(r1) != len(r2): print "Failure, len(r1)=%d, len(r2)=%d" % (l...
break
def test_fid(dataset, fd): query = [int(random.uniform(dataset[0], dataset[-1]) + 0.5) for i in xrange(1000)] query.sort() while 1: r1 = _fidtool.query_samples(fd, query) r2 = [reference_query(dataset, q) for q in query] if r1 == r2: print "Success" elif len(r1) != len(r2): print "Failure, len(r1)=%d, len(r2)=%d" % (l...
dataset = map(int, open("cia-commits.dataset"))[2000:2020]
def test_fid(dataset, fd): query = [int(random.uniform(dataset[0], dataset[-1]) + 0.5) for i in xrange(1000)] query.sort() while 1: r1 = _fidtool.query_samples(fd, query) r2 = [reference_query(dataset, q) for q in query] if r1 == r2: print "Success" elif len(r1) != len(r2): print "Failure, len(r1)=%d, len(r2)=%d" % (l...
self.rulesets[channel, server] = minidom.parseString(ruleset).getElementsByTagName('ruleset')[0]
def on_RulesetDialogOk_clicked(self, button): # Create the new ruleset according to our dialog's settings if self.xml.get_widget("AllProjects").get_active(): # All projects ruleset = '<ruleset>\n\t<formatter medium="irc"/>\n\t<formatter name="IRCProjectName"/>\n</ruleset>' elif self.xml.get_widget("SingleProject").get_...
if size:
if size is None: received = self.readBuffer self.readBuffer = '' try: while 1: received += self.recv(bufferSize) except Errors.ConnectionLost: pass return received elif size != 0:
def read(self, size=None, bufferSize=64*1024): if size: # Read the amount specified, first from our # local read buffer then from the socket itself. # If we can't read the complete packet, return # None and keep the partial packet buffered. received = self.readBuffer[:size] while len(received) < size: chunk = self.sock...
chunk = self.socket.recv(size - len(received))
chunk = self.recv(size - len(received))
def read(self, size=None, bufferSize=64*1024): if size: # Read the amount specified, first from our # local read buffer then from the socket itself. # If we can't read the complete packet, return # None and keep the partial packet buffered. received = self.readBuffer[:size] while len(received) < size: chunk = self.sock...
received = self.readBuffer self.readBuffer = '' while 1: buffer = self.socket.recv(bufferSize) if not buffer: break received += buffer return received
return ''
def read(self, size=None, bufferSize=64*1024): if size: # Read the amount specified, first from our # local read buffer then from the socket itself. # If we can't read the complete packet, return # None and keep the partial packet buffered. received = self.readBuffer[:size] while len(received) < size: chunk = self.sock...
if host.find(":"):
if host.find(":") >= 0:
def connect(self, host, port=None): """The port can be specified either as part of the host using a hostname:port format, or as a separate argument. A port included in the host overrides the port in the arguments if present, so you can treat the port argument as a default. """ if host.find(":"): (host, port) = host.spl...
try: self.handler(self, eventLoop) except socket.error: pass
self.handler(self, eventLoop)
def poll(self, eventLoop): """This is designed for event driven programming with one or more sockets. The event loop should call this method when it detects activity on the socket, then this method will call the current socket handler. If there really wasn't any data available (assuming this is a nonblocking socket) it...
body = self.read(header.length) if not body: self.unread(header) return None
if header.length > 0: body = self.read(header.length) if not body: self.unread(header) return None else: body = ''
def readMessage(self): header = self.readStruct(Common.MessageHeader) if not header: return None body = self.read(header.length) if not body: # Save the header for later if we can't read the body yet self.unread(header) return None try: msgClass = Common.getMessageDict()[header.id] except KeyError: raise Errors.Protoco...
(iwtd, owtd, ewtd) = select.select(selectables, [], selectables)
(iwtd, owtd, ewtd) = select.select(selectables, [], [])
def run(self, sockets): self.running = 1
self.archive_name = os.path.join(self.catalogDir, self.name)
self.archive_name = os.path.join(Catalog.catalogDir, self.name)
def __init__(self, paths): self.paths = paths self.name = self._getName() self.temp_name = "/tmp/navi_backup_%r.catalog" % os.getpid() self.cd_name = os.path.join("catalog", self.name) self.archive_name = os.path.join(self.catalogDir, self.name)
print taps
def fft_loop(input, *outputs): # Frequency tap indices for each bar s = 20 taps = (exp(arange(0, 1, 0.07)) * s - s).astype(Int) print taps bars = None while 1: # Read the audio, take an FFT of the left channel audio = delayed() fft = abs(FFT.real_fft(audio[0])) # Scale down the frequency axis nicely by integrating, ...
sb = SDLBargraph()
def fft_loop(input, *outputs): # Frequency tap indices for each bar s = 20 taps = (exp(arange(0, 1, 0.07)) * s - s).astype(Int) print taps bars = None while 1: # Read the audio, take an FFT of the left channel audio = delayed() fft = abs(FFT.real_fft(audio[0])) # Scale down the frequency axis nicely by integrating, ...
fft_loop(delayed, rw.writeBars, sb.writeBars)
fft_loop(delayed, rw.writeBars)
def fft_loop(input, *outputs): # Frequency tap indices for each bar s = 20 taps = (exp(arange(0, 1, 0.07)) * s - s).astype(Int) print taps bars = None while 1: # Read the audio, take an FFT of the left channel audio = delayed() fft = abs(FFT.real_fft(audio[0])) # Scale down the frequency axis nicely by integrating, ...
if not self.config['preserve-namespace']: self.server.debug.resetInterpreter(self.key)
if self.config['eval'] or self.config['console']: if not self.config['preserve-namespace']: self.server.debug.resetInterpreter(self.key)
def main(self): if self.config['rebuild']: self.server.debug.rebuild(self.key, self.config['rebuild'])
self.editScroller.add(frame)
self.editScroller.add_with_viewport(frame)
def __init__(self, node, character): hbox.__init__(self, node, character) #self.menu = []
metadata.remove(self.key, self.config['path'], [self.config['dataKey']])
metadata.remove(self.key, self.config['path'], self.config['dataKey'])
def main(self): metadata = self.server.stats.metadata
hour, min, sec = palantir.getTime() time = '[' + hour + ':' + min + ':' + sec + ']'
time = palantir.getTime()
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
time = ''
time = None
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
' => '+str(total)+'\n')
' => '+str(total))
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
self.axes[event.code] += event.value
self.axes[event.code] = self.axes.get(event.code, 0) + event.value
def update_EV_REL(self, event): self.axes[event.code] += event.value
else:
elif not active and self.active:
def eventhandler(self, event=None, menuw=None, arg=None): if plugin.isevent(event) == 'UVSWITCH': active = event.arg and self.channel in event.arg if active and not self.active: # Our input has just been enabled, add a menu item self.addItem(menuw, VideoInputItem(self)) else: # Out input has been disabled self.removeIt...
self.unselect(menuw)
self.unselect()
def eventhandler(self, event, menuw=None): if event == "MENU_BACK_ONE_MENU": self.unselect(menuw)
def unselect(self, menuw):
def unselect(self):
def unselect(self, menuw): rc.app(None) menuw.show() self.switch.reset()
menuw.show()
self.menuw.show()
def unselect(self, menuw): rc.app(None) menuw.show() self.switch.reset()
def requestPage(url, site=None): """Simulate an HTTP request given a Site object and the URL to request. Returns a string with the response, via a Deferred. """ if site is None: site = getSingleton("Site") io = StringIOWithoutClosing() wrapper = protocol.FileWrapper(io) result = defer.Deferred() def storeResult(): res...
def requestPage(url, site=None): """Simulate an HTTP request given a Site object and the URL to request. Returns a string with the response, via a Deferred. """ if site is None: site = getSingleton("Site") io = StringIOWithoutClosing() wrapper = protocol.FileWrapper(io) result = defer.Deferred() def storeResult(): res...
print start, end
if bone == 'root': start = start[3:6] end = end[3:6]
def find_node (graph, pos): vertex_map = graph.representations[VertexMap] for vertex in vertex_map: if vertex.inside (pos): return vertex
return "<files>%s</files>" % ''.join(["<file>%s</file>" % file for file in self.files])
return "<files>%s</files>" % \ ''.join(["<file>%s</file>" % file for file in self.files])
def makeFileTags(self): """Return XML tags for our file list""" return "<files>%s</files>" % ''.join(["<file>%s</file>" % file for file in self.files])
return os.popen('svnlook %s -r "%s" "%s"' % (command, self.revision, self.repository)).read()
return os.popen('svnlook %s -r "%s" "%s"' % \ (command, self.revision, self.repository)).read()
def svnlook(self, command): """Run the given svnlook command on our current repository and revision, returning all output""" return os.popen('svnlook %s -r "%s" "%s"' % (command, self.revision, self.repository)).read()
if boundary == 1: continue;
def find_node (graph, pos): vertex_map = graph.representations[VertexMap] for vertex in vertex_map: if vertex.inside (pos): return vertex
version = '1.19'
version = '1.20'
def makeTag(self, config): """Return an XML tag for this file, using the given config""" attrs = {}
self.project = self.config.project
def makeSourceTag(self): self.project = self.config.project return "<source>%s</source>" % self.makeAttrTags( 'project', 'module', 'branch', )
if len(sys.argv) < 3: sys.stderr.write("USAGE: %s REPOS-PATH REVISION [PROJECTNAME]\n" % sys.argv[0]) sys.exit(1) if len(sys.argv) > 3: config.project = sys.argv[3] SvnClient(sys.argv[1], sys.argv[2], config).main()
main()
def escapeToXml(text, isAttrib=0): text = unicode(text) text = text.replace("&", "&amp;") text = text.replace("<", "&lt;") text = text.replace(">", "&gt;") if isAttrib == 1: text = text.replace("'", "&apos;") text = text.replace("\"", "&quot;") return text
def getName (self): ''' FSTree.File.getName
def getName (self): ''' FSTree.File.getName Returns the filename ''' return self.name
def getName (self): ''' FSTree.File.getName
Returns the filename. ''' return self.name
def getPath (self): ''' FSTree.File.getPath Returns the full path to the File ''' if self.parent: return os.path.join (self.parent.getPath(),self.name) return self.name
def getName (self): ''' FSTree.File.getName
def getPath (self): ''' FSTree.File.getPath Returns the full path to the File. ''' if self.parent: return os.path.join (self.parent.getPath(),self.name) return self.name
def getParent (self): ''' FSTree.File.getParent Returns the File's parent node. ''' return self.parent
def getPath (self): ''' FSTree.File.getPath Returns the full path to the File. ''' if self.parent: return os.path.join (self.parent.getPath(),self.name) return self.name
def getParent (self): ''' FSTree.File.getParent Returns the File's parent node. ''' return self.parent
def destroy(self): ''' FSTree.File.destroy ''' if self.callback: self.callback.removed(self)
def getParent (self): ''' FSTree.File.getParent Returns the File's parent node. ''' return self.parent
def destroy(self): ''' FSTree.File.removed ''' if self.callback: self.callback.removed(self) def _register_del_callback(self,target): self.callback = target
def _register_del_callback(self,target): self.callback = target
def destroy(self): ''' FSTree.File.removed ''' if self.callback: self.callback.removed(self)
Returns a list of nodes that is the path from the source to the goal or None if there is no path. Arguments: - source The starting node for the search - goal The goal node for the search
Returns: A list of nodes that is the path from the source to the goal or ``None`` if there is no path.
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.
def compare(a, b): keyA = toTuple(a) keyB = toTuple(b) if not costs.has_key(keyA): a_path = pathToNode(a) costs[keyA] = self.costf(a_path, self.goal) if not costs.has_key(keyB): b_path = pathToNode(b) costs[keyB] = self.costf(b_path, self.goal) ac = costs[keyA] bc = costs[keyB] return (bc - ac) def pathToNode(no...
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.
costs = {} predecessors = {toTuple(self.source):None}
def toTuple(dictionary): return tuple([(bone, pos) for bone, pos in dictionary.iteritems()])
path = [] steps = []
def toTuple(dictionary): return tuple([(bone, pos) for bone, pos in dictionary.iteritems()])
self.path = pathToNode(node)
self.path = self.pathToNode(node)
def toTuple(dictionary): return tuple([(bone, pos) for bone, pos in dictionary.iteritems()])
predecessors[toTuple(s)] = toTuple(node)
self.predecessors[repr(s)] = node
def toTuple(dictionary): return tuple([(bone, pos) for bone, pos in dictionary.iteritems()])
agenda.sort(cmp=compare)
agenda.sort(cmp=self.compare)
def toTuple(dictionary): return tuple([(bone, pos) for bone, pos in dictionary.iteritems()])
def debugLeaks(reset=False, quiet=False): """Show representations of all object instances tracked by the garbage collector that
def debugLeaks(reset=False, quiet=False, interestedTypes=None): """Show representations of all objects tracked by the garbage collector that
def debugLeaks(reset=False, quiet=False): """Show representations of all object instances tracked by the garbage collector that were not present at the last invocation. """ global _leakTracker gc.collect() if _leakTracker is None or reset: _leakTracker = {} quiet = True objlist = gc.get_objects() newCount = 0 instCou...
if type(object) != types.InstanceType: continue
typename = getTypeName(object) if interestedTypes is not None: if not typename in interestedTypes: continue
def debugLeaks(reset=False, quiet=False): """Show representations of all object instances tracked by the garbage collector that were not present at the last invocation. """ global _leakTracker gc.collect() if _leakTracker is None or reset: _leakTracker = {} quiet = True objlist = gc.get_objects() newCount = 0 instCou...
if _leakTracker.get(id(object)) is object.__class__:
if _leakTracker.get(id(object)) == typename:
def debugLeaks(reset=False, quiet=False): """Show representations of all object instances tracked by the garbage collector that were not present at the last invocation. """ global _leakTracker gc.collect() if _leakTracker is None or reset: _leakTracker = {} quiet = True objlist = gc.get_objects() newCount = 0 instCou...
_leakTracker[id(object)] = object.__class__
_leakTracker[id(object)] = typename
def debugLeaks(reset=False, quiet=False): """Show representations of all object instances tracked by the garbage collector that were not present at the last invocation. """ global _leakTracker gc.collect() if _leakTracker is None or reset: _leakTracker = {} quiet = True objlist = gc.get_objects() newCount = 0 instCou...
print "dijkstra from %s to %s" % (path[-1][name], goal[name])
def cost (path, goal): """Return the cost of ``path``. Cost of a given path is the length of the path, plus the sum of each shortest path from the end of it to the goal. """ g = len (path) h = 0 done = [] undone = [] for name, x in input.graphs.iteritems (): print "dijkstra from %s to %s" % (path[-1][name], goal[name]...
def getDynamicChild(self, name, request):
def getDynamicChild(self, name, request=None):
def getDynamicChild(self, name, request): if self.path == '' or self.path[-1] == '/': newPath = self.path + name else: newPath = self.path + '/' + name return StatsPage(caps = self.caps, storage = self.storage, path = newPath)
d.addBoth(self.logProtectedCall, path, args, user)
def keyValidated(x=None): d = defer.maybeDeferred(f, *args) d.chainDeferred(result) d.addBoth(self.logProtectedCall, path, args, user)