rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
return maybeDeferred(render, req).addCallback(setHeaders) | return maybeDeferred(self.render, req).addCallback(setHeaders) | def setHeaders(response): for (header, value) in ( ("content-length", self.contentLength()), ("content-type", self.contentType()), ("content-encoding", self.contentType()), ): if value is not None: response.headers.setHeader(header, value) | abc9a0f10947bc0a6d62309fa6913b322b2c8e58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/abc9a0f10947bc0a6d62309fa6913b322b2c8e58/resource.py |
raise TypeError, "Failure, not Exception -- you lose." | print "Failure, not Exception -- can't postmortem." pdb.set_trace() | def reportResults(self, testClass, method, resultType, results=None): tup = (testClass, method, results) self.numTests += 1 if resultType in (FAILURE, ERROR, EXPECTED_FAILURE): if self.debugger: if isinstance(results, failure.Failure): raise TypeError, "Failure, not Exception -- you lose." else: pdb.post_mortem(results... | 544290276938784fdff6e07e5e147add056656fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/544290276938784fdff6e07e5e147add056656fd/reporter.py |
if seenNames.has_key(plugindir): debugInspection('Seen %s already' % plugindir) | tmlname = join((d, plugindir, "plugins.tml")) if seenNames.has_key(tmlname): debugInspection('Seen %s already' % tmlname) | def getPluginFileList(debugInspection=None, showProgress=None): """Find plugin.tml files in subdirectories of paths in C{sys.path} @type debugInspection: C{None} or a callable taking one argument @param debugInspection: If not None, this is invoked with strings containing debug information about the loading process. ... | 12a3aef9bbea6ad7d736ab159a5ce1fc9d51a2ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/12a3aef9bbea6ad7d736ab159a5ce1fc9d51a2ce/plugin.py |
seenNames[plugindir] = 1 tmlname = join((d, plugindir, "plugins.tml")) | seenNames[tmlname] = 1 | def getPluginFileList(debugInspection=None, showProgress=None): """Find plugin.tml files in subdirectories of paths in C{sys.path} @type debugInspection: C{None} or a callable taking one argument @param debugInspection: If not None, this is invoked with strings containing debug information about the loading process. ... | 12a3aef9bbea6ad7d736ab159a5ce1fc9d51a2ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/12a3aef9bbea6ad7d736ab159a5ce1fc9d51a2ce/plugin.py |
dict = {'__file__': pyfile, '__name__': pyfile} | dict = {'__file__': pyfile} | def rotateLog(signal, frame, logFile=logFile): logFile.rotate() | 13c9dd6d2e55d08c74fe6dabfbf0f3aa9474c5f7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/13c9dd6d2e55d08c74fe6dabfbf0f3aa9474c5f7/twistd.py |
print ''.join(traceback.format_exception(*sys.exc_info())[-3:]) | traceback.print_exc() | def run(): options = FirstPassOptions() try: options.parseOptions(sys.argv[1:]) except usage.UsageError, e: print str(options) print str(e) sys.exit(2) except (SystemExit, KeyboardInterrupt): sys.exit(1) except: import traceback print 'An error unexpected occurred:' print ''.join(traceback.format_exception(*sys.exc_inf... | e90d27f9a9c129418e410555c48bef058df1da01 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e90d27f9a9c129418e410555c48bef058df1da01/mktap.py |
print 'FOO2', repr(cont) | def continueReceived(self, cont): print 'FOO2', repr(cont) if not cont: return if cont[0].isupper(): f = getattr(self, 'macro_' + cont[:2].rstrip().upper(), None) print 'conting with', cont[:2].rstrip().upper(), f if f: f(cont[2:].strip()) else: self.text(cont) | 355c8733ed815ef33bfcd30f800e488206c67fd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/355c8733ed815ef33bfcd30f800e488206c67fd5/man2lore.py | |
print 'conting with', cont[:2].rstrip().upper(), f | def continueReceived(self, cont): print 'FOO2', repr(cont) if not cont: return if cont[0].isupper(): f = getattr(self, 'macro_' + cont[:2].rstrip().upper(), None) print 'conting with', cont[:2].rstrip().upper(), f if f: f(cont[2:].strip()) else: self.text(cont) | 355c8733ed815ef33bfcd30f800e488206c67fd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/355c8733ed815ef33bfcd30f800e488206c67fd5/man2lore.py | |
st = string.replace(st, k, v) | st = st.replace(k, v) | def multireplace(st, dct): for k, v in dct.items(): st = string.replace(st, k, v) return st | 8799a8f5fb9f9e869533ca9824ec8ac8d4c44d8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/8799a8f5fb9f9e869533ca9824ec8ac8d4c44d8b/telnet.py |
idx = string.find(self.buffer, delim) | idx = self.buffer.find(delim) | def processChunk(self, chunk): """I take a chunk of data and delegate out to telnet_* methods by way of processLine. If the current mode is 'Done', I'll close the connection. """ self.buffer = self.buffer + chunk | 8799a8f5fb9f9e869533ca9824ec8ac8d4c44d8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/8799a8f5fb9f9e869533ca9824ec8ac8d4c44d8b/telnet.py |
idx = string.find(self.buffer, delim) | idx = self.buffer.find(delim) | def processChunk(self, chunk): """I take a chunk of data and delegate out to telnet_* methods by way of processLine. If the current mode is 'Done', I'll close the connection. """ self.buffer = self.buffer + chunk | 8799a8f5fb9f9e869533ca9824ec8ac8d4c44d8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/8799a8f5fb9f9e869533ca9824ec8ac8d4c44d8b/telnet.py |
p = reactor.spawnProcess(protocol.ProcessProtocol(), "process_reader.py") | pproto = PProtocol() p = reactor.spawnProcess(pproto, "process_reader.py") | def testCyclicAlias(self): aliases = {} domain = {'': TestDomain(aliases, [])} A1 = mail.alias.AddressAlias('alias2', domain, 'alias1') A2 = mail.alias.AddressAlias('alias3', domain, 'alias2') A3 = mail.alias.AddressAlias('alias1', domain, 'alias3') aliases.update({ 'alias1': A1, 'alias2': A2, 'alias3': A3 }) | b7a5f84340189d7589aaeca78cd80759f1fcc096 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b7a5f84340189d7589aaeca78cd80759f1fcc096/test_mail.py |
self.assertEquals(r, expected) reactor.iterate() reactor.iterate() reactor.iterate() | tutil.spinUntil(lambda :r == expected) tutil.spinUntil(lambda :pproto.ended) | def testCyclicAlias(self): aliases = {} domain = {'': TestDomain(aliases, [])} A1 = mail.alias.AddressAlias('alias2', domain, 'alias1') A2 = mail.alias.AddressAlias('alias3', domain, 'alias2') A3 = mail.alias.AddressAlias('alias1', domain, 'alias3') aliases.update({ 'alias1': A1, 'alias2': A2, 'alias3': A3 }) | b7a5f84340189d7589aaeca78cd80759f1fcc096 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b7a5f84340189d7589aaeca78cd80759f1fcc096/test_mail.py |
"""Delayed.loop(ticks,func[,args=()]) -> Stoppable | """Delayed.loop(func[, ticks=0][, args=()]) -> Stoppable | def loop(self, func,ticks=0,args=()): """Delayed.loop(ticks,func[,args=()]) -> Stoppable | df1b71b5fe1dba88c3aad64b4f99f9196a64bd1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/df1b71b5fe1dba88c3aad64b4f99f9196a64bd1f/delay.py |
except IllegalClientResponse, e: self.sendBadResponse(tag, 'Illegal syntax: ' + str(e)) except IllegalOperation, e: self.sendNegativeResponse(tag, 'Illegal operation: ' + str(e)) except IllegalMailboxEncoding, e: self.sendNegativeResponse(tag, 'Illegal mailbox name: ' + str(e)) | def lineReceived(self, line): print 'S:', repr(line) self.resetTimeout() f = getattr(self, 'parse_' + self.parseState) try: f(line) except IllegalClientResponse, e: self.sendBadResponse(tag, 'Illegal syntax: ' + str(e)) except IllegalOperation, e: self.sendNegativeResponse(tag, 'Illegal operation: ' + str(e)) except I... | 0a0608aaf7333c1dde8a5d1d878c825f279fdba6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/0a0608aaf7333c1dde8a5d1d878c825f279fdba6/imap4.py | |
self.sendBadResponse(tag, 'Server error: ' + str(e)) | self.sendUntaggedResponse('BAD Server error: ' + str(e)) | def lineReceived(self, line): print 'S:', repr(line) self.resetTimeout() f = getattr(self, 'parse_' + self.parseState) try: f(line) except IllegalClientResponse, e: self.sendBadResponse(tag, 'Illegal syntax: ' + str(e)) except IllegalOperation, e: self.sendNegativeResponse(tag, 'Illegal operation: ' + str(e)) except I... | 0a0608aaf7333c1dde8a5d1d878c825f279fdba6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/0a0608aaf7333c1dde8a5d1d878c825f279fdba6/imap4.py |
return self.dispatchCommand(tag, cmd, rest) | try: return self.dispatchCommand(tag, cmd, rest) except IllegalClientResponse, e: self.sendBadResponse(tag, 'Illegal syntax: ' + str(e)) except IllegalOperation, e: self.sendNegativeResponse(tag, 'Illegal operation: ' + str(e)) except IllegalMailboxEncoding, e: self.sendNegativeResponse(tag, 'Illegal mailbox name: ' + ... | def parse_command(self, line): args = line.split(None, 2) rest = None if len(args) == 3: tag, cmd, rest = args elif len(args) == 2: tag, cmd = args elif len(args) == 1: tag = args[0] self.sendBadResponse(tag, 'Missing command') return None else: self.sendBadResponse(None, 'Null command') return None | 0a0608aaf7333c1dde8a5d1d878c825f279fdba6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/0a0608aaf7333c1dde8a5d1d878c825f279fdba6/imap4.py |
self.state = 'command' | self.parseState = 'command' | def parse_pending(self, line): self._pendingLiteral.callback(line) self._pendingLiteral = None self.state = 'command' | 0a0608aaf7333c1dde8a5d1d878c825f279fdba6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/0a0608aaf7333c1dde8a5d1d878c825f279fdba6/imap4.py |
def __doCommand(self, tag, handler, args, parseargs, line, uid): | 0a0608aaf7333c1dde8a5d1d878c825f279fdba6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/0a0608aaf7333c1dde8a5d1d878c825f279fdba6/imap4.py | ||
def arg_astring(self, line): """ Parse an astring from the line, return (arg, rest), possibly via a deferred (to handle literals) """ # line = line.lstrip() if not line: raise IllegalClientResponse("Missing argument") d = None arg, rest = None, None if line[0] == '"': try: spam, arg, rest = line.split('"',2) rest = res... | 0a0608aaf7333c1dde8a5d1d878c825f279fdba6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/0a0608aaf7333c1dde8a5d1d878c825f279fdba6/imap4.py | ||
self.xmlstream.streamError(None) | self.xmlstream.dispatch(iq, self.AUTH_FAILED_EVENT) | def _authResultEvent(self, iq): if iq["type"] == "result": self.xmlstream.dispatch(self.xmlstream, xmlstream.STREAM_AUTHD_EVENT) else: self.xmlstream.streamError(None) | a5cc51f58c35d2745538468bab42d7d27c6b31dd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a5cc51f58c35d2745538468bab42d7d27c6b31dd/client.py |
if isinstance(content, StringTypes): | if isinstance(content, types.StringTypes): | def remote_console(self, messages): for kind, content in messages: if isinstance(content, StringTypes): self.original.output.append(content, kind) elif (kind == "exception") and isinstance(content, failure.Failure): content.printTraceback(_Notafile(self.original.output, "exception")) else: self.original.output.append(s... | 2a67f124ca26abf207e852f45e8f7f8d4a2a7a8e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2a67f124ca26abf207e852f45e8f7f8d4a2a7a8e/gtk2manhole.py |
self.accountName = self.account.username | def __init__(self, account, chatui): toc.TOCClient.__init__(self, account.username, account.password) basesupport.AbstractClientMixin.__init__(self, account, chatui) self.accountName = self.account.username self.roomID = {} self.roomIDreverse = {} | e139d1900dc7f9b4da15dd88da17bce9b3bbfeec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e139d1900dc7f9b4da15dd88da17bce9b3bbfeec/tocsupport.py | |
if online: | if away: status=AWAY elif online: | def updateBuddy(self,username,online,evilness,signontime,idletime,userclass,away): if online: status=ONLINE elif away: status=AWAY else: status=OFFLINE self.getPerson(username).setStatusAndIdle(status, idletime) | e139d1900dc7f9b4da15dd88da17bce9b3bbfeec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e139d1900dc7f9b4da15dd88da17bce9b3bbfeec/tocsupport.py |
elif away: status=AWAY | def updateBuddy(self,username,online,evilness,signontime,idletime,userclass,away): if online: status=ONLINE elif away: status=AWAY else: status=OFFLINE self.getPerson(username).setStatusAndIdle(status, idletime) | e139d1900dc7f9b4da15dd88da17bce9b3bbfeec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e139d1900dc7f9b4da15dd88da17bce9b3bbfeec/tocsupport.py | |
print 'no packet type for', kind | log.msg('no packet type for', kind) | def dataReceived(self, data): self.buf += data while len(self.buf) > 5: length, kind = struct.unpack('!LB', self.buf[:5]) if len(self.buf) < 4 + length: return data, self.buf = self.buf[5:4+length], self.buf[4+length:] packetType = self.packetTypes.get(kind, None) if not packetType: print 'no packet type for', kind con... | 1791e9978562ff3700d3947b8ea8c78efd467fa8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1791e9978562ff3700d3947b8ea8c78efd467fa8/filetransfer.py |
print 'not implemented', packetType | log.msg('not implemented: %s' % packetType) log.msg(repr(data[4:])) | def dataReceived(self, data): self.buf += data while len(self.buf) > 5: length, kind = struct.unpack('!LB', self.buf[:5]) if len(self.buf) < 4 + length: return data, self.buf = self.buf[5:4+length], self.buf[4+length:] packetType = self.packetTypes.get(kind, None) if not packetType: print 'no packet type for', kind con... | 1791e9978562ff3700d3947b8ea8c78efd467fa8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1791e9978562ff3700d3947b8ea8c78efd467fa8/filetransfer.py |
f(data) | try: f(data) except Exception, e: reqId = struct.unpack('!L', data[:4])[0] self._ebStatus(failure.Failure(e), reqId) | def dataReceived(self, data): self.buf += data while len(self.buf) > 5: length, kind = struct.unpack('!LB', self.buf[:5]) if len(self.buf) < 4 + length: return data, self.buf = self.buf[5:4+length], self.buf[4+length:] packetType = self.packetTypes.get(kind, None) if not packetType: print 'no packet type for', kind con... | 1791e9978562ff3700d3947b8ea8c78efd467fa8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1791e9978562ff3700d3947b8ea8c78efd467fa8/filetransfer.py |
if e.args[0] == 'encrypted key with no password': | if e.args[0] == 'encrypted key with no passphrase': | def getPrivateKey(self): file = os.path.expanduser(self.usedFiles[-1]) if not os.path.exists(file): return None try: return defer.succeed(keys.getPrivateKeyObject(file)) except keys.BadKeyError, e: if e.args[0] == 'encrypted key with no password': for i in range(3): prompt = "Enter passphrase for key '%s': " % \ self.u... | ba7698ee3abb48e876b352f96607c8eeb59df503 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ba7698ee3abb48e876b352f96607c8eeb59df503/conch.py |
return defer.succeed(keys.getPrivateKeyObject(file, password = p)) | return defer.succeed(keys.getPrivateKeyObject(file, passphrase = p)) | def getPrivateKey(self): file = os.path.expanduser(self.usedFiles[-1]) if not os.path.exists(file): return None try: return defer.succeed(keys.getPrivateKeyObject(file)) except keys.BadKeyError, e: if e.args[0] == 'encrypted key with no password': for i in range(3): prompt = "Enter passphrase for key '%s': " % \ self.u... | ba7698ee3abb48e876b352f96607c8eeb59df503 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ba7698ee3abb48e876b352f96607c8eeb59df503/conch.py |
while not clientF.disconnected: reactor.iterate(0.01) | def loopbackTCP(server, client, port=0, noisy=True): """Run session between server and client protocol instances over TCP.""" from twisted.internet import reactor f = protocol.Factory() f.noisy = noisy f.buildProtocol = lambda addr, p=server: p serverPort = reactor.listenTCP(port, f, interface='127.0.0.1') reactor.iter... | 48b284161c9e435c823e4a16341ff0a0474d0b42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/48b284161c9e435c823e4a16341ff0a0474d0b42/loopback.py | |
reactor.iterate() | spinWhile(lambda :serverPort.connected) | def loopbackTCP(server, client, port=0, noisy=True): """Run session between server and client protocol instances over TCP.""" from twisted.internet import reactor f = protocol.Factory() f.noisy = noisy f.buildProtocol = lambda addr, p=server: p serverPort = reactor.listenTCP(port, f, interface='127.0.0.1') reactor.iter... | 48b284161c9e435c823e4a16341ff0a0474d0b42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/48b284161c9e435c823e4a16341ff0a0474d0b42/loopback.py |
timeout = 1000 else: timeout = int(timeout * 1000) | timeout = 1 timeout = int(timeout * 1000) | def doPoll(self, timeout, reads=reads, writes=writes, selectables=selectables, select=select, log=log): """Poll the poller for new events.""" if timeout is None: timeout = 1000 else: timeout = int(timeout * 1000) # convert seconds to milliseconds | 69b415ae585525f317df67e24d75e098005da1a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/69b415ae585525f317df67e24d75e098005da1a1/epollreactor.py |
try: l = poller.wait(len(selectables), timeout) except select.error, e: if e[0] == errno.EINTR: return else: raise | l = poller.wait(len(selectables), timeout) | def doPoll(self, timeout, reads=reads, writes=writes, selectables=selectables, select=select, log=log): """Poll the poller for new events.""" if timeout is None: timeout = 1000 else: timeout = int(timeout * 1000) # convert seconds to milliseconds | 69b415ae585525f317df67e24d75e098005da1a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/69b415ae585525f317df67e24d75e098005da1a1/epollreactor.py |
selectable = selectables[fd] log.callWithLogger(selectable, _drdw, selectable, fd, event) | try: selectable = selectables[fd] except KeyError: pass else: log.callWithLogger(selectable, _drdw, selectable, fd, event) | def doPoll(self, timeout, reads=reads, writes=writes, selectables=selectables, select=select, log=log): """Poll the poller for new events.""" if timeout is None: timeout = 1000 else: timeout = int(timeout * 1000) # convert seconds to milliseconds | 69b415ae585525f317df67e24d75e098005da1a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/69b415ae585525f317df67e24d75e098005da1a1/epollreactor.py |
def connectionMade(self): # This is half-cannibalised from twisted.internet.process.Process service = self.factory.service pid = os.fork() if pid == 0: # Child try: # Close stdin/stdout (we keep stderr from the parent to report # errors with) for fd in range(2): os.close(fd) # Make the socket be fd 0 # (and fd 1, a... | e35cd1f4637a2690ca03ca2bb95843240e2b654a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e35cd1f4637a2690ca03ca2bb95843240e2b654a/inetd.py | ||
if (service.protocol, service.socketType) not in [('tcp', 'stream')]: | if (service.protocol, service.socketType) not in [('tcp', 'stream'), ('udp', 'dgram')]: | def main(options=None): if not options: options = InetdOptions() options.parseOptions() conf = inetdconf.InetdConf() conf.parseFile(open(options['file'])) app = Application('tinetd') for service in conf.services: if (service.protocol, service.socketType) not in [('tcp', 'stream')]: log.msg('Skipping unsupported type... | e35cd1f4637a2690ca03ca2bb95843240e2b654a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e35cd1f4637a2690ca03ca2bb95843240e2b654a/inetd.py |
def on_PlainJoinChat_clicked(self, b): GroupJoinWindow() | 1274b8505bedacc5978a216c6e1c07ff183a268d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1274b8505bedacc5978a216c6e1c07ff183a268d/chat.py | ||
self.group.account.perspective.addContact(self.members[lw.selection[0]]) | self.group.account.perspective.callRemote('addContact', self.members[lw.selection[0]]) | def on_AddContactButton_clicked(self, b): lw = self.xml.get_widget("ParticipantList") | 1274b8505bedacc5978a216c6e1c07ff183a268d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1274b8505bedacc5978a216c6e1c07ff183a268d/chat.py |
def on_TopicEntry_activate(self, e): print "ACTIVATING TOPIC!!" self.group.setTopic(e.get_text()) | 1274b8505bedacc5978a216c6e1c07ff183a268d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1274b8505bedacc5978a216c6e1c07ff183a268d/chat.py | ||
self.substitute(request, child, subs) | substitute(request, child, subs) | def substitute(request, node, subs): """ Look through the given node's children for strings, and attempt to do string substitution with the given parameter. """ for child in node.childNodes: if child.nodeValue: child.replaceData(0, len(child.nodeValue), child.nodeValue % subs) self.substitute(request, child, subs) | 6f65cc63d418d29cbd850d92e51ee15f7d67e48d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/6f65cc63d418d29cbd850d92e51ee15f7d67e48d/domhelpers.py |
accept() on a server. Programmers for the twisted.net framework should not have to use me directly, since I am automatically instantiated in TCPServer's doRead method. For documentation on what I do, refer to the documentation for twisted.protocols.protocol.Transport. | accept() on a server. | def __init__(self, host, port, bindAddress, connector, reactor=None): self.connector = connector skt = self.createInternetSocket() self.addr = (host, port) whenDone = self.resolveAddress err = None # try to bind to given address if bindAddress is not None: try: skt.bind(bindAddress) except socket.error, se: err = error... | 1a7fa58d48055ae119635fd89eb13f3002ffd422 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1a7fa58d48055ae119635fd89eb13f3002ffd422/tcp.py |
return ('INET',)+self.client | if isinstance(self.client, types.TupleType): return ('INET',)+self.client else: return ("INET", self.client) | def getPeer(self): """ Returns a tuple of ('INET', hostname, port), indicating the connected client's address. """ return ('INET',)+self.client | 1a7fa58d48055ae119635fd89eb13f3002ffd422 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1a7fa58d48055ae119635fd89eb13f3002ffd422/tcp.py |
deferredError(self.dbpool.runQuery("select * from NOTABLE")) deferredError(self.dbpool.runOperation("delete from * from NOTABLE")) deferredError(self.dbpool.runInteraction(self.bad_interaction)) log.flushErrors() | if self.test_failures: deferredError(self.dbpool.runQuery("select * from NOTABLE")) deferredError(self.dbpool.runOperation("deletexxx from NOTABLE")) deferredError(self.dbpool.runInteraction(self.bad_interaction)) log.flushErrors() | def testPool(self): # make sure failures are raised correctly deferredError(self.dbpool.runQuery("select * from NOTABLE")) deferredError(self.dbpool.runOperation("delete from * from NOTABLE")) deferredError(self.dbpool.runInteraction(self.bad_interaction)) log.flushErrors() | 2b4cfd1f6570eca1b655d7f33a1f039a162b42f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2b4cfd1f6570eca1b655d7f33a1f039a162b42f6/test_enterprise.py |
def interaction(self, transaction): transaction.execute("select x from simple order by x") for i in range(self.count): row = transaction.fetchone() self.failUnless(len(row) == 1, "Wrong size row") self.failUnless(row[0] == i, "Value not returned.") # should test this, but gadfly throws an exception instead #self.failUn... | 2b4cfd1f6570eca1b655d7f33a1f039a162b42f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2b4cfd1f6570eca1b655d7f33a1f039a162b42f6/test_enterprise.py | ||
conn = psycopg.connect(database=PostgresTestCase.DB_NAME, user=PostgresTestCase.DB_USER, password=PostgresTestCase.DB_PASS) | conn = psycopg.connect(database=PsycopgTestCase.DB_NAME, user=PsycopgTestCase.DB_USER, password=PsycopgTestCase.DB_PASS) | def testQuoting(self): for value, typ, expected in [ (12, "integer", "12"), ("foo'd", "text", "'foo''d'"), ("\x00abc\\s\xFF", "bytea", "'\\\\000abc\\\\\\\\s\\377'"), ]: self.assertEquals(util.quote(value, typ), expected) | 2b4cfd1f6570eca1b655d7f33a1f039a162b42f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2b4cfd1f6570eca1b655d7f33a1f039a162b42f6/test_enterprise.py |
global n | global _n | def _generateMaildirName(): """utility function to generate a unique maildir name """ global n t = str(int(time.time())) s = socket.gethostname() p = os.getpid() n = n+1 return '%s.%s_%s.%s' % (t, p, n, s) | e8df9ac9036a2287c076b68eea7dbf837af313d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e8df9ac9036a2287c076b68eea7dbf837af313d5/maildir.py |
n = n+1 return '%s.%s_%s.%s' % (t, p, n, s) | _n = _n+1 return '%s.%s_%s.%s' % (t, p, _n, s) | def _generateMaildirName(): """utility function to generate a unique maildir name """ global n t = str(int(time.time())) s = socket.gethostname() p = os.getpid() n = n+1 return '%s.%s_%s.%s' % (t, p, n, s) | e8df9ac9036a2287c076b68eea7dbf837af313d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e8df9ac9036a2287c076b68eea7dbf837af313d5/maildir.py |
def initializeMaildir(dir): if not os.path.isdir(dir): os.mkdir(dir) for subdir in ['new', 'cur', 'tmp', '.Trash']: os.mkdir(os.path.join(dir, subdir)) for subdir in ['new', 'cur', 'tmp']: os.mkdir(os.path.join(dir, '.Trash', subdir)) # touch open(os.path.join(dir, '.Trash', 'maildirfolder'), 'w').close() | e8df9ac9036a2287c076b68eea7dbf837af313d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e8df9ac9036a2287c076b68eea7dbf837af313d5/maildir.py | ||
def initializeMaildir(dir): if not os.path.isdir(dir): os.mkdir(dir) for subdir in ['new', 'cur', 'tmp', '.Trash']: os.mkdir(os.path.join(dir, subdir)) for subdir in ['new', 'cur', 'tmp']: os.mkdir(os.path.join(dir, '.Trash', subdir)) # touch open(os.path.join(dir, '.Trash', 'maildirfolder'), 'w').close() | e8df9ac9036a2287c076b68eea7dbf837af313d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e8df9ac9036a2287c076b68eea7dbf837af313d5/maildir.py | ||
fname = _generateMaildirName() | fname = _generateMaildirName() | def startMessage(self, user): """Save a message for a given user """ name, domain = user.dest.local, user.dest.domain dir = self.userDirectory(name) fname = _generateMaildirName() filename = os.path.join(dir, 'tmp', fname) fp = open(filename, 'w') fp.write("Delivered-To: %(name)s@%(domain)s\n" % vars()) return mail.Fil... | e8df9ac9036a2287c076b68eea7dbf837af313d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e8df9ac9036a2287c076b68eea7dbf837af313d5/maildir.py |
def deleteMessage(self, i): """Delete a message | e8df9ac9036a2287c076b68eea7dbf837af313d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e8df9ac9036a2287c076b68eea7dbf837af313d5/maildir.py | ||
def undeleteMessages(self): """Undelete any deleted messages it is possible to undelete This moves any messages from .Trash/ subfolder back to their original position, and empties out the deleted dictionary. """ for (real, trash) in self.deleted.items(): try: os.rename(trash, real) except OSError, (err, str): # If the... | e8df9ac9036a2287c076b68eea7dbf837af313d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e8df9ac9036a2287c076b68eea7dbf837af313d5/maildir.py | ||
except OSError, (err, str): | except OSError, (err, estr): | def undeleteMessages(self): """Undelete any deleted messages it is possible to undelete This moves any messages from .Trash/ subfolder back to their original position, and empties out the deleted dictionary. """ for (real, trash) in self.deleted.items(): try: os.rename(trash, real) except OSError, (err, str): # If the... | e8df9ac9036a2287c076b68eea7dbf837af313d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e8df9ac9036a2287c076b68eea7dbf837af313d5/maildir.py |
def authenticateUserPASS(self, username, password): if not self.dbm.has_key(username) or self.dbm[username] != password: return None return MaildirMailbox(os.path.join(self.root, username)) | e8df9ac9036a2287c076b68eea7dbf837af313d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e8df9ac9036a2287c076b68eea7dbf837af313d5/maildir.py | ||
if self.chunked: | if self.chunked and self.code not in NO_BODY_CODES: | def finish(self): """We are finished writing data.""" if self.chunked: # write last chunk and closing CRLF self.transport.write("0\r\n\r\n") elif not self.startedWriting: # write headers self.write('') | cbc19c953c2c22d8bc4e0cdce65f758f4b49428e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/cbc19c953c2c22d8bc4e0cdce65f758f4b49428e/http.py |
(self.headers.get('content-length', None) is None)): l.append("%s: %s\r\n" % ('Transfer-encoding', 'chunked')) | (self.headers.get('content-length', None) is None) and (self.code not in NO_BODY_CODES)): l.append("%s: %s\r\n" % ('Transfer-encoding', 'chunked')) | def write(self, data): """ Write some data as a result of an HTTP request. The first time this is called, it writes out response data. """ if not self.startedWriting: self.startedWriting = 1 version = self.clientproto if version != "HTTP/0.9": l = [] l.append('%s %s %s\r\n' % (version, self.code, self.code_message)) #... | cbc19c953c2c22d8bc4e0cdce65f758f4b49428e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/cbc19c953c2c22d8bc4e0cdce65f758f4b49428e/http.py |
val = eval(code) | val = eval(code, self.namespace) | def perspective_do(self, mesg): fn = "$manhole" try: code = compile(mesg, fn, 'eval') except: try: code = compile(mesg, fn, 'exec') except: io = StringIO.StringIO() traceback.print_exc(file=io) return io.getvalue() try: val = eval(code) except: io = StringIO.StringIO() traceback.print_exc(file=io) return io.getvalue() ... | 6287b6ba2ea2b5e691d1f440dc13792f22abb96e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/6287b6ba2ea2b5e691d1f440dc13792f22abb96e/service.py |
d = utils.getProcessOutput(sys.executable, [scriptFile]) | d = utils.getProcessOutput(sys.executable, ['-u', scriptFile]) | def testOutput(self): scriptFile = self.makeSourceFile([ 'print "hello world"' ]) d = utils.getProcessOutput(sys.executable, [scriptFile]) return d.addCallback(self.assertEquals, "hello world\n") | 7b89bf4800a4c444036d44c6ab146adc71bc9395 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/7b89bf4800a4c444036d44c6ab146adc71bc9395/test_iutils.py |
d = utils.getProcessOutput(exe, [scriptFile], errortoo=0) | d = utils.getProcessOutput(exe, ['-u', scriptFile], errortoo=0) | def testOutputWithErrorIgnored(self): # make sure stderr raises an error normally exe = sys.executable scriptFile = self.makeSourceFile([ 'import sys', 'sys.stderr.write("hello world\\n")' ]) | 7b89bf4800a4c444036d44c6ab146adc71bc9395 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/7b89bf4800a4c444036d44c6ab146adc71bc9395/test_iutils.py |
d = utils.getProcessOutput(exe, [scriptFile], errortoo=1) | d = utils.getProcessOutput(exe, ['-u', scriptFile], errortoo=1) | def testOutputWithErrorCollected(self): # make sure stderr raises an error normally exe = sys.executable scriptFile = self.makeSourceFile([ 'import sys', 'sys.stderr.write("hello world\\n")' ]) | 7b89bf4800a4c444036d44c6ab146adc71bc9395 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/7b89bf4800a4c444036d44c6ab146adc71bc9395/test_iutils.py |
d = utils.getProcessValue(exe, [scriptFile]) | d = utils.getProcessValue(exe, ['-u', scriptFile]) | def testValue(self): exe = sys.executable scriptFile = self.makeSourceFile([ "import sys", "sys.exit(1)" ]) | 7b89bf4800a4c444036d44c6ab146adc71bc9395 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/7b89bf4800a4c444036d44c6ab146adc71bc9395/test_iutils.py |
d = utils.getProcessOutputAndValue(exe, [scriptFile]) | d = utils.getProcessOutputAndValue(exe, ['-u', scriptFile]) | def gotOutputAndValue((out, err, code)): self.assertEquals(out, "hello world!" + os.linesep) self.assertEquals(err, "goodbye world!" + os.linesep) self.assertEquals(code, 1) | 7b89bf4800a4c444036d44c6ab146adc71bc9395 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/7b89bf4800a4c444036d44c6ab146adc71bc9395/test_iutils.py |
d = utils.getProcessOutputAndValue(exe, [scriptFile]) | d = utils.getProcessOutputAndValue(exe, ['-u', scriptFile]) | def gotOutputAndValue(err): (out, err, sig) = err.value # XXX Sigh wtf self.assertEquals(out, "stdout bytes" + os.linesep) self.assertEquals(err, "stderr bytes" + os.linesep) self.assertEquals(sig, signal.SIGKILL) | 7b89bf4800a4c444036d44c6ab146adc71bc9395 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/7b89bf4800a4c444036d44c6ab146adc71bc9395/test_iutils.py |
m = o.getattr(str(ov.object)) | m = getattr(o, str(ov.object), None) | def doIteration(self, timeout): if timeout is None: timeout = INFINITE else: timeout = int(timeout * 1000) (ret, bytes, key, ov) = GetQueuedCompletionStatus(self.iocp, timeout) if int(key) not in self.completables: raise ValueError("unexpected completion key %s" % (key,)) # what's the right thing to do here? o = self.c... | 0c1d2ce95bbae6669a53c5e64cea6cd815ed3238 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/0c1d2ce95bbae6669a53c5e64cea6cd815ed3238/proactor.py |
try: from xml.dom.minidom import parse except ImportError: return | from xml.dom.minidom import parse | def _getSVNVersion(self): """ Figure out the SVN revision number based on the existance of twisted/.svn/entries, and its contents. This requires parsing the entries file and reading the first XML tag in the xml document that has a revision="" attribute. | fc024436bce5af421ca7b0da9e3b2af64aad56eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/fc024436bce5af421ca7b0da9e3b2af64aad56eb/versions.py |
- create factories for each respective client | - switchboard factory | to handle this 'cleanly'. One way would be to define methods like: def callBack(self, (arg1, arg2, arg)): ... another | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
from twisted.python import log | from twisted.internet.protocol import ClientFactory from twisted.internet.ssl import ClientContextFactory from twisted.python import failure, log | to handle this 'cleanly'. One way would be to define methods like: def callBack(self, (arg1, arg2, arg)): ... another | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
import md5, types, operator, os | import types, operator, os, md5 | to handle this 'cleanly'. One way would be to define methods like: def callBack(self, (arg1, arg2, arg)): ... another | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
MSN_PROTOCOL_VERSION = "MSNP7" MSN_PORT = 1863 MSN_MAX_MESSAGE = 1664 MSN_CHALLENGE_STR = "Q1P7W2E4J9R8U3S5" | MSN_PROTOCOL_VERSION = "MSNP8 CVR0" MSN_PORT = 1863 MSN_MAX_MESSAGE = 1664 MSN_CHALLENGE_STR = "Q1P7W2E4J9R8U3S5" MSN_CVR_STR = "0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS" LOGIN_SUCCESS = 1 LOGIN_FAILURE = 2 LOGIN_REDIRECT = 3 | to handle this 'cleanly'. One way would be to define methods like: def callBack(self, (arg1, arg2, arg)): ... another | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
FORWARD_LIST = 'fl' ALLOW_LIST = 'al' REVERSE_LIST = 'rl' BLOCK_LIST = 'bl' | FORWARD_LIST = 1 ALLOW_LIST = 2 BLOCK_LIST = 4 REVERSE_LIST = 8 | to handle this 'cleanly'. One way would be to define methods like: def callBack(self, (arg1, arg2, arg)): ... another | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" This Exception is basically used for debugging purposes, as the official MSN server should never send anything _wrong_ and nobody in their right mind would run their B{own} MSN server...if it is raised by default command handlers (handle_BLAH) the error will be logged. | """ This Exception is basically used for debugging purposes, as the official MSN server should never send anything _wrong_ and nobody in their right mind would run their B{own} MSN server. If it is raised by default command handlers (handle_BLAH) the error will be logged. | def checkParamLen(num, expected, cmd, error=None): if error == None: error = "Invalid Number of Parameters for %s" % cmd if num != expected: raise MSNProtocolError, error | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
@ivar ack: This variable is used to tell the server how to respond once the message has been sent. If set to MESSAGE_ACK (default) the server will respond with an ACK upon receiving the message, if set to MESSAGE_NACK the server will respond with a NACK upon failure to receive the message. If set to MESSAGE_ACK_NONE ... | @ivar ack: This variable is used to tell the server how to respond once the message has been sent. If set to MESSAGE_ACK (default) the server will respond with an ACK upon receiving the message, if set to MESSAGE_NACK the server will respond with a NACK upon failure to receive the message. If set to MESSAGE_ACK_NONE th... | def checkParamLen(num, expected, cmd, error=None): if error == None: error = "Invalid Number of Parameters for %s" % cmd if num != expected: raise MSNProtocolError, error | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" used to calculte the number to send as the message length when sending a message. | """ used to calculte the number to send as the message length when sending a message. | def _calcMessageLen(self): """ used to calculte the number to send as the message length when sending a message. """ return reduce(operator.add, [len(x[0]) + len(x[1]) + 4 for x in self.headers.items()]) + len(self.message) + 2 | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" get the desired header value @raise KeyError: if no such header exists. | """ get the desired header value @raise KeyError: if no such header exists. | def getHeader(self, header): """ get the desired header value @raise KeyError: if no such header exists. """ return self.headers[header] | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" This class represents a contact (user). @ivar userHandle: The contact's user handle (passport). @ivar screenName: The contact's screen name. @ivar group: The group ID. @type group: int if contact is in a group, None otherwise. @ivar status: The contact's status code. @type status: str if contact's status is known,... | """ This class represents a contact (user). @ivar userHandle: The contact's user handle (passport). @ivar screenName: The contact's screen name. @ivar groups: A list of all the group IDs which this contact belongs to. @ivar lists: An integer representing the sum of all lists that this contact belongs to. @ivar status:... | def setMessage(self, message): """ set the message text """ self.message = message | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
def __init__(self, userHandle="", screenName="", listType=None, group=None, status=None): | def __init__(self, userHandle="", screenName="", lists=0, groups=[], status=None): | def __init__(self, userHandle="", screenName="", listType=None, group=None, status=None): self.userHandle = userHandle self.screenName = screenName self.list = listType # list ('fl','rl','bl','al') self.group = group # group id (if applicable) self.status = status # current status | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
self.list = listType self.group = group self.status = status | self.lists = lists self.groups = [] self.status = status | def __init__(self, userHandle="", screenName="", listType=None, group=None, status=None): self.userHandle = userHandle self.screenName = screenName self.list = listType # list ('fl','rl','bl','al') self.group = group # group id (if applicable) self.status = status # current status | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
self.hasPager = None | self.hasPager = None | def __init__(self, userHandle="", screenName="", listType=None, group=None, status=None): self.userHandle = userHandle self.screenName = screenName self.list = listType # list ('fl','rl','bl','al') self.group = group # group id (if applicable) self.status = status # current status | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" set phone numbers/values for this specific user .. for phoneType check the *_PHONE constants and HAS_PAGER """ | """ set phone numbers/values for this specific user. for phoneType check the *_PHONE constants and HAS_PAGER """ | def setPhone(self, phoneType, value): """ set phone numbers/values for this specific user .. for phoneType check the *_PHONE constants and HAS_PAGER """ | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" This class represents a basic MSN contact list. @ivar contacts: The forward list (users on my list) @type contacts: dict (mapping user handles to MSNContact objects) @ivar authorizedContacts: Contacts that I have allowed to be notified when my state changes (allow list) @type authorizedContacts: dict (mapping use... | """ This class represents a basic MSN contact list. @ivar contacts: All contacts on my various lists @type contacts: dict (mapping user handles to MSNContact objects) @ivar version: The current contact list version (used for list syncing) @ivar groups: a mapping of group ids to group names (groups can only exist on th... | def setPhone(self, phoneType, value): """ set phone numbers/values for this specific user .. for phoneType check the *_PHONE constants and HAS_PAGER """ | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
self.authorizedContacts = {} self.reverseContacts = {} self.blockedContacts = {} | def __init__(self): self.contacts = {} self.authorizedContacts = {} self.reverseContacts = {} self.blockedContacts = {} self.version = 0 self.groups = {} | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py | |
def addContact(self, listType, contact, force=0): """ Add a contact to the desired list. @param listType: Which underlying contact list to add the user to: - FORWARD_LIST - 'B{fl}': the forward list - ALLOW_LIST - 'B{al}': the allow list - REVERSE_LIST - 'B{rl}': the reverse list - BLOCK_LIST - 'B{bl}': the block ... | self.autoAdd = 0 self.privacy = 0 def _getContactsFromList(self, listType): """ Obtain all contacts which belong to the given list type. """ return dict([(uH,obj) for uH,obj in self.contacts.items() if obj.lists & listType]) def addContact(self, contact): """ Add a contact """ self.contacts[contact.userHandle] = cont... | def __init__(self): self.contacts = {} self.authorizedContacts = {} self.reverseContacts = {} self.blockedContacts = {} self.version = 0 self.groups = {} | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" This class provides support for handling / dispatching events and is the base class of the three main client protocols (MSNDispatchClient, MSNNotificationClient, MSNSwitchboardClient) """ | """ This class provides support for handling / dispatching events and is the base class of the three main client protocols (DispatchClient, NotificationClient, SwitchboardClient) """ | def removeContact(self, listType, contact): """ Remove a contact from the desired list. @param listType: Which underlying contact list to remove the user from: - FORWARD_LIST - 'B{fl}': the forward list - ALLOW_LIST - 'B{al}': the allow list - REVERSE_LIST - 'B{rl}': the reverse list - BLOCK_LIST - 'B{bl}': the blo... | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" Fire the callback for the given id if one exists and return 1, else return false """ | """ Fire the callback for the given id if one exists and return 1, else return false """ | def _fireCallback(self, id, *args): """ Fire the callback for the given id if one exists and return 1, else return false """ if self.ids.has_key(id): self.ids[id][0].callback(args) del self.ids[id] return 1 return 0 | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" return a unique transaction ID that is mapped internally to a deferred .. also store arbitrary data if it is needed """ | """ return a unique transaction ID that is mapped internally to a deferred .. also store arbitrary data if it is needed """ | def _createIDMapping(self, data=None): """ return a unique transaction ID that is mapped internally to a deferred .. also store arbitrary data if it is needed """ id = self._nextTransactionID() d = Deferred() self.ids[id] = (d, data) return (id, d) | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" process received messages to check for file invitations and typing notifications and other control type messages """ | """ process received messages to check for file invitations and typing notifications and other control type messages """ | def checkMessage(self, message): """ process received messages to check for file invitations and typing notifications and other control type messages """ raise NotImplementedError | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" called when we receive a message - override in notification and switchboard clients """ | """ called when we receive a message - override in notification and switchboard clients """ | def gotMessage(self, message): """ called when we receive a message - override in notification and switchboard clients """ raise NotImplementedError | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" called when the server sends an error which is not in response to a sent command (ie. it has no matching transaction ID) """ | """ called when the server sends an error which is not in response to a sent command (ie. it has no matching transaction ID) """ | def gotError(self, errorCode): """ called when the server sends an error which is not in response to a sent command (ie. it has no matching transaction ID) """ log.msg('Error %s' % (errorCodes[errorCode])) | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
class MSNDispatchClient(MSNEventBase): """ This class provides support for clients connecting to the dispatch server @ivar userHandle: your user handle (passport) needed before connecting. """ | class DispatchClient(MSNEventBase): """ This class provides support for clients connecting to the dispatch server @ivar userHandle: your user handle (passport) needed before connecting. """ | def gotError(self, errorCode): """ called when the server sends an error which is not in response to a sent command (ie. it has no matching transaction ID) """ log.msg('Error %s' % (errorCodes[errorCode])) | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
if versions is None or versions[0].upper() != MSN_PROTOCOL_VERSION: | if versions is None or ' '.join(versions) != MSN_PROTOCOL_VERSION: | def handle_VER(self, params): versions = params[1:] if versions is None or versions[0].upper() != MSN_PROTOCOL_VERSION: self.transport.loseConnection() raise MSNProtocolError, "Version Mismatch" id = self._nextTransactionID() self.sendLine("INF %s" % id) | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
raise MSNProtocolError, "Version Mismatch" | raise MSNProtocolError, "Invalid version response" | def handle_VER(self, params): versions = params[1:] if versions is None or versions[0].upper() != MSN_PROTOCOL_VERSION: self.transport.loseConnection() raise MSNProtocolError, "Version Mismatch" id = self._nextTransactionID() self.sendLine("INF %s" % id) | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
self.sendLine("INF %s" % id) def handle_INF(self, params): try: mechanism = params[1] except IndexError: raise MSNProtocolError, "Invalid parameters for INF" if mechanism.upper() != "MD5": self.transport.loseConnection() raise MSNProtocolError, "Unknown Auth Mechanism Specified by Server" id = self._nextTransactionID(... | self.sendLine("CVR %s %s %s" % (id, MSN_CVR_STR, self.userHandle)) def handle_CVR(self, params): self.sendLine("USR %s TWN I %s" % (self._nextTransactionID(), self.userHandle)) | def handle_VER(self, params): versions = params[1:] if versions is None or versions[0].upper() != MSN_PROTOCOL_VERSION: self.transport.loseConnection() raise MSNProtocolError, "Version Mismatch" id = self._nextTransactionID() self.sendLine("INF %s" % id) | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
""" called when we get a referral to the notification server. @param host: the notification server's hostname @param port: the port to connect to | """ called when we get a referral to the notification server. @param host: the notification server's hostname @param port: the port to connect to | def gotNotificationReferral(self, host, port): """ called when we get a referral to the notification server. | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
class MSNNotificationClient(MSNEventBase): """ This class provides support for clients connecting to the notification server. @ivar userHandle: your user handle. @ivar screenName: your screen name @ivar password: MSN password """ | class NotificationClient(MSNEventBase): """ This class provides support for clients connecting to the notification server. """ factory = None | def gotNotificationReferral(self, host, port): """ called when we get a referral to the notification server. | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
self.userHandle = "" self.screenName = "" self.password = "" | def __init__(self, currentID=0): MSNEventBase.__init__(self) self.userHandle = "" self.screenName = "" self.password = "" self.currentID = currentID | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py | |
self.listState = (None, None) self._pendingLists = {} self._pendingState = {} self._pendingGroups = {} | self._state = ['DISCONNECTED', {}] def _setState(self, state): self._state[0] = state def _getState(self): return self._state[0] def _getStateData(self, key): return self._state[1][key] def _setStateData(self, key, value): self._state[1][key] = value def _remStateData(self, *args): for key in args: del self._state... | def __init__(self, currentID=0): MSNEventBase.__init__(self) self.userHandle = "" self.screenName = "" self.password = "" self.currentID = currentID | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
def _createUserFromListReply(self, params): numParams = len(params) if numParams == 6: if params[0] == "FL": raise MSNProtocolError, "Invalid Parameters for LST" user = MSNContact(userHandle=params[4], screenName=unquote(params[5]), listType=params[0]) return user elif numParams == 7: if params[0] != "FL": raise MSNPro... | def connectionLost(self, reason): self._setState('DISCONNECTED') self._state[1] = {} MSNEventBase.connectionLost(self, reason) | def _createUserFromListReply(self, params): numParams = len(params) if numParams == 6: if params[0] == "FL": raise MSNProtocolError, "Invalid Parameters for LST" user = MSNContact(userHandle=params[4], screenName=unquote(params[5]), listType=params[0]) return user elif numParams == 7: if params[0] != "FL": raise MSNPro... | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
if versions is None or versions[0] != MSN_PROTOCOL_VERSION: | if versions is None or ' '.join(versions) != MSN_PROTOCOL_VERSION: | def handle_VER(self, params): versions = params[1:] if versions is None or versions[0] != MSN_PROTOCOL_VERSION: self.transport.loseConnection() raise MSNProtocolError, "Invalid version response" self.sendLine("INF %s" % self._nextTransactionID()) | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
self.sendLine("INF %s" % self._nextTransactionID()) def handle_INF(self, params): try: mechanism = params[1] except IndexError: raise MSNProtocolError, "Invalid auth mechanism supplied by server" if mechanism.upper() != "MD5": raise MSNProtocolError, "Invalid auth mechanism supplied by server" self.sendLine("USR %s MD... | self.sendLine("CVR %s %s %s" % (self._nextTransactionID(), MSN_CVR_STR, self.factory.userHandle)) def handle_CVR(self, params): self.sendLine("USR %s TWN I %s" % (self._nextTransactionID(), self.factory.userHandle)) | def handle_VER(self, params): versions = params[1:] if versions is None or versions[0] != MSN_PROTOCOL_VERSION: self.transport.loseConnection() raise MSNProtocolError, "Invalid version response" self.sendLine("INF %s" % self._nextTransactionID()) | 9b2b7163e441396d9e5e7f46775cd7809b4655be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9b2b7163e441396d9e5e7f46775cd7809b4655be/msn.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.