rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
The method used to fetch the next value
The method used to fetch the next value, make sure to return a list of rows, not just a row
def next(self): ''' The method used to fetch the next value ''' raise StopIteration
ba18f3b8e8bc43496892b7fe4507e1f8530cde36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ba18f3b8e8bc43496892b7fe4507e1f8530cde36/flow.py
callFromThread(self.buff.append,val)
callFromThread(self.buff.extend,val)
def process(self): ''' This is called in the 'source' thread, and just basically sucks the iterator, appending items back to the main thread. ''' from twisted.internet.reactor import callFromThread try: while 1: val = self.source.next() callFromThread(self.buff.append,val) except StopIteration: callFromThread(self.stop...
ba18f3b8e8bc43496892b7fe4507e1f8530cde36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ba18f3b8e8bc43496892b7fe4507e1f8530cde36/flow.py
def __init__(self, pool, sql):
def __init__(self, pool, sql, fetchall=0):
def __init__(self, pool, sql): FlowIterator.__init__(self) self.curs = None self.sql = sql self.pool = pool self.data = None
ba18f3b8e8bc43496892b7fe4507e1f8530cde36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ba18f3b8e8bc43496892b7fe4507e1f8530cde36/flow.py
self.simulate()
def addReader(self, reader): if not hasReader(reader): reads[reader] = gtk.input_add(reader, gtk.GDK.INPUT_READ, self.callback) self.simulate()
8db6c74d280eec4eed6a130892c293242f600ed5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/8db6c74d280eec4eed6a130892c293242f600ed5/gtkreactor.py
self.port2 = reactor.connectMulticast("127.0.0.1", self.server.transport.getHost().port, self.client) reactor.iterate() reactor.iterate()
self.port2 = reactor.listenMulticast(0, self.client) reactor.iterate() reactor.iterate() self.client.transport.connect("127.0.0.1", self.server.transport.getHost().port)
def setUp(self): self.server = Server() self.client = Client() # multicast won't work if we listen over loopback, apparently self.port1 = reactor.listenMulticast(0, self.server) self.port2 = reactor.connectMulticast("127.0.0.1", self.server.transport.getHost().port, self.client) reactor.iterate() reactor.iterate()
e151b1339cb46e1ca27477841cf7142036f6cc62 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e151b1339cb46e1ca27477841cf7142036f6cc62/test_udp.py
self.o.write('x') self.o.flush()
try: self.o.write('x') self.o.flush() except ValueError: pass
def wakeUp(self): """Write one byte to the pipe, and flush it. """ self.o.write('x') self.o.flush()
68c0540537aad9ab8dd5b0dad9e6b7a70b0d9ecc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/68c0540537aad9ab8dd5b0dad9e6b7a70b0d9ecc/main.py
self.handshake = "start"
self.initiator = false self.handshake = "start"
def __init__(self): self.handshake = "start" # state transitions: "start" -> "hesaidhello", "hesaidhello" -> "completed", "start" -> "isaidhello", "isaidhello" -> "completed" self.gotver = None self.secret = "geheim"
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.secret = "geheim"
def __init__(self): self.handshake = "start" # state transitions: "start" -> "hesaidhello", "hesaidhello" -> "completed", "start" -> "isaidhello", "isaidhello" -> "completed" self.gotver = None self.secret = "geheim"
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
def setSecret(self, secret): self.secret = secret
def __init__(self): self.handshake = "start" # state transitions: "start" -> "hesaidhello", "hesaidhello" -> "completed", "start" -> "isaidhello", "isaidhello" -> "completed" self.gotver = None self.secret = "geheim"
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
def abortConnection(self, logmsg):
def initiateConnection(self, ipAddress, port): assert self.handshake == "start" assert self.initiator == false self.initiator = true def connectionMade(self): if self.initiator: self.transport.write(CONNSTRING) self.handshake = "initiatorsaidhello" def _abortConnection(self, logmsg):
def abortConnection(self, logmsg): log.msg(logmsg + ", self: %s" % str(self)) self.transport.loseConnection() return
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.abortConnection("Received non-empty Ping payload. Closing connection. payload: %s" % str(payload))
self._abortConnection("Received non-empty Ping payload. Closing connection. payload: %s" % str(payload))
def handlePing(self, descriptorId, ttl, hops, payload): """ A ping message has arrived. """ if payload != '': self.abortConnection("Received non-empty Ping payload. Closing connection. payload: %s" % str(payload)) return
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.abortConnection("Received ill-formatted Pong payload. Closing connection. payload: %s" % str(payload))
self._abortConnection("Received ill-formatted Pong payload. Closing connection. payload: %s" % str(payload))
def handlePong(self, descriptorId, ttl, hops, payload): try: (port, ipA0, ipA1, ipA2, ipA3, numberOfFilesShared, kbShared,) = struct.unpack(PONGPAYLOADENCODING, payload) except struct.error, le: self.abortConnection("Received ill-formatted Pong payload. Closing connection. payload: %s" % str(payload)) return
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.abortConnection("Received ill-formatted Query payload. Closing connection. payload: %s" % str(payload))
self._abortConnection("Received ill-formatted Query payload. Closing connection. payload: %s" % str(payload))
def handleQuery(self, descriptorId, ttl, hops, payload): try: (minimumSpeed,) = struct.unpack("<H", payload[:2]) except struct.error, le: self.abortConnection("Received ill-formatted Query payload. Closing connection. payload: %s" % str(payload)) return searchCriteria = payload[2:] self.queryReceived(descriptorId, tt...
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.abortConnection("Received ill-formatted QueryHit payload. Closing connection. payload: %s" % str(payload))
self._abortConnection("Received ill-formatted QueryHit payload. Closing connection. payload: %s" % str(payload))
def handleQueryHit(self, descriptorId, ttl, hops, payload): try: (numberOfHits, port, ipA0, ipA1, ipA2, ipA3, speed,) = struct.unpack(PARTIALQUERYHITPAYLOADENCODING, payload[:PARTIALQUERYHITPAYLOADLENGTH]) except struct.error, le: self.abortConnection("Received ill-formatted QueryHit payload. Closing connection. payl...
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.abortConnection("Received ill-formatted partial QueryHit result. Closing connection. partial query hit result: %s" % str(payload[i:i+PARTIALQUERYHITRESULTLENGTH]))
self._abortConnection("Received ill-formatted partial QueryHit result. Closing connection. partial query hit result: %s" % str(payload[i:i+PARTIALQUERYHITRESULTLENGTH]))
def handleQueryHit(self, descriptorId, ttl, hops, payload): try: (numberOfHits, port, ipA0, ipA1, ipA2, ipA3, speed,) = struct.unpack(PARTIALQUERYHITPAYLOADENCODING, payload[:PARTIALQUERYHITPAYLOADLENGTH]) except struct.error, le: self.abortConnection("Received ill-formatted QueryHit payload. Closing connection. payl...
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.abortConnection("Received ill-formatted QueryHit payload. Closing connection. i: %s, ill-formed part of query hit payload: %s" % (str(i), str(payload[i:]),))
self._abortConnection("Received ill-formatted QueryHit payload. Closing connection. i: %s, ill-formed part of query hit payload: %s" % (str(i), str(payload[i:]),))
def handleQueryHit(self, descriptorId, ttl, hops, payload): try: (numberOfHits, port, ipA0, ipA1, ipA2, ipA3, speed,) = struct.unpack(PARTIALQUERYHITPAYLOADENCODING, payload[:PARTIALQUERYHITPAYLOADLENGTH]) except struct.error, le: self.abortConnection("Received ill-formatted QueryHit payload. Closing connection. payl...
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.abortConnection("Received ill-formatted Push payload. Closing connection. i: %s, ill-formed part of query hit payload: %s" % (str(i), str(payload[i:]),))
self._abortConnection("Received ill-formatted Push payload. Closing connection. i: %s, ill-formed part of query hit payload: %s" % (str(i), str(payload[i:]),))
def handlePush(self, descriptorId, ttl, hops, payload): try: (serventIdentifer, fileIndex, ipA0, ipA1, ipA2, ipA3, port,) = struct.unpack(PUSHPAYLOADENCODING, payload) except struct.error, le: self.abortConnection("Received ill-formatted Push payload. Closing connection. i: %s, ill-formed part of query hit payload: %...
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.abortConnection("Received ill-formatted descriptor. Closing connection. payload: %s" % str(descriptor))
self._abortConnection("Received ill-formatted descriptor. Closing connection. payload: %s" % str(descriptor))
def descriptorReceived(self, descriptor): """ A Gnutella descriptor has arrived.
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.abortConnection("Received unrecognized payload descriptor. Closing connection. payloadDescriptor: %s" % str(payloadDescriptor))
self._abortConnection("Received unrecognized payload descriptor. Closing connection. payloadDescriptor: %s" % str(payloadDescriptor))
def descriptorReceived(self, descriptor): """ A Gnutella descriptor has arrived.
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
@precondition We must be expecting a GNUTELLA CONNECT handshake move.: self.handshake in ("start", "isaidhello",): "self.handshake: %s, line: %s" % (str(self.handshake), str(line),) """ assert self.handshake in ("start", "isaidhello",), "precondition failure: We must be expecting a GNUTELLA CONNECT handshake move." + "...
@precondition We must be expecting a GNUTELLA CONNECT handshake move.: (self.initiator and (self.handshake == "initiatorsaidhello")) or ((not self.initiator) and (self.handshake == "start")): "self.initiator: %s, self.handshake: %s, line: %s" % (str(self.initiator), str(self.handshake), str(line),) """ assert (self.ini...
def lineReceived(self, line): """ @precondition We must be expecting a GNUTELLA CONNECT handshake move.: self.handshake in ("start", "isaidhello",): "self.handshake: %s, line: %s" % (str(self.handshake), str(line),) """ assert self.handshake in ("start", "isaidhello",), "precondition failure: We must be expecting a GNU...
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.abortConnection("Received incorrect GNUTELLA HELLO. Closing connection. line: %s" % str(line))
self._abortConnection("Received incorrect GNUTELLA HELLO. Closing connection. line: %s" % str(line))
def lineReceived(self, line): """ @precondition We must be expecting a GNUTELLA CONNECT handshake move.: self.handshake in ("start", "isaidhello",): "self.handshake: %s, line: %s" % (str(self.handshake), str(line),) """ assert self.handshake in ("start", "isaidhello",), "precondition failure: We must be expecting a GNU...
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.setRawMode() else: assert self.handshake == "isaidhello" if line != ACKSTRING: self.abortConnection("Received incorrect GNUTELLA OK. Closing connection. line: %s" % str(line)) return self.handshake = "completed"
def lineReceived(self, line): """ @precondition We must be expecting a GNUTELLA CONNECT handshake move.: self.handshake in ("start", "isaidhello",): "self.handshake: %s, line: %s" % (str(self.handshake), str(line),) """ assert self.handshake in ("start", "isaidhello",), "precondition failure: We must be expecting a GNU...
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.abortConnection("Received ill-formatted raw data. Closing connection. self.buf: %s" % str(self.buf))
self._abortConnection("Received ill-formatted raw data. Closing connection. self.buf: %s" % str(self.buf))
def rawDataReceived(self, data): self.buf += data # XXX opportunity for future optimization --Zooko 2002-07-15 if len(self.buf) >= HEADERLENGTH: try: (payloadLength,) = struct.unpack(PAYLOADENCODING, self.buf[PAYLOADLENGTHOFFSET:HEADERLENGTH]) except struct.error, le: self.abortConnection("Received ill-formatted raw d...
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
self.abortConnection("Received payload > %d KB or < than 0 in size. Closing connection. payloadLength: %s" % ((OURMAXPAYLOADLENGTH / 2**10), str(payloadLength),))
self._abortConnection("Received payload > %d KB or < than 0 in size. Closing connection. payloadLength: %s" % ((OURMAXPAYLOADLENGTH / 2**10), str(payloadLength),))
def rawDataReceived(self, data): self.buf += data # XXX opportunity for future optimization --Zooko 2002-07-15 if len(self.buf) >= HEADERLENGTH: try: (payloadLength,) = struct.unpack(PAYLOADENCODING, self.buf[PAYLOADLENGTHOFFSET:HEADERLENGTH]) except struct.error, le: self.abortConnection("Received ill-formatted raw d...
b9cdcac8c6570b76f72db7d37d4350260766357e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b9cdcac8c6570b76f72db7d37d4350260766357e/gnutella.py
test, error = self.errorInfo[selected]
test, failure = self.errorInfo[selected] s = StringIO.StringIO() failure.printTraceback(s) tracebackText = s.getvalue()
def showSelectedError(self): selection = self.errorListbox.curselection() if not selection: return selected = int(selection[0]) txt = self.errorListbox.get(selected) window = tk.Toplevel(self.root) window.title(txt) window.protocol('WM_DELETE_WINDOW', window.quit) test, error = self.errorInfo[selected] tk.Label(window,...
dbead994e93d0dd0dde0bf383dc6a1763ce4b726 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/dbead994e93d0dd0dde0bf383dc6a1763ce4b726/unittestgui.py
tracebackLines = apply(traceback.format_exception, error + (10,)) tracebackText = string.join(tracebackLines,'')
def showSelectedError(self): selection = self.errorListbox.curselection() if not selection: return selected = int(selection[0]) txt = self.errorListbox.get(selected) window = tk.Toplevel(self.root) window.title(txt) window.protocol('WM_DELETE_WINDOW', window.quit) test, error = self.errorInfo[selected] tk.Label(window,...
dbead994e93d0dd0dde0bf383dc6a1763ce4b726 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/dbead994e93d0dd0dde0bf383dc6a1763ce4b726/unittestgui.py
self.call = reactor.callLater(self.delay, self._getPage)
if not self.call: self.call = reactor.callLater(self.delay, self._getPage)
def gotMD5(self, md5): if not self.working: return if md5 != self.md5: self.reportChange(self.md5, md5) self.md5 = md5 else: self.reportNoChange() self.call = reactor.callLater(self.delay, self._getPage)
f849f5c7b3dc13053d886a419d7f8631a29ddeb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f849f5c7b3dc13053d886a419d7f8631a29ddeb4/monitor.py
articles = string.split(text, '-')
articles = text.split('-')
def parseRange(text): # FIXME: should cope with '1-', '-443' and even '-' articles = string.split(text, '-') if len(articles) == 1: try: a = int(articles[0]) return a, a except: return None, None elif len(articles) == 2: try: if len(articles[0]): l = int(articles[0]) else: l = None if len(articles[1]): h = int(articles...
cffa1380b9b6ebe6dce04e9a3f44627d50fb1fcb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/cffa1380b9b6ebe6dce04e9a3f44627d50fb1fcb/nntp.py
except:
except ValueError, e:
def parseRange(text): # FIXME: should cope with '1-', '-443' and even '-' articles = string.split(text, '-') if len(articles) == 1: try: a = int(articles[0]) return a, a except: return None, None elif len(articles) == 2: try: if len(articles[0]): l = int(articles[0]) else: l = None if len(articles[1]): h = int(articles...
cffa1380b9b6ebe6dce04e9a3f44627d50fb1fcb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/cffa1380b9b6ebe6dce04e9a3f44627d50fb1fcb/nntp.py
except:
except ValueError, e:
def parseRange(text): # FIXME: should cope with '1-', '-443' and even '-' articles = string.split(text, '-') if len(articles) == 1: try: a = int(articles[0]) return a, a except: return None, None elif len(articles) == 2: try: if len(articles[0]): l = int(articles[0]) else: l = None if len(articles[1]): h = int(articles...
cffa1380b9b6ebe6dce04e9a3f44627d50fb1fcb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/cffa1380b9b6ebe6dce04e9a3f44627d50fb1fcb/nntp.py
if l is h is None: self.sendLine('501 command syntax error') else: defer = self.factory.backend.xoverRequest(self.currentGroup, l, h) defer.addCallbacks(self._gotXOver, self._errXOver)
defer = self.factory.backend.xoverRequest(self.currentGroup, l, h) defer.addCallbacks(self._gotXOver, self._errXOver)
def do_XOVER(self, parts): if self.currentGroup is None: self.sendLine('412 No news group currently selected') else: if not len(parts): self.sendLine('501 command syntax error') return l, h = parseRange(parts[0]) if l is h is None: self.sendLine('501 command syntax error') else: defer = self.factory.backend.xoverReques...
cffa1380b9b6ebe6dce04e9a3f44627d50fb1fcb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/cffa1380b9b6ebe6dce04e9a3f44627d50fb1fcb/nntp.py
self.transport.write(body + '\r\n')
self.transport.write(body.replace('\r\n..', '\r\n.') + '\r\n')
def _gotBody(self, parts): index, id, body = parts self.currentIndex = index self.sendLine('221 %d %s article retrieved' % (index, id)) self.transport.write(body + '\r\n') self.sendLine('.')
cffa1380b9b6ebe6dce04e9a3f44627d50fb1fcb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/cffa1380b9b6ebe6dce04e9a3f44627d50fb1fcb/nntp.py
self.setHeader("content-length", "0")
def redirect(self, url): """Utility function that does a redirect.
c7c148fc8deeb326bdef511afc550b681df225b5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c7c148fc8deeb326bdef511afc550b681df225b5/http.py
listConn = True
lostConn = True
def testManyRecords(self): self.auth.addresses['test.domain'] = [ 'mx1.test.domain', 'mx2.test.domain', 'mx3.test.domain' ] mx = unittest.deferredResult(self.mx.getMX('test.domain')) self.failUnless(str(mx.exchange).split('.', 1)[0] in ('mx1', 'mx2', 'mx3')) self.mx.markBad(mx) nextMX = unittest.deferredResult(self....
1635e02a3e8ef356f52b6506421bfa4b9ce6447d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1635e02a3e8ef356f52b6506421bfa4b9ce6447d/test_mail.py
sup.__init__(self)
def __init__(self): sup.__init__(self) self.xml = gtk.glade.XML(util.sibpath(__file__,"gladereactor.glade")) d = {} for m in reflect.prefixedMethods(self, "on_"): d[m.im_func.__name__] = m self.xml.signal_autoconnect(d) self.xml.get_widget('window1').connect('destroy', lambda w: self.stop()) self.servers = self.xml.get...
c0c8352ec912c4d46866b1d8d8e645d612ebad1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c0c8352ec912c4d46866b1d8d8e645d612ebad1a/gladereactor.py
method = getattr(self, "irc_%s" % command, None) try: if method is not None: method(prefix, params) else: self.irc_unknown(prefix, command, params) except: log.deferr()
self.handleCommand(command, prefix, params) def handleCommand(self, command, prefix, params): """Determine the function to call for the given command and call it with the given arguments. """ method = getattr(self, "irc_%s" % command, None) try: if method is not None: method(prefix, params) else: self.irc_unknown(pr...
def dataReceived(self, data): """This hack is to support mIRC, which sends LF only, even though the RFC says CRLF. (Also, the flexibility of LineReceiver to turn "line mode" on and off was not required.) """ self.buffer = self.buffer + data lines = string.split(self.buffer, LF) # Put the (possibly empty) element after...
c7c0043bdffda58d13dd58d76c46129051e91bf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c7c0043bdffda58d13dd58d76c46129051e91bf2/irc.py
method = getattr(self, "irc_%s" % command, None) if method is not None: method(prefix, params) else: self.irc_unknown(prefix, command, params)
self.handleCommand(command, prefix, params)
def lineReceived(self, line): line = lowDequote(line) try: prefix, command, params = parsemsg(line) if numeric_to_symbolic.has_key(command): command = numeric_to_symbolic[command] method = getattr(self, "irc_%s" % command, None) if method is not None: method(prefix, params) else: self.irc_unknown(prefix, command, param...
c7c0043bdffda58d13dd58d76c46129051e91bf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c7c0043bdffda58d13dd58d76c46129051e91bf2/irc.py
from xml.dom.minidom import Element
from twisted.web.microdom import Element
def unjellyFromDOM_2(self, unjellier, element): self.integer = int(element.getAttribute("integer")) self.name = element.getAttribute("name")
92f35baa0c563ea882f96cbbbb93a329f649e731 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/92f35baa0c563ea882f96cbbbb93a329f649e731/test_persisted.py
iterateFunc()
try: iterateFunc() except: log.err()
def iterateReactor_(self, iterateFunc): iterateFunc()
1234e820591ea29da05477bdd3e4cb57ee3a347f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1234e820591ea29da05477bdd3e4cb57ee3a347f/Twistzilla.py
from twisted.python import log
def reactorNotification_(self, iterateFunc): pool = NSAutoreleasePool.alloc().init() self.performSelectorOnMainThread_withObject_waitUntilDone_('iterateReactor:', iterateFunc, False) del pool
1234e820591ea29da05477bdd3e4cb57ee3a347f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1234e820591ea29da05477bdd3e4cb57ee3a347f/Twistzilla.py
if self.method == "HEAD":
if self.method == "HEAD" or response.code in NO_BODY_CODES: response.stream.close() self._finished(None)
def writeResponse(self, response): """ Write a response. """ if self.stream.doStartReading is not None: # Expect: 100-continue was requested, but 100 response has not been # sent, and there's a possibility that data is still waiting to be # sent. # # Ideally this means the remote side will not send any data. # However,...
1d368eeeb89a301101eca94cb34c393d5bca6fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1d368eeeb89a301101eca94cb34c393d5bca6fe8/http.py
if response.code in NO_BODY_CODES: return
def writeResponse(self, response): """ Write a response. """ if self.stream.doStartReading is not None: # Expect: 100-continue was requested, but 100 response has not been # sent, and there's a possibility that data is still waiting to be # sent. # # Ideally this means the remote side will not send any data. # However,...
1d368eeeb89a301101eca94cb34c393d5bca6fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1d368eeeb89a301101eca94cb34c393d5bca6fe8/http.py
not (code in NO_BODY_CODES)):
self.command != "HEAD" and code not in NO_BODY_CODES):
def _writeHeaders(self, code, headers, addConnectionHeaders): # HTTP 0.9 doesn't have headers. if self.version[0] == 0: return l = [] code_message = responsecode.RESPONSES.get(code, "Unknown Status") l.append('%s %s %s\r\n' % (self.out_version, code, code_message)) if headers is not None: for name, valuelist in heade...
1d368eeeb89a301101eca94cb34c393d5bca6fe8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1d368eeeb89a301101eca94cb34c393d5bca6fe8/http.py
from twisted.trial.util import deferredResult
def encodeTokens(obj, debug=0): from twisted.trial.util import deferredResult b = TokenStorageBanana() b.debug = debug d = b.send(obj) deferredResult(d) return b.tokens
e81e73b104949eb8b76f68e6a0459dcecd6c2afd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e81e73b104949eb8b76f68e6a0459dcecd6c2afd/debug.py
deferredResult(d) return b.tokens
d.addCallback(lambda res: b.tokens) return d
def encodeTokens(obj, debug=0): from twisted.trial.util import deferredResult b = TokenStorageBanana() b.debug = debug d = b.send(obj) deferredResult(d) return b.tokens
e81e73b104949eb8b76f68e6a0459dcecd6c2afd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e81e73b104949eb8b76f68e6a0459dcecd6c2afd/debug.py
class NDeferred: def __init__(self, n, deferred): self.n = n self.deferred = deferred self.done = 0 def callback(self, arg): if self.done: return self.n = self.n - 1 if self.n == 0: self.deferred.callback(arg) self.done = 1 def errback(self, arg): if self.done: return self.deferred.errback(arg) self.done = 1
def quoteaddr(addr): """Turn an email address, possibly with realname part etc, into a form suitable for and SMTP envelope. """ if isinstance(addr, Address): return '<%s>' % str(addr) res = rfc822.parseaddr(addr) if res == (None, None): # It didn't parse, use it as-is return '<%s>' % str(addr) else: return '<%s>' % ...
3eed604bca874a582b47562cf97cf7a21389eb6b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3eed604bca874a582b47562cf97cf7a21389eb6b/smtp.py
deferred = defer.Deferred() deferred.addCallback(self._messageHandled) deferred.addErrback(self._messageNotHandled) ndeferred = NDeferred(len(self.__messages), deferred) for message in self.__messages: deferred = message.eomReceived() deferred.addCallback(ndeferred.callback) deferred.addErrback(ndeferred.errback)
defer.DeferredList([ m.eomReceived() for m in self.__messages ]).addCallback(self._messageHandled ).addErrback(self._messageNotHandled)
def dataLineReceived(self, line): if line[:1] == '.': if line == '.': self.mode = COMMAND if self.datafailed: self.sendCode(self.datafailed.code, self.datafailed.resp) return if not self.__messages: self._messageHandled("thrown away") return deferred = defer.Deferred() deferred.addCallback(self._messageHandled) deferre...
3eed604bca874a582b47562cf97cf7a21389eb6b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3eed604bca874a582b47562cf97cf7a21389eb6b/smtp.py
fcntl.ioctl(pty.fileno(), tty.TIOCSWINSZ,
fcntl.ioctl(self.pty.fileno(), tty.TIOCSWINSZ,
def openShell(self, proto): import fcntl, tty if not self.ptyTuple: # we didn't get a pty-req log.msg('tried to get shell without pty, failing') raise error.ConchError("no pty") #proto = wrapProtocol(proto) uid, gid = self.avatar.getUserGroupId() homeDir = self.avatar.getHomeDir() shell = self.avatar.getShell() self.en...
0a54587f283890b713404317c788e44e022ed441 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/0a54587f283890b713404317c788e44e022ed441/session.py
prefix, s = string.split(s[1:], maxsplit=1)
prefix, s = string.split(s[1:], ' ', 1)
def parsemsg(s): prefix = '' trailing = [] if s[0] == ':': prefix, s = string.split(s[1:], maxsplit=1) if string.find(s,':') != -1: s, trailing = string.split(s, ':', 1) args = string.split(s) args.append(trailing) else: args = string.split(s) command = args.pop(0) return prefix, command, args
5f8cb01526e32358275bca534765e29c55269058 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5f8cb01526e32358275bca534765e29c55269058/irc.py
yield STRING, current yield OP, n
yield _STRING, current yield _OP, n
def _tokenize(description): current = '' ops = ':=' nextOps = {':': ':=', '=': ':'} description = iter(description) for n in description: if n in ops: yield STRING, current yield OP, n current = '' ops = nextOps[n] elif n=='\\': current += description.next() else: current += n yield STRING, current
c0d7568500315932e31b2c459362790b4f18bd5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c0d7568500315932e31b2c459362790b4f18bd5d/ports.py
yield STRING, current
yield _STRING, current
def _tokenize(description): current = '' ops = ':=' nextOps = {':': ':=', '=': ':'} description = iter(description) for n in description: if n in ops: yield STRING, current yield OP, n current = '' ops = nextOps[n] elif n=='\\': current += description.next() else: current += n yield STRING, current
c0d7568500315932e31b2c459362790b4f18bd5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c0d7568500315932e31b2c459362790b4f18bd5d/ports.py
if type is STRING: so_far += (value,) elif type is OP and value==':':
if type is _STRING: sofar += (value,) elif value==':':
def add(sofar): if len(sofar)==1: args.append(sofar[0]) else: kw[sofar[0]] = sofar[1]
c0d7568500315932e31b2c459362790b4f18bd5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c0d7568500315932e31b2c459362790b4f18bd5d/ports.py
def getEntityType(self): return "Service"
ee676b8cb217a1a60eae831ccaed93da270c9060 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ee676b8cb217a1a60eae831ccaed93da270c9060/app.py
def listStaticNames(self): n = [] for i in xrange(len(self.app.connectors)): c = self.app.connectors[i] n.append("%s:%s,%d" % (c.host, c.portno, i)) return n def listStaticEntities(self): return map(None, self.listStaticNames(), self.app.connectors[:])
def __init__(self, app): coil.ConfigCollection.__init__(self) self.app = app
ee676b8cb217a1a60eae831ccaed93da270c9060 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ee676b8cb217a1a60eae831ccaed93da270c9060/app.py
return self.processNode(request, result.render(request), node)
return self.processNode(request, result.generateDOM(request), node)
def dispatchResult(self, request, node, result): """ Check a given result from handling a node and hand it to a process* method which will convert the result into a node and insert it into the DOM tree. Return the new node. """ if isinstance(result, widgets.Widget): return self.processWidget(request, result, node) elif...
a79f5072d7a21839b336585fffdfcb070d47bbeb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a79f5072d7a21839b336585fffdfcb070d47bbeb/domtemplate.py
raise unittest.FailTest, "Deferred did not fail: %r" % result
raise unittest.FailTest, "Deferred did not fail: %r" % (result,)
def deferredError(d, timeout=None): """Waits for deferred to fail, and it returns the Failure. If the deferred succeeds, raises FailTest. """ result = _getDeferredResult(d, timeout) if isinstance(result, failure.Failure): return result else: raise unittest.FailTest, "Deferred did not fail: %r" % result
b7eb7d6e94e570cae33fe69c4c4c149f7205c39e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b7eb7d6e94e570cae33fe69c4c4c149f7205c39e/util.py
def render(self): return error.NoResource.render()
def render(self, request): return error.NoResource().render(request)
def render(self): return error.NoResource.render()
5c133c25362da05ebc3aa554078abbf840dc4d60 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5c133c25362da05ebc3aa554078abbf840dc4d60/twcgi.py
def generateDOM(self, request, node): href = self.baseHREF params = urllib.urlencode(self.parameters) if params: href = href + '?' + params self['href'] = href or self.getData() + '/' data = self.getData() if data is None: data = "" self.add(Text(data, self.raw)) return Widget.generateDOM(self, request, node)
3d5a629ffe9159820b053d4e353ecf906bddc2d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3d5a629ffe9159820b053d4e353ecf906bddc2d6/widgets.py
<ul id="blah" view="List"> <li id="listItem" view="Text">Foo</li> </ul>
| <ul id="blah" view="List"> | <li id="listItem" view="Text">Foo</li> | </ul>
def generateDOM(self, request, node): href = self.baseHREF params = urllib.urlencode(self.parameters) if params: href = href + '?' + params self['href'] = href or self.getData() + '/' data = self.getData() if data is None: data = "" self.add(Text(data, self.raw)) return Widget.generateDOM(self, request, node)
3d5a629ffe9159820b053d4e353ecf906bddc2d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3d5a629ffe9159820b053d4e353ecf906bddc2d6/widgets.py
<table model="blah" view="List"> <tr class="listHeader"><th>A</th><th>B</th></tr> <tr class="listItem"> <td><span view="Text" model="1" /</td> <td><span view="Text" model="2" /</td> </tr> </table> Where blah is the name of a list on the model; eg self.model.blah = ['foo', 'bar']
| <table model="blah" view="List"> | <tr class="listHeader"><th>A</th><th>B</th></tr> | <tr class="listItem"> | <td><span view="Text" model="1" /> | <td><span view="Text" model="2" /> | </tr> | </table> Where blah is the name of a list on the model; eg: | self.model.blah = ['foo', 'bar']
def generateDOM(self, request, node): href = self.baseHREF params = urllib.urlencode(self.parameters) if params: href = href + '?' + params self['href'] = href or self.getData() + '/' data = self.getData() if data is None: data = "" self.add(Text(data, self.raw)) return Widget.generateDOM(self, request, node)
3d5a629ffe9159820b053d4e353ecf906bddc2d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3d5a629ffe9159820b053d4e353ecf906bddc2d6/widgets.py
self.path = path or '/'
if path == '/': path = '' self.path = path
def __init__(self, scheme='', netloc='localhost', path='', query='', fragment=''): self.scheme = scheme or 'http' self.netloc = netloc self.path = path or '/' self.query = query self.fragment = fragment
b6326fb591d29b61acf513d1334608d1a3c06617 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b6326fb591d29b61acf513d1334608d1a3c06617/paths.py
def _pathMod(self, newpath, keepQuery):
def _pathMod(self, newpathsegs, keepQuery):
def _pathMod(self, newpath, keepQuery): if keepQuery: query = self.query else: query = '' return URLPath(self.scheme, self.netloc, newpath, query)
b6326fb591d29b61acf513d1334608d1a3c06617 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b6326fb591d29b61acf513d1334608d1a3c06617/paths.py
newpath,
'/'.join(newpathsegs),
def _pathMod(self, newpath, keepQuery): if keepQuery: query = self.query else: query = '' return URLPath(self.scheme, self.netloc, newpath, query)
b6326fb591d29b61acf513d1334608d1a3c06617 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b6326fb591d29b61acf513d1334608d1a3c06617/paths.py
newpath = '/'.join(l) return self._pathMod(path, keepQuery)
return self._pathMod(l, keepQuery)
def sibling(self, path, keepQuery=0): l = self.pathList() l[-1] = path newpath = '/'.join(l) return self._pathMod(path, keepQuery)
b6326fb591d29b61acf513d1334608d1a3c06617 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b6326fb591d29b61acf513d1334608d1a3c06617/paths.py
l.append(path) newpath = '/'.join(l) return self._pathMod(path, keepQuery)
if l[-1] == '': l[-1] = path else: l.append(path) return self._pathMod(l, keepQuery)
def child(self, path, keepQuery=0): l = self.pathList() l.append(path) newpath = '/'.join(l) return self._pathMod(path, keepQuery)
b6326fb591d29b61acf513d1334608d1a3c06617 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b6326fb591d29b61acf513d1334608d1a3c06617/paths.py
l[-2:] = [] newpath = '/'.join(l) return self._pathMod(newpath, keepQuery)
if l[-1] == '': del l[-2] else: l.pop() return self._pathMod(l, keepQuery) def here(self, keepQuery=0): l = self.pathList() if l[-1] != '': l.pop() return self._pathMod(l, keepQuery)
def parent(self, keepQuery=0): l = self.pathList() l[-2:] = [] newpath = '/'.join(l) return self._pathMod(newpath, keepQuery)
b6326fb591d29b61acf513d1334608d1a3c06617 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b6326fb591d29b61acf513d1334608d1a3c06617/paths.py
basic.LineReceiver.sendLine(self, lowQuote(line) + '\r')
self._reallySendLine(line)
def sendLine(self, line): if self.lineRate is None: basic.LineReceiver.sendLine(self, lowQuote(line) + '\r') else: self._queue.append(line) if not self._queueEmptying: self._queueEmptying = reactor.callLater(self.lineRate, self._sendLine)
ccf5dc721a6c70f4d3ca3c00908175a6847d3257 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ccf5dc721a6c70f4d3ca3c00908175a6847d3257/irc.py
self._queueEmptying = reactor.callLater(self.lineRate, self._sendLine)
self._sendLine()
def sendLine(self, line): if self.lineRate is None: basic.LineReceiver.sendLine(self, lowQuote(line) + '\r') else: self._queue.append(line) if not self._queueEmptying: self._queueEmptying = reactor.callLater(self.lineRate, self._sendLine)
ccf5dc721a6c70f4d3ca3c00908175a6847d3257 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ccf5dc721a6c70f4d3ca3c00908175a6847d3257/irc.py
basic.LineReceiver.sendLine(self, lowQuote(self._queue.pop(0)) + '\r')
self._reallySendLine(self._queue.pop(0))
def _sendLine(self): if self._queue: basic.LineReceiver.sendLine(self, lowQuote(self._queue.pop(0)) + '\r') self._queueEmptying = reactor.callLater(self.lineRate, self._sendLine) else: self._queueEmptying = None
ccf5dc721a6c70f4d3ca3c00908175a6847d3257 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ccf5dc721a6c70f4d3ca3c00908175a6847d3257/irc.py
pass
self.startWriting()
def doConnect(self): """I connect the socket. Then, call the protocol's makeConnection, and start waiting for data. """ try: self.socket.connect(self.addr) except socket.error, se: if se.args[0] in (EWOULDBLOCK, EALREADY, EINPROGRESS): pass else: self.protocol.connectionFailed() return CONNECTION_LOST # If I have reac...
f8c257d331ba0938e91d94f4900b4ca6466619be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f8c257d331ba0938e91d94f4900b4ca6466619be/tcp.py
return CONNECTION_LOST
self.stopWriting()
def doConnect(self): """I connect the socket. Then, call the protocol's makeConnection, and start waiting for data. """ try: self.socket.connect(self.addr) except socket.error, se: if se.args[0] in (EWOULDBLOCK, EALREADY, EINPROGRESS): pass else: self.protocol.connectionFailed() return CONNECTION_LOST # If I have reac...
f8c257d331ba0938e91d94f4900b4ca6466619be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f8c257d331ba0938e91d94f4900b4ca6466619be/tcp.py
removeReader(self)
self.stopReading()
def loseConnection(self): """ Stop accepting connections on this port.
f8c257d331ba0938e91d94f4900b4ca6466619be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f8c257d331ba0938e91d94f4900b4ca6466619be/tcp.py
def _addDeferred(self, deferred, lst, idx): sentinel = self.Sentinel() if hasattr(deferred, 'needsHeader'): # You might want to set a header from a deferred, in which # case you have to set an attribute -- needsHeader. self.needsHeaders = self.needsHeaders + 1 args = (sentinel, 1) else: args = (sentinel, 0) lst[idx] = ...
64e0b8cb65c7d433a1db38f53bdef92d635907b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/64e0b8cb65c7d433a1db38f53bdef92d635907b8/widgets.py
borderColor = ' titleTextColor = ' boxTextColor = ' boxColor = '
borderColor = ' titleTextColor = ' boxTextColor = ' boxColor = '
def getChild(self, path, request): if path == '': # ZOOP! if isinstance(self, Widget): return self.pageFactory(self) widget = self.getWidget(path, request) if widget: if isinstance(widget, resource.Resource): return widget else: p = self.pageFactory(widget) p.isLeaf = getattr(widget,'isLeaf',0) return p elif self.paths...
64e0b8cb65c7d433a1db38f53bdef92d635907b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/64e0b8cb65c7d433a1db38f53bdef92d635907b8/widgets.py
self._properties = DeadPropertyStore(self) return self._properties
self._dead_properties = DeadPropertyStore(self) return self._dead_properties
def getDeadProperties(self): if not hasattr(self, "_dead_properties"): self._properties = DeadPropertyStore(self) return self._properties
27c70e907615f3c8e2588034963dece8c94aff45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/27c70e907615f3c8e2588034963dece8c94aff45/static.py
def formatError(tm, tbformat=None): ret = [DOUBLE_SEPARATOR, '%s: %s (%s)\n' % (WORDS[tm.status], tm.name, reflect.qual(tm.klass))] ret.extend([(msg + '\n') for msg in (tm.skip, itrial.ITodo(tm.todo).msg) if msg is not None]) if tm.status not in (SUCCESS, SKIP, UNEXPECTED_SUCCESS): return "%s\n\n%s" % ('\n'.join(ret...
821633b87968385f50add898d6c470ac3f9c0fa5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/821633b87968385f50add898d6c470ac3f9c0fa5/reporter.py
what = error.getBriefTraceback()
what = itrial.IFormattedFailure(error)
def formatImportError(name, error): if isinstance(error, failure.Failure): what = error.getBriefTraceback() elif type(error) == types.TupleType: what = error.args[0] else: what = "%s\n" % error ret = "Could not import %s: %s\n" % (name, what) return ret
821633b87968385f50add898d6c470ac3f9c0fa5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/821633b87968385f50add898d6c470ac3f9c0fa5/reporter.py
ret = "Could not import %s: %s\n" % (name, what) return ret
ret.append("Could not import %s: \n%s\n" % (name, what)) return ''.join(ret)
def formatImportError(name, error): if isinstance(error, failure.Failure): what = error.getBriefTraceback() elif type(error) == types.TupleType: what = error.args[0] else: what = "%s\n" % error ret = "Could not import %s: %s\n" % (name, what) return ret
821633b87968385f50add898d6c470ac3f9c0fa5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/821633b87968385f50add898d6c470ac3f9c0fa5/reporter.py
return "fake", "fake", "fake"
return address.IPv4Address("TCP", "fake", "fake")
def getPeer(self): return "fake", "fake", "fake"
39617348e24d0927ac2e4ee0c0adff192b69f98d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/39617348e24d0927ac2e4ee0c0adff192b69f98d/test_woven.py
return "fake", "fake", 80
return address.IPv4Address("TCP", "fake", 80)
def getHost(self): return "fake", "fake", 80
39617348e24d0927ac2e4ee0c0adff192b69f98d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/39617348e24d0927ac2e4ee0c0adff192b69f98d/test_woven.py
@rtype: C{Deferred} @return: The callback of the C{Deferred} that is returned will be passed a string that represents the IP address of the specified name, or the errback will be called if the lookup times out. If multiple types of address records are associated with the name, A6 records will be returned in preference...
@rtype: L{twisted.internet.defer.Deferred} @return: The callback of the Deferred that is returned will be passed a string that represents the IP address of the specified name, or the errback will be called if the lookup times out. If multiple types of address records are associated with the name, A6 records will be re...
def getHostByName(self, name, timeout = 10): """Resolve the domain name C{name} into an IP address.
61b27ac6b2779aeb25ead8677978334e2f000f50 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/61b27ac6b2779aeb25ead8677978334e2f000f50/interfaces.py
if the name cannot be resolved within the specified timeout period.
if the name cannot be resolved within the specified timeout period.
def getHostByName(self, name, timeout = 10): """Resolve the domain name C{name} into an IP address.
61b27ac6b2779aeb25ead8677978334e2f000f50 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/61b27ac6b2779aeb25ead8677978334e2f000f50/interfaces.py
"""Connects a L{ConnectedDatagramProtocol} instance to a UDP port.
"""Connects a L{twisted.internet.protocol.ConnectedDatagramProtocol} instance to a UDP port.
def connectUDP(self, remotehost, remoteport, protocol, localport=0, interface='', maxPacketSize=8192): """Connects a L{ConnectedDatagramProtocol} instance to a UDP port. """
61b27ac6b2779aeb25ead8677978334e2f000f50 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/61b27ac6b2779aeb25ead8677978334e2f000f50/interfaces.py
@param processProtocol: a L{ProcessProtocol} instance
@param processProtocol: a L{twisted.internet.protocol.ProcessProtocol} instance
def spawnProcess(self, processProtocol, executable, args=(), env={}, path=None, uid=None, gid=None, usePTY=0): """Spawn a process, with a process protocol.
61b27ac6b2779aeb25ead8677978334e2f000f50 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/61b27ac6b2779aeb25ead8677978334e2f000f50/interfaces.py
"""Return a L{Deferred} that will resolve a hostname.
"""Return a L{twisted.internet.defer.Deferred} that will resolve a hostname.
def resolve(self, name, timeout=10): """Return a L{Deferred} that will resolve a hostname. """
61b27ac6b2779aeb25ead8677978334e2f000f50 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/61b27ac6b2779aeb25ead8677978334e2f000f50/interfaces.py
@precondition ttl must be > 0 and <= MAXUINT8.: (ttl > 0) and (ttl <= MAXUINT8): "ttl: %s" % str(ttl)
Precondition: ttl must be > 0 and <= MAXUINT8.: (ttl > 0) and (ttl <= MAXUINT8): "ttl: %s" % str(ttl)
def sendPing(self, ttl): """ @precondition ttl must be > 0 and <= MAXUINT8.: (ttl > 0) and (ttl <= MAXUINT8): "ttl: %s" % str(ttl) """ assert (ttl > 0) and (ttl <= MAXUINT8), "ttl must be > 0 and <= MAXUINT8." + " -- " + "ttl: %s" % str(ttl) log.msg("%s.sendPing(%s)" % (str(self), str(ttl),)) self.sendDescriptor(self._...
839a8f2cc7db04e43b435c51dd43208f74b68ce6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/839a8f2cc7db04e43b435c51dd43208f74b68ce6/gnutella.py
@precondition ttl must be > 0 and <= MAXUINT8.: (ttl > 0) and (ttl <= MAXUINT8): "ttl: %s" % str(ttl) @precondition descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descriptorId: %s :: %s" % (repr(descriptorId), str(type(de...
Precondition: ttl must be > 0 and <= MAXUINT8.: (ttl > 0) and (ttl <= MAXUINT8): "ttl: %s" % str(ttl) Precondition: descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descriptorId: %s :: %s" % (repr(descriptorId), str(type(de...
def sendPong(self, ttl, descriptorId, host, port, numberOfFilesShared, kbShared): """ @precondition ttl must be > 0 and <= MAXUINT8.: (ttl > 0) and (ttl <= MAXUINT8): "ttl: %s" % str(ttl) @precondition descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descripto...
839a8f2cc7db04e43b435c51dd43208f74b68ce6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/839a8f2cc7db04e43b435c51dd43208f74b68ce6/gnutella.py
@precondition descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descriptorId: %s :: %s" % (repr(descriptorId), str(type(descriptorId)),)
Precondition: descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descriptorId: %s :: %s" % (repr(descriptorId), str(type(descriptorId)),)
def pingReceived(self, descriptorId, ttl, hops): """ Override this to handle ping messages. @precondition descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descriptorId: %s :: %s" % (repr(descriptorId), str(type(descriptorId...
839a8f2cc7db04e43b435c51dd43208f74b68ce6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/839a8f2cc7db04e43b435c51dd43208f74b68ce6/gnutella.py
@param ipAddress a string representing an IPv4 address like this "140.184.83.37"; This is the representation that the Python Standard Library's socket.connect() expects. @param port an integer port number @param numberOfFilesShared a long @param kbShared a long @precondition descriptorId must be a string of length DES...
@param ipAddress: a string representing an IPv4 address like this "140.184.83.37"; This is the representation that the Python Standard Library's socket.connect() expects. @param port: an integer port number @param numberOfFilesShared: a long @param kbShared: a long Precondition: descriptorId must be a string of length...
def pongReceived(self, descriptorId, ttl, hops, ipAddress, port, numberOfFilesShared, kbShared): """ Override this to handle pong messages.
839a8f2cc7db04e43b435c51dd43208f74b68ce6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/839a8f2cc7db04e43b435c51dd43208f74b68ce6/gnutella.py
@param searchCriteria a string @param minimumSpeed integer KB/s -- you are not supposed to respond to this query if you can't serve at least this fast @precondition descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descript...
Precondition: descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descriptorId: %s :: %s" % (repr(descriptorId), str(type(descriptorId)),) @param searchCriteria: a string @param minimumSpeed: integer KB/s -- you are not suppo...
def queryReceived(self, descriptorId, ttl, hops, searchCriteria, minimumSpeed): """ Override this to handle query messages. @param searchCriteria a string @param minimumSpeed integer KB/s -- you are not supposed to respond to this query if you can't serve at least this fast
839a8f2cc7db04e43b435c51dd43208f74b68ce6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/839a8f2cc7db04e43b435c51dd43208f74b68ce6/gnutella.py
@param ipAddress a string representing an IPv4 address like this "140.184.83.37"; This is the representation that the Python Standard Library's socket.connect() expects. @param port an integer port number @param resultSet a list of tuples of (fileIndex, fileSize, fileName,) where fileIndex is a long, fileSize (in bytes...
@param ipAddress: a string representing an IPv4 address like this "140.184.83.37"; This is the representation that the Python Standard Library's socket.connect() expects. @param port: an integer port number @param resultSet: a list of tuples of (fileIndex, fileSize, fileName,) where fileIndex is a long, fileSize (in by...
def queryHitReceived(self, descriptorId, ttl, hops, ipAddress, port, resultSet, serventIdentifer, speed): """ Override this to handle query hit messages. @param ipAddress a string representing an IPv4 address like this "140.184.83.37"; This is the representation that the Python Standard Library's socket.connect() expe...
839a8f2cc7db04e43b435c51dd43208f74b68ce6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/839a8f2cc7db04e43b435c51dd43208f74b68ce6/gnutella.py
@param ipAddress a string representing an IPv4 address like this "140.184.83.37"; This is the representation that the Python Standard Library's socket.connect() expects. @param port an integer port number @param serventIdentifier string of length 16 @param fileIndex a long @precondition descriptorId must be a string o...
Precondition: descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descriptorId: %s :: %s" % (repr(descriptorId), str(type(descriptorId)),) @param ipAddress: a string representing an IPv4 address like this "140.184.83.37"; Thi...
def pushReceived(descriptorId, ttl, hops, ipAddress, port, serventIdentifer, fileIndex): """ Override this to handle push messages. @param ipAddress a string representing an IPv4 address like this "140.184.83.37"; This is the representation that the Python Standard Library's socket.connect() expects. @param port an in...
839a8f2cc7db04e43b435c51dd43208f74b68ce6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/839a8f2cc7db04e43b435c51dd43208f74b68ce6/gnutella.py
@precondition descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descriptorId: %s :: %s" % (repr(descriptorId), str(type(descriptorId)),) @precondition payload must not be larger than MAXUINT32 bytes.: len(payload) <= MAXUINT...
Precondition: descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descriptorId: %s :: %s" % (repr(descriptorId), str(type(descriptorId)),) Precondition: payload must not be larger than MAXUINT32 bytes.: len(payload) <= MAXUINT...
def sendDescriptor(self, descriptorId, payloadDescriptor, ttl, payload): """ @precondition descriptorId must be a string of length DESCRIPTORLENGTH.: (type(descriptorId) is types.StringType) and (len(descriptorId) == DESCRIPTORLENGTH): "descriptorId: %s :: %s" % (repr(descriptorId), str(type(descriptorId)),) @precondit...
839a8f2cc7db04e43b435c51dd43208f74b68ce6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/839a8f2cc7db04e43b435c51dd43208f74b68ce6/gnutella.py
@precondition descriptor must be a string of the right length to hold a payload of the encoded length.: len(descriptor) == (struct.unpack(PAYLOADENCODING, descriptor[PAYLOADLENGTHOFFSET:HEADERLENGTH])[0] + HEADERLENGTH): "self: %s, descriptor: %s" % (str(self), repr(descriptor),)
Precondition: descriptor must be a string of the right length to hold a payload of the encoded length.: len(descriptor) == (struct.unpack(PAYLOADENCODING, descriptor[PAYLOADLENGTHOFFSET:HEADERLENGTH])[0] + HEADERLENGTH): "self: %s, descriptor: %s" % (str(self), repr(descriptor),)
def descriptorReceived(self, descriptor): """ A Gnutella descriptor has arrived.
839a8f2cc7db04e43b435c51dd43208f74b68ce6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/839a8f2cc7db04e43b435c51dd43208f74b68ce6/gnutella.py
@precondition We must be expecting a GNUTELLA CONNECT handshake move.: (self.initiator and (self.handshake == "initiatorsaidhello")) or ((not self.initiator) and (self.handshake == "start")): "self.initiator: %s, self.handshake: %s, line: %s" % (str(self.initiator), str(self.handshake), str(line),)
Precondition: We must be expecting a GNUTELLA CONNECT handshake move.: (self.initiator and (self.handshake == "initiatorsaidhello")) or ((not self.initiator) and (self.handshake == "start")): "self.initiator: %s, self.handshake: %s, line: %s" % (str(self.initiator), str(self.handshake), str(line),)
def lineReceived(self, line): """ @precondition We must be expecting a GNUTELLA CONNECT handshake move.: (self.initiator and (self.handshake == "initiatorsaidhello")) or ((not self.initiator) and (self.handshake == "start")): "self.initiator: %s, self.handshake: %s, line: %s" % (str(self.initiator), str(self.handshake)...
839a8f2cc7db04e43b435c51dd43208f74b68ce6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/839a8f2cc7db04e43b435c51dd43208f74b68ce6/gnutella.py
_host = socket.gethostbyaddr(socket.gethostname())[0]
def __repr__(self): return '<%s %s %s>'% (self.method, self.uri, self.clientproto)
3a35da1907748cd0640478012d5d7677e7dd3dc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3a35da1907748cd0640478012d5d7677e7dd3dc1/server.py
return self._host
return socket.gethostbyaddr(self.transport.getHost()[1])
def getHost(self): return self._host
3a35da1907748cd0640478012d5d7677e7dd3dc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3a35da1907748cd0640478012d5d7677e7dd3dc1/server.py
netResult.addCallbacks(self._sendAnswer, self._sendError,
netResult.addCallbacks(self._sendAnswer, self._sendFormattedFailure,
def _recvMessage(self, findObjMethod, requestID, objectID, message, answerRequired, netArgs, netKw): """Received a message-send.
8ee55b9e8635a9fd1c80dea287eca397063034a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/8ee55b9e8635a9fd1c80dea287eca397063034a5/pb.py
callbackArgs=(d, client, service, password, perspectiveName or userName))
callbackArgs=(d, client, service, password, perspectiveName or username))
def logIn(authServRef, client, service, username, password, perspectiveName=None): """I return a Deferred which will be called back with a Perspective. """ d = defer.Deferred() authServRef.username(username).addCallbacks(_cbLogInRespond, d.armAndErrback, callbackArgs=(d, client, service, password, perspectiveName or us...
8ee55b9e8635a9fd1c80dea287eca397063034a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/8ee55b9e8635a9fd1c80dea287eca397063034a5/pb.py
def appendChild(self, child): self.childNodes.append(child)
def appendChild(self, child): # should we be checking the type of the child? self.childNodes.append(child)
eef50ed66d79b00b89311c49981932bc8ecbb36a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/eef50ed66d79b00b89311c49981932bc8ecbb36a/microdom.py