Ticket #5385: patch_5385.2.patch
| File patch_5385.2.patch, 19.2 KB (added by moijes12, 14 months ago) |
|---|
-
twisted/test/test_compat.py
80 80 self.assertEqual(lst1, lst2) 81 81 82 82 def testIsinstance(self): 83 self.assert_(isinstance(u'hi', types.StringTypes))84 self.assert_(isinstance(self, unittest.TestCase))85 # I'm pretty sure it's impossible to implement this86 # without replacing isinstance on 2.2 as well :(87 # self.assert_(isinstance({}, dict))83 """ 84 The current object is an instance of 85 unittest.TestCase. 86 """ 87 self.assertTrue(isinstance(self, unittest.TestCase)) 88 88 89 89 90 def testStrip(self): 90 91 self.assertEqual(' x '.lstrip(' '), 'x ') 91 92 self.assertEqual(' x x'.lstrip(' '), 'x x') -
twisted/test/test_defgen.py
1 from __future__ import generators, nested_scopes 1 """ 2 __future__.nested_scopes is not imported anymore. nested_scopes was used to add 3 Python 2.1 support (see http://www.python.org/dev/peps/pep-0227/). Twisted does 4 not support Python 2.1. 2 5 6 __future__.generators is not imported anymore as it is Python 2.2 specific. 7 Twisted no longer supports Python 2.2. 8 """ 9 3 10 import sys 4 11 5 12 from twisted.internet import reactor -
twisted/python/filepath.py
873 873 874 874 def getInodeNumber(self): 875 875 """ 876 Retrieve the file serial number, also called inode number, which 876 Retrieve the file serial number, also called inode number, which 877 877 distinguishes this file from all other files on the same device. 878 878 879 879 @raise: NotImplementedError if the platform is Windows, since the … … 1046 1046 """ 1047 1047 Returns whether the underlying path is a block device. 1048 1048 1049 @return: C{True} if it is a block device, C{False} otherwise 1049 @return: C{True} if it is a block device, C{False} otherwise 1050 1050 @rtype: C{bool} 1051 1051 @since: 11.1 1052 1052 """ … … 1063 1063 """ 1064 1064 Returns whether the underlying path is a socket. 1065 1065 1066 @return: C{True} if it is a socket, C{False} otherwise 1066 @return: C{True} if it is a socket, C{False} otherwise 1067 1067 @rtype: C{bool} 1068 1068 @since: 11.1 1069 1069 """ … … 1254 1254 os.rename(sib.path, self.path) 1255 1255 1256 1256 1257 # new in 2.2.01258 1259 1257 def __cmp__(self, other): 1260 1258 if not isinstance(other, FilePath): 1261 1259 return NotImplemented -
twisted/protocols/ident.py
5 5 """ 6 6 Ident protocol implementation. 7 7 8 __future__.generators is not imported anymore as it is Python 2.2 specific. 9 Twisted no longer supports Python 2.2. 10 8 11 @author: Jean-Paul Calderone 9 12 """ 10 13 11 from __future__ import generators12 13 14 import struct 14 15 15 16 from twisted.internet import defer -
twisted/protocols/htb.py
9 9 Patterned after U{Martin Devera's Hierarchical Token Bucket traffic 10 10 shaper for the Linux kernel<http://luxik.cdi.cz/~devik/qos/htb/>}. 11 11 12 __future__.nested_scopes is not imported anymore. nested_scopes was used to add 13 Python 2.1 support (see http://www.python.org/dev/peps/pep-0227/). Twisted does 14 not support Python 2.1. 15 12 16 @seealso: U{HTB Linux queuing discipline manual - user guide 13 17 <http://luxik.cdi.cz/~devik/qos/htb/manual/userg.htm>} 14 18 @seealso: U{Token Bucket Filter in Linux Advanced Routing & Traffic Control … … 16 20 @author: Kevin Turner 17 21 """ 18 22 19 from __future__ import nested_scopes20 23 21 24 __version__ = '$Revision: 1.5 $'[11:-2] 22 25 -
twisted/topfiles/5385.misc
1 twisted no longer supports Python 2.2. -
twisted/scripts/tkunzip.py
3 3 # See LICENSE for details. 4 4 5 5 """ 6 Post-install GUI to compile to pyc and unpack twisted doco 6 Post-install GUI to compile to pyc and unpack twisted doco. 7 8 __future__.generators is not imported anymore as it is Python 2.2 specific. 9 Twisted no longer supports Python 2.2. 7 10 """ 8 11 9 from __future__ import generators10 11 12 import sys 12 13 import zipfile 13 14 import py_compile … … 15 16 # we're going to ignore failures to import tkinter and fall back 16 17 # to using the console if the required dll is not found 17 18 18 # Scary kludge to work around tk84.dll bug: 19 # Scary kludge to work around tk84.dll bug: 19 20 # https://sourceforge.net/tracker/index.php?func=detail&aid=814654&group_id=5470&atid=105470 20 21 # Without which(): you get a windows missing-dll popup message 21 22 from twisted.python.procutils import which … … 71 72 72 73 def pack(self, *args, **kwargs): 73 74 self.frame.pack(*args, **kwargs) 74 75 75 76 def updateProgress(self, newValue, newMax=None): 76 77 if newMax: 77 78 self.max = newMax … … 91 92 float(value) / self.max * self.width, self.height) 92 93 else: 93 94 self.canvas.coords(self.scale, 0, 94 self.height - (float(value) / 95 self.height - (float(value) / 95 96 self.max*self.height), 96 97 self.width, self.height) 97 98 # Now update the colors … … 101 102 if self.doLabel: 102 103 if value: 103 104 if value >= 0: 104 pvalue = int((float(value) / float(self.max)) * 105 pvalue = int((float(value) / float(self.max)) * 105 106 100.0) 106 107 else: 107 108 pvalue = 0 … … 133 134 def setIterator(self, iterator): 134 135 self.iterator=iterator 135 136 return self 136 137 137 138 def updateBar(self, deferred): 138 139 b=self.bar 139 140 try: … … 156 157 if self.stopping: 157 158 deferred.callback(self.root) 158 159 return 159 160 160 161 try: 161 162 self.remaining=self.iterator.next() 162 163 except StopIteration: 163 self.stopping=1 164 self.stopping=1 164 165 except: 165 166 deferred.errback(failure.Failure()) 166 167 167 168 if self.remaining%10==0: 168 169 reactor.callLater(0, self.updateBar, deferred) 169 170 if self.remaining%100==0: … … 218 219 219 220 if opt['use-console']: 220 221 # this should come before shell-exec to prevent infinite loop 221 return doItConsolicious(opt) 222 return doItConsolicious(opt) 222 223 if opt['shell-exec'] or not 'Tkinter' in sys.modules: 223 224 from distutils import sysconfig 224 225 from twisted.scripts import tkunzip … … 240 241 if n % 1000 == 0: 241 242 print 242 243 print 'Done unpacking.' 243 244 244 245 if opt['compiledir']: 245 246 print 'Compiling to pyc...' 246 247 import compileall … … 253 254 root.title('One Moment.') 254 255 root.protocol('WM_DELETE_WINDOW', reactor.stop) 255 256 tksupport.install(root) 256 257 257 258 prog=ProgressBar(root, value=0, labelColor="black", width=200) 258 259 prog.pack() 259 260 … … 265 266 return root 266 267 267 268 d.addCallback(deiconify) 268 269 269 270 if opt['zipfile']: 270 271 uz=Progressor('Unpacking documentation...') 271 272 max=zipstream.countZipFileChunks(opt['zipfile'], 4096) -
twisted/internet/_threadedselect.py
3 3 # Copyright (c) Twisted Matrix Laboratories. 4 4 # See LICENSE for details. 5 5 6 from __future__ import generators7 8 6 """ 9 7 Threaded select reactor 10 8 … … 54 52 loop. Shutdown functions that could be used in place of 55 53 "foreignEventloopStop" would be the ExitMainLoop method of the wxApp instance 56 54 with wxPython, or the PyObjCTools.AppHelper.stopEventLoop function. 55 56 __future__.generators is not imported anymore as it is Python 2.2 specific. 57 Twisted no longer supports Python 2.2. 57 58 """ 58 59 59 60 from threading import Thread -
twisted/conch/scripts/tkconch.py
5 5 # 6 6 # $Id: tkconch.py,v 1.6 2003/02/22 08:10:15 z3p Exp $ 7 7 8 """ Implementation module for the `tkconch` command.9 8 """ 9 Implementation module for the `tkconch` command. 10 10 11 from __future__ import nested_scopes 11 __future__.nested_scopes is not imported anymore. nested_scopes was used to add 12 Python 2.1 support (see http://www.python.org/dev/peps/pep-0227/). Twisted does 13 not support Python 2.1. 14 """ 12 15 13 16 import Tkinter, tkFileDialog, tkFont, tkMessageBox, string 14 17 from twisted.conch.ui import tkvt100 … … 86 89 self.grid_columnconfigure(2, weight=1, minsize=2) 87 90 88 91 self.master.protocol("WM_DELETE_WINDOW", sys.exit) 89 90 92 93 91 94 def getIdentityFile(self): 92 95 r = tkFileDialog.askopenfilename() 93 96 if r: … … 160 163 finished = 0 161 164 if finished: 162 165 self.master.quit() 163 self.master.destroy() 166 self.master.destroy() 164 167 if options['log']: 165 168 realout = sys.stdout 166 169 log.startLogging(sys.stderr) … … 337 340 raise 338 341 339 342 class SSHClientFactory(protocol.ClientFactory): 340 noisy = 1 343 noisy = 1 341 344 342 345 def stopFactory(self): 343 346 reactor.stop() … … 379 382 host = options['host'] 380 383 khHost = options['host'] 381 384 else: 382 host = '%s (%s)' % (options['host'], 385 host = '%s (%s)' % (options['host'], 383 386 self.transport.getPeer()[1]) 384 khHost = '%s,%s' % (options['host'], 387 khHost = '%s,%s' % (options['host'], 385 388 self.transport.getPeer()[1]) 386 389 keyType = common.getNS(pubKey)[0] 387 390 ques = """The authenticity of host '%s' can't be established.\r 388 %s key fingerprint is %s.""" % (host, 389 {'ssh-dss':'DSA', 'ssh-rsa':'RSA'}[keyType], 390 fingerprint) 391 %s key fingerprint is %s.""" % (host, 392 {'ssh-dss':'DSA', 'ssh-rsa':'RSA'}[keyType], 393 fingerprint) 391 394 ques+='\r\nAre you sure you want to continue connecting (yes/no)? ' 392 395 return deferredAskFrame(ques, 1).addCallback(self._cbVerifyHostKey, pubKey, khHost, keyType) 393 396 … … 405 408 known_hosts.close() 406 409 except: 407 410 log.deferr() 408 raise error.ConchError 411 raise error.ConchError 409 412 410 413 def connectionSecure(self): 411 414 if options['user']: … … 420 423 def getPassword(self, prompt = None): 421 424 if not prompt: 422 425 prompt = "%s@%s's password: " % (self.user, options['host']) 423 return deferredAskFrame(prompt,0) 426 return deferredAskFrame(prompt,0) 424 427 425 428 def getPublicKey(self): 426 429 files = [x for x in options.identitys if x not in self.usedFiles] … … 429 432 file = files[0] 430 433 log.msg(file) 431 434 self.usedFiles.append(file) 432 file = os.path.expanduser(file) 435 file = os.path.expanduser(file) 433 436 file += '.pub' 434 437 if not os.path.exists(file): 435 438 return 436 439 try: 437 return keys.Key.fromFile(file).blob() 440 return keys.Key.fromFile(file).blob() 438 441 except: 439 442 return self.getPublicKey() # try again 440 443 441 444 def getPrivateKey(self): 442 445 file = os.path.expanduser(self.usedFiles[-1]) 443 446 if not os.path.exists(file): … … 467 470 if options.localForwards: 468 471 for localPort, hostport in options.localForwards: 469 472 reactor.listenTCP(localPort, 470 forwarding.SSHListenForwardingFactory(self, 473 forwarding.SSHListenForwardingFactory(self, 471 474 hostport, 472 475 forwarding.SSHListenClientForwardingChannel)) 473 476 if options.remoteForwards: … … 482 485 class SSHSession(channel.SSHChannel): 483 486 484 487 name = 'session' 485 488 486 489 def channelOpen(self, foo): 487 490 #global globalSession 488 491 #globalSession = self … … 505 508 #winsz = fcntl.ioctl(fd, tty.TIOCGWINSZ, '12345678') 506 509 winSize = (25,80,0,0) #struct.unpack('4H', winsz) 507 510 ptyReqData = session.packRequest_pty_req(term, winSize, '') 508 self.conn.sendRequest(self, 'pty-req', ptyReqData) 511 self.conn.sendRequest(self, 'pty-req', ptyReqData) 509 512 self.conn.sendRequest(self, 'exec', \ 510 513 common.NS(options['command'])) 511 514 else: -
twisted/words/im/pbsupport.py
2 2 # See LICENSE for details. 3 3 4 4 5 """L{twisted.words} support for Instance Messenger.""" 5 """ 6 L{twisted.words} support for Instance Messenger. 6 7 7 from __future__ import nested_scopes 8 __future__.nested_scopes is not imported anymore. nested_scopes was used to add 9 Python 2.1 support (see http://www.python.org/dev/peps/pep-0227/). Twisted does 10 not support Python 2.1. 11 """ 8 12 9 13 from twisted.internet import defer 10 14 from twisted.internet import error -
twisted/trial/test/detests.py
1 from __future__ import generators 1 """ 2 __future__.generators is not imported anymore as it is Python 2.2 specific. 3 Twisted no longer supports Python 2.2. 4 """ 5 2 6 from twisted.trial import unittest 3 7 from twisted.internet import defer, threads, reactor 4 8 … … 18 22 19 23 class DeferredSetUpFail(unittest.TestCase): 20 24 testCalled = False 21 25 22 26 def setUp(self): 23 27 return defer.fail(unittest.FailTest('i fail')) 24 28 … … 29 33 30 34 class DeferredSetUpCallbackFail(unittest.TestCase): 31 35 testCalled = False 32 36 33 37 def setUp(self): 34 38 d = defer.succeed('value') 35 39 d.addCallback(self._cb_setUpCalled) … … 41 45 def test_ok(self): 42 46 DeferredSetUpCallbackFail.testCalled = True 43 47 44 48 45 49 class DeferredSetUpError(unittest.TestCase): 46 50 testCalled = False 47 51 48 52 def setUp(self): 49 53 return defer.fail(RuntimeError('deliberate error')) 50 54 … … 54 58 55 59 class DeferredSetUpNeverFire(unittest.TestCase): 56 60 testCalled = False 57 61 58 62 def setUp(self): 59 63 return defer.Deferred() 60 64 … … 64 68 65 69 class DeferredSetUpSkip(unittest.TestCase): 66 70 testCalled = False 67 71 68 72 def setUp(self): 69 73 d = defer.succeed('value') 70 74 d.addCallback(self._cb1) … … 79 83 80 84 class DeferredTests(unittest.TestCase): 81 85 touched = False 82 86 83 87 def _cb_fail(self, reason): 84 88 self.fail(reason) 85 89 … … 134 138 135 139 class TimeoutTests(unittest.TestCase): 136 140 timedOut = None 137 141 138 142 def test_pass(self): 139 143 d = defer.Deferred() 140 144 reactor.callLater(0, d.callback, 'hoorj!') … … 159 163 return defer.Deferred() 160 164 test_expectedFailure.timeout = 0.1 161 165 test_expectedFailure.todo = "i will get it right, eventually" 162 166 163 167 def test_skip(self): 164 168 return defer.Deferred() 165 169 test_skip.timeout = 0.1 -
twisted/spread/ui/gtk2util.py
2 2 # Copyright (c) Twisted Matrix Laboratories. 3 3 # See LICENSE for details. 4 4 5 """ 6 __future__.nested_scopes is not imported anymore. nested_scopes was used to add 7 Python 2.1 support (see http://www.python.org/dev/peps/pep-0227/). Twisted does 8 not support Python 2.1. 9 """ 5 10 6 from __future__ import nested_scopes7 8 11 import gtk 9 12 10 13 from twisted import copyright -
doc/core/examples/threadedselect/pygamedemo.py
1 from __future__ import generators 1 """ 2 __future__.generators is not imported anymore as it is Python 2.2 specific. 3 Twisted no longer supports Python 2.2. 4 """ 2 5 3 6 # import Twisted and install 4 7 from twisted.internet import _threadedselect … … 71 74 reactor.stop() 72 75 elif event.type == KEYDOWN and event.key == K_ESCAPE: 73 76 reactor.stop() 74 77 75 78 pygame.quit() 76 79 77 80 if __name__ == '__main__': -
doc/core/examples/pbgtk2.py
1 1 # Copyright (c) Twisted Matrix Laboratories. 2 2 # See LICENSE for details. 3 3 4 """ 5 __future__.nested_scopes is not imported anymore. nested_scopes was used to add 6 Python 2.1 support (see http://www.python.org/dev/peps/pep-0227/). Twisted does 7 not support Python 2.1. 8 """ 4 9 5 from __future__ import nested_scopes6 7 10 from twisted.internet import gtk2reactor 8 11 gtk2reactor.install() 9 12 … … 67 70 reactor.connectTCP(host, port, client_factory) 68 71 creds = UsernamePassword(userName, password) 69 72 client_factory.login(creds).addCallbacks(self._cbGotPerspective, self._ebFailedLogin) 70 73 71 74 self.statusMsg("Contacting server...") 72 75 73 76 def _cbGotPerspective(self, perspective): … … 80 83 text = str(reason.value) 81 84 else: 82 85 text = str(reason) 83 86 84 87 self.statusMsg(text) 85 88 msg = gtk.MessageDialog(self._loginDialog, 86 89 gtk.DIALOG_DESTROY_WITH_PARENT, -
doc/core/examples/longex2.py
39 39 Multiplying zero numbers is a perfectly sensible operation, and the 40 40 result is 1. In that, this example departs from doc/examples/longex.py, 41 41 which errors out when trying to do this. 42 43 __future__.generators is not imported anymore as it is Python 2.2 specific. 44 Twisted no longer supports Python 2.2. 42 45 """ 43 from __future__ import generators 46 44 47 from twisted.protocols import basic 45 48 from twisted.internet import defer, protocol 46 49
