<86>Apr 14 01:02:03 userdel[79054]: delete user 'rooter' <86>Apr 14 01:02:03 userdel[79054]: removed group 'rooter' owned by 'rooter' <86>Apr 14 01:02:03 userdel[79054]: removed shadow group 'rooter' owned by 'rooter' <86>Apr 14 01:02:03 groupadd[79059]: group added to /etc/group: name=rooter, GID=561 <86>Apr 14 01:02:03 groupadd[79059]: group added to /etc/gshadow: name=rooter <86>Apr 14 01:02:03 groupadd[79059]: new group: name=rooter, GID=561 <86>Apr 14 01:02:03 useradd[79065]: new user: name=rooter, UID=561, GID=561, home=/root, shell=/bin/bash <86>Apr 14 01:02:03 userdel[79074]: delete user 'builder' <86>Apr 14 01:02:03 userdel[79074]: removed group 'builder' owned by 'builder' <86>Apr 14 01:02:03 userdel[79074]: removed shadow group 'builder' owned by 'builder' <86>Apr 14 01:02:03 groupadd[79079]: group added to /etc/group: name=builder, GID=562 <86>Apr 14 01:02:03 groupadd[79079]: group added to /etc/gshadow: name=builder <86>Apr 14 01:02:03 groupadd[79079]: new group: name=builder, GID=562 <86>Apr 14 01:02:03 useradd[79086]: new user: name=builder, UID=562, GID=562, home=/usr/src, shell=/bin/bash <13>Apr 14 01:02:06 rpmi: libexpat-2.2.4-alt0.M80P.1 1503871120 installed <13>Apr 14 01:02:06 rpmi: libpng15-1.5.28-alt1 1484572014 installed <13>Apr 14 01:02:06 rpmi: libjpeg-2:1.3.1-alt0.1 1388074033 installed <13>Apr 14 01:02:06 rpmi: libtiff5-4.0.3-alt1 1348347498 installed <13>Apr 14 01:02:06 rpmi: libopenblas-0.2.14-alt1.git20150324 1433158855 installed <13>Apr 14 01:02:06 rpmi: libwayland-server-1.14.0-alt0.M80P.1 1502720500 installed <13>Apr 14 01:02:06 rpmi: libgdbm-1.8.3-alt10 1454943313 installed <13>Apr 14 01:02:06 rpmi: libjasper-1.900.1-alt3 1391718482 installed <13>Apr 14 01:02:06 rpmi: libnumpy-1:1.12.1-alt0.M80P.1 1496160663 installed <13>Apr 14 01:02:06 rpmi: libxblas-1.0.248-alt1 1322010716 installed <13>Apr 14 01:02:06 rpmi: libgtk+2-locales-2.24.31-alt1 1473461664 installed <13>Apr 14 01:02:06 rpmi: liborc-0.4.27-alt1.M80P.1 1503911715 installed <13>Apr 14 01:02:06 rpmi: libquadmath0-5.3.1-alt3.M80P.1 p8+225520.100.3.1 1553688800 installed <13>Apr 14 01:02:06 rpmi: libgfortran3-5.3.1-alt3.M80P.1 p8+225520.100.3.1 1553688800 installed <13>Apr 14 01:02:06 rpmi: liblapack-1:3.5.0-alt1 1401382194 installed <13>Apr 14 01:02:06 rpmi: libdatrie-0.2.8-alt1_5 1410185969 installed <13>Apr 14 01:02:07 rpmi: libthai-0.1.24-alt1_1 1459282110 installed <13>Apr 14 01:02:07 rpmi: libpixman-3:0.32.8-alt1 1447610691 installed <13>Apr 14 01:02:07 rpmi: liblz4-1:1.7.5-alt1 1488766699 installed <13>Apr 14 01:02:07 rpmi: libgpg-error-1.31-alt1.M80P.1 1529024730 installed <13>Apr 14 01:02:07 rpmi: libgcrypt20-1.8.3-alt4 p8+219793.200.6.1 1551112986 installed <13>Apr 14 01:02:07 rpmi: libsystemd-1:237-alt2.M80P.6 p8+221965.100.2.1 1550786217 installed <13>Apr 14 01:02:07 rpmi: libdbus-1.10.24-alt4.M80P.1 1518773282 installed <13>Apr 14 01:02:07 rpmi: libavahi-0.6.31-alt7.M80P.1 1526318593 installed <13>Apr 14 01:02:07 rpmi: libatk-locales-2.24.0-alt0.M80P.1 1504535386 installed <13>Apr 14 01:02:07 rpmi: libatk-2.24.0-alt0.M80P.1 1504535253 installed <13>Apr 14 01:02:07 rpmi: libgraphite2-1.3.10-alt0.M80P.1 1496411360 installed <13>Apr 14 01:02:07 rpmi: libICE-1.0.9-alt1 1409902719 installed <13>Apr 14 01:02:07 rpmi: libSM-1.2.2-alt1 1391072686 installed <13>Apr 14 01:02:07 rpmi: libwayland-client-1.14.0-alt0.M80P.1 1502720500 installed <13>Apr 14 01:02:07 rpmi: libxshmfence-1.2-alt1 1420972191 installed <13>Apr 14 01:02:07 rpmi: libpciaccess-1:0.13.4-alt1 1431681688 installed <13>Apr 14 01:02:07 rpmi: libdrm-1:2.4.89-alt1.M80P.1 1516609380 installed <13>Apr 14 01:02:07 rpmi: libgbm-4:18.0.5-alt1.M80P.1 p8+226404.100.1.1 1554206332 installed <13>Apr 14 01:02:07 rpmi: libX11-locales-3:1.6.3-alt1 1431956885 installed <13>Apr 14 01:02:07 rpmi: libXdmcp-1.1.1-alt1 1334617699 installed <13>Apr 14 01:02:07 rpmi: libXau-1.0.8-alt1 1369565807 installed <13>Apr 14 01:02:07 rpmi: libxcb-1.12-alt2 p8.218219.300 1545313310 installed <13>Apr 14 01:02:07 rpmi: libX11-3:1.6.3-alt1 1431956911 installed <13>Apr 14 01:02:07 rpmi: libXext-1.3.3-alt1 1409902932 installed <13>Apr 14 01:02:07 rpmi: libXrender-0.9.8-alt1 1371312110 installed <13>Apr 14 01:02:07 rpmi: libXfixes-5.0.1-alt1 1369809606 installed <13>Apr 14 01:02:07 rpmi: libXinerama-1.1.3-alt1 1369984571 installed <13>Apr 14 01:02:07 rpmi: libXdamage-1.1.3-alt4 1297162596 installed <13>Apr 14 01:02:07 rpmi: libXcursor-1.1.15-alt1.M80P.1 1512373713 installed <13>Apr 14 01:02:07 rpmi: libXrandr-1.5.0-alt1 1431936188 installed <13>Apr 14 01:02:07 rpmi: libXxf86vm-1.1.3-alt1 1369984824 installed <13>Apr 14 01:02:07 rpmi: libGL-4:18.0.5-alt1.M80P.1 p8+226404.100.1.1 1554206332 installed <13>Apr 14 01:02:07 rpmi: libEGL-4:18.0.5-alt1.M80P.1 p8+226404.100.1.1 1554206332 installed <13>Apr 14 01:02:07 rpmi: libXi-1.7.9-alt1.M80P.1 1515766146 installed <13>Apr 14 01:02:07 rpmi: libXcomposite-0.4.3-alt3 1297306939 installed <13>Apr 14 01:02:07 rpmi: icon-theme-hicolor-0.17-alt1 1505715846 installed <13>Apr 14 01:02:07 rpmi: libgdk-pixbuf-locales-2.36.11-alt0.M80P.1 1507198237 installed <13>Apr 14 01:02:07 rpmi: rpm-build-xdg-0.2-alt1 1250461503 installed <13>Apr 14 01:02:07 rpmi: shared-mime-info-1.9-alt0.M80P.1 1506021412 installed <13>Apr 14 01:02:07 rpmi: gsettings-desktop-schemas-data-3.24.1-alt0.M80P.1 1504768054 installed <13>Apr 14 01:02:07 rpmi: libtinfo-devel-5.9-alt8 1456756459 installed <13>Apr 14 01:02:07 rpmi: libncurses-devel-5.9-alt8 1456756459 installed <13>Apr 14 01:02:07 rpmi: python-modules-curses-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:07 rpmi: libverto-0.2.6-alt1_6 1455633234 installed <13>Apr 14 01:02:07 rpmi: libkeyutils-1.5.10-alt0.M80P.2 p8+216694.100.6.1 1547827915 installed <13>Apr 14 01:02:07 rpmi: libcom_err-1.42.13-alt2 1449075846 installed <13>Apr 14 01:02:07 rpmi: ca-certificates-2016.02.25-alt1 1462368370 installed <13>Apr 14 01:02:07 rpmi: libcrypto10-1.0.2n-alt0.M80P.1 1512766129 installed <13>Apr 14 01:02:07 rpmi: libgio-2.52.3-alt0.M80P.1 1504533271 installed <13>Apr 14 01:02:07 rpmi: libssl10-1.0.2n-alt0.M80P.1 1512766129 installed <13>Apr 14 01:02:07 rpmi: libgdk-pixbuf-2.36.11-alt0.M80P.1 1507198160 installed <13>Apr 14 01:02:07 rpmi: libgstreamer1.0-1.12.3-alt0.M80P.1 1505901068 installed <13>Apr 14 01:02:07 rpmi: libharfbuzz-1.6.3-alt0.M80P.1 1509918814 installed <13>Apr 14 01:02:07 rpmi: libfreetype-2.8-alt0.M80P.3 1505462817 installed <13>Apr 14 01:02:07 rpmi: fontconfig-2.12.6-alt1.M80P.1 1506008910 installed Updating fonts cache: <29>Apr 14 01:02:08 fontconfig: Updating fonts cache: succeeded [ DONE ] <13>Apr 14 01:02:08 rpmi: libcairo-1:1.14.4-alt1 1447005495 installed <86>Apr 14 01:02:08 groupadd[92889]: group added to /etc/group: name=_keytab, GID=499 <86>Apr 14 01:02:08 groupadd[92889]: group added to /etc/gshadow: name=_keytab <86>Apr 14 01:02:08 groupadd[92889]: new group: name=_keytab, GID=499 <13>Apr 14 01:02:09 rpmi: libkrb5-1.14.6-alt1.M80P.1 1525355673 installed <13>Apr 14 01:02:09 rpmi: libcups-2.1.0-alt2.M80P.4 p8+223280.100.1.1 1551372192 installed <13>Apr 14 01:02:09 rpmi: libXft-2.3.2-alt1 1409902650 installed <13>Apr 14 01:02:09 rpmi: libpango-1.40.14-alt0.M80P.1 1510824230 installed <13>Apr 14 01:02:09 rpmi: libgst-plugins1.0-1.12.3-alt0.M80P.1 1505901518 installed <13>Apr 14 01:02:09 rpmi: gtk-update-icon-cache-2.24.31-alt1 1473461609 installed <13>Apr 14 01:02:09 rpmi: libgtk+2-2.24.31-alt1 1473461609 installed <13>Apr 14 01:02:09 rpmi: gsettings-desktop-schemas-3.24.1-alt0.M80P.1 1504768052 installed <13>Apr 14 01:02:09 rpmi: python3-base-3.5.4-alt2.M80P.1 1527753911 installed <13>Apr 14 01:02:09 rpmi: python-modules-compiler-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:09 rpmi: wxGTK-2:2.8.12-alt1.svn20131012.3.M80P.1 1491241128 installed <13>Apr 14 01:02:09 rpmi: libwxGTK-2:2.8.12-alt1.svn20131012.3.M80P.1 1491241128 installed <13>Apr 14 01:02:09 rpmi: libwxGTK-contrib-gizmos-2:2.8.12-alt1.svn20131012.3.M80P.1 1491241128 installed <13>Apr 14 01:02:10 rpmi: libwxGTK-contrib-stc-2:2.8.12-alt1.svn20131012.3.M80P.1 1491241128 installed <13>Apr 14 01:02:10 rpmi: python3-module-asn1crypto-0.22.0-alt0.M80P.1 1501735102 installed <13>Apr 14 01:02:10 rpmi: python3-module-pycparser-2.14-alt1.1 1458071180 installed <13>Apr 14 01:02:10 rpmi: python3-module-idna-2.5-alt0.M80P.1 1501735172 installed <13>Apr 14 01:02:10 rpmi: python3-module-six-1.10.0-alt7 1496087616 installed <13>Apr 14 01:02:10 rpmi: python3-module-z3c-3.0.0-alt2.a2.dev0.git20130313.1.1.1 1460417103 installed <13>Apr 14 01:02:10 rpmi: python3-module-zc-1.0.0-alt6.2 1458024144 installed <13>Apr 14 01:02:10 rpmi: python-modules-email-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python3-3.5.4-alt2.M80P.1 1527753911 installed <13>Apr 14 01:02:10 rpmi: python3-module-cffi-1.10.0-alt0.M80P.1 1501702481 installed <13>Apr 14 01:02:10 rpmi: rpm-build-python3-0.1.10.10-alt1.M80P.1 1530521451 installed <13>Apr 14 01:02:10 rpmi: python3-module-cryptography-2.0.0-alt0.M80P.1 1501702598 installed <13>Apr 14 01:02:10 rpmi: python-modules-unittest-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python3-module-zope-3.3.0-alt8.4 1458261152 installed <13>Apr 14 01:02:10 rpmi: python3-module-zope.interface-4.1.3-alt1.dev0.git20150601.4 1459629874 installed <13>Apr 14 01:02:10 rpmi: python-modules-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python-modules-ctypes-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python-modules-encodings-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python-modules-xml-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python-modules-multiprocessing-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python-modules-logging-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python-tools-2to3-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python-modules-hotshot-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python-modules-bsddb-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python-dev-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python-strict-2.7.11-alt6.M80P.1 1527682534 installed <13>Apr 14 01:02:10 rpmi: python-module-pycairo-1.13.3-alt0.M80P.1 1504561359 installed <13>Apr 14 01:02:10 rpmi: python-module-py-1.4.34-alt0.M80P.1 1503506764 installed <13>Apr 14 01:02:10 rpmi: python-modules-json-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 14 01:02:10 rpmi: python-module-pycrypto-2.7-alt3.a1.git20140620.1 1459652085 installed <13>Apr 14 01:02:10 rpmi: python-module-numpy-1:1.12.1-alt0.M80P.1 1496160663 installed <13>Apr 14 01:02:10 rpmi: python-module-numpy-testing-1:1.12.1-alt0.M80P.1 1496160663 installed <13>Apr 14 01:02:10 rpmi: python-module-setuptools-1:18.5-alt0.M80P.1 1497527461 installed <13>Apr 14 01:02:10 rpmi: python-module-pytest-3.2.1-alt0.M80P.1 1503499784 installed <13>Apr 14 01:02:11 rpmi: python-module-wx-2.8.12.1-alt3.svn20120530.1 1443907729 installed Installing python-module-Epsilon-0.7.1-alt1.src.rpm Building target platforms: x86_64 Building for target x86_64 Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.11504 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + rm -rf Epsilon-0.7.1 + echo 'Source #0 (Epsilon-0.7.1.tar.gz):' Source #0 (Epsilon-0.7.1.tar.gz): + /bin/gzip -dc /usr/src/RPM/SOURCES/Epsilon-0.7.1.tar.gz + /bin/tar -xf - + cd Epsilon-0.7.1 + /bin/chmod -c -Rf u+rwX,go-w . + echo 'Patch #0 (Epsilon-0.7.0-alt-python3.patch):' Patch #0 (Epsilon-0.7.0-alt-python3.patch): + /usr/bin/patch -p2 patching file epsilon/hotfixes/filepath_copyTo.py patching file epsilon/modal.py patching file epsilon/test/test_expose.py patching file epsilon/unrepr.py + cp -fR . ../python3 + find ../python3 -type f -name '*.py' -exec 2to3 -w -n '{}' + RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored ../python3/versioneer.py RefactoringTool: No changes to ../python3/setup.py RefactoringTool: No changes to ../python3/epsilon/_version.py RefactoringTool: Refactored ../python3/epsilon/view.py RefactoringTool: Refactored ../python3/epsilon/structlike.py RefactoringTool: Refactored ../python3/epsilon/spewer.py RefactoringTool: Refactored ../python3/epsilon/setuphelper.py --- ../python3/versioneer.py (original) +++ ../python3/versioneer.py (refactored) @@ -339,11 +339,11 @@ """ -from __future__ import print_function + try: import configparser except ImportError: - import ConfigParser as configparser + import configparser as configparser import errno import json import os --- ../python3/epsilon/view.py (original) +++ ../python3/epsilon/view.py (refactored) @@ -28,7 +28,7 @@ def _getIndices(self): start, stop, step = self.bounds.indices(len(self.sequence)) - indices = xrange(start, stop, step) + indices = range(start, stop, step) return indices --- ../python3/epsilon/structlike.py (original) +++ ../python3/epsilon/structlike.py (refactored) @@ -151,7 +151,7 @@ elif len(a) == 0: if not kw: raise TypeError("Attempted to define a record with no attributes.") - attributeNames = kw.keys() + attributeNames = list(kw.keys()) attributeNames.sort() else: raise TypeError( --- ../python3/epsilon/spewer.py (original) +++ ../python3/epsilon/spewer.py (refactored) @@ -66,7 +66,7 @@ def formatArgs(args): - return ', '.join(['='.join((k, reflect.safe_repr(v))) for (k, v) in args.iteritems()]) + return ', '.join(['='.join((k, reflect.safe_repr(v))) for (k, v) in args.items()]) class Spewer(Tracer): @@ -85,26 +85,26 @@ else: k = '' - print ("%X %s%s%s(%s)" % ( + print(("%X %s%s%s(%s)" % ( id(threading.currentThread()), self.callDepth * ' ', k, frame.f_code.co_name, - formatArgs(extractArgs(frame)))) + formatArgs(extractArgs(frame))))) def trace_RETURN(self, frame, arg): if arg is not None: - print ("%X %s<= %s" % ( + print(("%X %s<= %s" % ( id(threading.currentThread()), self.callDepth * ' ', - reflect.safe_repr(arg),)) + reflect.safe_repr(arg),))) self.callDepth = max(0, self.callDepth - 1) def trace_EXCEPTION(self, frame, arg): - print ("%X %s^- %s" % ( + print(("%X %s^- %s" % ( id(threading.currentThread()), self.callDepth * ' ', - reflect.safe_repr(arg),)) + reflect.safe_repr(arg),))) self.callDepth = max(0, self.callDepth - 1) @@ -115,11 +115,11 @@ def startService(self): service.Service.startService(self) self.oldsigmap = {} - for sig, handler in self.sigmap.items(): + for sig, handler in list(self.sigmap.items()): self.oldsigmap[sig] = signal.signal(sig, handler) def stopService(self): - for sig, handler in self.oldsigmap.items(): + for sig, handler in list(self.oldsigmap.items()): signal.signal(sig, handler) del self.oldsigmap service.Service.stopService(self) --- ../python3/epsilon/setuphelper.py (original) +++ ../python3/epsilon/setuphelper.py (refactored) @@ -12,20 +12,20 @@ yield namedAny(moduleName) except ImportError: pass - except ValueError, ve: + except ValueError as ve: if ve.args[0] != 'Empty module name': traceback.print_exc() except: traceback.print_exc() def _regeneratePluginCache(pluginPackages): - print 'Regenerating cache with path: ', + print('Regenerating cache with path: ', end=' ') pprint.pprint(sys.path) from twisted import plugin for pluginModule in pluginModules([ p + ".plugins" for p in pluginPackages]): # Not just *some* zigs, mind you - *every* zig: - print 'Full plugin list for %r: ' % (pluginModule.__name__) + print('Full plugin list for %r: ' % (pluginModule.__name__)) pprint.pprint(list(plugin.getPlugins(plugin.IPlugin, pluginModule))) def regeneratePluginCache(dist, pluginPackages): @@ -53,7 +53,7 @@ if '.' in package: continue D = RefactoringTool: Refactored ../python3/epsilon/remember.py RefactoringTool: No changes to ../python3/epsilon/react.py RefactoringTool: No changes to ../python3/epsilon/process.py RefactoringTool: No changes to ../python3/epsilon/liner.py RefactoringTool: Refactored ../python3/epsilon/juice.py RefactoringTool: No changes to ../python3/epsilon/iepsilon.py RefactoringTool: Refactored ../python3/epsilon/hotfix.py datafiles[package] = [] - print 'Files in package %r:' % (package,) + print('Files in package %r:' % (package,)) pprint.pprint(os.listdir(package)) for (dirpath, dirnames, filenames) in os.walk(package): dirnames[:] = [p for p in dirnames if not p.startswith('.')] @@ -67,7 +67,7 @@ 'packages': packages, 'package_data': datafiles, } - print 'Automatically determined setup() args:' + print('Automatically determined setup() args:') pprint.pprint(autoresult, indent=4) assert 'packages' not in kw assert 'package_data' not in kw --- ../python3/epsilon/remember.py (original) +++ ../python3/epsilon/remember.py (refactored) @@ -26,7 +26,7 @@ Retrieve the value if already cached, otherwise, call the C{creationFunction} to create it. """ - remembername = "_remembered_" + self.creationFunction.func_name + remembername = "_remembered_" + self.creationFunction.__name__ rememberedval = oself.__dict__.get(remembername, None) if rememberedval is not None: return rememberedval --- ../python3/epsilon/juice.py (original) +++ ../python3/epsilon/juice.py (refactored) @@ -58,7 +58,7 @@ assert LENGTH not in self L = [] - for (k, v) in self.iteritems(): + for (k, v) in self.items(): if k == BODY: k = LENGTH v = str(len(self[BODY])) @@ -318,21 +318,21 @@ if self.transport is not None: self.transport.loseConnection() - _counter = 0L + _counter = 0 def _nextTag(self): self._counter += 1 return '%x' % (self._counter,) def failAllOutgoing(self, reason): - OR = self._outstandingRequests.items() + OR = list(self._outstandingRequests.items()) self._outstandingRequests = None # we can never send another request for key, value in OR: value.errback(reason) def juiceBoxReceived(self, box): if debug: - log.msg("Juice receive: %s" % pprint.pformat(dict(box.iteritems()))) + log.msg("Juice receive: %s" % pprint.pformat(dict(iter(box.items())))) if ANSWER in box: question = self._outstandingRequests.pop(box[ANSWER]) @@ -596,10 +596,10 @@ def __new__(cls, name, bases, attrs): re = attrs['reverseErrors'] = {} er = attrs['allErrors'] = {} - for v, k in attrs.get('errors',{}).iteritems(): + for v, k in attrs.get('errors',{}).items(): re[k] = v er[v] = k - for v, k in attrs.get('fatalErrors',{}).iteritems(): + for v, k in attrs.get('fatalErrors',{}).items(): re[k] = v er[v] = k return type.__new__(cls, name, bases, attrs) @@ -626,7 +626,7 @@ def __init__(self, **kw): self.structured = kw - givenArgs = [normalizeKey(k) for k in kw.keys()] + givenArgs = [normalizeKey(k) for k in list(kw.keys())] forgotten = [] for name, arg in self.arguments: if normalizeKey(name) not in givenArgs and not arg.optional: @@ -813,7 +813,7 @@ self._startingTLSBuffer.append(completeBox) else: if debug: - log.msg("Juice send: %s" % pprint.pformat(dict(completeBox.iteritems()))) + log.msg("Juice send: %s" % pprint.pformat(dict(iter(completeBox.items())))) self.transport.write(completeBox.serialize()) @@ -944,7 +944,7 @@ VERSIONS = [1] -from cStringIO import StringIO +from io import StringIO class _ParserHelper(Juice): def __init__(self): Juice.__init__(self, False) @@ -986,7 +986,7 @@ def objectsToStrings(objects, arglist, strings, proto): myObjects = {} - for (k, v) in objects.items(): + for (k, v) in list(objects.items()): myObjects[normalizeKey(k)] = v for argname, argparser in arglist: --- ../python3/epsilon/hotfix.py (original) +++ ..RefactoringTool: Refactored ../python3/epsilon/extime.py RefactoringTool: Refactored ../python3/epsilon/expose.py RefactoringTool: Refactored ../python3/epsilon/descriptor.py /python3/epsilon/hotfix.py (refactored) @@ -23,7 +23,7 @@ timeoutmixin_calllater.install() elif (packageName, fixName) == ('twisted', 'delayedcall_seconds'): from twisted.internet import base - args = inspect.getargs(base.DelayedCall.__init__.func_code)[0] + args = inspect.getargs(base.DelayedCall.__init__.__code__)[0] if 'seconds' not in args: from epsilon.hotfixes import delayedcall_seconds delayedcall_seconds.install() @@ -44,8 +44,8 @@ from twisted.test.proto_helpers import StringTransport st = StringTransport() try: - st.write(u'foo') - except TypeError, e: + st.write('foo') + except TypeError as e: pass else: from epsilon.hotfixes import proto_helpers_stringtransport --- ../python3/epsilon/extime.py (original) +++ ../python3/epsilon/extime.py (refactored) @@ -226,13 +226,13 @@ ampm = (match.group('ampm') or '').lower() if ampm: if not 1 <= hour <= 12: - raise ValueError, 'hour %i is not in 1..12' % (hour,) + raise ValueError('hour %i is not in 1..12' % (hour,)) if hour == 12 and ampm == 'am': hour = 0 elif ampm == 'pm': hour += 12 if not 0 <= hour <= 23: - raise ValueError, 'hour %i is not in 0..23' % (hour,) + raise ValueError('hour %i is not in 0..23' % (hour,)) dtnow = now.asDatetime(tzinfo).replace(second=0, microsecond=0) dtthen = dtnow.replace(hour=hour, minute=minute) @@ -336,7 +336,7 @@ return creator(klass, match, tzinfo, now) except ValueError: continue - raise ValueError, 'could not parse date: %r' % (humanStr,) + raise ValueError('could not parse date: %r' % (humanStr,)) fromHumanly = classmethod(fromHumanly) @@ -459,7 +459,7 @@ # don't forget leap years ('dayofyear', 1, 366)]: if not min <= groups[group] <= max: - raise ValueError, '%s must be in %i..%i' % (group, min, max) + raise ValueError('%s must be in %i..%i' % (group, min, max)) def determineResolution(): if match.group('fractionalsec') is not None: @@ -640,7 +640,7 @@ maybeStructTimePlus = parsedate_tz(rfc822string) if maybeStructTimePlus is None: - raise ValueError, 'could not parse RFC 2822 date %r' % (rfc822string,) + raise ValueError('could not parse RFC 2822 date %r' % (rfc822string,)) structTimePlus = sanitizeStructTime(maybeStructTimePlus) offsetInSeconds = structTimePlus[-1] if offsetInSeconds is None: @@ -964,7 +964,7 @@ def __add__(self, addend): if not isinstance(addend, datetime.timedelta): - raise TypeError, 'expected a datetime.timedelta instance' + raise TypeError('expected a datetime.timedelta instance') return Time.fromDatetime(self._time + addend) def __sub__(self, subtrahend): --- ../python3/epsilon/expose.py (original) +++ ../python3/epsilon/expose.py (refactored) @@ -131,7 +131,7 @@ T = obj.__class__ seen = {} for subT in inspect.getmro(T): - for name, value in subT.__dict__.items(): + for name, value in list(subT.__dict__.items()): for rightFunc in rightFuncs: if value is rightFunc: if name in seen: --- ../python3/epsilon/descriptor.py (original) +++ ../python3/epsilon/descriptor.py (refactored) @@ -17,7 +17,7 @@ return secretClass return secretClass() -class attribute(object): +class attribute(object, metaclass=_MetaAttribute): """ Convenience class for providing one-shot descriptors, similar to 'property'. For example: @@ -47,8 +47,6 @@ ... AttributeError: attribute cannot be removed """ - - __metaclassRefactoringTool: No changes to ../python3/epsilon/cooperator.py RefactoringTool: Refactored ../python3/epsilon/caseless.py RefactoringTool: No changes to ../python3/epsilon/asplode.py RefactoringTool: Refactored ../python3/epsilon/amprouter.py RefactoringTool: Refactored ../python3/epsilon/ampauth.py RefactoringTool: Refactored ../python3/epsilon/__init__.py RefactoringTool: No changes to ../python3/epsilon/test/utils.py RefactoringTool: No changes to ../python3/epsilon/test/test_view.py RefactoringTool: No changes to ../python3/epsilon/test/test_version.py RefactoringTool: Refactored ../python3/epsilon/test/test_unrepr.py RefactoringTool: Refactored ../python3/epsilon/test/test_structlike.py __ = _MetaAttribute def __get__(self, oself, type): """ --- ../python3/epsilon/caseless.py (original) +++ ../python3/epsilon/caseless.py (refactored) @@ -54,7 +54,7 @@ def __unicode__(self): - return unicode(self.cased) + return str(self.cased) def __len__(self): --- ../python3/epsilon/amprouter.py (original) +++ ../python3/epsilon/amprouter.py (refactored) @@ -141,7 +141,7 @@ @rtype: C{unicode} """ - return unicode(self._routeCounter.next()) + return str(next(self._routeCounter)) def bindRoute(self, receiver, routeName=_unspecified): @@ -173,7 +173,7 @@ Initialize route tracking objects. """ self._sender = sender - for routeName, route in self._unstarted.iteritems(): + for routeName, route in self._unstarted.items(): # Any route which has been bound but which does not yet have a # remote route name should not yet be started. These will be # started in Route.connectTo. @@ -196,7 +196,7 @@ """ Stop all the L{IBoxReceiver}s which have been added to this router. """ - for routeName, route in self._routes.iteritems(): + for routeName, route in self._routes.items(): route.stop(reason) self._routes = None --- ../python3/epsilon/ampauth.py (original) +++ ../python3/epsilon/ampauth.py (refactored) @@ -132,7 +132,7 @@ @return: A C{bool}, C{True} if this credentials object agrees with the given password, C{False} otherwise. """ - if isinstance(password, unicode): + if isinstance(password, str): password = password.encode('utf-8') correctResponse = _calcResponse(self.challenge, self.nonce, password) return correctResponse == self.response @@ -193,7 +193,8 @@ Actually login to our portal with the given credentials. """ d = self.portal.login(credentials, None, IBoxReceiver) - def cbLoggedIn((interface, avatar, logout)): + def cbLoggedIn(xxx_todo_changeme): + (interface, avatar, logout) = xxx_todo_changeme self.logout = logout self.boxReceiver = avatar self.boxReceiver.startReceivingBoxes(self.boxSender) --- ../python3/epsilon/__init__.py (original) +++ ../python3/epsilon/__init__.py (refactored) @@ -7,7 +7,7 @@ def asTwistedVersion(packageName, versionString): return versions.Version( - packageName, *map(int, versionString.split('+', 1)[0].split("."))) + packageName, *list(map(int, versionString.split('+', 1)[0].split(".")))) version = asTwistedVersion("epsilon", __version__) --- ../python3/epsilon/test/test_unrepr.py (original) +++ ../python3/epsilon/test/test_unrepr.py (refactored) @@ -3,5 +3,5 @@ class UnreprTestCase(unittest.TestCase): def testSimpleUnrepr(self): - data = {'x': [u'bob', (1+2j), []], 10: (1, {}, 'two'), (3, 4): 5L} - self.assertEquals(unrepr(repr(data)), data) + data = {'x': ['bob', (1+2j), []], 10: (1, {}, 'two'), (3, 4): 5} + self.assertEqual(unrepr(repr(data)), data) --- ../python3/epsilon/test/test_structlike.py (original) +++ ../python3/epsilon/test/test_structlike.py (refactored) @@ -23,29 +23,29 @@ class StructLike(unittest.TestCase): def _testme(self, TestStruct): x = TestStruct() - self.assertEquals(x.x, 1) - self.assertEquals(x.y, 2) - self.assertEquals(x.z, 3) + self.assertEqual(x.x, 1) + self.assertEqual(x.y, 2) + self.assertEqual(x.z, 3) y = TestStruct('3', '2', '1') - self.assertEquals(y.x, '3') - self.assertEquals(y.y, '2') - self.assertEquals(y.z, '1') + self.assertEqual(y.x, '3') + self.assertEqual(y.y, '2') + self.assertEqual(y.z, '1') z = TestStruct(z='z', x='x', y='y') - self.assertEquals(z.x, 'x') - self.assertEquals(z.y, 'y') - self.assertEquals(z.z, 'z') + self.assertEqual(z.x, 'x') + RefactoringTool: Refactored ../python3/epsilon/test/test_setuphelper.py self.assertEqual(z.y, 'y') + self.assertEqual(z.z, 'z') a = TestStruct('abc') - self.assertEquals(a.x, 'abc') - self.assertEquals(a.y, 2) - self.assertEquals(a.z, 3) + self.assertEqual(a.x, 'abc') + self.assertEqual(a.y, 2) + self.assertEqual(a.z, 3) b = TestStruct(y='123') - self.assertEquals(b.x, 1) - self.assertEquals(b.y, '123') - self.assertEquals(b.z, 3) + self.assertEqual(b.x, 1) + self.assertEqual(b.y, '123') + self.assertEqual(b.z, 3) def testWithPositional(self): self._testme(record('x y z', x=1, y=2, z=3)) @@ -73,7 +73,7 @@ R = record('a') r = R(1) r.foo = 2 - self.assertEquals(r.foo, 2) + self.assertEqual(r.foo, 2) def testCreateWithNoValuesAndNoDefaults(self): R = record('x') @@ -95,7 +95,7 @@ slots they contain. """ R = record('xyz abc def') - self.assertEquals(R.__name__, "Record") + self.assertEqual(R.__name__, "Record") def test_instanceStringRepresentation(self): @@ -104,7 +104,7 @@ provides information about the values contained in their slots. """ obj = MyRecord(something=1, somethingElse=2) - self.assertEquals(repr(obj), 'MyRecord(something=1, somethingElse=2)') + self.assertEqual(repr(obj), 'MyRecord(something=1, somethingElse=2)') def test_instanceStringRepresentationNesting(self): @@ -113,7 +113,7 @@ """ obj = MyRecord(something=1, somethingElse=2) objRepr = 'MyRecord(something=1, somethingElse=2)' - self.assertEquals( + self.assertEqual( repr(MyRecord(obj, obj)), 'MyRecord(something=%s, somethingElse=%s)' % (objRepr, objRepr)) @@ -125,7 +125,7 @@ """ obj = MyRecord(something=1, somethingElse=2) obj.somethingElse = obj - self.assertEquals( + self.assertEqual( repr(obj), 'MyRecord(something=1, somethingElse=MyRecord(...))') @@ -136,7 +136,7 @@ """ obj = MyRecord(something=1, somethingElse=[]) obj.somethingElse.append(obj) - self.assertEquals( + self.assertEqual( repr(obj), 'MyRecord(something=1, somethingElse=[MyRecord(...)])') @@ -182,9 +182,10 @@ return result d2 = deferToThreadPool(reactor, pool, otherRepr) - def done((thread1repr, thread2repr)): + def done(xxx_todo_changeme): + (thread1repr, thread2repr) = xxx_todo_changeme knownGood = 'MyRecord(something=1, somethingElse=sticky)' # self.assertEquals(thread1repr, thread2repr) - self.assertEquals(thread1repr, knownGood) - self.assertEquals(thread2repr, knownGood) + self.assertEqual(thread1repr, knownGood) + self.assertEqual(thread2repr, knownGood) return gatherResults([d, d2]).addCallback(done) --- ../python3/epsilon/test/test_setuphelper.py (original) +++ ../python3/epsilon/test/test_setuphelper.py (refactored) @@ -15,7 +15,7 @@ module = namedAny(modname) self.removedModules.append(module) except: - print 'COULD NOT LOAD', modname + print('COULD NOT LOAD', modname) self.sysmodules = sys.modules.copy() self.syspath = sys.path[:] @@ -33,7 +33,7 @@ def testRegeneratingIt(self): for mod in self.removedModules: - self.failIf(mod.__name__ in sys.modules, 'Started with %r loaded: %r' % (mod.__name__, sys.path)) + self.assertFalse(mod.__name__ in sys.modules, 'Started with %r loaded: %r' % (mod.__name__, sys.path)) _regeneratePluginCache(['axiom', 'xmantissa']) log.flushErrors(ImportError) # This is necessary since there are Axiom # plugins that depend on Mantissa, so when @@ -41,7 +41,7 @@ # powerups are, butRefactoringTool: Refactored ../python3/epsilon/test/test_remember.py RefactoringTool: No changes to ../python3/epsilon/test/test_react.py RefactoringTool: No changes to ../python3/epsilon/test/test_process.py RefactoringTool: Refactored ../python3/epsilon/test/test_modes.py RefactoringTool: Refactored ../python3/epsilon/test/test_juice.py Mantissa isn't some # harmless tracebacks are printed. for mod in self.removedModules: - self.failIf(mod.__name__ in sys.modules, 'Loaded %r: %r' % (mod.__name__, sys.path)) + self.assertFalse(mod.__name__ in sys.modules, 'Loaded %r: %r' % (mod.__name__, sys.path)) testRegeneratingIt.skip = """ This test really ought to be the dependency-direction test from old --- ../python3/epsilon/test/test_remember.py (original) +++ ../python3/epsilon/test/test_remember.py (refactored) @@ -65,11 +65,11 @@ The callable wrapped by C{@remembered} will only be invoked once, regardless of how many times the attribute is accessed. """ - self.assertEquals(self.rememberer.invocations, 0) + self.assertEqual(self.rememberer.invocations, 0) firstTime = self.rememberer.value1 - self.assertEquals(self.rememberer.invocations, 1) + self.assertEqual(self.rememberer.invocations, 1) secondTime = self.rememberer.value1 - self.assertEquals(self.rememberer.invocations, 1) + self.assertEqual(self.rememberer.invocations, 1) self.assertIdentical(firstTime, secondTime) @@ -78,13 +78,13 @@ If the L{@remembered} decorator is used more than once, each one will be an attribute with its own identity. """ - self.assertEquals(self.rememberer.invocations, 0) - self.assertEquals(self.rememberer.otherInvocations, 0) + self.assertEqual(self.rememberer.invocations, 0) + self.assertEqual(self.rememberer.otherInvocations, 0) firstValue1 = self.rememberer.value1 - self.assertEquals(self.rememberer.invocations, 1) - self.assertEquals(self.rememberer.otherInvocations, 0) + self.assertEqual(self.rememberer.invocations, 1) + self.assertEqual(self.rememberer.otherInvocations, 0) firstValue2 = self.rememberer.value2 - self.assertEquals(self.rememberer.otherInvocations, 1) + self.assertEqual(self.rememberer.otherInvocations, 1) self.assertNotIdentical(firstValue1, firstValue2) secondValue2 = self.rememberer.value2 self.assertIdentical(firstValue2, secondValue2) --- ../python3/epsilon/test/test_modes.py (original) +++ ../python3/epsilon/test/test_modes.py (refactored) @@ -39,21 +39,21 @@ modalFactory = ModalTestClass def testModalMethods(self): x = self.modalFactory() - self.assertEquals(x.one(), 'alpha-one') - self.assertEquals(x.two(), 'alpha-two') + self.assertEqual(x.one(), 'alpha-one') + self.assertEqual(x.two(), 'alpha-two') self.assertRaises(AttributeError, getattr, x, 'three') - self.assertEquals(x.four(), 'unmode-four') + self.assertEqual(x.four(), 'unmode-four') x.mode = 'beta' self.assertRaises(AttributeError, getattr, x, 'one') - self.assertEquals(x.two(), 'beta-two') - self.assertEquals(x.three(), 'beta-three') - self.assertEquals(x.four(), 'unmode-four') + self.assertEqual(x.two(), 'beta-two') + self.assertEqual(x.three(), 'beta-three') + self.assertEqual(x.four(), 'unmode-four') def testInternalModeChange(self): x = self.modalFactory() x.mode = 'gamma' - self.assertEquals(x.change(), 'delta-change') + self.assertEqual(x.change(), 'delta-change') class MostBasicInheritanceTestCase(ModalityTestCase): --- ../python3/epsilon/test/test_juice.py (original) +++ ../python3/epsilon/test/test_juice.py (refactored) @@ -163,10 +163,10 @@ asserts = {'hello': HELLO, '-answer': ASKTOK} hdrs = [j.split(': ') for j in c.buf.split('\r\n')[:-2]] - self.assertEquals(len(asserts), len(hdrs)) + self.assertEqual(len(asserts), len(hdrs)) for hdr in hdrs: k, v = hdr - self.assertEquals(v, asserts[k.lower()]) + self.assertEqual(v, asserts[k.lower()]) def testParsingRoundTrip(self): c, s, p =RefactoringTool: Refactored ../python3/epsilon/test/test_extime.py connectedServerAndClient(ClientClass=lambda: LiteralJuice(False), @@ -197,7 +197,7 @@ jb.update(dict(test)) jb.sendTo(c) p.flush() - self.assertEquals(s.boxes[-1], jb) + self.assertEqual(s.boxes[-1], jb) SWITCH_CLIENT_DATA = 'Success!' SWITCH_SERVER_DATA = 'No, really. Success.' @@ -209,7 +209,7 @@ HELLO = 'world' c.sendHello(HELLO).addCallback(L.append) p.flush() - self.assertEquals(L[0]['hello'], HELLO) + self.assertEqual(L[0]['hello'], HELLO) def testHelloWorldCommand(self): c, s, p = connectedServerAndClient( @@ -219,7 +219,7 @@ HELLO = 'world' c.sendHello(HELLO).addCallback(L.append) p.flush() - self.assertEquals(L[0]['hello'], HELLO) + self.assertEqual(L[0]['hello'], HELLO) def testHelloErrorHandling(self): L=[] @@ -229,7 +229,7 @@ c.sendHello(HELLO).addErrback(L.append) p.flush() L[0].trap(UnfriendlyGreeting) - self.assertEquals(str(L[0].value), "Don't be a dick.") + self.assertEqual(str(L[0].value), "Don't be a dick.") def testJuiceListCommand(self): c, s, p = connectedServerAndClient(ServerClass=lambda: SimpleSymmetricCommandProtocol(True), @@ -238,7 +238,7 @@ GetList(length=10).do(c).addCallback(L.append) p.flush() values = L.pop().get('body') - self.assertEquals(values, [{'x': 1}] * 10) + self.assertEqual(values, [{'x': 1}] * 10) def testFailEarlyOnArgSending(self): okayCommand = Hello(Hello="What?") @@ -250,9 +250,9 @@ negotiatedVersion = [] s.renegotiateVersion(1).addCallback(negotiatedVersion.append) p.flush() - self.assertEquals(negotiatedVersion[0], 1) - self.assertEquals(c.protocolVersion, 1) - self.assertEquals(s.protocolVersion, 1) + self.assertEqual(negotiatedVersion[0], 1) + self.assertEqual(c.protocolVersion, 1) + self.assertEqual(s.protocolVersion, 1) def testProtocolSwitch(self, switcher=SimpleSymmetricCommandProtocol): self.testSucceeded = False @@ -266,11 +266,12 @@ switchDeferred = c.switchToTestProtocol() - def cbConnsLost(((serverSuccess, serverData), (clientSuccess, clientData))): - self.failUnless(serverSuccess) - self.failUnless(clientSuccess) - self.assertEquals(''.join(serverData), SWITCH_CLIENT_DATA) - self.assertEquals(''.join(clientData), SWITCH_SERVER_DATA) + def cbConnsLost(xxx_todo_changeme): + ((serverSuccess, serverData), (clientSuccess, clientData)) = xxx_todo_changeme + self.assertTrue(serverSuccess) + self.assertTrue(clientSuccess) + self.assertEqual(''.join(serverData), SWITCH_CLIENT_DATA) + self.assertEqual(''.join(clientData), SWITCH_SERVER_DATA) self.testSucceeded = True def cbSwitch(proto): @@ -281,7 +282,7 @@ if serverProto.maybeLater is not None: serverProto.maybeLater.callback(serverProto.maybeLaterProto) p.flush() - self.failUnless(self.testSucceeded) + self.assertTrue(self.testSucceeded) def testProtocolSwitchDeferred(self): return self.testProtocolSwitch(switcher=DeferredSymmetricCommandProtocol) --- ../python3/epsilon/test/test_extime.py (original) +++ ../python3/epsilon/test/test_extime.py (refactored) @@ -46,7 +46,7 @@ """ Check timeInstance against self.reference. """ - self.assertEquals(timeInstance._time, reference or self.reference) + self.assertEqual(timeInstance._time, reference or self.reference) def _createReference(self, reference=None): """ @@ -61,21 +61,21 @@ try: import pytz except ImportError: - raise unittest.SkipTest, 'pytz could not be imported' + raise unittest.SkipTest('pytz could not be imported') tz = pytz.timezone('America/Detroit') time = extime.Time.fromRFC2822('Wed, 06 Apr 2005 23:12:27 -0400') dtime = time.asDatetime(tz) - self.assertEquals(dtime.hour, 23) - self.assertEquals(dtime.minute, 12) + self.assertEqual(dtime.hour, 23) + self.assertEqual(dtime.minute, 12) def test_cmp(self): now = time.gmtime() - self.assertEquals(extime.Time.fromStructTime(now), extime.Time.fromStructTime(now)) + self.assertEqual(extime.Time.fromStructTime(now), extime.Time.fromStructTime(now)) self.assertNotEqual( extime.Time.fromStructTime(now), extime.Time.fromStructTime(now) + datetime.timedelta(seconds=42)) - self.assertNotEquals(extime.Time.fromStructTime(now), 13) + self.assertNotEqual(extime.Time.fromStructTime(now), 13) aTime = extime.Time.fromStructTime(now) for op in 'lt', 'le', 'gt', 'ge': @@ -86,17 +86,17 @@ diff = datetime.datetime.utcnow() - extime.Time()._time if diff < datetime.timedelta(): diff = -diff - self.failUnless(diff.days == 0 and diff.seconds <= 5, 'Time created now is %r away from now' % (diff,)) + self.assertTrue(diff.days == 0 and diff.seconds <= 5, 'Time created now is %r away from now' % (diff,)) def test_insignificantTimezones(self): """ Timezones should be insignificant when the resolution is >= 1 day """ def testEqual(creator, input): - self.assertEquals(creator(input), creator(input, tzinfo=self.MST())) + self.assertEqual(creator(input), creator(input, tzinfo=self.MST())) def testNotEqual(creator, input): - self.assertNotEquals(creator(input), creator(input, tzinfo=self.MST())) + self.assertNotEqual(creator(input), creator(input, tzinfo=self.MST())) testEqual(extime.Time.fromHumanly, 'sunday') testEqual(extime.Time.fromISO8601TimeAndDate, '2005') @@ -114,7 +114,7 @@ tzinfo, self._createReference()) - self.assertEquals( + self.assertEqual( time.asISO8601TimeAndDate(), expected) @@ -125,15 +125,15 @@ def testDay(input, expected, tzinfo=None): time = test(input, expected, tzinfo) - self.assert_(time.isAllDay()) + self.assertTrue(time.isAllDay()) def testMinute(input, expected, tzinfo=None): time = test(input, expected, tzinfo) - self.assertEquals(time.resolution, datetime.timedelta(minutes=1)) + self.assertEqual(time.resolution, datetime.timedelta(minutes=1)) def testMicrosecond(input, expected, tzinfo=None): time = test(input, expected, tzinfo) - self.assertEquals(time.resolution, datetime.timedelta(microseconds=1)) + self.assertEqual(time.resolution, datetime.timedelta(microseconds=1)) # 'now' is Monday, 2004-12-06 14:15:16 UTC testDay('yesterday', '2004-12-05') @@ -187,30 +187,30 @@ try: extime.Time.fromISO8601TimeAndDate('2004-366') except ValueError: - raise unittest.FailTest, 'leap years should have 366 days' + raise unittest.FailTest('leap years should have 366 days') try: extime.Time.fromISO8601TimeAndDate('2004-123T14-0600') extime.Time.fromISO8601TimeAndDate('2004-123T14:13-0600') extime.Time.fromISO8601TimeAndDate('2004-123T14:13:51-0600') except ValueError: - raise unittest.FailTest, 'timezone should be allowed if time with *any* resolution is specified' - - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2005').resolution, datetime.timedelta(days=365) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004').resolution, datetime.timedelta(days=366) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-02').resolution, datetime.timedelta(days=29) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-02-29').resolution, datetime.timedelta(days=1) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-02-29T13').resolution, datetime.timedelta(hours=1) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-02-29T13:10').resolution, datetime.timedelta(minutes=1) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-02-29T13:10:05').resolution, datetime.timedelta(seconds=1) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-02-29T13:10:05.010').resolution, datetime.timedelta(microseconds=1000) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-02-29T13:10:05.010000').resolution, datetime.timedelta(microseconds=1) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-02-29T13:10:05.010000123').resolution, datetime.timedelta(microseconds=1) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-W11').resolution, datetime.timedelta(days=7) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-W11-3').resolution, datetime.timedelta(days=1) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-W11-3T14:16:21').resolution, datetime.timedelta(seconds=1) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-123').resolution, datetime.timedelta(days=1) ) - self.assertEquals( extime.Time.fromISO8601TimeAndDate('2004-123T14:16:21').resolution, datetime.timedelta(seconds=1) ) + raise unittest.FailTest('timezone should be allowed if time with *any* resolution is specified') + + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2005').resolution, datetime.timedelta(days=365) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004').resolution, datetime.timedelta(days=366) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-02').resolution, datetime.timedelta(days=29) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-02-29').resolution, datetime.timedelta(days=1) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-02-29T13').resolution, datetime.timedelta(hours=1) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-02-29T13:10').resolution, datetime.timedelta(minutes=1) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-02-29T13:10:05').resolution, datetime.timedelta(seconds=1) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-02-29T13:10:05.010').resolution, datetime.timedelta(microseconds=1000) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-02-29T13:10:05.010000').resolution, datetime.timedelta(microseconds=1) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-02-29T13:10:05.010000123').resolution, datetime.timedelta(microseconds=1) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-W11').resolution, datetime.timedelta(days=7) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-W11-3').resolution, datetime.timedelta(days=1) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-W11-3T14:16:21').resolution, datetime.timedelta(seconds=1) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-123').resolution, datetime.timedelta(days=1) ) + self.assertEqual( extime.Time.fromISO8601TimeAndDate('2004-123T14:16:21').resolution, datetime.timedelta(seconds=1) ) def test_fromStructTime(self): self._checkReference( extime.Time.fromStructTime((2004, 12, 6, 14, 15, 16, 0, 0, 0)) ) @@ -262,12 +262,12 @@ In other words, make sure that we don't round trip through a platform time_t, because those will overflow on 32-bit platforms in 2038. """ - self.assertEquals( + self.assertEqual( extime.Time.fromRFC2822( 'Fri, 19 Jan 2038 03:14:08 -0000' ).asPOSIXTimestamp(), (2**31)) - self.assertEquals( + self.assertEqual( extime.Time.fromRFC2822( 'Fri, 13 Dec 1901 20:45:52 -0000' ).asPOSIXTimestamp(), @@ -281,12 +281,12 @@ In other words, make sure that we don't round trip through a platform time_t, because those will overflow on 32-bit platforms in 2038. """ - self.assertEquals( + self.assertEqual( extime.Time.fromPOSIXTimestamp( 2**31 ).asPOSIXTimestamp(), (2**31)) - self.assertEquals( + self.assertEqual( extime.Time.fromPOSIXTimestamp( -(2**31)-1 ).asPOSIXTimestamp(), @@ -301,64 +301,64 @@ timezones, nor does it handle obsoleted comments in the header''' def test_asPOSIXTimestamp(self): - self.assertEquals( self._createReference().asPOSIXTimestamp(), 1102342516 ) + self.assertEqual( self._createReference().asPOSIXTimestamp(), 1102342516 ) def test_asRFC1123(self): - self.assertEquals( + self.assertEqual( self._createReference().asRFC1123(), 'Mon, 06 Dec 2004 14:15:16 GMT' ) def test_asRFC2822(self): - self.assertEquals( self._createReference().asRFC2822(), 'Mon, 6 Dec 2004 14:15:16 -0000' ) - self.assertEquals( self._createReference().asRFC2822(self.MST()), 'Mon, 6 Dec 2004 07:15:16 -0700' ) - self.assertEquals( self._createReference().asRFC2822(self.CET()), 'Mon, 6 Dec 2004 15:15:16 +0100' ) + self.assertEqual( self._createReference().asRFC2822(), 'Mon, 6 Dec 2004 14:15:16 -0000' ) + self.assertEqual( self._createReference().asRFC2822(self.MST()), 'Mon, 6 Dec 2004 07:15:16 -0700' ) + self.assertEqual( self._createReference().asRFC2822(self.CET()), 'Mon, 6 Dec 2004 15:15:16 +0100' ) def test_asISO8601TimeAndDate(self): - self.assertEquals( + self.assertEqual( self._createReference().asISO8601TimeAndDate(), '2004-12-06T14:15:16+00:00' ) - self.assertEquals( + self.assertEqual( self._createReference(reference=datetime.datetime(2004, 12, 6, 14, 15, 16, 43210)).asISO8601TimeAndDate(), '2004-12-06T14:15:16.04321+00:00' ) - self.assertEquals( + self.assertEqual( self._createReference().asISO8601TimeAndDate(tzinfo=self.MST()), '2004-12-06T07:15:16-07:00' ) - self.assertEquals( + self.assertEqual( self._createReference().asISO8601TimeAndDate(tzinfo=self.CET()), '2004-12-06T15:15:16+01:00' ) - self.assertEquals( + self.assertEqual( self._createReference().asISO8601TimeAndDate(includeTimezone=False), '2004-12-06T14:15:16' ) - self.assertEquals( + self.assertEqual( self._createReference(reference=datetime.datetime(2004, 12, 6, 14, 15, 16, 43210)).asISO8601TimeAndDate(includeTimezone=False), '2004-12-06T14:15:16.04321' ) - self.assertEquals( + self.assertEqual( self._createReference().asISO8601TimeAndDate(tzinfo=self.MST(), includeTimezone=False), '2004-12-06T07:15:16' ) - self.assertEquals( + self.assertEqual( self._createReference().asISO8601TimeAndDate(tzinfo=self.CET(), includeTimezone=False), '2004-12-06T15:15:16' ) def test_asStructTime(self): - self.assertEquals( self._createReference().asStructTime(), (2004, 12, 06, 14, 15, 16, 0, 341, 0) ) - self.assertEquals( self._createReference().asStructTime(tzinfo=self.MST()), (2004, 12, 06, 7, 15, 16, 0, 341, 0) ) - self.assertEquals( self._createReference().asStructTime(tzinfo=self.CET()), (2004, 12, 06, 15, 15, 16, 0, 341, 0) ) + self.assertEqual( self._createReference().asStructTime(), (2004, 12, 0o6, 14, 15, 16, 0, 341, 0) ) + self.assertEqual( self._createReference().asStructTime(tzinfo=self.MST()), (2004, 12, 0o6, 7, 15, 16, 0, 341, 0) ) + self.assertEqual( self._createReference().asStructTime(tzinfo=self.CET()), (2004, 12, 0o6, 15, 15, 16, 0, 341, 0) ) def test_asNaiveDatetime(self): def ref(tzinfo): return self.awareReference.astimezone(tzinfo).replace(tzinfo=None) - self.assertEquals( self._createReference().asNaiveDatetime(), self.reference ) - self.assertEquals( self._createReference().asNaiveDatetime(tzinfo=self.MST()), ref(self.MST())) - self.assertEquals( self._createReference().asNaiveDatetime(tzinfo=self.CET()), ref(self.CET())) + self.assertEqual( self._createReference().asNaiveDatetime(), self.reference ) + self.assertEqual( self._createReference().asNaiveDatetime(tzinfo=self.MST()), ref(self.MST())) + self.assertEqual( self._createReference().asNaiveDatetime(tzinfo=self.CET()), ref(self.CET())) def test_asDatetime(self): - self.assertEquals( self._createReference().asDatetime(), self.awareReference ) - self.assertEquals( self._createReference().asDatetime(tzinfo=self.MST()), self.awareReference ) - self.assertEquals( self._createReference().asDatetime(tzinfo=self.CET()), self.awareReference ) + self.assertEqual( self._createReference().asDatetime(), self.awareReference ) + self.assertEqual( self._createReference().asDatetime(tzinfo=self.MST()), self.awareReference ) + self.assertEqual( self._createReference().asDatetime(tzinfo=self.CET()), self.awareReference ) def test_asHumanlySameDay(self): """ @@ -367,18 +367,18 @@ the time of day, when formatting times in the same day as now. """ sameDay = extime.Time.fromStructTime((2004, 12, 6, 14, 15, 16, 0, 0, 0)) - self.assertEquals( + self.assertEqual( self._createReference().asHumanly(now=sameDay), '02:15 pm' ) - self.assertEquals( + self.assertEqual( self._createReference().asHumanly(tzinfo=self.MST(), now=sameDay), '07:15 am' ) - self.assertEquals( + self.assertEqual( self._createReference().asHumanly(tzinfo=self.CET(), now=sameDay), '03:15 pm' ) allDay = extime.Time.fromISO8601TimeAndDate('2005-123') - self.assertEquals(allDay.asHumanly(now=allDay), 'all day') + self.assertEqual(allDay.asHumanly(now=allDay), 'all day') def test_asHumanlyDifferentDay(self): @@ -387,19 +387,19 @@ times in a different day (but the same year) as now. """ nextDay = extime.Time.fromStructTime((2004, 12, 7, 14, 15, 16, 0, 0, 0)) - self.assertEquals( + self.assertEqual( self._createReference().asHumanly(now=nextDay), '6 Dec, 02:15 pm' ) - self.assertEquals( + self.assertEqual( self._createReference().asHumanly(tzinfo=self.MST(), now=nextDay), '6 Dec, 07:15 am' ) - self.assertEquals( + self.assertEqual( self._createReference().asHumanly(tzinfo=self.CET(), now=nextDay), '6 Dec, 03:15 pm' ) allDay = extime.Time.fromISO8601TimeAndDate('2005-123') allDayNextDay = extime.Time.fromISO8601TimeAndDate('2005-124') - self.assertEquals(allDay.asHumanly(now=allDayNextDay), '3 May') + self.assertEqual(allDay.asHumanly(now=allDayNextDay), '3 May') def test_asHumanlyDifferentYear(self): @@ -408,19 +408,19 @@ different year than now. """ nextYear = extime.Time.fromStructTime((2005, 12, 6, 14, 15, 16, 0, 0, 0)) - self.assertEquals( + self.assertEqual( self._createReference().asHumanly(now=nextYear), '6 Dec 2004, 02:15 pm' ) - self.assertEquals( + self.assertEqual( self._createReference().asHumanly(tzinfo=self.MST(), now=nextYear), '6 Dec 2004, 07:15 am' ) - self.assertEquals( + self.assertEqual( self._createReference().asHumanly(tzinfo=self.CET(), now=nextYear), '6 Dec 2004, 03:15 pm' ) allDay = extime.Time.fromISO8601TimeAndDate('2005-123') allDayNextYear = extime.Time.fromISO86RefactoringTool: Refactored ../python3/epsilon/test/test_descriptor.py RefactoringTool: Refactored ../python3/epsilon/test/test_caseless.py 01TimeAndDate('2006-123') - self.assertEquals(allDay.asHumanly(now=allDayNextYear), '3 May 2005') + self.assertEqual(allDay.asHumanly(now=allDayNextYear), '3 May 2005') def test_asHumanlyValidPrecision(self): @@ -432,13 +432,13 @@ """ sameDay = extime.Time.fromStructTime((2004, 12, 6, 14, 15, 16, 0, 0, 0)) nextDay = extime.Time.fromStructTime((2004, 12, 7, 14, 15, 16, 0, 0, 0)) - self.assertEquals(self._createReference().asHumanly(now=sameDay), + self.assertEqual(self._createReference().asHumanly(now=sameDay), '02:15 pm' ) - self.assertEquals(self._createReference().asHumanly(now=sameDay, + self.assertEqual(self._createReference().asHumanly(now=sameDay, precision=extime.Time.Precision.SECONDS), '02:15:16 pm' ) - self.assertEquals(self._createReference().asHumanly(now=nextDay), + self.assertEqual(self._createReference().asHumanly(now=nextDay), '6 Dec, 02:15 pm' ) - self.assertEquals(self._createReference().asHumanly(now=nextDay, + self.assertEqual(self._createReference().asHumanly(now=nextDay, precision=extime.Time.Precision.SECONDS), '6 Dec, 02:15:16 pm' ) @@ -462,13 +462,13 @@ 'ISO8601TimeAndDate']: parse = getattr(extime.Time, 'from'+style) format = getattr(extime.Time, 'as'+style) - self.assertEquals( self._createReference(), parse(format(self._createReference())), '%s() is not the inverse of %s()' % (style, style)) + self.assertEqual( self._createReference(), parse(format(self._createReference())), '%s() is not the inverse of %s()' % (style, style)) def test_evalRepr(self): evalns = {'datetime': datetime, 'extime': extime} now = extime.Time() - self.assertEquals( now, eval(repr(now), evalns, evalns) ) + self.assertEqual( now, eval(repr(now), evalns, evalns) ) def test_containment(self): makeTime = extime.Time.fromISO8601TimeAndDate @@ -498,10 +498,10 @@ def test_oneDay(self): day = self._createReference().oneDay() - self.assertEquals(day._time, datetime.datetime(2004, 12, 6, 0, 0, 0)) - self.assertEquals(day.resolution, datetime.timedelta(days=1)) + self.assertEqual(day._time, datetime.datetime(2004, 12, 6, 0, 0, 0)) + self.assertEqual(day.resolution, datetime.timedelta(days=1)) def test_isAllDay(self): - self.failIf(self._createReference().isAllDay()) - self.failUnless(extime.Time.fromISO8601TimeAndDate('2005-123').isAllDay()) - + self.assertFalse(self._createReference().isAllDay()) + self.assertTrue(extime.Time.fromISO8601TimeAndDate('2005-123').isAllDay()) + --- ../python3/epsilon/test/test_descriptor.py (original) +++ ../python3/epsilon/test/test_descriptor.py (refactored) @@ -26,17 +26,17 @@ class DescriptorTest(unittest.TestCase): def testCase1(self): t = Test1() - self.assertEquals(t.a, 1) + self.assertEqual(t.a, 1) t.a = 2 - self.assertEquals(t.a, 1) + self.assertEqual(t.a, 1) del t.a - self.assertEquals(t.a, 1) + self.assertEqual(t.a, 1) def testCase2(self): t = Test2() - self.assertEquals(Test2.a.__doc__, 'stuff') - self.assertEquals(t.a, 10) + self.assertEqual(Test2.a.__doc__, 'stuff') + self.assertEqual(t.a, 10) self.assertRaises(AttributeError, setattr, t, 'a', 1) self.assertRaises(AttributeError, delattr, t, 'a') --- ../python3/epsilon/test/test_caseless.py (original) +++ ../python3/epsilon/test/test_caseless.py (refactored) @@ -25,7 +25,7 @@ """ Generate a variety of C{str} and C{unicode} test samples. """ - for t in [str, unicode]: + for t in [str, str]: yield t() for s in self._casings('foo'): yield t(s) @@ -52,7 +52,7 @@ L{Caseless} should implement L{repr}. """ for s in self._strings(): - self.assertEquals(repr(Caseless(s)), 'Caseless(%r)' % s) + self.assertEqual(repr(Caseless(s)), 'Caseless(%r)' % s) def test_str(self): @@ -60,7 +60,7 @@ L{Caseless} should delegate L{str}. """ for s in self._strings(): - self.assertEquals(str(Caseless(s)), str(s)) + self.assertEqual(str(Caseless(s)), str(s)) def test_unicode(self): @@ -68,7 +68,7 @@ L{Caseless} should delegate L{unicode}. """ for s in self._strings(): - self.assertEquals(unicode(Caseless(s)), unicode(s)) + self.assertEqual(str(Caseless(s)), str(s)) def test_len(self): @@ -76,7 +76,7 @@ L{Caseless} should delegate L{len}. """ for s in self._strings(): - self.assertEquals(len(Caseless(s)), len(s)) + self.assertEqual(len(Caseless(s)), len(s)) def test_getitem(self): @@ -84,11 +84,11 @@ L{Caseless} should delegate indexing/slicing. """ for s in self._strings(): - for i in xrange(len(s)): - self.assertEquals(Caseless(s)[i], s[i]) - self.assertEquals(Caseless(s)[:i], s[:i]) - self.assertEquals(Caseless(s)[i:], s[i:]) - self.assertEquals(Caseless(s)[::-1], s[::-1]) + for i in range(len(s)): + self.assertEqual(Caseless(s)[i], s[i]) + self.assertEqual(Caseless(s)[:i], s[:i]) + self.assertEqual(Caseless(s)[i:], s[i:]) + self.assertEqual(Caseless(s)[::-1], s[::-1]) def test_iter(self): @@ -96,7 +96,7 @@ L{Caseless} should delegate L{iter}. """ for s in self._strings(): - self.assertEquals(list(iter(Caseless(s))), list(iter(s))) + self.assertEqual(list(iter(Caseless(s))), list(iter(s))) def test_lower(self): @@ -104,7 +104,7 @@ L{Caseless} should delegate C{lower}. """ for s in self._strings(): - self.assertEquals(Caseless(s).lower(), s.lower()) + self.assertEqual(Caseless(s).lower(), s.lower()) def test_upper(self): @@ -112,7 +112,7 @@ L{Caseless} should delegate C{upper}. """ for s in self._strings(): - self.assertEquals(Caseless(s).upper(), s.upper()) + self.assertEqual(Caseless(s).upper(), s.upper()) def test_title(self): @@ -120,7 +120,7 @@ L{Caseless} should delegate C{title}. """ for s in self._strings(): - self.assertEquals(Caseless(s).title(), s.title()) + self.assertEqual(Caseless(s).title(), s.title()) def test_swapcase(self): @@ -128,34 +128,34 @@ L{Caseless} should delegate C{swapcase}. """ for s in self._strings(): - self.assertEquals(Caseless(s).swapcase(), s.swapcase()) + self.assertEqual(Caseless(s).swapcase(), s.swapcase()) def test_comparison(self): """ L{Caseless} should implement comparison and hashing case-insensitively. """ - for a in map(Caseless, self._casings(u'abc')): - for b in map(Caseless, self._casings(u'abc')): - self.assertEquals(a, b) - self.assertEquals(hash(a), hash(b)) - self.assertEquals(cmp(a, b), 0) - for a in map(Caseless, self._casings(u'abc')): - for b in map(Caseless, self._casings(u'abd')): - self.assertNotEquals(a, b) - self.assertNotEquals(hash(a), hash(b)) - self.assertEquals(cmp(a, b), -1) + for a in map(Caseless, self._casings('abc')): + for b in map(Caseless, self._casings('abc')): + self.assertEqual(a, b) + self.assertEqual(hash(a), hash(b)) + self.assertEqual(cmp(a, b), 0) + for a in map(Caseless, self._casings('abc')): + for b in map(Caseless, self._casings('abd')): + self.assertNotEqual(a, b) + self.assertNotEqual(hash(a), hash(b)) + self.assertEqual(cmp(a, b), -1) def test_contains(self): """ L{Caseless} should search for substrings case-insensitively. """ - for a in map(Caseless, self._casings(u'abc')): - for b in map(Caseless, self._casings(u'{{{abc}}}')): + for a in map(Caseless, self._casings('abc')): + for b in map(Caseless, self._casings('{{{abc}}}')): self.assertIn(a, b) - for a in map(Caseless, self._casings(u'abc')): - for b in map(Caseless, self._casings(u'{{{abd}}}')): + for a in map(Caseless, self._casings('abc')): + for b in map(Caseless, self._casings('{{{abd}}}')): self.assertNotIn(a, b) @@ -163,14 +163,14 @@ """ L{Caseless} should implement C{startswith} case-insensitively. """ - for a in map(Caseless, self._casings(u'abcbabcba')): - for b in self._casings(u'abc'): + for a in map(Caseless, self._casings('abcbabcba')): + for b in self._casings('abc'): self.assertTrue(a.startswith(b)) self.assertTrue(a.startswith(b, 4)) self.assertFalse(a.startswith(b, 2)) self.assertFalse(a.startswith(b, 4, 6)) - for a in map(Caseless, self._casings(u'abcbabcba')): - for b in self._casings(u'cba'): + for a in map(Caseless, self._casings('abcbabcba')): + for b in self._casings('cba'): self.assertFalse(a.startswith(b)) self.assertFalse(a.startswith(b, 4)) self.assertTrue(a.startswith(b, 2)) @@ -181,14 +181,14 @@ """ L{Caseless} should implement C{endswith} case-insensitively. """ - for a in map(Caseless, self._casings(u'abcbabcba')): - for b in self._casings(u'cba'): + for a in map(Caseless, self._casings('abcbabcba')): + for b in self._casings('cba'): self.assertTrue(a.endswith(b)) self.assertTrue(a.endswith(b, 0, 5)) self.assertFalse(a.endswith(b, 0, 3)) self.assertFalse(a.endswith(b, 7)) - for a in map(Caseless, self._casings(u'abcbabcba')): - for b in self._casings(u'abc'): + for a in map(Caseless, self._casings('abcbabcba')): + for b in self._casings('abc'): self.assertFalse(a.endswith(b)) self.assertFalse(a.endswith(b, 0, 5)) self.assertTrue(a.endswith(b, 0, 3)) @@ -199,36 +199,36 @@ """ L{test_startswith} with tuple arguments. """ - for a in map(Caseless, self._casings(u'abcbabcba')): - for b in self._casings(u'abc'): - self.assertTrue(a.startswith((u'foo', b, u'bar'))) - self.assertTrue(a.startswith((u'foo', b, u'bar'), 4)) - self.assertFalse(a.startswith((u'foo', b, u'bar'), 2)) - self.assertFalse(a.startswith((u'foo', b, u'bar'), 4, 6)) - for a in map(Caseless, self._casings(u'abcbabcba')): - for b in self._casings(u'cba'): - self.assertFalse(a.startswith((u'foo', b, u'bar'))) - self.assertFalse(a.startswith((u'foo', b, u'bar'), 4)) - self.assertTrue(a.startswith((u'foo', b, u'bar'), 2)) - self.assertFalse(a.startswith((u'foo', b, u'bar'), 4, 6)) + for a in map(Caseless, self._casings('abcbabcba')): + for b in self._casings('abc'): + self.assertTrue(a.startswith(('foo', b, 'bar'))) + self.assertTrue(a.startswith(('foo', b, 'bar'), 4)) + self.assertFalse(a.startswith(('foo', b, 'bar'), 2)) + self.assertFalse(a.startswith(('foo', b, 'bar'), 4, 6)) + for a in map(Caseless, self._casings('abcbabcba')): + for b in self._casings('cba'): + self.assertFalse(a.startswith(('foo', b, 'bar'))) + self.assertFalse(a.startswith(('foo', b, 'bar'), 4)) + self.assertTrue(a.startswith(('foo', b, 'bar'), 2)) + self.assertFalse(a.startswith(('foo', b, 'bar'), 4, 6)) def test_endswithTuple(self): """ L{test_endswith} with tuple arguments. """ - for a in map(Caseless, self._casings(u'abcbabcba')): - for b in self._casings(u'cba'): - self.assertTrue(a.endswith((u'foo', b, u'bar'))) - self.assertTrue(a.endswith((u'foo', b, u'bar'), 0, 5)) - self.assertFalse(a.endswith((u'foo', b, u'bar'), 0, 3)) - self.assertFalse(a.endswith((u'foo', b, u'bar'), 7)) - for a in map(Caseless, self._casings(u'abcbabcba')): - for b in self._casings(u'abc'): - self.assertFalse(a.endswith((u'foo', b, u'bar'))) - self.assertFalse(a.endswith((u'foo', b, u'bar'), 0, 5)) - self.assertTrue(a.endswith((u'foo', b, u'bar'), 0, 3)) - self.assertFalse(a.endswith((u'foo', b, u'bar'), 7)) + for a in map(Caseless, self._casings('abcbabcba')): + for b in self._casings('cba'): + self.assertTrue(a.endswith(('foo', b, 'bar'))) + self.assertTrue(a.endswith(('foo', b, 'bar'), 0, 5)) + self.assertFalse(a.endswith(('foo', b, 'bar'), 0, 3)) + self.assertFalse(a.endswith(('foo', b, 'bar'), 7)) + for a in map(Caseless, self._casings('abcbabcba')): + for b in self._casings('abc'): + self.assertFalse(a.endswith(('foo', b, 'bar'))) + self.assertFalse(a.endswith(('foo', b, 'bar'), 0, 5)) + self.assertTrue(a.endswith(('foo', b, 'bar'), 0, 3)) + self.assertFalse(a.endswith(('foo', b, 'bar'), 7)) if sys.version_info < (2, 5): test_startswithTuple.skip = test_endswithTuple.skip = ( @@ -239,13 +239,13 @@ """ L{Caseless} should implement C{count} case-insensitively. """ - for a in map(Caseless, self._casings(u'abcbabcba')): - self.assertEquals(a.count(u'foo'), 0) - for b in self._casings(u'cba'): - self.assertEquals(a.count(b), 2) - self.assertEquals(a.count(b, 2), 2) - self.assertEquals(a.count(b, 3), 1) - self.assertEquals(a.count(b, 0, 4), 0) + for a in map(Caseless, self._casings('abcbabcba')): + self.assertEqual(a.count('foo'), 0) + for b in self._casings('cba'): + self.assertEqual(a.count(b), 2) + self.assertEqual(a.count(b, 2), 2) + self.assertEqual(a.count(b, 3), 1) + self.assertEqual(a.count(b, 0, 4), 0) def test_findindex(self): @@ -253,16 +253,16 @@ L{Caseless} should implement C{find}/C{index} case-insensitively. """ def assertFound(a, b, result, rest=()): - self.assertEquals(a.find(b, *rest), result) - self.assertEquals(a.index(b, *rest), result) + self.assertEqual(a.find(b, *rest), result) + self.assertEqual(a.index(b, *rest), result) def assertNotFound(a, b, rest=()): - self.assertEquals(a.find(b, *rest), -1) + self.assertEqual(a.find(b, *rest), -1) err = self.assertRaises(ValueError, lambda: a.index(b, *rest)) self.assertSubstring('substring not found', str(err)) - for a in map(Caseless, self._casings(u'abcbabcba')): - assertNotFound(a, u'foo') - for b in self._casings(u'abc'): + for a in map(Caseless, self._casings('abcbabcba')): + assertNotFound(a, 'foo') + for b in self._casings('abc'): assertFound(a, b, result=0) assertFound(a, b, rest=(1,), result=4) assertNotFound(a, b, rest=(1, 6)) @@ -273,16 +273,16 @@ L{Caseless} should implement C{rfind}/C{rindex} case-insensitively. """ def assertFound(a, b, result, rest=()): - RefactoringTool: Refactored ../python3/epsilon/test/test_benchmark.py self.assertEquals(a.rfind(b, *rest), result) - self.assertEquals(a.rindex(b, *rest), result) + self.assertEqual(a.rfind(b, *rest), result) + self.assertEqual(a.rindex(b, *rest), result) def assertNotFound(a, b, rest=()): - self.assertEquals(a.rfind(b, *rest), -1) + self.assertEqual(a.rfind(b, *rest), -1) err = self.assertRaises(ValueError, lambda: a.rindex(b, *rest)) self.assertSubstring('substring not found', str(err)) - for a in map(Caseless, self._casings(u'abcbabcba')): - assertNotFound(a, u'foo') - for b in self._casings(u'cba'): + for a in map(Caseless, self._casings('abcbabcba')): + assertNotFound(a, 'foo') + for b in self._casings('cba'): assertFound(a, b, result=6) assertFound(a, b, rest=(0, 8), result=2) assertNotFound(a, b, rest=(7,)) --- ../python3/epsilon/test/test_benchmark.py (original) +++ ../python3/epsilon/test/test_benchmark.py (refactored) @@ -3,7 +3,7 @@ hotfix.require('twisted', 'delayedcall_seconds') hotfix.require('twisted', 'timeoutmixin_calllater') -import os, StringIO +import os, io from twisted.trial import unittest from twisted.internet import error, base @@ -36,18 +36,18 @@ s = ("3 0 hda 267481 3913 3944418 1625467 3392405 3781877 58210592 " "150845143 0 6136300 153333793") device, stat = benchmark.parseDiskStatLine(s) - self.assertEquals(device, 'hda') - self.assertEquals(stat.readCount, 267481) - self.assertEquals(stat.mergedReadCount, 3913) - self.assertEquals(stat.readSectorCount, 3944418) - self.assertEquals(stat.readMilliseconds, 1625467) - self.assertEquals(stat.writeCount, 3392405) - self.assertEquals(stat.mergedWriteCount, 3781877) - self.assertEquals(stat.writeSectorCount, 58210592) - self.assertEquals(stat.writeMilliseconds, 150845143) - self.assertEquals(stat.outstandingIOCount, 0) - self.assertEquals(stat.ioMilliseconds, 6136300) - self.assertEquals(stat.weightedIOMilliseconds, 153333793) + self.assertEqual(device, 'hda') + self.assertEqual(stat.readCount, 267481) + self.assertEqual(stat.mergedReadCount, 3913) + self.assertEqual(stat.readSectorCount, 3944418) + self.assertEqual(stat.readMilliseconds, 1625467) + self.assertEqual(stat.writeCount, 3392405) + self.assertEqual(stat.mergedWriteCount, 3781877) + self.assertEqual(stat.writeSectorCount, 58210592) + self.assertEqual(stat.writeMilliseconds, 150845143) + self.assertEqual(stat.outstandingIOCount, 0) + self.assertEqual(stat.ioMilliseconds, 6136300) + self.assertEqual(stat.weightedIOMilliseconds, 153333793) def testPartitionLineParser(self): @@ -57,11 +57,11 @@ """ s = "3 1 hda1 2 5 7 9" device, stat = benchmark.parseDiskStatLine(s) - self.assertEquals(device, 'hda1') - self.assertEquals(stat.readCount, 2) - self.assertEquals(stat.readSectorCount, 5) - self.assertEquals(stat.writeCount, 7) - self.assertEquals(stat.writeSectorCount, 9) + self.assertEqual(device, 'hda1') + self.assertEqual(stat.readCount, 2) + self.assertEqual(stat.readSectorCount, 5) + self.assertEqual(stat.writeCount, 7) + self.assertEqual(stat.writeSectorCount, 9) def testFileParser(self): @@ -69,36 +69,36 @@ Test the parsing of multiple lines into a dict mapping device names and numbers to diststat instances. """ - s = StringIO.StringIO( + s = io.StringIO( "1 2 abc 3 4 5 6 7 8 9 10 11 12 13\n" "14 15 def 16 17 18 19 20 21 22 23 24 25 26\n") ds = list(benchmark.parseDiskStats(s)) ds.sort() - self.assertEquals(ds[0][0], "abc") - self.assertEquals(ds[0][1].readCount, 3) - self.assertEquals(ds[0][1].mergedReadCount, 4) - self.assertEquals(ds[0][1].readSectorCount, 5) - self.assertEquals(ds[0][1].readMilliseconds, 6) - self.assertEquals(ds[0][1].writeCount, 7) - self.assertEquals(ds[0][1].mergedWriteCount, 8) - self.assertEquals(ds[0][1].writeSectorCount, 9) - self.assertEquals(ds[0][1].writeMilliseconds, 10) - self.assertEquals(ds[0][1].outstandingIOCount, 11) - self.assertEquals(ds[0][1].ioMilliseconds, 12) - self.assertEquals(ds[0][1].weightedIOMilliseconds, 13) - - self.assertEquals(ds[1][0], "def") - self.assertEquals(ds[1][1].readCount, 16) - self.assertEquals(ds[1][1].mergedReadCount, 17) - self.assertEquals(ds[1][1].readSectorCount, 18) - self.assertEquals(ds[1][1].readMilliseconds, 19) - self.assertEquals(ds[1][1].writeCount, 20) - self.assertEquals(ds[1][1].mergedWriteCount, 21) - self.assertEquals(ds[1][1].writeSectorCount, 22) - self.assertEquals(ds[1][1].writeMilliseconds, 23) - self.assertEquals(ds[1][1].outstandingIOCount, 24) - self.assertEquals(ds[1][1].ioMilliseconds, 25) - self.assertEquals(ds[1][1].weightedIOMilliseconds, 26) + self.assertEqual(ds[0][0], "abc") + self.assertEqual(ds[0][1].readCount, 3) + self.assertEqual(ds[0][1].mergedReadCount, 4) + self.assertEqual(ds[0][1].readSectorCount, 5) + self.assertEqual(ds[0][1].readMilliseconds, 6) + self.assertEqual(ds[0][1].writeCount, 7) + self.assertEqual(ds[0][1].mergedWriteCount, 8) + self.assertEqual(ds[0][1].writeSectorCount, 9) + self.assertEqual(ds[0][1].writeMilliseconds, 10) + self.assertEqual(ds[0][1].outstandingIOCount, 11) + self.assertEqual(ds[0][1].ioMilliseconds, 12) + self.assertEqual(ds[0][1].weightedIOMilliseconds, 13) + + self.assertEqual(ds[1][0], "def") + self.assertEqual(ds[1][1].readCount, 16) + self.assertEqual(ds[1][1].mergedReadCount, 17) + self.assertEqual(ds[1][1].readSectorCount, 18) + self.assertEqual(ds[1][1].readMilliseconds, 19) + self.assertEqual(ds[1][1].writeCount, 20) + self.assertEqual(ds[1][1].mergedWriteCount, 21) + self.assertEqual(ds[1][1].writeSectorCount, 22) + self.assertEqual(ds[1][1].writeMilliseconds, 23) + self.assertEqual(ds[1][1].outstandingIOCount, 24) + self.assertEqual(ds[1][1].ioMilliseconds, 25) + self.assertEqual(ds[1][1].weightedIOMilliseconds, 26) def testCaptureStats(self): @@ -107,7 +107,7 @@ available. """ stats = benchmark.captureStats() - self.failUnless(isinstance(stats, dict), "Expected dictionary, got %r" % (stats,)) + self.assertTrue(isinstance(stats, dict), "Expected dictionary, got %r" % (stats,)) @@ -127,27 +127,27 @@ benchmark.partitionstat(5, 7, 9, 11), 56), False, False)) - self.assertEquals(msg['_command'], 'Result') - - self.assertEquals(msg['version'], '0') - self.assertEquals(msg['error'], 'False') - self.assertEquals(msg['timeout'], 'False') - self.assertEquals(msg['name'], 'frunk') - self.failIfEqual(msg['host'], 'localhost') + self.assertEqual(msg['_command'], 'Result') + + self.assertEqual(msg['version'], '0') + self.assertEqual(msg['error'], 'False') + self.assertEqual(msg['timeout'], 'False') + self.assertEqual(msg['name'], 'frunk') + self.assertNotEqual(msg['host'], 'localhost') self.assertIn('sector_size', msg) self.assertIn('python_version', msg) self.assertIn('twisted_version', msg) self.assertIn('divmod_version', msg) - self.assertEquals(msg['elapsed'], '4') - self.assertEquals(msg['filesystem_growth'], '44') - self.assertEquals(msg['read_count'], '4') - self.assertEquals(msg['read_sectors'], '5') - self.assertEquals(msg['write_count'], '6') - self.assertEquals(msg['write_sectors'], '7') - self.assertEquals(msg['read_ms'], '10') - self.assertEquals(msg['write_ms'], '10') + self.assertEqual(msg['elapsed'], '4') + self.assertEqual(msg['filesystem_growth'], '44') + self.assertEqual(msg['read_count'], '4') + self.assertEqual(msg['read_sectors'], '5') + self.assertEqual(msg['write_count'], '6') + self.assertEqual(msg['write_sectors'], '7') + self.assertEqual(msg['read_ms'], '10') + self.assertEqual(msg['write_ms'], '10') def testFormatterWithoutDiskStats(self): @@ -170,25 +170,25 @@ benchmark.partitionstat(5, 7, 9, 11), 56), False, False)) - self.assertEquals(msg['_command'], 'Result') - - self.assertEquals(msg['version'], '0') - self.assertEquals(msg['error'], 'False') - self.assertEquals(msg['timeout'], 'False') - self.assertEquals(msg['name'], 'frunk') - self.failIfEqual(msg['host'], 'localhost') + self.assertEqual(msg['_command'], 'Result') + + self.assertEqual(msg['version'], '0') + self.assertEqual(msg['error'], 'False') + self.assertEqual(msg['timeout'], 'False') + self.assertEqual(msg['name'], 'frunk') + self.assertNotEqual(msg['host'], 'localhost') self.assertIn('sector_size', msg) self.assertIn('python_version', msg) self.assertIn('twisted_version', msg) self.assertIn('divmod_version', msg) - self.assertEquals(msg['elapsed'], '4') - self.assertEquals(msg['filesystem_growth'], '44') - self.assertEquals(msg['read_count'], '4') - self.assertEquals(msg['read_sectors'], '5') - self.assertEquals(msg['write_count'], '6') - self.assertEquals(msg['write_sectors'], '7') + self.assertEqual(msg['elapsed'], '4') + self.assertEqual(msg['filesystem_growth'], '44') + self.assertEqual(msg['read_count'], '4') + self.assertEqual(msg['read_sectors'], '5') + self.assertEqual(msg['write_count'], '6') + self.assertEqual(msg['write_sectors'], '7') self.failIfIn('read_ms', msg) self.failIfIn('write_ms', msg) @@ -214,29 +214,29 @@ None, 56), False, False)) - self.assertEquals(msg['_command'], 'Result') - - self.assertEquals(msg['version'], '0') - self.assertEquals(msg['error'], 'False') - self.assertEquals(msg['timeout'], 'False') - self.assertEquals(msg['name'], 'frunk') - self.failIfEqual(msg['host'], 'localhost') + self.assertEqual(msg['_command'], 'Result') + + self.assertEqual(msg['version'], '0') + self.assertEqual(msg['error'], 'False') + self.assertEqual(msg['timeout'], 'False') + self.assertEqual(msg['name'], 'frunk') + self.assertNotEqual(msg['host'], 'localhost') self.assertIn('sector_size', msg) self.assertIn('python_version', msg) self.assertIn('twisted_version', msg) self.assertIn('divmod_version', msg) - self.assertEquals(msg['elapsed'], '4') - self.assertEquals(msg['filesystem_growth'], '44') + self.assertEqual(msg['elapsed'], '4') + self.assertEqual(msg['filesystem_growth'], '44') self.failIfIn('read_count', msg) self.failIfIn('read_sectors', msg) self.failIfIn('write_count', msg) self.failIfIn('write_sectors', msg) - self.assertEquals(msg['read_ms'], '10') - self.assertEquals(msg['write_ms'], '10') + self.assertEqual(msg['read_ms'], '10') + self.assertEqual(msg['write_ms'], '10') def testGetSize(self): @@ -245,7 +245,7 @@ fObj = file(os.path.join(path, 'foo'), 'wb') fObj.write('x' * 10) fObj.close() - self.assertEquals( + self.assertEqual( benchmark.getSize(filepath.FilePath(path)), os.path.getsize(path) + os.path.getsize(os.path.join(path, 'foo'))) @@ -259,7 +259,7 @@ path.makedirs() link = path.child('foo') os.symlink('abcdefg', link.path) - self.assertEquals( + self.assertEqual( benchmark.getOneSize(link), len('abcdefg')) @@ -331,10 +331,10 @@ processProtocol = benchmark.BasicProcess def testCorrectArgs(self): - self.assertEquals(self.mock.executable, 'executable') - self.assertEquals(self.mock.args, ['executable', 'args']) - self.assertEquals(self.mock.path, self.workingDirectory) - self.assertEquals(self.mock.env, {'env': 'stuff'}) + self.assertEqual(self.mock.executable, 'executable') + self.assertEqual(self.mock.args, ['executable', 'args']) + self.assertEqual(self.mock.path, self.workingDirectory) + self.assertEqual(self.mock.env, {'env': 'stuff'}) def testChildDataReceived(self): @@ -342,10 +342,11 @@ self.mock.proto.childDataReceived(2, 'stderr bytes') self.mock.proto.childDataReceived(1, 'more stdout bytes') - def cbProcessFinished((proto, status, output)): + def cbProcessFinished(xxx_todo_changeme): + (proto, status, output) = xxx_todo_changeme self.assertIdentical(proto, self.mock.proto) - self.assertEquals(status, 0) - self.assertEquals( + self.assertEqual(status, 0) + self.assertEqual( output, [(1, 'stdout bytes'), (2, 'stderr bytes'), @@ -360,12 +361,12 @@ Assert that a timeout call is created as soon as the process is started and that if it expires, the spawn call's Deferred fails. """ - self.assertEquals(len(self.sched), 1) - self.assertEquals(self.sched[0].getTime(), 900.0) + self.assertEqual(len(self.sched), 1) + self.assertEqual(self.sched[0].getTime(), 900.0) self.sched[0].func(*self.sched[0].args, **self.sched[0].kw) def cbTimedOut(ign): - self.assertEquals(self.mock.signals, ['KILL']) + self.assertEqual(self.mock.signals, ['KILL']) d = self.assertFailure(self.spawnDeferred, error.TimeoutError) d.addCallback(cbTimedOut) @@ -378,13 +379,13 @@ """ self.currentTime = 1 self.mock.proto.childDataReceived(1, 'bytes') - self.assertEquals(len(self.sched), 1) - self.assertEquals(self.sched[0].getTime(), 901.0) + self.assertEqual(len(self.sched), 1) + self.assertEqual(self.sched[0].getTime(), 901.0) self.currentTime = 2 self.mock.proto.childConnectionLost(1) - self.assertEquals(len(self.sched), 1) - self.assertEquals(self.sched[0].getTime(), 902.0) + self.assertEqual(len(self.sched), 1) + self.assertEqual(self.sched[0].getTime(), 902.0) def testProcessKilled(self): @@ -393,10 +394,10 @@ else gets involved and kills the child process. """ def cbKilled(exc): - self.assertEquals(exc.exitCode, 1) - self.assertEquals(exc.signal, 2) - self.assertEquals(exc.status, 3) - self.assertEquals(exc.output, [(1, 'bytes')]) + self.assertEqual(exc.exitCode, 1) + self.assertEqual(exc.signal, 2) + self.assertEqual(exc.status, 3) + self.assertEqual(exc.output, [(1, 'bytes')]) self.mock.proto.childDataReceived(1, 'bytes') self.mock.proto.processEnded(failure.Failure(error.ProcessTerminated(1, 2, 3))) @@ -414,13 +415,13 @@ def testStart(self): c = benchmark.Change() c.start(filepath.FilePath('.'), 'hda', 'hda1') - self.failUnless(isinstance(c.before, benchmark.ResourceSnapshot)) + self.assertTrue(isinstance(c.before, benchmark.ResourceSnapshot)) def testStop(self): c = benchmark.Change() c.stop(filepath.FilePath('.'), 'hda', 'hda1') - self.failUnless(isinstance(c.after, benchmark.ResourceSnapshot)) + self.assertTrue(isinstance(c.after, benchmark.ResourceSnapshot)) @@ -436,7 +437,7 @@ p = self.mock.proto p.startTiming = lambda: started.append(None) seRefactoringTool: Refactored ../python3/epsilon/test/test_amprouter.py RefactoringTool: Refactored ../python3/epsilon/test/test_ampauth.py RefactoringTool: No changes to ../python3/epsilon/test/mantissa-structure.py RefactoringTool: Refactored ../python3/epsilon/test/iosim.py lf.mock.proto.childDataReceived(p.BACKCHANNEL_OUT, p.START) - self.assertEquals(started, [None]) + self.assertEqual(started, [None]) def testProcessStopTimingCommand(self): @@ -444,4 +445,4 @@ p = self.mock.proto p.stopTiming = lambda: stopped.append(None) self.mock.proto.childDataReceived(p.BACKCHANNEL_OUT, p.STOP) - self.assertEquals(stopped, [None]) + self.assertEqual(stopped, [None]) --- ../python3/epsilon/test/test_amprouter.py (original) +++ ../python3/epsilon/test/test_amprouter.py (refactored) @@ -74,7 +74,7 @@ Reject boxes with non-string keys or values; save all the rest in C{self.boxes}. """ - for k, v in box.iteritems(): + for k, v in box.items(): if not (isinstance(k, str) and isinstance(v, str)): raise TypeError("Cannot send boxes containing non-strings") self.boxes.append(box) @@ -96,8 +96,8 @@ """ self.receiver = SomeReceiver() self.sender = CollectingSender() - self.localName = u"foo" - self.remoteName = u"bar" + self.localName = "foo" + self.remoteName = "bar" self.router = Router() self.router.startReceivingBoxes(self.sender) self.route = self.router.bindRoute(self.receiver, self.localName) @@ -186,7 +186,7 @@ self.router.startReceivingBoxes(self.sender) self.receiver = SomeReceiver() self.route = self.router.bindRoute(self.receiver) - self.route.connectTo(u"foo") + self.route.connectTo("foo") def test_interfaces(self): @@ -229,7 +229,7 @@ router = Router() receiver = SomeReceiver() route = router.bindRoute(receiver) - route.connectTo(u'quux') + route.connectTo('quux') self.assertFalse(receiver.started) sender = CollectingSender() router.startReceivingBoxes(sender) @@ -255,7 +255,7 @@ sender = CollectingSender() router.startReceivingBoxes(sender) self.assertFalse(receiver.started) - route.connectTo(u"remoteName") + route.connectTo("remoteName") self.assertTrue(receiver.started) receiver.sender.sendBox({'foo': 'bar'}) self.assertEqual(sender.boxes, [{_ROUTE: 'remoteName', 'foo': 'bar'}]) --- ../python3/epsilon/test/test_ampauth.py (original) +++ ../python3/epsilon/test/test_ampauth.py (refactored) @@ -325,7 +325,7 @@ """ def setUp(self): self.username = 'user name' - password = u'foo bar\N{LATIN SMALL LETTER E WITH ACUTE}' + password = 'foo bar\N{LATIN SMALL LETTER E WITH ACUTE}' self.password = password.encode('utf-8') self.challenge = '123xyzabc789' self.nonce = '1 2 3 4 5' @@ -368,7 +368,7 @@ """ self.assertFalse( self.credentials.checkPassword( - u'\N{LATIN SMALL LETTER E WITH ACUTE}')) + '\N{LATIN SMALL LETTER E WITH ACUTE}')) --- ../python3/epsilon/test/iosim.py (original) +++ ../python3/epsilon/test/iosim.py (refactored) @@ -2,7 +2,7 @@ """Utilities and helpers for simulating a network """ -from cStringIO import StringIO +from io import StringIO from twisted.internet import error @@ -16,7 +16,7 @@ iodata.seek(0) iodata.truncate() except ValueError: - print '' + print('') result = '' return result @@ -55,20 +55,20 @@ Returns whether any data was moved. """ if self.debug or debug: - print '-- GLUG --' + print('-- GLUG --') sData = readAndDestroy(self.serverIO) cData = readAndDestroy(self.clientIO) self.client.transport._checkProducer() self.server.transport._checkProducer() if self.debug or debug: - print '.' + print('.') # XXX slightly buggy in the face of incremental output if cData: RefactoringTool: No changes to ../python3/epsilon/test/test_expose.py RefactoringTool: Refactored ../python3/epsilon/scripts/certcreate.py RefactoringTool: Refactored ../python3/epsilon/scripts/benchmark.py RefactoringTool: Refactored ../python3/epsilon/unrepr.py for line in cData.split('\r\n'): - print 'C: '+line + print('C: '+line) if sData: for line in sData.split('\r\n'): - print 'S: '+line + print('S: '+line) if cData: self.server.dataReceived(cData) if sData: @@ -77,14 +77,14 @@ return True if self.server.transport.disconnecting and not self.server.transport.disconnected: if self.debug or debug: - print '* C' + print('* C') self.server.transport.disconnected = True self.client.transport.disconnecting = True self.client.connectionLost(error.ConnectionDone("Connection done")) return True if self.client.transport.disconnecting and not self.client.transport.disconnected: if self.debug or debug: - print '* S' + print('* S') self.client.transport.disconnected = True self.server.transport.disconnecting = True self.server.connectionLost(error.ConnectionDone("Connection done")) --- ../python3/epsilon/scripts/certcreate.py (original) +++ ../python3/epsilon/scripts/certcreate.py (refactored) @@ -40,8 +40,8 @@ ssc = KeyPair.generate().selfSignedCert(serialNumber, **sslopt) file(opts['filename'], 'w').write(ssc.dumpPEM()) if not opts['quiet']: - print 'Wrote SSL certificate:' - print ssc.inspect() + print('Wrote SSL certificate:') + print(ssc.inspect()) return ssc @@ -56,7 +56,7 @@ o = Options() try: o.parseOptions(args) - except usage.UsageError, e: + except usage.UsageError as e: raise SystemExit(str(e)) else: return createSSLCertificate(o) --- ../python3/epsilon/scripts/benchmark.py (original) +++ ../python3/epsilon/scripts/benchmark.py (refactored) @@ -5,7 +5,7 @@ usage information and other statistics about it. """ -import os, time, sys, socket, StringIO, pprint, errno +import os, time, sys, socket, io, pprint, errno import twisted from twisted.python import log, filepath, failure, util @@ -51,7 +51,7 @@ factory = partitionstat else: factory = diskstat - return device, factory(*map(int, parts[3:])) + return device, factory(*list(map(int, parts[3:]))) @@ -354,7 +354,7 @@ assert hostname != 'localhost', "Fix your computro." def formatResults(name, sectorSize, before, after, error, timeout): - output = StringIO.StringIO() + output = io.StringIO() jj = juice.Juice(issueGreeting=False) tt = utils.FileWrapper(output) jj.makeConnection(tt) @@ -399,7 +399,7 @@ write_sectors=write_sectors, write_ms=write_ms, filesystem_growth=after.size - before.size, - python_version=unicode(sys.hexversion), + python_version=str(sys.hexversion), twisted_version=twisted_version, divmod_version=epsilon_version, ).do(jj, requiresAnswer=False) @@ -408,8 +408,8 @@ def reportResults(results): - print results - print + print(results) + print() fObj = file('output', 'ab') fObj.write(results) fObj.close() @@ -447,7 +447,7 @@ """ try: return ch.getsize() - except OSError, e: + except OSError as e: if e.errno == errno.ENOENT: # XXX FilePath is broken if os.path.islink(ch.path): @@ -475,7 +475,7 @@ elif result.check(ProcessDied): log.msg("Failing because Failure!") pprint.pprint(result.value.output) - print result.value.exitCode, result.value.signal + print(result.value.exitCode, result.value.signal) else: log.err(result) else: --- ../python3/epsilon/unrepr.py (original) +++ ../python3/epsilon/unrepr.py (refactored) @@ -26,7 +26,7 @@ return m(o) def build_List(self, o): - return map(self.build, o.getChildren()) + RefactoringTool: Refactored ../python3/epsilon/modal.py RefactoringTool: Refactored ../python3/epsilon/hotfixes/trial_assertwarns.py RefactoringTool: No changes to ../python3/epsilon/hotfixes/timeoutmixin_calllater.py RefactoringTool: Refactored ../python3/epsilon/hotfixes/proto_helpers_stringtransport.py RefactoringTool: No changes to ../python3/epsilon/hotfixes/plugin_package_paths.py RefactoringTool: No changes to ../python3/epsilon/hotfixes/loopbackasync_reentrancy.py RefactoringTool: No changes to ../python3/epsilon/hotfixes/internet_task_clock.py RefactoringTool: Refactored ../python3/epsilon/hotfixes/filepath_copyTo.py return list(map(self.build, o.getChildren())) def build_Const(self, o): return o.value @@ -35,7 +35,7 @@ d = {} i = iter(map(self.build, o.getChildren())) for el in i: - d[el] = i.next() + d[el] = next(i) return d def build_Tuple(self, o): @@ -47,7 +47,7 @@ raise UnknownType('Name') def build_Add(self, o): - real, imag = map(self.build_Const, o.getChildren()) + real, imag = list(map(self.build_Const, o.getChildren())) try: real = float(real) except TypeError: --- ../python3/epsilon/modal.py (original) +++ ../python3/epsilon/modal.py (refactored) @@ -103,21 +103,20 @@ implementations = {} keepAttrs = {'mode': initialMode} - for (k, v) in attrs.iteritems(): + for (k, v) in attrs.items(): if isinstance(v, type) and issubclass(v, mode): - for (methName, methDef) in v.__dict__.iteritems(): + for (methName, methDef) in v.__dict__.items(): if methName not in ('__module__', '__file__', '__name__'): implementations.setdefault(methName, {})[k] = methDef keepAttrs[k] = v - for (methName, methDefs) in implementations.iteritems(): + for (methName, methDefs) in implementations.items(): keepAttrs[methName] = ModalMethod(methName, methDefs, modeAttribute) return super(ModalType, cls).__new__(cls, name, bases, keepAttrs) -class Modal(object): +class Modal(object, metaclass=ModalType): - __metaclass__ = ModalType modeAttribute = 'mode' initialMode = 'nil' --- ../python3/epsilon/hotfixes/trial_assertwarns.py (original) +++ ../python3/epsilon/hotfixes/trial_assertwarns.py (refactored) @@ -44,7 +44,7 @@ self.assertIdentical(gotCategory, category) # Use starts with because of .pyc/.pyo issues. - self.failUnless( + self.assertTrue( filename.startswith(gotFilename), 'Warning in %r, expected %r' % (gotFilename, filename)) --- ../python3/epsilon/hotfixes/proto_helpers_stringtransport.py (original) +++ ../python3/epsilon/hotfixes/proto_helpers_stringtransport.py (refactored) @@ -3,7 +3,7 @@ class StringTransport: def write(self, data): - if isinstance(data, unicode): # no, really, I mean it + if isinstance(data, str): # no, really, I mean it raise TypeError("Data must not be unicode") self.io.write(data) --- ../python3/epsilon/hotfixes/filepath_copyTo.py (original) +++ ../python3/epsilon/hotfixes/filepath_copyTo.py (refactored) @@ -2,7 +2,7 @@ # Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. -from __future__ import generators + import os import errno @@ -34,7 +34,7 @@ from os import urandom as randomBytes except ImportError: def randomBytes(n): - randomData = [random.randrange(256) for n in xrange(n)] + randomData = [random.randrange(256) for n in range(n)] return ''.join(map(chr, randomData)) try: @@ -86,7 +86,7 @@ def __getstate__(self): d = self.__dict__.copy() - if d.has_key('statinfo'): + if 'statinfo' in d: del d['statinfo'] return d @@ -272,7 +272,7 @@ """ import glob path = self.path[-1] == '/' and self.path + pattern or slash.join([self.path, pattern]) - return map(self.clonePath, glob.glob(path)) + return list(map(self.clonePath, glob.glob(path))) def basename(self): return basename(self.path) @@ -326,7 +326,7 @@ return sib def children(self): - return map(self.child, self.listdir()) + return list(map(self.child, self.listdir())) def walk(self): yield self @@ -375,7 +375,7 @@ try: os.rename(self.path, destination.path) self.restat(False) - except OSError, ose: + except OSError as ose: if ose.errno == errno.EXDEV: # RefactoringTool: Refactored ../python3/epsilon/hotfixes/delayedcall_seconds.py RefactoringTool: Refactored ../python3/epsilon/hotfixes/deferredgenerator_tfailure.py RefactoringTool: Files that were modified: RefactoringTool: ../python3/versioneer.py RefactoringTool: ../python3/setup.py RefactoringTool: ../python3/epsilon/_version.py RefactoringTool: ../python3/epsilon/view.py RefactoringTool: ../python3/epsilon/structlike.py RefactoringTool: ../python3/epsilon/spewer.py RefactoringTool: ../python3/epsilon/setuphelper.py RefactoringTool: ../python3/epsilon/remember.py RefactoringTool: ../python3/epsilon/react.py RefactoringTool: ../python3/epsilon/process.py RefactoringTool: ../python3/epsilon/liner.py RefactoringTool: ../python3/epsilon/juice.py RefactoringTool: ../python3/epsilon/iepsilon.py RefactoringTool: ../python3/epsilon/hotfix.py RefactoringTool: ../python3/epsilon/extime.py RefactoringTool: ../python3/epsilon/expose.py RefactoringTool: ../python3/epsilon/descriptor.py RefactoringTool: ../python3/epsilon/cooperator.py RefactoringTool: ../python3/epsilon/caseless.py RefactoringTool: ../python3/epsilon/asplode.py RefactoringTool: ../python3/epsilon/amprouter.py RefactoringTool: ../python3/epsilon/ampauth.py RefactoringTool: ../python3/epsilon/__init__.py RefactoringTool: ../python3/epsilon/test/utils.py RefactoringTool: ../python3/epsilon/test/test_view.py RefactoringTool: ../python3/epsilon/test/test_version.py RefactoringTool: ../python3/epsilon/test/test_unrepr.py RefactoringTool: ../python3/epsilon/test/test_structlike.py RefactoringTool: ../python3/epsilon/test/test_setuphelper.py RefactoringTool: ../python3/epsilon/test/test_remember.py RefactoringTool: ../python3/epsilon/test/test_react.py RefactoringTool: ../python3/epsilon/test/test_process.py RefactoringTool: ../python3/epsilon/test/test_modes.py RefactoringTool: ../python3/epsilon/test/test_juice.py RefactoringTool: ../python3/epsilon/test/test_extime.py RefactoringTool: ../python3/epsilon/test/test_descriptor.py RefactoringTool: ../python3/epsilon/test/test_caseless.py RefactoringTool: ../python3/epsilon/test/test_benchmark.py RefactoringTool: ../python3/epsilon/test/test_amprouter.py RefactoringTool: ../python3/epsilon/test/test_ampauth.py RefactoringTool: ../python3/epsilon/test/mantissa-structure.py RefactoringTool: ../python3/epsilon/test/iosim.py RefactoringTool: ../python3/epsilon/test/test_expose.py RefactoringTool: ../python3/epsilon/scripts/certcreate.py RefactoringTool: ../python3/epsilon/scripts/benchmark.py RefactoringTool: ../python3/epsilon/unrepr.py RefactoringTool: ../python3/epsilon/modal.py RefactoringTool: ../python3/epsilon/hotfixes/trial_assertwarns.py RefactoringTool: ../python3/epsilon/hotfixes/timeoutmixin_calllater.py RefactoringTool: ../python3/epsilon/hotfixes/proto_helpers_stringtransport.py RefactoringTool: ../python3/epsilon/hotfixes/plugin_package_paths.py RefactoringTool: ../python3/epsilon/hotfixes/loopbackasync_reentrancy.py RefactoringTool: ../python3/epsilon/hotfixes/internet_task_clock.py RefactoringTool: ../python3/epsilon/hotfixes/filepath_copyTo.py RefactoringTool: ../python3/epsilon/hotfixes/delayedcall_seconds.py RefactoringTool: ../python3/epsilon/hotfixes/deferredgenerator_tfailure.py man 2 rename, ubuntu linux 5.10 "breezy": --- ../python3/epsilon/hotfixes/delayedcall_seconds.py (original) +++ ../python3/epsilon/hotfixes/delayedcall_seconds.py (refactored) @@ -121,9 +121,9 @@ return self._str if hasattr(self, 'func'): if hasattr(self.func, 'func_name'): - func = self.func.func_name + func = self.func.__name__ if hasattr(self.func, 'im_class'): - func = self.func.im_class.__name__ + '.' + func + func = self.func.__self__.__class__.__name__ + '.' + func else: func = reflect.safe_repr(self.func) else: @@ -142,7 +142,7 @@ if self.kw: L.append(", ") if self.kw: - L.append(", ".join(['%s=%s' % (k, reflect.safe_repr(v)) for (k, v) in self.kw.iteritems()])) + L.append(", ".join(['%s=%s' % (k, reflect.safe_repr(v)) for (k, v) in self.kw.items()])) L.append(")") if self.debug: --- ../python3/epsilon/hotfixes/deferredgenerator_tfailure.py (original) +++ ../python3/epsilon/hotfixes/deferredgenerator_tfailure.py (refactored) @@ -17,7 +17,7 @@ if deferred is None: deferred = defer.Deferred() try: - result = g.next() + result = next(g) except StopIteration: deferred.callback(result) return deferred + exit 0 Executing(%build): /bin/sh -e /usr/src/tmp/rpm-tmp.11963 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd Epsilon-0.7.1 + CFLAGS='-pipe -Wall -g -O2' + export CFLAGS + CXXFLAGS='-pipe -Wall -g -O2' + export CXXFLAGS + FFLAGS='-pipe -Wall -g -O2' + export FFLAGS + /usr/bin/python2.7 setup.py build running build running build_py creating build creating build/lib creating build/lib/epsilon copying epsilon/unrepr.py -> build/lib/epsilon copying epsilon/modal.py -> build/lib/epsilon copying epsilon/_version.py -> build/lib/epsilon copying epsilon/view.py -> build/lib/epsilon copying epsilon/structlike.py -> build/lib/epsilon copying epsilon/spewer.py -> build/lib/epsilon copying epsilon/setuphelper.py -> build/lib/epsilon copying epsilon/remember.py -> build/lib/epsilon copying epsilon/react.py -> build/lib/epsilon copying epsilon/process.py -> build/lib/epsilon copying epsilon/pending.py -> build/lib/epsilon copying epsilon/liner.py -> build/lib/epsilon copying epsilon/juice.py -> build/lib/epsilon copying epsilon/iepsilon.py -> build/lib/epsilon copying epsilon/hotfix.py -> build/lib/epsilon copying epsilon/extime.py -> build/lib/epsilon copying epsilon/expose.py -> build/lib/epsilon copying epsilon/descriptor.py -> build/lib/epsilon copying epsilon/cooperator.py -> build/lib/epsilon copying epsilon/caseless.py -> build/lib/epsilon copying epsilon/asplode.py -> build/lib/epsilon copying epsilon/amprouter.py -> build/lib/epsilon copying epsilon/ampauth.py -> build/lib/epsilon copying epsilon/__init__.py -> build/lib/epsilon creating build/lib/epsilon/test copying epsilon/test/test_expose.py -> build/lib/epsilon/test copying epsilon/test/utils.py -> build/lib/epsilon/test copying epsilon/test/test_view.py -> build/lib/epsilon/test copying epsilon/test/test_version.py -> build/lib/epsilon/test copying epsilon/test/test_unrepr.py -> build/lib/epsilon/test copying epsilon/test/test_structlike.py -> build/lib/epsilon/test copying epsilon/test/test_setuphelper.py -> build/lib/epsilon/test copying epsilon/test/test_remember.py -> build/lib/epsilon/test copying epsilon/test/test_react.py -> build/lib/epsilon/test copying epsilon/test/test_process.py -> build/lib/epsilon/test copying epsilon/test/test_modes.py -> build/lib/epsilon/test copying epsilon/test/test_juice.py -> build/lib/epsilon/test copying epsilon/test/test_extime.py -> build/lib/epsilon/test copying epsilon/test/test_descriptor.py -> build/lib/epsilon/test copying epsilon/test/test_caseless.py -> build/lib/epsilon/test copying epsilon/test/test_benchmark.py -> build/lib/epsilon/test copying epsilon/test/test_amprouter.py -> build/lib/epsilon/test copying epsilon/test/test_ampauth.py -> build/lib/epsilon/test copying epsilon/test/mantissa-structure.py -> build/lib/epsilon/test copying epsilon/test/iosim.py -> build/lib/epsilon/test copying epsilon/test/__init__.py -> build/lib/epsilon/test creating build/lib/epsilon/scripts copying epsilon/scripts/certcreate.py -> build/lib/epsilon/scripts copying epsilon/scripts/benchmark.py -> build/lib/epsilon/scripts copying epsilon/scripts/__init__.py -> build/lib/epsilon/scripts creating build/lib/epsilon/hotfixes copying epsilon/hotfixes/filepath_copyTo.py -> build/lib/epsilon/hotfixes copying epsilon/hotfixes/trial_assertwarns.py -> build/lib/epsilon/hotfixes copying epsilon/hotfixes/timeoutmixin_calllater.py -> build/lib/epsilon/hotfixes copying epsilon/hotfixes/proto_helpers_stringtransport.py -> build/lib/epsilon/hotfixes copying epsilon/hotfixes/plugin_package_paths.py -> build/lib/epsilon/hotfixes copying epsilon/hotfixes/loopbackasync_reentrancy.py -> build/lib/epsilon/hotfixes copying epsilon/hotfixes/internet_task_clock.py -> build/lib/epsilon/hotfixes copying epsilon/hotfixes/delayedcall_seconds.py -> build/lib/epsilon/hotfixes copying epsilon/hotfixes/deferredgenerator_tfailure.py -> build/lib/epsilon/hotfixes copying epsilon/hotfixes/__init__.py -> build/lib/epsilon/hotfixes UPDATING build/lib/epsilon/_version.py set build/lib/epsilon/_version.py to '0.7.1' running build_scripts creating build/scripts-2.7 copying and adjusting bin/benchmark -> build/scripts-2.7 copying and adjusting bin/certcreate -> build/scripts-2.7 changing mode of build/scripts-2.7/benchmark from 644 to 755 changing mode of build/scripts-2.7/certcreate from 644 to 755 + pushd ../python3 ~/RPM/BUILD/python3 ~/RPM/BUILD/Epsilon-0.7.1 + CFLAGS='-pipe -Wall -g -O2' + export CFLAGS + CXXFLAGS='-pipe -Wall -g -O2' + export CXXFLAGS + FFLAGS='-pipe -Wall -g -O2' + export FFLAGS + python3 setup.py build Traceback (most recent call last): File "setup.py", line 2, in from setuptools import setup, find_packages ImportError: No module named 'setuptools' error: Bad exit status from /usr/src/tmp/rpm-tmp.11963 (%build) RPM build errors: Bad exit status from /usr/src/tmp/rpm-tmp.11963 (%build) Command exited with non-zero status 1 5.36user 0.18system 0:06.14elapsed 90%CPU (0avgtext+0avgdata 48236maxresident)k 0inputs+0outputs (0major+54806minor)pagefaults 0swaps hsh-rebuild: rebuild of `python-module-Epsilon-0.7.1-alt1.src.rpm' failed. Command exited with non-zero status 1 12.27user 2.19system 0:16.77elapsed 86%CPU (0avgtext+0avgdata 122204maxresident)k 19344inputs+0outputs (0major+288581minor)pagefaults 0swaps