rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
"""Return an object implementing IProtocol, or None. | """Return an object implementing L{IProtocol}, or None. | def buildProtocol(self, addr): """Return an object implementing IProtocol, or None. | 2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8/interfaces.py |
Once TLS mode is started the transport will implement ISSLTransport. | Once TLS mode is started the transport will implement L{ISSLTransport}. | def getPeer(self): """Returns tuple ('INET', host, port).""" | 2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8/interfaces.py |
@param contextFactory: A context factory (see ssl.py) | @param contextFactory: A context factory (see L{ssl.py<twisted.internet.ssl>}) | def startTLS(self, contextFactory): """Initiate TLS negotiation. @param contextFactory: A context factory (see ssl.py) """ | 2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8/interfaces.py |
Might raise error.ConnectionRefusedError. | Might raise L{ConnectionRefusedError<twisted.internet.error.ConnectionRefusedError>}. | def write(self, packet, (host, port)): """Write packet to given address. | 2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8/interfaces.py |
Might raise error.ConnectionRefusedError. | Might raise L{ConnectionRefusedError<twisted.internet.error.ConnectionRefusedError>}. | def write(self, packet): """Write packet to address we are connected to. | 2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8/interfaces.py |
Might raise error.ConnectionRefusedError. | Might raise L{ConnectionRefusedError<twisted.internet.error.ConnectionRefusedError>}. | def write(self, packet, address): """Write packet to given address. | 2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8/interfaces.py |
Might raise error.ConnectionRefusedError. | Might raise L{ConnectionRefusedError<twisted.internet.error.ConnectionRefusedError>}. | def write(self, packet): """Write packet to address we are connected to. | 2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2049631dd0aa73ddfc33a2c3c8f41078e4f4fcf8/interfaces.py |
class InetdFactory(ServerFactory): protocol = InetdProtocol service = None def __init__(self, service): self.service = service | class InvalidServicesConfError(InvalidConfError): """Invalid services file""" | def connectionLost(self, reason): self.process.transport.loseConnection() | 59b7c96d7977c3d04970c0f9d92a7da0b935ed55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/59b7c96d7977c3d04970c0f9d92a7da0b935ed55/inetdconf.py |
class InetdOptions(usage.Options): optParameters = [['file', 'f', '/etc/inetd.conf'],] | class UnknownService(Exception): """Unknown service name""" | def __init__(self, service): self.service = service | 59b7c96d7977c3d04970c0f9d92a7da0b935ed55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/59b7c96d7977c3d04970c0f9d92a7da0b935ed55/inetdconf.py |
def main(options=None): if not options: options = InetdOptions() options.parseOptions() | class SimpleConfFile: """Simple configuration file parser superclass. Filters out comments and empty lines (which includes lines that only contain comments). """ | 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 != 'tcp' or service.socketType != 'stream': log.msg('Skipping unsupported type/proto... | 59b7c96d7977c3d04970c0f9d92a7da0b935ed55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/59b7c96d7977c3d04970c0f9d92a7da0b935ed55/inetdconf.py |
conf = inetdconf.InetdConf() conf.parseFile(open(options['file'])) | commentChar = ' | 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 != 'tcp' or service.socketType != 'stream': log.msg('Skipping unsupported type/proto... | 59b7c96d7977c3d04970c0f9d92a7da0b935ed55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/59b7c96d7977c3d04970c0f9d92a7da0b935ed55/inetdconf.py |
app = Application('tinetd') for service in conf.services: if service.protocol != 'tcp' or service.socketType != 'stream': log.msg('Skipping unsupported type/protocol: %s/%s' % (service.socketType, service.protocol)) continue | def parseFile(self, file): """Parse a configuration file""" for line in file.readlines(): comment = line.find(self.commentChar) if comment != -1: line = line[:comment] | 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 != 'tcp' or service.socketType != 'stream': log.msg('Skipping unsupported type/proto... | 59b7c96d7977c3d04970c0f9d92a7da0b935ed55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/59b7c96d7977c3d04970c0f9d92a7da0b935ed55/inetdconf.py |
print 'Adding service:', service.name, service.port, service.protocol factory = InetdFactory(service) app.listenTCP(service.port, factory) app.run(save=0) | line = line.strip() if not line: continue self.parseLine(line) def parseLine(self, line): """Override this.""" | 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 != 'tcp' or service.socketType != 'stream': log.msg('Skipping unsupported type/proto... | 59b7c96d7977c3d04970c0f9d92a7da0b935ed55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/59b7c96d7977c3d04970c0f9d92a7da0b935ed55/inetdconf.py |
if __name__ == '__main__': main() | class InetdService: name = None port = None socketType = None protocol = None wait = None user = None group = None program = None programArgs = None def __init__(self, name, port, socketType, protocol, wait, user, group, program, programArgs): self.name = name self.port = port self.socketType = socketType self.protoco... | 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 != 'tcp' or service.socketType != 'stream': log.msg('Skipping unsupported type/proto... | 59b7c96d7977c3d04970c0f9d92a7da0b935ed55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/59b7c96d7977c3d04970c0f9d92a7da0b935ed55/inetdconf.py |
request.prepath = [] | prefixLen = 3+request.isSecure()+4+len(path)+len(request.prepath[-3]) | def getChild(self, path, request): if ':' in path: host, port = path.split(':', 1) port = int(port) else: host, port = path, 80 request.setHost(host, port) request.prepath = [] request.path = '/'+'/'.join(request.postpath) return request.site.getResourceFor(request) | 1d8ae9dee952b83cd70d29313702a10900bb0869 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1d8ae9dee952b83cd70d29313702a10900bb0869/vhost.py |
class ISSHUser: | class ISSHUser(components.Interface): | def requestAvatar(self, username, mind, *interfaces): return interfaces[0], UnixSSHUser(username), lambda: None | b1bb4e0d5b1d63b3cbdfc4b558a58a529efcc1d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b1bb4e0d5b1d63b3cbdfc4b558a58a529efcc1d6/realm.py |
for i in range(self.numberAccepts): | if os.name == "posix": numAccepts = self.numberAccepts else: numAccepts = 1 for i in range(numAccepts): | def doRead(self): """Called when my socket is ready for reading. | c49bc6cef27dcc28d1ea0edb012135ba2ed53dea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c49bc6cef27dcc28d1ea0edb012135ba2ed53dea/tcp.py |
def encrypt(passphrase, data): | def _encrypt(passphrase, data): | def encrypt(passphrase, data): from Crypto.Cipher import AES as cipher leftover = len(data) % cipher.block_size if leftover: data += ' '*(cipher.block_size - leftover) return cipher.new(md5.new(passphrase).digest()[:16]).encrypt(data) | e64ed19422041a89f53fb01cf7eeb17a2fc1e6f1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e64ed19422041a89f53fb01cf7eeb17a2fc1e6f1/persist.py |
def decrypt(passphrase, data): | def _decrypt(passphrase, data): | def decrypt(passphrase, data): from Crypto.Cipher import AES return AES.new(md5.new(passphrase).digest()[:16]).decrypt(data) | e64ed19422041a89f53fb01cf7eeb17a2fc1e6f1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e64ed19422041a89f53fb01cf7eeb17a2fc1e6f1/persist.py |
def setPassword(self, password): pass | def setPassword(self, password): pass | e64ed19422041a89f53fb01cf7eeb17a2fc1e6f1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e64ed19422041a89f53fb01cf7eeb17a2fc1e6f1/persist.py | |
f.write(encrypt(passphrase, s.getvalue())) | f.write(_encrypt(passphrase, s.getvalue())) | def _saveTemp(self, filename, passphrase, dumpFunc): f = open(filename, 'wb') if passphrase is None: dumpFunc(self, f) else: s = StringIO.StringIO() dumpFunc(self, s) f.write(encrypt(passphrase, s.getvalue())) f.close() | e64ed19422041a89f53fb01cf7eeb17a2fc1e6f1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e64ed19422041a89f53fb01cf7eeb17a2fc1e6f1/persist.py |
fp = StringIO.StringIO(open(filename, 'rb').read()) | fp = StringIO.StringIO(_decrypt(open(filename, 'rb').read())) | def load(filename, style, passphrase=None): mode = 'r' if style=='source' from twisted.persisted.marmalade import unjellyFromXML as load elif style=='xml': from twisted.persisted.aot import unjellyFromSource as load else: from cPickle import load mode = 'rb' if passphrase: fp = StringIO.StringIO(open(filename, 'rb').re... | e64ed19422041a89f53fb01cf7eeb17a2fc1e6f1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/e64ed19422041a89f53fb01cf7eeb17a2fc1e6f1/persist.py |
entry.set_position(oldpos+len(result[0])-len(word)-1) | entry.set_position(oldpos+len(result[0])-len(word)) | def handle_key_press_event(self, entry, event): stopSignal = False # ASSUMPTION: Assume Meta == mod4 isMeta = event.state & gtk.GDK.MOD4_MASK | 34523b996e2f6c069d67603c638845aaee6583b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/34523b996e2f6c069d67603c638845aaee6583b8/gtkcommon.py |
usedFiles = [] | def isInKnownHosts(host, pubKey, options): """checks to see if host is in the known_hosts file for the user. returns 0 if it isn't, 1 if it is and is the same, 2 if it's changed. """ keyType = common.getNS(pubKey)[0] retVal = 0 if not options['known-hosts'] and not os.path.exists(os.path.expanduser('~/.ssh/')): print ... | 3516b3f100dfdd1e6f30c9adbd234b19899bfb0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3516b3f100dfdd1e6f30c9adbd234b19899bfb0b/default.py | |
except KeyboardInterrupt, e: | except (KeyboardInterrupt, IOError): | def getPassword(self, prompt = None): if not prompt: prompt = "%s@%s's password: " % (self.user, self.transport.transport.getPeer().host) try: oldout, oldin = sys.stdout, sys.stdin sys.stdin = sys.stdout = open('/dev/tty','r+') p=getpass.getpass(prompt) sys.stdout,sys.stdin=oldout,oldin return defer.succeed(p) except K... | 3516b3f100dfdd1e6f30c9adbd234b19899bfb0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3516b3f100dfdd1e6f30c9adbd234b19899bfb0b/default.py |
"wcfactory_ instead", DeprecationWarning) | "wvfactory_ instead", DeprecationWarning) | def getNodeView(self, request, node, submodel, model): namespaces = [] view = None viewName = node.getAttribute('view') | 54b31b3e67aeea3de0463ec333ae5a20b146b5be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/54b31b3e67aeea3de0463ec333ae5a20b146b5be/view.py |
If there is no buffered data this tries to write this data immediately, otherwise this adds data to be written the next time this file descriptor is ready for writing. | The data is buffered until his file descriptor is ready for writing. | def write(self, data): """Reliably write some data. | 94298afff49aa9ee8f40a23ddb30bd2790c59fb3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/94298afff49aa9ee8f40a23ddb30bd2790c59fb3/abstract.py |
reactor.callLater(10, self.timeOut) | self.id = reactor.callLater(10, self.timeOut) | def runClient(self): pb.connect("localhost", PORTNO, "guest", "guest", "pbfailure", "guest", 30).addCallbacks(self.connected, self.notConnected) reactor.callLater(10, self.timeOut) | 6bf614cc1ef2d83348b3bf81228663011ecb85d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/6bf614cc1ef2d83348b3bf81228663011ecb85d8/test_pbfailure.py |
reactor.stop() | self.stopReactor() | def notConnected(self, fail): reactor.stop() raise pb.Error("There's probably something wrong with your environment" "(is port 54321 free?), because I couldn't connect to myself.") | 6bf614cc1ef2d83348b3bf81228663011ecb85d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/6bf614cc1ef2d83348b3bf81228663011ecb85d8/test_pbfailure.py |
if self.total == 3: self.stopReactor() | def success(self, result): if result in [42, 420, 4200]: self.total = self.total + 1 | 6bf614cc1ef2d83348b3bf81228663011ecb85d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/6bf614cc1ef2d83348b3bf81228663011ecb85d8/test_pbfailure.py | |
if self.total != 3: raise TimeoutError("Never got all three failures!") | raise TimeoutError("Never got all three failures!") | def timeOut(self): reactor.stop() if self.total != 3: raise TimeoutError("Never got all three failures!") | 6bf614cc1ef2d83348b3bf81228663011ecb85d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/6bf614cc1ef2d83348b3bf81228663011ecb85d8/test_pbfailure.py |
_setUpLogging(self) | def postOptions(self): self['_origdir'] = os.getcwd() # Want to do this stuff as early as possible _setUpTestdir() _setUpLogging(self) if self['suppresswarnings']: warnings.warn('--suppresswarnings deprecated. Is a no-op', category=DeprecationWarning) if not self.has_key('tbformat'): self['tbformat'] = 'default' if sel... | 924af4e405b1ecd1dc6717c8117791e292eb19be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/924af4e405b1ecd1dc6717c8117791e292eb19be/trial.py | |
def __init__(self, methodName=None): | def __init__(self, methodName): | def __init__(self, methodName=None): super(TestCase, self).__init__(methodName) self._testMethodName = methodName testMethod = getattr(self, methodName) self._parents = [testMethod, self] self._parents.extend(util.getPythonContainers(testMethod)) self._shared = (hasattr(self, 'setUpClass') or hasattr(self, 'tearDownCla... | b7e78eb5833d66795b80f1516df69db55622316c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b7e78eb5833d66795b80f1516df69db55622316c/unittest.py |
df = lambda file, linkrel: self.doFile[0](file, linkrel, d['ext'], | df = lambda file, linkrel: self.doFile[0](file, linkrel, ext, | def generate_html(self, d): n = htmlDefault.copy() n.update(d) d = n if d['ext'] == "None": ext = "" else: ext = d['ext'] try: fp = open(d['template']) templ = microdom.parse(fp) except IOError, e: raise process.NoProcessorError(e.filename+": "+e.strerror) except sux.ParseError, e: raise process.NoProcessorError(str(e)... | 5d5a28ac3fa3f3ca37cc0cce9e03b64e59aec95a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5d5a28ac3fa3f3ca37cc0cce9e03b64e59aec95a/default.py |
import thread | def preWait(self, key): import thread global ioThread if thread.get_ident() == ioThread: return _Waiter.preWait(self, key) import thread import threading cond = self.conditions[key] = threading.Condition() cond.acquire() | f487c5bb3d90eb7d11459e5303877cfbb82272aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f487c5bb3d90eb7d11459e5303877cfbb82272aa/threadable.py | |
if thread.get_ident() == ioThread: | if threadmodule.get_ident() == ioThread: | def preWait(self, key): import thread global ioThread if thread.get_ident() == ioThread: return _Waiter.preWait(self, key) import thread import threading cond = self.conditions[key] = threading.Condition() cond.acquire() | f487c5bb3d90eb7d11459e5303877cfbb82272aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f487c5bb3d90eb7d11459e5303877cfbb82272aa/threadable.py |
import thread import threading cond = self.conditions[key] = threading.Condition() | cond = self.conditions[key] = threadingmodule.Condition() | def preWait(self, key): import thread global ioThread if thread.get_ident() == ioThread: return _Waiter.preWait(self, key) import thread import threading cond = self.conditions[key] = threading.Condition() cond.acquire() | f487c5bb3d90eb7d11459e5303877cfbb82272aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f487c5bb3d90eb7d11459e5303877cfbb82272aa/threadable.py |
import thread | def wait(self, key): import thread global ioThread if thread.get_ident() == ioThread: return _Waiter.wait(self, key) cond = self.conditions[key] cond.wait() # ... r, is_ok = self.results[key] del self.conditions[key] del self.results[key] cond.release() if is_ok: return r else: raise r | f487c5bb3d90eb7d11459e5303877cfbb82272aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f487c5bb3d90eb7d11459e5303877cfbb82272aa/threadable.py | |
if thread.get_ident() == ioThread: | if threadmodule.get_ident() == ioThread: | def wait(self, key): import thread global ioThread if thread.get_ident() == ioThread: return _Waiter.wait(self, key) cond = self.conditions[key] cond.wait() # ... r, is_ok = self.results[key] del self.conditions[key] del self.results[key] cond.release() if is_ok: return r else: raise r | f487c5bb3d90eb7d11459e5303877cfbb82272aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f487c5bb3d90eb7d11459e5303877cfbb82272aa/threadable.py |
import thread self.block = thread.allocate_lock() | self.block = threadmodule.allocate_lock() | def __init__(self): assert threaded,\ "Locks may not be allocated in an unthreaded environment!" import thread self.block = thread.allocate_lock() self.count = 0 self.owner = 0 | f487c5bb3d90eb7d11459e5303877cfbb82272aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f487c5bb3d90eb7d11459e5303877cfbb82272aa/threadable.py |
import thread current = thread.get_ident() | current = threadmodule.get_ident() | def acquire(self): import thread current = thread.get_ident() if self.owner == current: self.count = self.count + 1 return 1 self.block.acquire() self.owner = current self.count = 1 | f487c5bb3d90eb7d11459e5303877cfbb82272aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f487c5bb3d90eb7d11459e5303877cfbb82272aa/threadable.py |
import thread current = thread.get_ident() | current = threadmodule.get_ident() | def release(self): import thread current = thread.get_ident() if self.owner != current: raise "Release of unacquired lock." self.count = self.count - 1 if self.count == 0: self.owner = None self.block.release() | f487c5bb3d90eb7d11459e5303877cfbb82272aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f487c5bb3d90eb7d11459e5303877cfbb82272aa/threadable.py |
import thread if (ioThread == thread.get_ident()): | if (ioThread == threadmodule.get_ident()): | def isInIOThread(): """Are we in the thread responsable for I/O requests (the event loop)? """ global threaded global ioThread if threaded: import thread if (ioThread == thread.get_ident()): return 1 else: return 0 return 1 | f487c5bb3d90eb7d11459e5303877cfbb82272aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f487c5bb3d90eb7d11459e5303877cfbb82272aa/threadable.py |
self.assertIdentical(1._connection, None) | self.assertIdentical(t._connection, None) | def testVolatile(self): if not interfaces.IReactorUNIX(reactor, None): raise unittest.SkipTest, "This reactor does not support UNIX domain sockets" factory = protocol.ServerFactory() factory.protocol = wire.Echo t = internet.UNIXServer('echo.skt', factory) t.startService() self.failIfIdentical(t._port, None) t1 = copy.... | 049469107a2ce4a0c5f4546fd8bd64fa2a46b912 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/049469107a2ce4a0c5f4546fd8bd64fa2a46b912/test_application.py |
return '"' + _cmdLineQuoteRe.sub(r'\1\1\\"', s) + '"' | quote = ((" " in s) or ("\t" in s) or ('"' in s)) and '"' or '' return quote + _cmdLineQuoteRe2.sub(r"\1\1", _cmdLineQuoteRe.sub(r'\1\1\\"', s)) + quote | def _cmdLineQuote(s): return '"' + _cmdLineQuoteRe.sub(r'\1\1\\"', s) + '"' | 9e22e361339dd61c291b56e6875f1911e68db657 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/9e22e361339dd61c291b56e6875f1911e68db657/process.py |
def search_TEXT(self, query, id, msg): # XXX - This msut search headers too body = query.pop(0).lower() return text.strFile(body, msg.getBody(), False) | d89b2d6695a08387919bd678e59f6ae015994923 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/d89b2d6695a08387919bd678e59f6ae015994923/imap4.py | ||
self.suffix = '\x00' * self.bytes + readPrecisely(strio, 16 - self.bytes) | self.suffix = '\x00' * (16 - self.bytes) + readPrecisely(strio, self.bytes) | def decode(self, strio, length = None): self.prefixLen = struct.unpack('!B', readPrecisely(strio, 1))[0] self.bytes = int(self.prefixLen / 8.0) if self.prefixLen != 128: self.suffix = '\x00' * self.bytes + readPrecisely(strio, 16 - self.bytes) if self.prefixLen != 0: self.prefix.decode(strio) | 7d1317c895146f68ecab80df43f0bc3f9c49deab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/7d1317c895146f68ecab80df43f0bc3f9c49deab/dns.py |
self._parseError("Invalid intial attribute value: %r" % byte) | self._parseError("Invalid initial attribute value: %r" % byte) | def do_beforeattrval(self, byte): if byte in '"\'': return 'attrval' elif byte.isspace(): return elif self.beExtremelyLenient: if byte in lenientIdentChars or byte.isalnum(): return 'messyattr' if byte == '>': self.attrval = 'True' self.tagAttributes[self.attrname] = self.attrval self.gotTagStart(self.tagName, self.tag... | 1e1f2fc01b34d7b4ee180f509117f7b83fc8cde1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1e1f2fc01b34d7b4ee180f509117f7b83fc8cde1/sux.py |
p = [p.type for p in p.result] | p = [str(p).lower() for p in p.result] | def testFetchParserMacros(self): cases = [ ['ALL', (4, ['flags', 'internaldate', 'rfc822.size', 'envelope'])], ['FULL', (5, ['flags', 'internaldate', 'rfc822.size', 'envelope', 'body'])], ['FAST', (3, ['flags', 'internaldate', 'rfc822.size'])], ] | df0859da3312553bdbed54260473c41b22bb6636 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/df0859da3312553bdbed54260473c41b22bb6636/test_imap.py |
modified_since = stringToDatetime(modified_since) | modified_since = stringToDatetime(modified_since.split(';', 1)[0]) | def setLastModified(self, when): """Set the X{Last-Modified} time for the response to this request. | b38c7162c376ab08ae6186f01d8af93857870bef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b38c7162c376ab08ae6186f01d8af93857870bef/http.py |
os.setgid(gid) | def __init__(self, reactor, command, args, environment, path, proto, uid=None, gid=None): """Spawn an operating-system process. | 2639f8385b9e632f627f180bfd82b110b86059e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2639f8385b9e632f627f180bfd82b110b86059e8/process.py | |
stderr = os.fdopen(fd, 'w') stderr.write("Upon execvpe %s %s in environment %s\n:" % | stderr = os.fdopen(1, 'w') stderr.write("Upon execvpe %s %s in environment %s:\n" % | def __init__(self, reactor, command, args, environment, path, proto, uid=None, gid=None): """Spawn an operating-system process. | 2639f8385b9e632f627f180bfd82b110b86059e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2639f8385b9e632f627f180bfd82b110b86059e8/process.py |
tk.Label(statusFrame, textvariable=self.statusVar).pack(side=tk.LEFT) | tk.Label(statusFrame, textvariable=self.statusVar, width=80, anchor="w").pack(side=tk.LEFT) | def createWidgets(self): """Creates and packs the various widgets. | 5accc6c7a4c9eadf6cf0f6b553e60a58cba8f07d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5accc6c7a4c9eadf6cf0f6b553e60a58cba8f07d/unittestgui.py |
dump(compiledTemplate, open(compiledTemplateName, 'wb'), 1) | dump(compiledTemplate, open(compiledTemplatePath, 'wb'), 1) | def lookupTemplate(self, request): """ Use acquisition to look up the template named by self.templateFile, located anywhere above this object in the heirarchy, and use it as the template. The first time the template is used it is cached for speed. """ if not self.templateDirectory: self.templateDirectory = os.path.spli... | d4b4b0abe171f7e9bded148ca198ea34a752e21f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/d4b4b0abe171f7e9bded148ca198ea34a752e21f/template.py |
def lookupTemplate(self, request): """ Use acquisition to look up the template named by self.templateFile, located anywhere above this object in the heirarchy, and use it as the template. The first time the template is used it is cached for speed. """ if not self.templateDirectory: self.templateDirectory = os.path.spli... | d4b4b0abe171f7e9bded148ca198ea34a752e21f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/d4b4b0abe171f7e9bded148ca198ea34a752e21f/template.py | ||
if not reason.check(error.UserError): | if not reason.check(error.UserError) or reason.check(TimeoutError): | def clientConnectionFailed(self, connector, reason): if self.continueTrying: self.connector = connector if not reason.check(error.UserError): self.retry() | 15ed1ae4e037496b5d7e16f1e4ea31f17ef859c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/15ed1ae4e037496b5d7e16f1e4ea31f17ef859c7/protocol.py |
if not os.path.exists(path) or hasattr(self, 'lastPublicKey'): | if not os.path.exists(path) or self.lastPublicKey: | def getPublicKey(self): path = os.path.expanduser('~/.ssh/id_dsa') # this works with rsa too # just change the name here and in getPrivateKey if not os.path.exists(path) or hasattr(self, 'lastPublicKey'): # the file doesn't exist, or we've tried a public key return return keys.getPublicKeyString(path+'.pub') | b5dc647c63659143c2a7df4aa65fa51c736c23fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b5dc647c63659143c2a7df4aa65fa51c736c23fc/sshsimpleclient.py |
"useranonymous": [types.StringType, "Anonymous Username", "Username for anonymous users, typically 'username'."], "otp": ["boolean", "OTP", "Use One time passwords."], | "useranonymous": [types.StringType, "Anonymous Username", "Username for anonymous users, typically 'anonymous'."], "otp": ["boolean", "OTP", "Use One Time Passwords."], | def getNameType(self): return "Username" | de7667728249a296619fa0c22c027a49c2b21cb1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/de7667728249a296619fa0c22c027a49c2b21cb1/ftp.py |
"thirdparty": ["boolean", "Allow 3rd-party Transfers", "Allow A to forward data to B. May be a security risk"], | "thirdparty": ["boolean", "Allow 3rd-party Transfers", "Allow A to forward data to B. May be a security risk."], | def getNameType(self): return "Username" | de7667728249a296619fa0c22c027a49c2b21cb1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/de7667728249a296619fa0c22c027a49c2b21cb1/ftp.py |
def __init__(self, app, ptype): | a89bb9bed3432c6ebe1055f95383769e6545c156 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a89bb9bed3432c6ebe1055f95383769e6545c156/app.py | ||
print 'adding', str(port[0]), port[1] | def listStaticEntities(self): ret = [] for port in getattr(self.app, '%sPorts' % self.ptype): print 'adding', str(port[0]), port[1] ret.append((str(port[0]), port[1])) return ret | a89bb9bed3432c6ebe1055f95383769e6545c156 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a89bb9bed3432c6ebe1055f95383769e6545c156/app.py | |
def getStaticEntity(self, name): idx = int(name) #for port in self.ports: for port in getattr(self.app, '%sPorts' % self.ptype): print "?", port[0] if port[0] == idx: print "ret",port[1] return port[1] raise KeyError, "No such entity %s" % (name,) | a89bb9bed3432c6ebe1055f95383769e6545c156 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a89bb9bed3432c6ebe1055f95383769e6545c156/app.py | ||
print "?", port[0] | def getStaticEntity(self, name): idx = int(name) #for port in self.ports: for port in getattr(self.app, '%sPorts' % self.ptype): print "?", port[0] if port[0] == idx: print "ret",port[1] return port[1] raise KeyError, "No such entity %s" % (name,) | a89bb9bed3432c6ebe1055f95383769e6545c156 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a89bb9bed3432c6ebe1055f95383769e6545c156/app.py | |
print "ret",port[1] | def getStaticEntity(self, name): idx = int(name) #for port in self.ports: for port in getattr(self.app, '%sPorts' % self.ptype): print "?", port[0] if port[0] == idx: print "ret",port[1] return port[1] raise KeyError, "No such entity %s" % (name,) | a89bb9bed3432c6ebe1055f95383769e6545c156 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a89bb9bed3432c6ebe1055f95383769e6545c156/app.py | |
reactor.iterate() reactor.iterate() | def setUp(self): self.f = f = MyServerFactory() self.p = p = reactor.listenTCP(0, f, interface="127.0.0.1") reactor.iterate() reactor.iterate() # XXX we don't test server side yet since we don't do it yet d = protocol.ClientCreator(reactor, MyProtocol).connectTCP( p.getHost().host, p.getHost().port) d.addCallback(self.... | 3fe34849e3c9552649fb76785f40bedcb0016fe2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3fe34849e3c9552649fb76785f40bedcb0016fe2/test_tcp.py | |
__implements__ = (Referenceable.__implements__, IUsernameHashedPassword, IUsernameMD5Password) | implements(IUsernameHashedPassword, IUsernameMD5Password) | def remote_login(self, username): """Start of username/password login.""" c = challenge() return c, _PortalAuthChallenger(self, username, c) | b230c16d61db5484815679ca669f2d3811a9c794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b230c16d61db5484815679ca669f2d3811a9c794/pb.py |
if se.args[0] in (EWOULDBLOCK, EALREADY, EINPROGRESS): | print "SR DEBUG:", se.args[0], EWOULDBLOCK, EALREADY, EINPROGRESS if se.args[0] == EMYSTERY: | 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): self.startWriting() else: self.protocol.connectionFailed() self.stopWriting() retur... | c4cab890eb60e5c2635237275b5e289c4dd1d272 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c4cab890eb60e5c2635237275b5e289c4dd1d272/tcp.py |
return | return | 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): self.startWriting() else: self.protocol.connectionFailed() self.stopWriting() retur... | c4cab890eb60e5c2635237275b5e289c4dd1d272 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c4cab890eb60e5c2635237275b5e289c4dd1d272/tcp.py |
path = self.filename | path = os.path.basename(self.filename) | def visitNode_a_href(self, node): supported_schemes=['http', 'https', 'ftp', 'mailto'] self.visitNodeDefault(node) href = node.getAttribute('href') if urlparse.urlparse(href)[0] in supported_schemes: text = domhelpers.getNodeText(node) if text != href: self.writer('\\footnote{%s}' % latexEscape(href)) else: path, fragi... | a54f5975b5e0d7c00c36e9283879291696eb5bcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a54f5975b5e0d7c00c36e9283879291696eb5bcf/latex.py |
self.writer('\\label{%sHASH%s}' % (self.filename, | self.writer('\\label{%sHASH%s}' % (os.path.basename(self.filename), | def visitNode_a_name(self, node): self.writer('\\label{%sHASH%s}' % (self.filename, node.getAttribute('name'))) self.visitNodeDefault(node) | a54f5975b5e0d7c00c36e9283879291696eb5bcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a54f5975b5e0d7c00c36e9283879291696eb5bcf/latex.py |
self.writer('\\label{%s}}\n' % self.filename) | self.writer('\\label{%s}}\n' % os.path.basename(self.filename)) | def visitNode_title(self, node): self.writer('\\section{') self.visitNodeDefault(node) self.writer('\\label{%s}}\n' % self.filename) | a54f5975b5e0d7c00c36e9283879291696eb5bcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a54f5975b5e0d7c00c36e9283879291696eb5bcf/latex.py |
class SMTP(basic.LineReceiver, policies.TimeoutMixin): | class SMTP(basic.LineOnlyReceiver, policies.TimeoutMixin): | def connectionLost(self): """handle message truncated | 282ef5998791e28b9550d69ff4929029dab9a341 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/282ef5998791e28b9550d69ff4929029dab9a341/smtp.py |
def rawDataReceived(self, data): """Throw away rest of long line""" rest = string.split(data, '\r\n', 1) if len(rest) == 2: self.setLineMode(rest[1]) | def lineLengthExceeded(self, line): if self.mode is DATA: for message in self.__messages: message.connectionLost() self.mode = COMMAND del self.__messages self.sendCode(500, 'Line too long') | 282ef5998791e28b9550d69ff4929029dab9a341 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/282ef5998791e28b9550d69ff4929029dab9a341/smtp.py | |
cmd = 'emote %s' % cmd[6:].replace('"', r'\"') | cmd = 'emote "%s"' % cmd[6:].replace('"', r'\"') | def telnet_Command(self, cmd): """Execute a command as a player. """ | 8c1b2eb5ea226d0e3ae906211c22e5744b8b6aec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/8c1b2eb5ea226d0e3ae906211c22e5744b8b6aec/plumbing.py |
f = getattr(self, 'macro_' + line[1:3].rstrip(), None) | f = getattr(self, 'macro_' + line[1:3].rstrip().upper(), None) | def lineReceived(self, line): if line[0] == '.': f = getattr(self, 'macro_' + line[1:3].rstrip(), None) if f: f(line[3:].strip()) else: self.text(line) | a0f0a11c63c59ab9735b3391f3c307b4137465f7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a0f0a11c63c59ab9735b3391f3c307b4137465f7/man2lore.py |
macro_DT = macro_TH | def macro_TH(self, line): self.write('<html><head>\n') parts = [stripQuotes(x) for x in line.split(' ', 2)] + ['', ''] title, manSection = parts[:2] self.write('<title>%s.%s</title>' % (title, manSection)) self.write('</head>\n<body>\n\n') self.write('<h1>%s.%s</h1>\n\n' % (title, manSection)) | a0f0a11c63c59ab9735b3391f3c307b4137465f7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/a0f0a11c63c59ab9735b3391f3c307b4137465f7/man2lore.py | |
done = 0 | def __init__(self): self.done = defer.Deferred() | def dataReceived(self, data): self.transport.write(data) if '\n' in data: self.transport.loseConnection() | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
self.done = 1 unittest.assertEquals(reason.value.exitCode, 0, 'exit code was not 0: %s' % reason.value.exitCode) | log.msg("MAD(ssh): connection lost") log.msg(str(process.reapProcessHandlers.keys())) unittest._inst.assertEquals(reason.value.exitCode, 0, 'exit code was not 0: %s' % reason.value.exitCode) | def processEnded(self, reason): self.done = 1 unittest.assertEquals(reason.value.exitCode, 0, 'exit code was not 0: %s' % reason.value.exitCode) self.buf = self.buf.replace('\r\n', '\n') unittest.assertEquals(self.buf, 'goodbye\n') | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
unittest.assertEquals(self.buf, 'goodbye\n') | unittest._inst.assertEquals(self.buf, 'goodbye\n') reactor.callLater(0, self.done.callback, True) | def processEnded(self, reason): self.done = 1 unittest.assertEquals(reason.value.exitCode, 0, 'exit code was not 0: %s' % reason.value.exitCode) self.buf = self.buf.replace('\r\n', '\n') unittest.assertEquals(self.buf, 'goodbye\n') | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
self.done = 0 | self.done = defer.Deferred() | def __init__(self, port, fac): self.port = port self.fac = fac self.done = 0 self.connected = 0 self.buf = '' | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
self.done = 1 | self.done.callback(True) | def processEnded(self, reason): log.msg('FORWARDING PROCESS CLOSED') self.done = 1 | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
unittest.failUnlessEqual(self.buf, self.data) | unittest._inst.failUnlessEqual(self.buf, self.data) | def connectionLost(self, reason): log.msg('FORWARDING PORT CLOSED') unittest.failUnlessEqual(self.buf, self.data) | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
d = self.server.stopListening() if d: util.wait(d) | return self.server.stopListening() | def tearDown(self): try: self.fac.proto.done = 1 except AttributeError: pass else: self.fac.proto.transport.loseConnection() reactor.iterate() d = self.server.stopListening() if d: util.wait(d) | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
self.execute('echo goodbye', p) | return self.execute('echo goodbye', p) | def testExec(self): p = ConchTestOpenSSHProcess() self.execute('echo goodbye', p) | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
self.execute('', p, preargs='-N -L%i:127.0.0.1:%i' % (lport, port)) serv.stopListening() | d = self.execute('', p, preargs='-N -L%i:127.0.0.1:%i' % (lport, port)) d.addBoth(lambda x: serv.stopListening()) return d | def testLocalToRemoteForwarding(self): f = EchoFactory() f.fac = self.fac serv = reactor.listenTCP(0, f) port = serv.getHost().port lport = self._getRandomPort() p = ConchTestForwardingProcess(lport,self.fac) self.execute('', p, preargs='-N -L%i:127.0.0.1:%i' % (lport, port)) serv.stopListening() | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
self.execute('', p, preargs='-N -R %i:127.0.0.1:%i' % (lport, port)) serv.stopListening() | d = self.execute('', p, preargs='-N -R %i:127.0.0.1:%i' % (lport, port)) d.addBoth(lambda x: serv.stopListening()) return d | def testRemoteToLocalForwarding(self): f = EchoFactory() f.fac = self.fac serv = reactor.listenTCP(0, f) port = serv.getHost().port lport = self._getRandomPort() p = ConchTestForwardingProcess(lport, self.fac) self.execute('', p, preargs='-N -R %i:127.0.0.1:%i' % (lport, port)) serv.stopListening() | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
util.spinWhile(lambda: not p.done, timeout=30) | return p.done | def execute(self, args, p, preargs = ''): cmdline = ('ssh -2 -l testuser -p %i ' '-oUserKnownHostsFile=kh_test ' '-oPasswordAuthentication=no ' # Always use the RSA key, since that's the one in kh_test. '-oHostKeyAlgorithms=ssh-rsa ' '-a ' '-i dsa_test ') + preargs + \ ' 127.0.0.1 ' + args port = self.server.getHost().... | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
util.spinWhile(lambda: not p.done, timeout=30) | return p.done | def execute(self, args, p, preargs=''): if runtime.platformType == 'win32': raise unittest.SkipTest, "can't run cmdline client on win32" port = self.server.getHost().port cmd = ('-p %i -l testuser ' '--known-hosts kh_test ' '--user-authentications publickey ' '--host-key-algorithms ssh-rsa ' '-a -I ' '-K direct ' '-i d... | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
util.spinWhile(lambda: not p.done, timeout=30) | d.addCallback(lambda x: p.done) return d | def _(host, *args): o['host'] = host | 17023a52397552f518943441de5271088ecb7cbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/17023a52397552f518943441de5271088ecb7cbb/test_conch.py |
def runInThread(cnt): while cnt > 0: from time import sleep sleep(.1) yield cnt cnt -= 1 def howdy(): print "howdy" source = flow.Threaded(runInThread(8)) reactor.callLater(.3,howdy) printFlow(source) | from __future__ import generators from twisted.internet import reactor, defer from twisted.flow import flow from twisted.flow.threads import Threaded def countSleep(index): from time import sleep for index in range(index): sleep(.3) print "sleep", index yield index def countCooperate(index): for index in range(index)... | def runInThread(cnt): while cnt > 0: from time import sleep sleep(.1) yield cnt cnt -= 1 | d023c44b113a3b1b62727322ff4e07ac38bd6024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/d023c44b113a3b1b62727322ff4e07ac38bd6024/threads.py |
self.stop = True | pass | def _process(self): try: self._iterable = iter(self._iterable) except: self.failure = Failure() else: try: while True: val = self._iterable.next() reactor.callFromThread(self._process_result, val) except StopIteration: self.stop = True except: self.failure = Failure() self._cooperate.immediate = True reactor.callFromTh... | d023c44b113a3b1b62727322ff4e07ac38bd6024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/d023c44b113a3b1b62727322ff4e07ac38bd6024/threads.py |
reactor.callFromThread(self._cooperate) | self._cooperate() | def _process(self): try: self._iterable = iter(self._iterable) except: self.failure = Failure() else: try: while True: val = self._iterable.next() reactor.callFromThread(self._process_result, val) except StopIteration: self.stop = True except: self.failure = Failure() self._cooperate.immediate = True reactor.callFromTh... | d023c44b113a3b1b62727322ff4e07ac38bd6024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/d023c44b113a3b1b62727322ff4e07ac38bd6024/threads.py |
This is particularly useful for executing a query in a thread. TODO: show example here | from __future__ import generators from twisted.enterprise import adbapi from twisted.internet import reactor from twisted.flow import flow from twisted.flow.threads import QueryIterator, Threaded dbpool = adbapi.ConnectionPool("SomeDriver",host='localhost', db='Database',user='User',passwd='Password') ... | def _yield(self): if self.results or self.stop or self.failure: return return self._cooperate | d023c44b113a3b1b62727322ff4e07ac38bd6024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/d023c44b113a3b1b62727322ff4e07ac38bd6024/threads.py |
conn = self.pool.connect() self.curs = conn.cursor() | self.conn = self.pool.connect() self.curs = self.conn.cursor() | def __iter__(self): conn = self.pool.connect() self.curs = conn.cursor() self.curs.execute(self.sql) return self | d023c44b113a3b1b62727322ff4e07ac38bd6024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/d023c44b113a3b1b62727322ff4e07ac38bd6024/threads.py |
write(" %s:%s='%s'" % (self.getPrefix[k[0]], k[1], escapeToXml(v, 1)).encode("utf-8")) | write((" %s:%s='%s'" % (self.getPrefix(k[0]), k[1], escapeToXml(v, 1))).encode("utf-8")) | def serialize(self, elem, closeElement = 1): # Optimization shortcuts write = self.cio.write | 7d25a95ec49275c6bd81e0481a65ace865205cb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/7d25a95ec49275c6bd81e0481a65ace865205cb4/domish.py |
attrs[k.split(" ")] = v | aqname = k.split(" ") attrs[(aqname[0], aqname[1])] = v | def _onStartElement(self, name, attrs): # Generate a qname tuple from the provided name qname = name.split(" ") | 7d25a95ec49275c6bd81e0481a65ace865205cb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/7d25a95ec49275c6bd81e0481a65ace865205cb4/domish.py |
self.stdoutClosed = 0 self.stderrClosed = 0 | self.closedNotifies = 0 | def __init__(self, command, args, environment, path): # security attributes for pipes sAttrs = win32security.SECURITY_ATTRIBUTES() sAttrs.bInheritHandle = 1 | 0398376f759760421714536582cc2d7ca02cf413 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/0398376f759760421714536582cc2d7ca02cf413/win32.py |
"""Will be called twice, by the stdout and stderr threads.""" if not self.closed: | """Will be called 3 times, by stdout/err threads and process handle.""" self.closedNotifies = self.closedNotifies + 1 if self.closedNotifies == 3: | def connectionLostNotify(self): """Will be called twice, by the stdout and stderr threads.""" if not self.closed: self.closed = 1 self.connectionLost() | 0398376f759760421714536582cc2d7ca02cf413 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/0398376f759760421714536582cc2d7ca02cf413/win32.py |
def resumeProducing(self): if (self.request is None) or (self.file.closed): return self.request.write(self.file.read(abstract.FileDescriptor.bufferSize)) | 07377cad2b39b3e3d459447a924d1bc82ce72f33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/07377cad2b39b3e3d459447a924d1bc82ce72f33/ftp.py | ||
print "very finished" | self.request.stopConsuming() | def resumeProducing(self): if (self.request is None) or (self.file.closed): return self.request.write(self.file.read(abstract.FileDescriptor.bufferSize)) | 07377cad2b39b3e3d459447a924d1bc82ce72f33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/07377cad2b39b3e3d459447a924d1bc82ce72f33/ftp.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.