rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
while len(f.allMessages) != 2 and (time.time() < now + 5): | while len(f.allMessages) != 2 and (time.time() < now + 10): | def testStopTrying(self): f = Factory() f.protocol = In f.connections = 0 f.allMessages = [] | cbf8d82e9a4465da3f880641fa10513b01496bd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/cbf8d82e9a4465da3f880641fa10513b01496bd7/test_factories.py |
def resumeProducing(self): if (self.request is None) or (self.file.closed): return buffer = self.file.read(abstract.FileDescriptor.bufferSize) self.request.write(buffer) if self.file.tell() == self.filesize: self.stopProducing() | 4cbee09c952e7e1e0bb10077fe15845702686270 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4cbee09c952e7e1e0bb10077fe15845702686270/ftp.py | ||
def resumeProducing(self): if (self.request is None) or (self.file.closed): return buffer = self.file.read(abstract.FileDescriptor.bufferSize) self.request.write(buffer) if self.file.tell() == self.filesize: self.stopProducing() | 4cbee09c952e7e1e0bb10077fe15845702686270 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4cbee09c952e7e1e0bb10077fe15845702686270/ftp.py | ||
self.request.stopConsuming() self.request.finish() | self.request.unregisterProducer() reactor.callLater(0, self.request.finish) | def stopProducing(self): self.request.stopConsuming() self.request.finish() self.request = None | 4cbee09c952e7e1e0bb10077fe15845702686270 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4cbee09c952e7e1e0bb10077fe15845702686270/ftp.py |
self.file.close() self.file = None | def connectionLost(self): if (self.action == 'STOR') and (self.file): self.file.close() self.file = None self.pi.reply('fileok') self.pi.queuedfile = None self.action = None self.dtpPort.loseConnection() | 4cbee09c952e7e1e0bb10077fe15845702686270 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4cbee09c952e7e1e0bb10077fe15845702686270/ftp.py | |
self.pi.queuedfile = None | elif self.file is not None: if self.file.tell() == self.filesize: self.pi.reply('fileok') else: self.pi.reply('getabort') self.file.close() self.file = None self.pi.queuedfile = None | def connectionLost(self): if (self.action == 'STOR') and (self.file): self.file.close() self.file = None self.pi.reply('fileok') self.pi.queuedfile = None self.action = None self.dtpPort.loseConnection() | 4cbee09c952e7e1e0bb10077fe15845702686270 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4cbee09c952e7e1e0bb10077fe15845702686270/ftp.py |
if self.file is not None: if self.file.tell() == self.filesize: self.pi.reply('fileok') else: self.pi.reply('getabort') self.file.close() self.file = None self.pi.queuedfile = None | def finishRETR(self): """Disconnect, and clean up a RETR Called by producer when the transfer is done """ # Has _two_ checks if it is run when it is not connected; this logic # should be somewhere else. if self.file is not None: if self.file.tell() == self.filesize: self.pi.reply('fileok') else: self.pi.reply('getabort... | 4cbee09c952e7e1e0bb10077fe15845702686270 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4cbee09c952e7e1e0bb10077fe15845702686270/ftp.py | |
factory = RPCFactory(service, rpcConf[service.name], rpcVersions) | factory = RPCFactory(service, rpcConf.services[name], rpcVersions) | def main(options=None): # Parse options, read various config files if not options: options = InetdOptions() options.parseOptions() conf = inetdconf.InetdConf() conf.parseFile(open(options['file'])) rpcConf = inetdconf.RPCServicesConf() try: rpcConf.parseFile() except: # We'll survive even if we can't read /etc/rpc lo... | 5d49965ec059765df7f8195ffeb01285d7f97c16 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5d49965ec059765df7f8195ffeb01285d7f97c16/inetd.py |
p = app.listenTCP(service.port, factory) | p = reactor.listenTCP(service.port, factory) | def main(options=None): # Parse options, read various config files if not options: options = InetdOptions() options.parseOptions() conf = inetdconf.InetdConf() conf.parseFile(open(options['file'])) rpcConf = inetdconf.RPCServicesConf() try: rpcConf.parseFile() except: # We'll survive even if we can't read /etc/rpc lo... | 5d49965ec059765df7f8195ffeb01285d7f97c16 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5d49965ec059765df7f8195ffeb01285d7f97c16/inetd.py |
p = app.listenUDP(service.port, factory) | p = reactor.listenUDP(service.port, factory) | def main(options=None): # Parse options, read various config files if not options: options = InetdOptions() options.parseOptions() conf = inetdconf.InetdConf() conf.parseFile(open(options['file'])) rpcConf = inetdconf.RPCServicesConf() try: rpcConf.parseFile() except: # We'll survive even if we can't read /etc/rpc lo... | 5d49965ec059765df7f8195ffeb01285d7f97c16 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/5d49965ec059765df7f8195ffeb01285d7f97c16/inetd.py |
return udp.Port(self, port, factory, interface, maxPacketSize) | return udp.Port(port, factory, interface, maxPacketSize) | def listenUDP(self, port, factory, interface='', maxPacketSize=8192): """See twisted.internet.interfaces.IReactorUDP.listenUDP """ return udp.Port(self, port, factory, interface, maxPacketSize) | 440ff3a904d70a7f54c43ffa291d596604857899 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/440ff3a904d70a7f54c43ffa291d596604857899/default.py |
cmd.deferred.addBoth(lambda x, m=_mutable: m[0].disconnect() or x) | cmd.deferred.addBoth(lambda x, m=_mutable: m[0] and m[0].disconnect() or x) | def clientConnectionFailed(self, connector, reason): self.protocol.connectionFailed() | ad3d580424e15044c1b11ec33056d8e42a2c5fd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ad3d580424e15044c1b11ec33056d8e42a2c5fd5/ftp.py |
result = _Wait.wait(d, timeout) | result = _wait(d, timeout) | def deferredResult(d, timeout=None): """ Waits for a Deferred to arrive, then returns or throws an exception, based on the result. """ result = _Wait.wait(d, timeout) if isinstance(result, failure.Failure): raise result else: return result | 2bc6cc19533bf27c3579c33806a5fb1126b9b71a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2bc6cc19533bf27c3579c33806a5fb1126b9b71a/util.py |
result = _Wait.wait(d, timeout) | result = _wait(d, timeout) | def deferredError(d, timeout=None): """ Waits for deferred to fail, and it returns the Failure. If the deferred succeeds, raises FailTest. """ result = _Wait.wait(d, timeout) if isinstance(result, failure.Failure): return result else: from twisted.trial import unittest raise unittest.FailTest, "Deferred did not fail: ... | 2bc6cc19533bf27c3579c33806a5fb1126b9b71a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2bc6cc19533bf27c3579c33806a5fb1126b9b71a/util.py |
class _Wait(object): _active = 0 def wait(cls, d, timeout=None): from twisted.trial import unittest, itrial from twisted.internet import reactor if cls._active >= 1: raise WaitIsNotReentrantError, REENTRANT_WAIT_ERROR_MSG cls._active += 1 | def _wait(d, timeout=None, running=[]): from twisted.trial import unittest, itrial from twisted.internet import reactor if running: raise WaitIsNotReentrantError, REENTRANT_WAIT_ERROR_MSG running.append(None) try: assert isinstance(d, defer.Deferred), "first argument must be a deferred!" results = [] def append(any):... | def spinWhile(f, timeout=4.0, msg="f did not return false before timeout"): """spin the reactor while condition returned by f() == True or until timeout seconds have elapsed i.e. spin until f() is False """ assert callable(f) from twisted.internet import reactor now = time.time() stop = now + timeout while f(): if time... | 2bc6cc19533bf27c3579c33806a5fb1126b9b71a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2bc6cc19533bf27c3579c33806a5fb1126b9b71a/util.py |
assert isinstance(d, defer.Deferred), "first argument must be a deferred!" results = [] def append(any): results.append(any) d.addBoth(append) if results: return results[0] def crash(ign): reactor.crash() d.addBoth(crash) if timeout is None: timeoutCall = None | reactor.run() finally: del reactor.stop if timeoutCall is not None: if timeoutCall.active(): timeoutCall.cancel() | def wait(cls, d, timeout=None): from twisted.trial import unittest, itrial from twisted.internet import reactor | 2bc6cc19533bf27c3579c33806a5fb1126b9b71a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2bc6cc19533bf27c3579c33806a5fb1126b9b71a/util.py |
timeoutCall = reactor.callLater(timeout, reactor.crash) def stop(): reactor.crash() reactor.stop = stop try: reactor.run() finally: del reactor.stop if timeoutCall is not None: if timeoutCall.active(): timeoutCall.cancel() else: raise defer.TimeoutError() if results: return results[0] raise KeyboardInterrupt() fi... | raise defer.TimeoutError() if results: return results[0] raise KeyboardInterrupt() finally: results = None running.pop() | def crash(ign): reactor.crash() | 2bc6cc19533bf27c3579c33806a5fb1126b9b71a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2bc6cc19533bf27c3579c33806a5fb1126b9b71a/util.py |
r = _Wait.wait(d, timeout) | r = _wait(d, timeout) | def wait(d, timeout=DEFAULT_TIMEOUT, useWaitError=False): """Waits (spins the reactor) for a Deferred to arrive, then returns or throws an exception, based on the result. The difference between this and deferredResult is that it actually throws the original exception, not the Failure, so synchronous exception handling ... | 2bc6cc19533bf27c3579c33806a5fb1126b9b71a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2bc6cc19533bf27c3579c33806a5fb1126b9b71a/util.py |
domhelpers.writeNodeData(node, oldio) | latex.getLatexText(node, oldio.write, entities={'lt': '<', 'gt': '>', 'amp': '&'}) | def fontifyPythonNode(node): oldio = cStringIO.StringIO() domhelpers.writeNodeData(node, oldio) oldio = cStringIO.StringIO(oldio.getvalue().strip()+'\n') newio = cStringIO.StringIO() htmlizer.filter(oldio, newio) newio.seek(0) newel = microdom.parse(newio).documentElement newel.setAttribute("class", "python") node.pare... | f2f51f50daa26fb0d06900ec2fee5c50dfbc3958 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f2f51f50daa26fb0d06900ec2fee5c50dfbc3958/tree.py |
new = node.cloneNode(1) | if self.clearNode: new = node.cloneNode(0) else: new = node.cloneNode(1) | def generateDOM(self, request, node): """ @returns: A DOM Node to replace the Node in the template that this Widget handles. This Node is created based on L{tagName}, L{children}, and L{attributes} (You should populate these in L{setUp}, probably). """ if self.become: #print "becoming" become = self.become self.become ... | 11a4cf487f8450446e902d7b8f4b534faffcc0da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/11a4cf487f8450446e902d7b8f4b534faffcc0da/widgets.py |
id = self['id'] | id = self.attributes.get('id', '') | def setError(self, request, message): """ Convenience method for allowing a Controller to report an error to the user. When this is called, a Widget of class self.errorFactory is instanciated and set to self.become. When generate is subsequently called, self.become will be responsible for mutating the DOM instead of th... | 11a4cf487f8450446e902d7b8f4b534faffcc0da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/11a4cf487f8450446e902d7b8f4b534faffcc0da/widgets.py |
def getPattern(self, name, default=missingPattern, clone=1): | def getPattern(self, name, default=missingPattern, clone=1, deep=1): | def getPattern(self, name, default=missingPattern, clone=1): """Get a named slot from the incoming template node. Returns a copy of the node and all its children. If there was more than one node with the same slot identifier, they will be returned in a round-robin fashion. """ #print self.templateNode.toxml() if self.s... | 11a4cf487f8450446e902d7b8f4b534faffcc0da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/11a4cf487f8450446e902d7b8f4b534faffcc0da/widgets.py |
clone = slot.cloneNode(1) | clone = slot.cloneNode(deep) | def getPattern(self, name, default=missingPattern, clone=1): """Get a named slot from the incoming template node. Returns a copy of the node and all its children. If there was more than one node with the same slot identifier, they will be returned in a round-robin fashion. """ #print self.templateNode.toxml() if self.s... | 11a4cf487f8450446e902d7b8f4b534faffcc0da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/11a4cf487f8450446e902d7b8f4b534faffcc0da/widgets.py |
if self._has_data(data): | if data: | def generateDOM(self, request, node): node = Widget.generateDOM(self, request, node) listHeader = self.getPattern('listHeader', None) listFooter = self.getPattern('listFooter', None) emptyList = self.getPattern('emptyList', None) domhelpers.clearNode(node) if not listHeader is None: node.appendChild(listHeader) data = ... | 11a4cf487f8450446e902d7b8f4b534faffcc0da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/11a4cf487f8450446e902d7b8f4b534faffcc0da/widgets.py |
def _has_data(self, data): try: return len(data) except (TypeError, AttributeError): return 0 | def generateDOM(self, request, node): node = Widget.generateDOM(self, request, node) listHeader = self.getPattern('listHeader', None) listFooter = self.getPattern('listFooter', None) emptyList = self.getPattern('emptyList', None) domhelpers.clearNode(node) if not listHeader is None: node.appendChild(listHeader) data = ... | 11a4cf487f8450446e902d7b8f4b534faffcc0da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/11a4cf487f8450446e902d7b8f4b534faffcc0da/widgets.py | |
def _has_data(self, data): return len(data.keys()) | def _has_data(self, data): return len(data.keys()) | 11a4cf487f8450446e902d7b8f4b534faffcc0da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/11a4cf487f8450446e902d7b8f4b534faffcc0da/widgets.py | |
class ColumnList(List): | class ColumnList(Widget): | def _iterateData(self, parentNode, submodel, data): """ """ currentListItem = 0 keys = data.keys() # Keys may be a tuple, if this is not a true dictionary but a dictionary-like object if hasattr(keys, 'sort'): keys.sort() for key in keys: newNode = self.getPattern('keyedListItem') if not newNode: newNode = self.getPatt... | 11a4cf487f8450446e902d7b8f4b534faffcc0da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/11a4cf487f8450446e902d7b8f4b534faffcc0da/widgets.py |
List.__init__(self, model, *args, **kwargs) | Widget.__init__(self, model, *args, **kwargs) | def __init__(self, model, columns=1, start=0, end=0, *args, **kwargs): List.__init__(self, model, *args, **kwargs) self.columns = columns self.start = start self.end = end | 11a4cf487f8450446e902d7b8f4b534faffcc0da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/11a4cf487f8450446e902d7b8f4b534faffcc0da/widgets.py |
def generateDOM(self, request, node): node = Widget.generateDOM(self, request, node) domhelpers.clearNode(node) | def setUp(self, request, node, data): pattern = self.getPattern('columnListRow', clone=0) | def generateDOM(self, request, node): node = Widget.generateDOM(self, request, node) domhelpers.clearNode(node) | 11a4cf487f8450446e902d7b8f4b534faffcc0da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/11a4cf487f8450446e902d7b8f4b534faffcc0da/widgets.py |
if listSize > len(self.getData()): listSize = len(self.getData()) else: listSize = len(self.getData()) | if listSize > len(data): listSize = len(data) else: listSize = len(data) | def generateDOM(self, request, node): node = Widget.generateDOM(self, request, node) domhelpers.clearNode(node) | 11a4cf487f8450446e902d7b8f4b534faffcc0da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/11a4cf487f8450446e902d7b8f4b534faffcc0da/widgets.py |
newNode = self.getPattern('item') | newNode = self.getPattern('item', _RAISE) | def _iterateData(self, parentNode, submodel, data): """ """ currentListItem = 0 for key in data.keys(): if not newNode: newNode = self.getPattern('item') if newNode: warnings.warn("itemOf= is deprecated, " "please use listItemOf instead", DeprecationWarning) appendModel(newNode, key) | 27cc5a7c9bcef7e938ac4a748ff68b84cf84d49e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/27cc5a7c9bcef7e938ac4a748ff68b84cf84d49e/widgets.py |
if not newNode.getAttribute("view"): newNode.setAttribute("view", "DefaultWidget") | def _iterateData(self, parentNode, submodel, data): """ """ currentListItem = 0 for key in data.keys(): if not newNode: newNode = self.getPattern('item') if newNode: warnings.warn("itemOf= is deprecated, " "please use listItemOf instead", DeprecationWarning) appendModel(newNode, key) | 27cc5a7c9bcef7e938ac4a748ff68b84cf84d49e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/27cc5a7c9bcef7e938ac4a748ff68b84cf84d49e/widgets.py | |
adapter = adaptable.getComponent(self, registry, _Nothing) | adapter = adaptable.getComponent(self, registry, default=_Nothing) | def __call__(self, adaptable, default=_Nothing, persist=None, registry=None): """ Try to adapt `adaptable' to self; return `default' if it was passed, otherwise raise L{CannotAdapt}. """ adapter = default registry = getRegistry(registry) try: # should this be `implements' of some kind? if (persist is None or persist) a... | 3551f021574ce27d47535077aabdfb16c038c96e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3551f021574ce27d47535077aabdfb16c038c96e/components.py |
return self.original.getComponent(interface, registry=None, default=None) | return self.original.getComponent(interface, registry=None, default=default) | def getComponent(self, interface, registry=None, default=None): """ I forward getComponent to self.original on the assumption that it is an instance of Componentized. """ return self.original.getComponent(interface, registry=None, default=None) | 3551f021574ce27d47535077aabdfb16c038c96e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3551f021574ce27d47535077aabdfb16c038c96e/components.py |
errback, as appropriate.""" | errback, as appropriate. It is merely a shorthand way of performing the following:: self.addCallbacks(d.callback, d.errback) When you chain a deferred d2 to another deferred d1 with d1.chainDeferred(d2), you are making d2 participate in the callback chain of d1. Thus any event that fires d1 will also fire d2. However... | def chainDeferred(self, d): """Chain another Deferred to this Deferred. | cc37e33e8b0284c6f27f17cf6e75631a19507105 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/cc37e33e8b0284c6f27f17cf6e75631a19507105/defer.py |
class ISFTPFile: | class ISFTPFile(Interface): | def realPath(self, path): """ Convert any path to an absolute path. | bacd05b8d89c0a827c36f0fd45c58f06d8998b78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/bacd05b8d89c0a827c36f0fd45c58f06d8998b78/interfaces.py |
class ISFTPFile: """ This represents an open file on the server. An object adhering to this interface should be returned from openFile(). """ def close(self): """ Close the file. This method returns nothing if the close succeeds immediatly, or a Deferred that is called back when the close succeeds. """ def readChun... | def setAttrs(self, attrs): """ Set the attributes for the file. | bacd05b8d89c0a827c36f0fd45c58f06d8998b78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/bacd05b8d89c0a827c36f0fd45c58f06d8998b78/interfaces.py | |
_drdw = self._doWriteOrRead | def doKEvent(self, timeout, reads=reads, writes=writes, selectables=selectables, kq=kq, log=log, OSError=OSError, EVFILT_READ=EVFILT_READ, EVFILT_WRITE=EVFILT_WRITE): """Poll the kqueue for new events.""" if timeout is None: timeout = 1000 else: timeout = int(timeout * 1000) # convert seconds to milliseconds | 618f6b6a336e6c9027ff94183aad29a50c7668e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/618f6b6a336e6c9027ff94183aad29a50c7668e7/kqreactor.py | |
log.logOwner.own(selectable) try: if filter == EVFILT_READ: why = selectable.doRead() if filter == EVFILT_WRITE: why = selectable.doWrite() if not selectable.fileno() == fd: why = main.CONNECTION_LOST except: why = sys.exc_value log.deferr() if why: self.removeReader(selectable) self.removeWriter(selectable) try: sel... | log.callWithLogger(selectable, _drdw, selectable, fd, filter) def _doWriteOrRead(self, selectable, fd, filter): try: if filter == EVFILT_READ: why = selectable.doRead() if filter == EVFILT_WRITE: why = selectable.doWrite() if not selectable.fileno() == fd: why = main.CONNECTION_LOST except: why = sys.exc_value log.def... | def doKEvent(self, timeout, reads=reads, writes=writes, selectables=selectables, kq=kq, log=log, OSError=OSError, EVFILT_READ=EVFILT_READ, EVFILT_WRITE=EVFILT_WRITE): """Poll the kqueue for new events.""" if timeout is None: timeout = 1000 else: timeout = int(timeout * 1000) # convert seconds to milliseconds | 618f6b6a336e6c9027ff94183aad29a50c7668e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/618f6b6a336e6c9027ff94183aad29a50c7668e7/kqreactor.py |
print self.views | def notify(self, changed=None): """ Notify all views that something was changed on me. Passing a dictionary of {'attribute': 'new value'} in changed will pass this dictionary to the view for increased performance. If you don't want to do this, don't, and just use the traditional MVC paradigm of querying the model for t... | 91051d885fc7ba1ef9ae66f166412d7a8a681141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/91051d885fc7ba1ef9ae66f166412d7a8a681141/mvc.py | |
self.addr = port | def __init__(self, host, port, protocol): """Initialize the client, setting up its socket, and request to connect. """ if host == 'unix': # we are using unix sockets skt = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) # "port" in this case is really a filename self.addr = port else: skt = self.createInternetSocket(... | d1a8ab80a43e219665b56f58cabfb23e37a69094 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/d1a8ab80a43e219665b56f58cabfb23e37a69094/tcp.py | |
skt = self.createInternetSocket() | skt = self.createInternetSocket() | def startListening(self): """Create and bind my socket, and begin listening on it. This is called on unserialization, and must be called after creating a server to begin listening on the specified port. """ log.msg("%s starting on %s"%(self.factory.__class__, self.port)) if type(self.port) == types.StringType: skt = s... | d1a8ab80a43e219665b56f58cabfb23e37a69094 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/d1a8ab80a43e219665b56f58cabfb23e37a69094/tcp.py |
log.msg('error on port %s: %s' % (port.port, msg[1])) | log.msg('error on port %s: %s' % (port.port, msg)) | def run(self, save=1, installSignalHandlers=1): """Run this application, running the main loop if necessary. """ global resolver if not self.running: log.logOwner.own(self) for delayed in self.delayeds: main.addDelayed(delayed) if save: main.addShutdown(self.shutDownSave) for port in self.ports: try: port.startListenin... | 0143eb8c92015f95112fdb6cb3d8adabe05d5344 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/0143eb8c92015f95112fdb6cb3d8adabe05d5344/app.py |
self.deferred.errback(failure.Failure(IOError("got stderr"))) self.deferred = None self.transport.loseConnection() | if self.deferred is not None: self.deferred.errback(failure.Failure(IOError("got stderr: %r" % text))) self.deferred = None self.transport.loseConnection() | def errReceivedIsBad(self, text): self.deferred.errback(failure.Failure(IOError("got stderr"))) self.deferred = None self.transport.loseConnection() | cee6a119a105e609b60b6cecdef48116c2c1c6c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/cee6a119a105e609b60b6cecdef48116c2c1c6c8/utils.py |
self.win.remove(self.widget) self.currentlyVisible = 0 self.win.disconnect(self.connectid) self.win.destroy() | if self.currentlyVisible: self.win.remove(self.widget) self.currentlyVisible = 0 self.win.disconnect(self.connectid) self.win.destroy() | def hide(self): self.win.remove(self.widget) self.currentlyVisible = 0 self.win.disconnect(self.connectid) self.win.destroy() | 3f9856b49508054e557b84758d79e85b68c4e1b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/3f9856b49508054e557b84758d79e85b68c4e1b8/gtkcommon.py |
class _IReactorWaker(Interface): """I am a waker for the select reactor""" | def connectWith(self, connectorType, *args, **kw): kw['reactor'] = self c = connectorType(*args, **kw) c.connect() return c | bff8c2acdc8deea662136c7a48ff3efe0a450a3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/bff8c2acdc8deea662136c7a48ff3efe0a450a3b/default.py | |
implements(_IReactorWaker) | def connectWith(self, connectorType, *args, **kw): kw['reactor'] = self c = connectorType(*args, **kw) c.connect() return c | bff8c2acdc8deea662136c7a48ff3efe0a450a3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/bff8c2acdc8deea662136c7a48ff3efe0a450a3b/default.py | |
implements(_IReactorWaker) | def connectionLost(self, reason): self.r.close() self.w.close() self.reactor.waker = None | bff8c2acdc8deea662136c7a48ff3efe0a450a3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/bff8c2acdc8deea662136c7a48ff3efe0a450a3b/default.py | |
readers = reads.keys() | readers = [reader for reader in reads.iterkeys() if reader is not self.waker] | def removeAll(self): """Remove all readers and writers, and return list of Selectables.""" readers = reads.keys() for reader in readers: if reads.has_key(reader): del reads[reader] if writes.has_key(reader): del writes[reader] self.waker = None return readers | bff8c2acdc8deea662136c7a48ff3efe0a450a3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/bff8c2acdc8deea662136c7a48ff3efe0a450a3b/default.py |
self.waker = None | def removeAll(self): """Remove all readers and writers, and return list of Selectables.""" readers = reads.keys() for reader in readers: if reads.has_key(reader): del reads[reader] if writes.has_key(reader): del writes[reader] self.waker = None return readers | bff8c2acdc8deea662136c7a48ff3efe0a450a3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/bff8c2acdc8deea662136c7a48ff3efe0a450a3b/default.py | |
return [reader for reader in self.removeAll() if not _IReactorWaker.providedBy(reader)] | return self.removeAll() | def cleanup(self): """Remove all readers and writers, and return a list of Selectables that represent dirty reactor state """ return [reader for reader in self.removeAll() if not _IReactorWaker.providedBy(reader)] | bff8c2acdc8deea662136c7a48ff3efe0a450a3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/bff8c2acdc8deea662136c7a48ff3efe0a450a3b/default.py |
def __init__(self, stream=sys.stdout, tbformat='default', args=None, realtime=False): super(TextReporter, self).__init__(stream, tbformat, args, realtime) self.seenModules, self.seenClasses = {}, {} | def __init__(self, stream=sys.stdout, tbformat='default', args=None, realtime=False): super(TextReporter, self).__init__(stream, tbformat, args, realtime) self.seenModules, self.seenClasses = {}, {} | 2111afd113df8f03d5a8292816aa499e4230763f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2111afd113df8f03d5a8292816aa499e4230763f/reporter.py | |
class VerboseTextReporter(TextReporter): | class VerboseTextReporter(Reporter): | def endTest(self, method): self.write(LETTERS.get(self.getStatus(method), '?')) super(TextReporter, self).endTest(method) | 2111afd113df8f03d5a8292816aa499e4230763f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2111afd113df8f03d5a8292816aa499e4230763f/reporter.py |
class TimingTextReporter(VerboseTextReporter): | class TimingTextReporter(Reporter): def startTest(self, tm): self.write('%s ... ', tm.id()) super(VerboseTextReporter, self).startTest(tm) | def endTest(self, method): self.write("%s\n" % WORDS.get(self.getStatus(method), "[??]")) super(VerboseTextReporter, self).endTest(method) | 2111afd113df8f03d5a8292816aa499e4230763f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2111afd113df8f03d5a8292816aa499e4230763f/reporter.py |
class TreeReporter(VerboseTextReporter): | class TreeReporter(Reporter): | def endTest(self, method): self.write("%s" % WORDS.get(self.getStatus(method), "[??]") + " " + "(%.03f secs)\n" % method.runningTime()) super(TimingTextReporter, self).endTest(method) | 2111afd113df8f03d5a8292816aa499e4230763f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2111afd113df8f03d5a8292816aa499e4230763f/reporter.py |
super(VerboseTextReporter, self).startTest(method) | super(TreeReporter, self).startTest(method) | def startTest(self, method): self.write(' %s ... ', method.shortDescription()) super(VerboseTextReporter, self).startTest(method) | 2111afd113df8f03d5a8292816aa499e4230763f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2111afd113df8f03d5a8292816aa499e4230763f/reporter.py |
Reporter.endTest(self, method) | def endTest(self, method): Reporter.endTest(self, method) self.endLine(*self._getText(self.getStatus(method))) | 2111afd113df8f03d5a8292816aa499e4230763f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/2111afd113df8f03d5a8292816aa499e4230763f/reporter.py | |
def wmfactory_description(self): | def wmfactory_description(self, request): | def wmfactory_description(self): return str(self.desc) | 1f9b14db77842d9b235b6a5df945c6bf6a18c561 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/1f9b14db77842d9b235b6a5df945c6bf6a18c561/form.py |
def newerr(stuff, err=log.err): r = err(stuff) pdb.post_mortem(sys.exc_info()[2]) | from twisted.python import failure def newinit(self, exc_value=None, exc_type=None, exc_tb=None, init=failure.Failure.__init__.im_func): r = init(self, exc_value, exc_type, exc_tb) if (exc_value, exc_type, exc_tb) == (None, None, None): exc = sys.exc_info() if not exc[0] == failure.Failure: print "Jumping into debugger... | def newerr(stuff, err=log.err): r = err(stuff) pdb.post_mortem(sys.exc_info()[2]) return r | 618bf2dca2a843826cf7e0a005645c4c4d4bf5c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/618bf2dca2a843826cf7e0a005645c4c4d4bf5c4/twistd.py |
log.err = newerr | failure.Failure.__init__ = newinit | def newerr(stuff, err=log.err): r = err(stuff) pdb.post_mortem(sys.exc_info()[2]) return r | 618bf2dca2a843826cf7e0a005645c4c4d4bf5c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/618bf2dca2a843826cf7e0a005645c4c4d4bf5c4/twistd.py |
if model is not peek(self.viewStack).model and not isinstance(view, widgets.DefaultWidget): | prevView, stack = self.viewStack while isinstance(prevView, widgets.DefaultWidget) and stack is not None: prevView, stack = stack if prevView is None: prevMod = None else: prevMod = prevView.model if model is not prevMod and not isinstance(view, widgets.DefaultWidget): | def handleNode(self, request, node): submodelName = node.attributes.get('model') if submodelName is None: submodelName = "" model = self.getNodeModel(request, node, submodelName) view = self.getNodeView(request, node, submodelName, model) controller = self.getNodeController(request, node, submodelName, model) if view o... | f8164adc7c6c818df3f90126e7e5019a0b924f04 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/f8164adc7c6c818df3f90126e7e5019a0b924f04/view.py |
scriptOutput.append('top.woven_clientToServerEventComplete()') | scriptOutput.append('parent.woven_clientToServerEventComplete()') | def clientToServerEvent(self, request, eventName, eventTarget, eventArgs): """The client sent an asynchronous event to the server. Locate the View object targeted by this event and attempt to call onEvent on it. """ sess = request.getSession(interfaces.IWovenLivePage) self.view = sess.getCurrentPage().view #request.d =... | 32ddb889f21fb8dfaf2a0b42265f26477f8c3b0a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/32ddb889f21fb8dfaf2a0b42265f26477f8c3b0a/controller.py |
js = "top.woven_replaceElement('%s', '%s')" % (nodeId, nodeXML) | js = "parent.woven_replaceElement('%s', '%s')" % (nodeId, nodeXML) | def domChanged(self, request, widget, node): sess = request.getSession(interfaces.IWovenLivePage) print "domchanged" if sess is not None: if not hasattr(node, 'getAttribute'): return page = sess.getCurrentPage() if page is None: return nodeId = node.getAttribute('id') #logger.warn("DOM for %r is changing to %s", nodeId... | 32ddb889f21fb8dfaf2a0b42265f26477f8c3b0a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/32ddb889f21fb8dfaf2a0b42265f26477f8c3b0a/controller.py |
def parseOptions(self, options=None): """The guts of the command-line parser. """ | 4b1d715a0727bb894ffb17c3a2f2e576ec4a05aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4b1d715a0727bb894ffb17c3a2f2e576ec4a05aa/usage.py | ||
self.__dispatch[optMangled](opt, arg) | self.__dispatch[optMangled](optMangled, arg) | def parseOptions(self, options=None): """The guts of the command-line parser. """ | 4b1d715a0727bb894ffb17c3a2f2e576ec4a05aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4b1d715a0727bb894ffb17c3a2f2e576ec4a05aa/usage.py |
basic.LineReceiver.sendLine(self, lowQuote(line)) | basic.LineReceiver.sendLine(self, lowQuote(line) + '\r') | def sendLine(self, line): if self.lineRate is None: basic.LineReceiver.sendLine(self, lowQuote(line)) else: self._queue.append(line) if not self._queueEmptying: self._queueEmptying = reactor.callLater(self.lineRate, self._sendLine) | 7479b7a8278b73cad7d4c637e47c9f2db7e067c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/7479b7a8278b73cad7d4c637e47c9f2db7e067c0/irc.py |
basic.LineReceiver.sendLine(self, lowQuote(self._queue.pop(0))) | basic.LineReceiver.sendLine(self, lowQuote(self._queue.pop(0)) + '\r') | def _sendLine(self): if self._queue: basic.LineReceiver.sendLine(self, lowQuote(self._queue.pop(0))) self._queueEmptying = reactor.callLater(self.lineRate, self._sendLine) else: self._queueEmptying = None | 7479b7a8278b73cad7d4c637e47c9f2db7e067c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/7479b7a8278b73cad7d4c637e47c9f2db7e067c0/irc.py |
args, functionPath = xmlrpclib.loads(request.content) | request.content.seek(0, 0) args, functionPath = xmlrpclib.loads(request.content.read()) | def render(self, request): args, functionPath = xmlrpclib.loads(request.content) try: function = self._getFunction(functionPath) except NoSuchFunction: result = xmlrpclib.Fault(NOT_FOUND, "no such function %s" % functionPath) else: try: result = apply(function, args) except: log.deferr() result = xmlrpclib.Fault(FAILUR... | 73fc5aee6c8a389d2f2fff6dfd1d47c043204906 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/73fc5aee6c8a389d2f2fff6dfd1d47c043204906/xmlrpc.py |
raise xmlrpc.NoSuchFunction | raise NoSuchFunction | def _getFunction(self, functionPath): """Given a string, return a function, or raise NoSuchFunction. This returned function will be called, and should return the result of the call, a Deferred, or a xmlrpclib.Fault instance. Override in subclasses if you want your own policy. The default policy is that given function... | 73fc5aee6c8a389d2f2fff6dfd1d47c043204906 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/73fc5aee6c8a389d2f2fff6dfd1d47c043204906/xmlrpc.py |
self.stageHead = None self.stageTail = None | self._stageHead = None self._stageTail = None def __getattr__(self, attr): return getattr(self._stageHead.stage, attr) | def __init__(self): self.stageHead = None self.stageTail = None | 726ed9585986d8cd6ac40e40920958df34fd06f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/726ed9585986d8cd6ac40e40920958df34fd06f2/flow.py |
if not self.stageHead: self.stageHead = link self.stageTail = link | if not self._stageHead: self._stageHead = link self._stageTail = link | def _append(self, stage): """ adds an additional stage to the singly-lined list """ link = _LinkItem(stage) if not self.stageHead: self.stageHead = link self.stageTail = link else: self.stageTail.next = link self.stageTail = link return self | 726ed9585986d8cd6ac40e40920958df34fd06f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/726ed9585986d8cd6ac40e40920958df34fd06f2/flow.py |
self.stageTail.next = link self.stageTail = link | self._stageTail.next = link self._stageTail = link | def _append(self, stage): """ adds an additional stage to the singly-lined list """ link = _LinkItem(stage) if not self.stageHead: self.stageHead = link self.stageTail = link else: self.stageTail.next = link self.stageTail = link return self | 726ed9585986d8cd6ac40e40920958df34fd06f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/726ed9585986d8cd6ac40e40920958df34fd06f2/flow.py |
assert self.stageHead, "What? A flow without stages?" return _Stack(self.stageHead, data, context) | assert self._stageHead, "What? A flow without stages?" return _Stack(self._stageHead, data, context) | def build(self, data = None, context = None): """ builds a flow stack for execution | 726ed9585986d8cd6ac40e40920958df34fd06f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/726ed9585986d8cd6ac40e40920958df34fd06f2/flow.py |
def __getitem__(self, idx): return self.flows[-idx-1] | def __init__(self, flows): flows = list(flows) flows.reverse() self.flows = flows | 726ed9585986d8cd6ac40e40920958df34fd06f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/726ed9585986d8cd6ac40e40920958df34fd06f2/flow.py | |
curr = subflow.stageHead | curr = subflow._stageHead | def start(flow, subflow): curr = subflow.stageHead flow.push(data, curr.stage, curr.next) | 726ed9585986d8cd6ac40e40920958df34fd06f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/726ed9585986d8cd6ac40e40920958df34fd06f2/flow.py |
self._tunnel = tunnel | def __init__(self, data = None): from twisted.internet.reactor import callInThread self.data = data tunnel = _TunnelIterator(self) callInThread(tunnel.process) self._tunnel = tunnel | 726ed9585986d8cd6ac40e40920958df34fd06f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/726ed9585986d8cd6ac40e40920958df34fd06f2/flow.py | |
Iterator.__init__(self) | def __init__(self, pool, sql, fetchall=0): Iterator.__init__(self) self.curs = None self.sql = sql self.pool = pool self.data = None self.fetchall = fetchall | 726ed9585986d8cd6ac40e40920958df34fd06f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/726ed9585986d8cd6ac40e40920958df34fd06f2/flow.py | |
from stat import ST_MODE,ST_NLINK,ST_UID,ST_GID,ST_SIZE,ST_MTIME | def getUnixLongListString(self, path): """generates the equivalent output of a unix ls -l path, but using python-native code. | c3dee5f5d8746bc39ac971dd605bd03521001141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c3dee5f5d8746bc39ac971dd605bd03521001141/ftp.py | |
type = dtype(pstat[ST_MODE]) pmstr = pmask(pstat[ST_MODE]) nlinks = str(pstat[ST_NLINK]) owner = pwd.getpwuid(pstat[ST_UID])[0] group = grp.getgrgid(pstat[ST_GID])[0] size = str(pstat[ST_SIZE]) mtime = time.strftime('%b %d %I:%M', time.gmtime(pstat[ST_MTIME])) | type = dtype(pstat.st_mode) pmstr = pmask(pstat.st_mode) nlinks = str(pstat.st_nlink) owner = _callWithDefault([str(pstat.st_uid)], pwd.getpwuid, pstat.st_uid)[0] group = _callWithDefault([str(pstat.st_gid)], grp.getgrgid, pstat.st_gid)[0] size = str(pstat.st_size) mtime = time.strftime('%b %d %I:%M', time.gmtime(pstat... | def getUnixLongListString(self, path): """generates the equivalent output of a unix ls -l path, but using python-native code. | c3dee5f5d8746bc39ac971dd605bd03521001141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c3dee5f5d8746bc39ac971dd605bd03521001141/ftp.py |
if avatarId == checkers.ANONYMOUS: avatar = FTPAnonymousShell() avatar.tld = self.tld avatar.clientwd = self.clientwd avatar.user = self.user avatar.logout = self.logout | avatar = FTPAnonymousShell() avatar.tld = self.tld avatar.clientwd = self.clientwd avatar.user = self.user avatar.logout = self.logout | def requestAvatar(self, avatarId, mind, *interfaces): if IFTPShell in interfaces: if avatarId == checkers.ANONYMOUS: avatar = FTPAnonymousShell() avatar.tld = self.tld avatar.clientwd = self.clientwd avatar.user = self.user avatar.logout = self.logout return IFTPShell, avatar, avatar.logout raise NotImplementedError("O... | c3dee5f5d8746bc39ac971dd605bd03521001141 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c3dee5f5d8746bc39ac971dd605bd03521001141/ftp.py |
if idx != -1: | while idx != -1: | 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 | 03bbb746443be5b7eca0c0ea8212805284f4e427 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/03bbb746443be5b7eca0c0ea8212805284f4e427/telnet.py |
total = reduce(operator.add, messages, 0) | def do_LIST(self, i=None): messages = self.mbox.listMessages() total = reduce(operator.add, messages, 0) self.successResponse(len(messages)) i = 1 for message in messages: if message: self.sendLine('%d %d' % (i, message)) i = i+1 self.sendLine('.') | 8969d7d5c46fee81c689107339ac6a80ff39598f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/8969d7d5c46fee81c689107339ac6a80ff39598f/pop3.py | |
self.successReponse() | self.successResponse() | def do_NOOP(self): """Perform no operation. Return a success code""" self.successReponse() | 8969d7d5c46fee81c689107339ac6a80ff39598f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/8969d7d5c46fee81c689107339ac6a80ff39598f/pop3.py |
if self.chunked and self.code in NO_BODY_CODES: raise RuntimeError, "we screwed up" | def finish(self): """We are finished writing data.""" if self.finished: warnings.warn("Warning! request.finish called twice.", stacklevel=2) return | aa19f0983c0c885fd07506f9d73463c2efc28bbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/aa19f0983c0c885fd07506f9d73463c2efc28bbb/http.py | |
(self.code not in NO_BODY_CODES)): | self.method != "HEAD" and self.code not in NO_BODY_CODES): | 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 l = [] l.append('%s %s %s\r\n' % (version, self.code, self.code_message)) # if we don't have a conten... | aa19f0983c0c885fd07506f9d73463c2efc28bbb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/aa19f0983c0c885fd07506f9d73463c2efc28bbb/http.py |
'version': ver | 'version': ver, | def finalize_options (self): self.set_undefined_options('install', ('install_lib', 'install_dir'), ('root', 'root'), ('force', 'force'), ) | c35a180c640cc65df760770db2a5986e8c378a89 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c35a180c640cc65df760770db2a5986e8c378a89/setup.py |
class XLock: | class _XLock: | def unwait(self, key, value, ok): if not self.runCallback(key, value, ok): cond = self.conditions.get(key) if cond is None: self.results[key] = (value,ok) else: cond.acquire() self.results[key] = (value, ok) cond.notify() cond.release() | b3e42d3afd1cb849005d9a65f145c9e8bb638b38 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b3e42d3afd1cb849005d9a65f145c9e8bb638b38/threadable.py |
global threadingmodule, threadmodule | global threadingmodule, threadmodule, XLock | def init(with_threads=1): """Initialize threading. Should be run once, at the beginning of program. """ global threaded, _to_be_synched, Waiter global threadingmodule, threadmodule if threaded == with_threads: return elif threaded: raise RuntimeError("threads cannot be disabled, once enabled") threaded = with_threads i... | b3e42d3afd1cb849005d9a65f145c9e8bb638b38 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b3e42d3afd1cb849005d9a65f145c9e8bb638b38/threadable.py |
global XLock class XLock: | class DummyXLock: | def init(with_threads=1): """Initialize threading. Should be run once, at the beginning of program. """ global threaded, _to_be_synched, Waiter global threadingmodule, threadmodule if threaded == with_threads: return elif threaded: raise RuntimeError("threads cannot be disabled, once enabled") threaded = with_threads i... | b3e42d3afd1cb849005d9a65f145c9e8bb638b38 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/b3e42d3afd1cb849005d9a65f145c9e8bb638b38/threadable.py |
"""called when a unique filename is needed | """Called when a unique filename is needed. filename is the name of the file as given by the client. Returns the fully qualified path of the file to create. The file must not yet exist. | def makeUniqueName(self, filename): """called when a unique filename is needed """ | 4484bc934084bd79c718f3023b2eb4f8ca9e607e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4484bc934084bd79c718f3023b2eb4f8ca9e607e/static.py |
u = md5.new(filename) u.update(str(time.time())) ext = os.path.splitext(filename)[1] return os.path.join(self.destination, u.hexdigest() + ext) def isWriteable(self, filename, mimetype, filestream): """returns True if it's "safe" to write this file, otherwise it raises an exception | return tempfile.mktemp(suffix=os.path.splitext(filename)[1], dir=self.destination) def isSafeToWrite(self, filename, mimetype, filestream): """Returns True if it's "safe" to write this file, otherwise it raises an exception. | def makeUniqueName(self, filename): """called when a unique filename is needed """ | 4484bc934084bd79c718f3023b2eb4f8ca9e607e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4484bc934084bd79c718f3023b2eb4f8ca9e607e/static.py |
if os.path.exists(filename): raise IOError("%s: File already exists" % (filename,)) | def isWriteable(self, filename, mimetype, filestream): """returns True if it's "safe" to write this file, otherwise it raises an exception """ if filestream.length > self.maxBytes: raise IOError("%s: File exceeds maximum length (%d > %d)" % (filename, filestream.length, self.maxBytes)) | 4484bc934084bd79c718f3023b2eb4f8ca9e607e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4484bc934084bd79c718f3023b2eb4f8ca9e607e/static.py | |
"""does the I/O dirty work after it calls isWriteable to make sure it's safe to write this file | """Does the I/O dirty work after it calls isWriteable to make sure it's safe to write this file. | def writeFile(self, filename, mimetype, fileobject): """does the I/O dirty work after it calls isWriteable to make sure it's safe to write this file """ outname = self.makeUniqueName(os.path.join(self.destination, filename)) filestream = stream.FileStream(fileobject) | 4484bc934084bd79c718f3023b2eb4f8ca9e607e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4484bc934084bd79c718f3023b2eb4f8ca9e607e/static.py |
outname = self.makeUniqueName(os.path.join(self.destination, filename)) | def writeFile(self, filename, mimetype, fileobject): """does the I/O dirty work after it calls isWriteable to make sure it's safe to write this file """ outname = self.makeUniqueName(os.path.join(self.destination, filename)) filestream = stream.FileStream(fileobject) | 4484bc934084bd79c718f3023b2eb4f8ca9e607e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4484bc934084bd79c718f3023b2eb4f8ca9e607e/static.py | |
if self.isWriteable(outname, mimetype, filestream): fd = os.fdopen(os.open(outname, os.O_WRONLY | os.O_CREAT, self.permissions), 'w', 0) stream.readIntoFile(filestream, fd) | if self.isSafeToWrite(filename, mimetype, filestream): outname = self.makeUniqueName(filename) fileobject = os.fdopen(os.open(outname, os.O_WRONLY | os.O_CREAT | os.O_EXCL, self.permissions), 'w', 0) stream.readIntoFile(filestream, fileobject) | def writeFile(self, filename, mimetype, fileobject): """does the I/O dirty work after it calls isWriteable to make sure it's safe to write this file """ outname = self.makeUniqueName(os.path.join(self.destination, filename)) filestream = stream.FileStream(fileobject) | 4484bc934084bd79c718f3023b2eb4f8ca9e607e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/4484bc934084bd79c718f3023b2eb4f8ca9e607e/static.py |
from twisted.protocols.jabber import jid | from twisted.words.protocols.jabber import jid | def value(self, elem): from twisted.protocols.jabber import jid try: user, host, resource = jid.parse(self.sourceValue.value(elem)) if user: return "%s@%s" % (user, host) else: return None except jid.InvalidFormat: return None | c1cc822df703ae7d0ba1cd1797f292cd9e4203cd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/c1cc822df703ae7d0ba1cd1797f292cd9e4203cd/xpath.py |
re_psep = re.escape(os.path.sep) | re_psep = re.escape(os.sep) | def gimmeAFailure(): f = None try: raise BogusError, ERROR_MSG except: f = failure.Failure() return f | 8c5d3ea2a1f451c2c4d9d65a407ec2abe6fa7420 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/8c5d3ea2a1f451c2c4d9d65a407ec2abe6fa7420/test_adapters.py |
deferred = f or defer.Deferred() | deferred = f or Deferred() | def maybeDeferred(f, *args, **kw): """Invoke a function that may or may not return a deferred. Call the given function with the given arguments. If the returned object is a C{Deferred}, return it. If the returned object is a C{Failure}, wrap it with C{fail} and return it. Otherwise, wrap it in C{succeed} and return... | 296b1140037136d6ae1b2c7e16fa862c8128621d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/296b1140037136d6ae1b2c7e16fa862c8128621d/defer.py |
self.p.perspective_do("service is sys.modules['twisted.manhole.service']") | self.p.perspective_do("int(service is sys.modules['twisted.manhole.service'])") | def test_importIdentity(self): """Making sure imported module is the same as one previously loaded. """ self.p.perspective_do("from twisted.manhole import service") self.client.setZero() self.p.perspective_do("service is sys.modules['twisted.manhole.service']") msg = self.client.getMessages()[0] self.failUnlessEqual(ms... | 83eb0eb0347f0abc46ef926627c6b01fa25ebde2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/83eb0eb0347f0abc46ef926627c6b01fa25ebde2/test_manhole.py |
handles = events.keys() if not handles: | if not (events or writes): | def doWaitForMultipleEvents(timeout, reads=reads, writes=writes): if timeout is None: #timeout = INFINITE timeout = 5000 else: timeout = int(timeout * 1000) handles = events.keys() if not handles: # sleep so we don't suck up CPU time time.sleep(timeout / 1000.0) return canDoMoreWrites = 0 for fd in writes.keys(): log... | ca1ebdfce031a3565f5ea7bca917c25716762356 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12595/ca1ebdfce031a3565f5ea7bca917c25716762356/win32.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.