<86>Apr 21 02:17:55 userdel[67405]: delete user 'rooter' <86>Apr 21 02:17:55 userdel[67405]: removed group 'rooter' owned by 'rooter' <86>Apr 21 02:17:55 groupadd[67423]: group added to /etc/group: name=rooter, GID=615 <86>Apr 21 02:17:55 groupadd[67423]: group added to /etc/gshadow: name=rooter <86>Apr 21 02:17:55 groupadd[67423]: new group: name=rooter, GID=615 <86>Apr 21 02:17:55 useradd[67437]: new user: name=rooter, UID=615, GID=615, home=/root, shell=/bin/bash <86>Apr 21 02:17:55 userdel[67455]: delete user 'builder' <86>Apr 21 02:17:55 userdel[67455]: removed group 'builder' owned by 'builder' <86>Apr 21 02:17:55 userdel[67455]: removed shadow group 'builder' owned by 'builder' <86>Apr 21 02:17:55 groupadd[67468]: group added to /etc/group: name=builder, GID=616 <86>Apr 21 02:17:55 groupadd[67468]: group added to /etc/gshadow: name=builder <86>Apr 21 02:17:55 groupadd[67468]: new group: name=builder, GID=616 <86>Apr 21 02:17:55 useradd[67481]: new user: name=builder, UID=616, GID=616, home=/usr/src, shell=/bin/bash <13>Apr 21 02:17:57 rpmi: libexpat-2.2.4-alt0.M80P.1 1503871120 installed <13>Apr 21 02:17:57 rpmi: libgdbm-1.8.3-alt10 1454943313 installed <13>Apr 21 02:17:57 rpmi: python-module-google-0.4.0-alt2.1 1457968526 installed <13>Apr 21 02:17:57 rpmi: python-module-sphinx_rtd_theme-0.1.8-alt1.git20150730.1 1457859644 installed <13>Apr 21 02:17:57 rpmi: python-sphinx-objects.inv-2.3.6.20160413-alt1 1460595508 installed <13>Apr 21 02:17:57 rpmi: libxapian-1.2.23-alt1 1459318465 installed <13>Apr 21 02:17:57 rpmi: python-module-xapian-1.2.23-alt1.M80P.1 1503464748 installed <13>Apr 21 02:17:57 rpmi: libsqlite3-3.15.2-alt1 1480432212 installed <13>Apr 21 02:17:57 rpmi: libgpg-error-1.31-alt1.M80P.1 1529024730 installed <13>Apr 21 02:17:57 rpmi: libgcrypt20-1.8.3-alt4 p8+219793.200.6.1 1551112986 installed <13>Apr 21 02:17:57 rpmi: libxslt-1.1.28-alt4 1448210404 installed <13>Apr 21 02:17:57 rpmi: libtinfo-devel-5.9-alt8 1456756459 installed <13>Apr 21 02:17:57 rpmi: libncurses-devel-5.9-alt8 1456756459 installed <13>Apr 21 02:17:58 rpmi: python-modules-curses-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:58 rpmi: libverto-0.2.6-alt1_6 1455633234 installed <13>Apr 21 02:17:58 rpmi: libkeyutils-1.5.10-alt0.M80P.2 p8+216694.100.6.1 1547827915 installed <13>Apr 21 02:17:58 rpmi: libcom_err-1.42.13-alt2 1449075846 installed <13>Apr 21 02:17:58 rpmi: ca-certificates-2016.02.25-alt1 1462368370 installed <13>Apr 21 02:17:58 rpmi: libcrypto10-1.0.2n-alt0.M80P.1 1512766129 installed <13>Apr 21 02:17:58 rpmi: rpm-macros-sphinx-1:1.4-alt8.a0.git20150813 1460726255 installed <13>Apr 21 02:17:58 rpmi: libssl10-1.0.2n-alt0.M80P.1 1512766129 installed <86>Apr 21 02:17:58 groupadd[75419]: group added to /etc/group: name=_keytab, GID=499 <86>Apr 21 02:17:58 groupadd[75419]: group added to /etc/gshadow: name=_keytab <86>Apr 21 02:17:58 groupadd[75419]: new group: name=_keytab, GID=499 <13>Apr 21 02:17:58 rpmi: libkrb5-1.14.6-alt1.M80P.1 1525355673 installed <13>Apr 21 02:17:58 rpmi: python-modules-compiler-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:58 rpmi: python3-base-3.5.4-alt2.M80P.1 1527753911 installed <13>Apr 21 02:17:58 rpmi: python3-module-py-1.4.34-alt0.M80P.1 1503506764 installed <13>Apr 21 02:17:58 rpmi: python-modules-email-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:58 rpmi: python3-3.5.4-alt2.M80P.1 1527753911 installed <13>Apr 21 02:17:58 rpmi: rpm-build-python3-0.1.10.10-alt1.M80P.1 1530521451 installed <13>Apr 21 02:17:58 rpmi: python-modules-unittest-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:58 rpmi: python3-module-pytest-3.2.1-alt0.M80P.1 1503499784 installed <13>Apr 21 02:17:58 rpmi: python3-module-setuptools-1:18.5-alt0.M80P.1 1497527461 installed <13>Apr 21 02:17:59 rpmi: python-modules-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-modules-xml-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-modules-encodings-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-modules-json-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-modules-ctypes-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-modules-multiprocessing-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-modules-logging-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-module-six-1.10.0-alt7 1496087616 installed <13>Apr 21 02:17:59 rpmi: python-tools-2to3-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-module-whoosh-2.7.0-alt1.hg20150805.1.1 1457859779 installed <13>Apr 21 02:17:59 rpmi: python-module-webencodings-0.5.1-alt0.M80P.1 1507185481 installed <13>Apr 21 02:17:59 rpmi: python-modules-hotshot-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-modules-bsddb-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-strict-2.7.11-alt6.M80P.1 1527682534 installed <13>Apr 21 02:17:59 rpmi: python-dev-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-module-PyStemmer-1.0.1-alt1.2.1 1321387369 installed <13>Apr 21 02:17:59 rpmi: python-module-snowballstemmer-1.2.0-alt2.1 1457859319 installed <13>Apr 21 02:17:59 rpmi: python-module-pytz-1:2015.4-alt1.1.1 1460413776 installed <13>Apr 21 02:17:59 rpmi: python-module-py-1.4.34-alt0.M80P.1 1503506764 installed <13>Apr 21 02:17:59 rpmi: python-module-simplejson-3.15.0-alt1.M80P.1 1528995430 installed <13>Apr 21 02:17:59 rpmi: python-module-markupsafe-0.23-alt1.2.1 1459593526 installed <13>Apr 21 02:17:59 rpmi: python-modules-sqlite3-2.7.11-alt6.M80P.1 1527682470 installed <13>Apr 21 02:17:59 rpmi: python-module-SQLAlchemy-1.2.15-alt1 p8+223214.600.2.1 1551354313 installed <13>Apr 21 02:17:59 rpmi: python-module-setuptools-1:18.5-alt0.M80P.1 1497527461 installed <13>Apr 21 02:17:59 rpmi: python-module-jinja2-2.9-alt1.dev.git20150726.1.1.1 1460400640 installed <13>Apr 21 02:18:00 rpmi: python-module-babel-1:2.3.4-alt0.M80P.1 1480881327 installed <13>Apr 21 02:18:00 rpmi: python-module-jinja2-tests-2.9-alt1.dev.git20150726.1.1.1 1460400640 installed <13>Apr 21 02:18:00 rpmi: python-module-pytest-3.2.1-alt0.M80P.1 1503499784 installed <13>Apr 21 02:18:00 rpmi: python-module-cssselect-0.9.1-alt1.1 1457858257 installed <13>Apr 21 02:18:00 rpmi: python-module-coverage-4.0-alt1.a7.git20150730.1.1 1459584383 installed <13>Apr 21 02:18:00 rpmi: python-module-nose-1:1.3.7-alt1.git20160316.1 1460404907 installed <13>Apr 21 02:18:00 rpmi: python-module-lxml-4.0.0-alt0.M80P.1 1507163741 installed <13>Apr 21 02:18:00 rpmi: python-module-docutils-0.13-alt4.git20150716.1.1 1460400317 installed <13>Apr 21 02:18:00 rpmi: python-module-html5lib-1:0.999999999-alt1.M80P.2 1507185603 installed <13>Apr 21 02:18:00 rpmi: python-module-Pygments-2.2.0-alt1.M80P.2 p8.214223.100 1538848792 installed <13>Apr 21 02:18:00 rpmi: python-module-alabaster-0.7.6-alt1.git20150703.1 1457857919 installed <13>Apr 21 02:18:00 rpmi: python-module-sphinx-1:1.4-alt8.a0.git20150813 1460726255 installed Installing python-module-cherrypy-3.5.1-alt1.hg20140627.1.1.src.rpm Building target platforms: x86_64 Building for target x86_64 Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.67567 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + rm -rf python-module-cherrypy-3.5.1 + echo 'Source #0 (python-module-cherrypy-3.5.1.tar):' Source #0 (python-module-cherrypy-3.5.1.tar): + /bin/tar -xf /usr/src/RPM/SOURCES/python-module-cherrypy-3.5.1.tar + cd python-module-cherrypy-3.5.1 + /bin/chmod -c -Rf u+rwX,go-w . + rm -rf ../python3 + cp -a . ../python3 + install -pm644 /usr/share/python-sphinx/objects.inv ./ + '[' -e ./conf.py ']' + cp -u /usr/lib/python2.7/site-packages/sphinx/conf.py.template ./conf.py + ln -s ../objects.inv docs/ + exit 0 Executing(%build): /bin/sh -e /usr/src/tmp/rpm-tmp.67567 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd python-module-cherrypy-3.5.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/cherrypy copying cherrypy/_cpwsgi_server.py -> build/lib/cherrypy copying cherrypy/_cpwsgi.py -> build/lib/cherrypy copying cherrypy/_cptree.py -> build/lib/cherrypy copying cherrypy/_cptools.py -> build/lib/cherrypy copying cherrypy/_cpthreadinglocal.py -> build/lib/cherrypy copying cherrypy/_cpserver.py -> build/lib/cherrypy copying cherrypy/_cprequest.py -> build/lib/cherrypy copying cherrypy/_cpreqbody.py -> build/lib/cherrypy copying cherrypy/_cpnative_server.py -> build/lib/cherrypy copying cherrypy/_cpmodpy.py -> build/lib/cherrypy copying cherrypy/_cplogging.py -> build/lib/cherrypy copying cherrypy/_cperror.py -> build/lib/cherrypy copying cherrypy/_cpdispatch.py -> build/lib/cherrypy copying cherrypy/_cpconfig.py -> build/lib/cherrypy copying cherrypy/_cpcompat_subprocess.py -> build/lib/cherrypy copying cherrypy/_cpcompat.py -> build/lib/cherrypy copying cherrypy/_cpchecker.py -> build/lib/cherrypy copying cherrypy/__init__.py -> build/lib/cherrypy creating build/lib/cherrypy/lib copying cherrypy/lib/xmlrpcutil.py -> build/lib/cherrypy/lib copying cherrypy/lib/static.py -> build/lib/cherrypy/lib copying cherrypy/lib/sessions.py -> build/lib/cherrypy/lib copying cherrypy/lib/reprconf.py -> build/lib/cherrypy/lib copying cherrypy/lib/profiler.py -> build/lib/cherrypy/lib copying cherrypy/lib/locking.py -> build/lib/cherrypy/lib copying cherrypy/lib/lockfile.py -> build/lib/cherrypy/lib copying cherrypy/lib/jsontools.py -> build/lib/cherrypy/lib copying cherrypy/lib/httputil.py -> build/lib/cherrypy/lib copying cherrypy/lib/httpauth.py -> build/lib/cherrypy/lib copying cherrypy/lib/http.py -> build/lib/cherrypy/lib copying cherrypy/lib/gctools.py -> build/lib/cherrypy/lib copying cherrypy/lib/encoding.py -> build/lib/cherrypy/lib copying cherrypy/lib/cptools.py -> build/lib/cherrypy/lib copying cherrypy/lib/cpstats.py -> build/lib/cherrypy/lib copying cherrypy/lib/covercp.py -> build/lib/cherrypy/lib copying cherrypy/lib/caching.py -> build/lib/cherrypy/lib copying cherrypy/lib/auth_digest.py -> build/lib/cherrypy/lib copying cherrypy/lib/auth_basic.py -> build/lib/cherrypy/lib copying cherrypy/lib/auth.py -> build/lib/cherrypy/lib copying cherrypy/lib/__init__.py -> build/lib/cherrypy/lib creating build/lib/cherrypy/tutorial copying cherrypy/tutorial/tut10_http_errors.py -> build/lib/cherrypy/tutorial copying cherrypy/tutorial/tut09_files.py -> build/lib/cherrypy/tutorial copying cherrypy/tutorial/tut08_generators_and_yield.py -> build/lib/cherrypy/tutorial copying cherrypy/tutorial/tut07_sessions.py -> build/lib/cherrypy/tutorial copying cherrypy/tutorial/tut06_default_method.py -> build/lib/cherrypy/tutorial copying cherrypy/tutorial/tut05_derived_objects.py -> build/lib/cherrypy/tutorial copying cherrypy/tutorial/tut04_complex_site.py -> build/lib/cherrypy/tutorial copying cherrypy/tutorial/tut03_get_and_post.py -> build/lib/cherrypy/tutorial copying cherrypy/tutorial/tut02_expose_methods.py -> build/lib/cherrypy/tutorial copying cherrypy/tutorial/tut01_helloworld.py -> build/lib/cherrypy/tutorial copying cherrypy/tutorial/__init__.py -> build/lib/cherrypy/tutorial creating build/lib/cherrypy/test copying cherrypy/test/webtest.py -> build/lib/cherrypy/test copying cherrypy/test/test_xmlrpc.py -> build/lib/cherrypy/test copying cherrypy/test/test_wsgiapps.py -> build/lib/cherrypy/test copying cherrypy/test/test_wsgi_vhost.py -> build/lib/cherrypy/test copying cherrypy/test/test_wsgi_ns.py -> build/lib/cherrypy/test copying cherrypy/test/test_virtualhost.py -> build/lib/cherrypy/test copying cherrypy/test/test_tutorials.py -> build/lib/cherrypy/test copying cherrypy/test/test_tools.py -> build/lib/cherrypy/test copying cherrypy/test/test_static.py -> build/lib/cherrypy/test copying cherrypy/test/test_states.py -> build/lib/cherrypy/test copying cherrypy/test/test_sessionauthenticate.py -> build/lib/cherrypy/test copying cherrypy/test/test_session.py -> build/lib/cherrypy/test copying cherrypy/test/test_routes.py -> build/lib/cherrypy/test copying cherrypy/test/test_request_obj.py -> build/lib/cherrypy/test copying cherrypy/test/test_refleaks.py -> build/lib/cherrypy/test copying cherrypy/test/test_proxy.py -> build/lib/cherrypy/test copying cherrypy/test/test_objectmapping.py -> build/lib/cherrypy/test copying cherrypy/test/test_misc_tools.py -> build/lib/cherrypy/test copying cherrypy/test/test_mime.py -> build/lib/cherrypy/test copying cherrypy/test/test_logging.py -> build/lib/cherrypy/test copying cherrypy/test/test_json.py -> build/lib/cherrypy/test copying cherrypy/test/test_iterator.py -> build/lib/cherrypy/test copying cherrypy/test/test_httplib.py -> build/lib/cherrypy/test copying cherrypy/test/test_httpauth.py -> build/lib/cherrypy/test copying cherrypy/test/test_http.py -> build/lib/cherrypy/test copying cherrypy/test/test_etags.py -> build/lib/cherrypy/test copying cherrypy/test/test_encoding.py -> build/lib/cherrypy/test copying cherrypy/test/test_dynamicobjectmapping.py -> build/lib/cherrypy/test copying cherrypy/test/test_core.py -> build/lib/cherrypy/test copying cherrypy/test/test_conn.py -> build/lib/cherrypy/test copying cherrypy/test/test_config_server.py -> build/lib/cherrypy/test copying cherrypy/test/test_config.py -> build/lib/cherrypy/test copying cherrypy/test/test_compat.py -> build/lib/cherrypy/test copying cherrypy/test/test_caching.py -> build/lib/cherrypy/test copying cherrypy/test/test_bus.py -> build/lib/cherrypy/test copying cherrypy/test/test_auth_digest.py -> build/lib/cherrypy/test copying cherrypy/test/test_auth_basic.py -> build/lib/cherrypy/test copying cherrypy/test/sessiondemo.py -> build/lib/cherrypy/test copying cherrypy/test/modwsgi.py -> build/lib/cherrypy/test copying cherrypy/test/modpy.py -> build/lib/cherrypy/test copying cherrypy/test/modfcgid.py -> build/lib/cherrypy/test copying cherrypy/test/modfastcgi.py -> build/lib/cherrypy/test copying cherrypy/test/logtest.py -> build/lib/cherrypy/test copying cherrypy/test/helper.py -> build/lib/cherrypy/test copying cherrypy/test/checkerdemo.py -> build/lib/cherrypy/test copying cherrypy/test/benchmark.py -> build/lib/cherrypy/test copying cherrypy/test/_test_states_demo.py -> build/lib/cherrypy/test copying cherrypy/test/_test_decorators.py -> build/lib/cherrypy/test copying cherrypy/test/__init__.py -> build/lib/cherrypy/test creating build/lib/cherrypy/process copying cherrypy/process/wspbus.py -> build/lib/cherrypy/process copying cherrypy/process/win32.py -> build/lib/cherrypy/process copying cherrypy/process/servers.py -> build/lib/cherrypy/process copying cherrypy/process/plugins.py -> build/lib/cherrypy/process copying cherrypy/process/__init__.py -> build/lib/cherrypy/process creating build/lib/cherrypy/scaffold copying cherrypy/scaffold/__init__.py -> build/lib/cherrypy/scaffold creating build/lib/cherrypy/wsgiserver copying cherrypy/wsgiserver/wsgiserver2.py -> build/lib/cherrypy/wsgiserver copying cherrypy/wsgiserver/ssl_pyopenssl.py -> build/lib/cherrypy/wsgiserver copying cherrypy/wsgiserver/ssl_builtin.py -> build/lib/cherrypy/wsgiserver copying cherrypy/wsgiserver/__init__.py -> build/lib/cherrypy/wsgiserver running build_scripts creating build/scripts-2.7 copying and adjusting cherrypy/cherryd -> build/scripts-2.7 changing mode of build/scripts-2.7/cherryd from 644 to 755 + pushd ../python3 ~/RPM/BUILD/python3 ~/RPM/BUILD/python-module-cherrypy-3.5.1 + find -type f -name '*.py' -exec 2to3 -w '{}' + RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored ./setup.py RefactoringTool: Refactored ./release.py RefactoringTool: Refactored ./docs/util/test-doc.py RefactoringTool: Refactored ./docs/util/convert-trac.py RefactoringTool: Refactored ./docs/conf.py RefactoringTool: Refactored ./cherrypy/wsgiserver/wsgiserver3.py --- ./setup.py (original) +++ ./setup.py (refactored) @@ -145,7 +145,7 @@ def main(): if sys.version < required_python_version: s = "I'm sorry, but %s %s requires Python %s or later." - print(s % (name, version, required_python_version)) + print((s % (name, version, required_python_version))) sys.exit(1) # set default location for "data_files" to # platform specific "site-packages" location --- ./release.py (original) +++ ./release.py (refactored) @@ -5,7 +5,7 @@ python -m jaraco.packaging.release """ -from __future__ import print_function + import sys import os --- ./docs/util/test-doc.py (original) +++ ./docs/util/test-doc.py (refactored) @@ -1,9 +1,9 @@ -from __future__ import print_function + import sys import inspect import docutils.utils import docutils.parsers.rst -from StringIO import StringIO +from io import StringIO def print_with_line_numbers(block): --- ./docs/util/convert-trac.py (original) +++ ./docs/util/convert-trac.py (refactored) @@ -11,14 +11,14 @@ source. """ -from __future__ import print_function + import sys import re import inspect import optparse import shutil -import urllib2 -from StringIO import StringIO +import urllib.request, urllib.error, urllib.parse +from io import StringIO def get_options(): @@ -65,7 +65,7 @@ def indent(block): add_indent = lambda s: ' ' + s lines = StringIO(block) - i_lines = map(add_indent, lines) + i_lines = list(map(add_indent, lines)) return ''.join(i_lines) @@ -101,7 +101,7 @@ replacements = [remove_2x_compat_notes] + \ [func for name, - func in globals().items() if name.startswith('replace_')] + func in list(globals().items()) if name.startswith('replace_')] def normalize_linebreaks(text): @@ -111,7 +111,7 @@ def convert_file(): filename = options.filename if options.url: - text = urllib2.urlopen(options.url).read() + text = urllib.request.urlopen(options.url).read() text = normalize_linebreaks(text) else: shutil.copy(filename, filename + '.bak') --- ./docs/conf.py (original) +++ ./docs/conf.py (refactored) @@ -47,8 +47,8 @@ master_doc = 'index' # General information about the project. -project = u'CherryPy' -copyright = u'2014, CherryPy Team' +project = 'CherryPy' +copyright = '2014, CherryPy Team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -206,8 +206,8 @@ # (source start file, target name, title, author, # documentclass [howto/manual]). latex_documents = [ - ('index', 'CherryPy.tex', u'CherryPy Documentation', - u'CherryPy Team', 'manual'), + ('index', 'CherryPy.tex', 'CherryPy Documentation', + 'CherryPy Team', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of --- ./cherrypy/wsgiserver/wsgiserver3.py (original) +++ ./cherrypy/wsgiserver/wsgiserver3.py (refactored) @@ -81,7 +81,7 @@ try: import queue except: - import Queue as queue + import queue as queue import re import email.utils import socket @@ -104,7 +104,7 @@ if sys.version_info >= (3, 0): bytestr = bytes unicodestr = str - basestring = (bytes, str) + str = (bytes, str) def ntob(n, encoding='ISO-8859-1'): """Return the given native string as a byte string in the given @@ -114,8 +114,8 @@ return n.encode(encoding) else: bytestr = str - unicodestr = unicode - basestring = basestring + unicodestr = str + str = str def ntob(n, encoding='ISO-8859-1'): """Return the given native string as a byte string in the given @@ -305,8 +305,8 @@ self._check_length() return data - def next(self): - data = self.rfile.next() + def __next__(self): + data = next(self.rfile) self.bytes_read += len(data) self._check_length() return data @@ -1524,20 +1524,20 @@ 'Threads Idle': lambda s: getattr(self.requRefactoringTool: Refactored ./cherrypy/wsgiserver/wsgiserver2.py ests, "idle", None), 'Socket Errors': 0, 'Requests': lambda s: (not s['Enabled']) and -1 or sum( - [w['Requests'](w) for w in s['Worker Threads'].values()], 0), + [w['Requests'](w) for w in list(s['Worker Threads'].values())], 0), 'Bytes Read': lambda s: (not s['Enabled']) and -1 or sum( - [w['Bytes Read'](w) for w in s['Worker Threads'].values()], 0), + [w['Bytes Read'](w) for w in list(s['Worker Threads'].values())], 0), 'Bytes Written': lambda s: (not s['Enabled']) and -1 or sum( - [w['Bytes Written'](w) for w in s['Worker Threads'].values()], + [w['Bytes Written'](w) for w in list(s['Worker Threads'].values())], 0), 'Work Time': lambda s: (not s['Enabled']) and -1 or sum( - [w['Work Time'](w) for w in s['Worker Threads'].values()], 0), + [w['Work Time'](w) for w in list(s['Worker Threads'].values())], 0), 'Read Throughput': lambda s: (not s['Enabled']) and -1 or sum( [w['Bytes Read'](w) / (w['Work Time'](w) or 1e-6) - for w in s['Worker Threads'].values()], 0), + for w in list(s['Worker Threads'].values())], 0), 'Write Throughput': lambda s: (not s['Enabled']) and -1 or sum( [w['Bytes Written'](w) / (w['Work Time'](w) or 1e-6) - for w in s['Worker Threads'].values()], 0), + for w in list(s['Worker Threads'].values())], 0), 'Worker Threads': {}, } logging.statistics["CherryPy HTTPServer %d" % id(self)] = self.stats @@ -1597,7 +1597,7 @@ self.software = "%s Server" % self.version # Select the appropriate socket - if isinstance(self.bind_addr, basestring): + if isinstance(self.bind_addr, str): # AF_UNIX socket # So we can reuse the socket... @@ -1750,7 +1750,7 @@ conn = self.ConnectionClass(self, s, makefile) - if not isinstance(self.bind_addr, basestring): + if not isinstance(self.bind_addr, str): # optional values # Until we do DNS lookups, omit REMOTE_HOST if addr is None: # sometimes this can happen @@ -1819,7 +1819,7 @@ sock = getattr(self, "socket", None) if sock: - if not isinstance(self.bind_addr, basestring): + if not isinstance(self.bind_addr, str): # Touch our own socket to make accept() return immediately. try: host, port = sock.getsockname()[:2] @@ -1880,7 +1880,7 @@ def get_ssl_adapter_class(name='builtin'): """Return an SSL adapter class for the given name.""" adapter = ssl_adapters[name.lower()] - if isinstance(adapter, basestring): + if isinstance(adapter, str): last_dot = adapter.rfind(".") attr_name = adapter[last_dot + 1:] mod_path = adapter[:last_dot] @@ -2079,7 +2079,7 @@ 'wsgi.url_scheme': req.scheme.decode('ISO-8859-1'), 'wsgi.version': (1, 0), } - if isinstance(req.server.bind_addr, basestring): + if isinstance(req.server.bind_addr, str): # AF_UNIX. This isn't really allowed by WSGI, which doesn't # address unix domain sockets. But it's better than nothing. env["SERVER_PORT"] = "" @@ -2087,7 +2087,7 @@ env["SERVER_PORT"] = str(req.server.bind_addr[1]) # Request headers - for k, v in req.inheaders.items(): + for k, v in list(req.inheaders.items()): k = k.decode('ISO-8859-1').upper().replace("-", "_") env["HTTP_" + k] = v.decode('ISO-8859-1') --- ./cherrypy/wsgiserver/wsgiserver2.py (original) +++ ./cherrypy/wsgiserver/wsgiserver2.py (refactored) @@ -78,10 +78,11 @@ 'WSGIPathInfoDispatcher', 'get_ssl_adapter_class'] import os +from functools import reduce try: import queue except: - import Queue as queue + import queue as queue import re import rfc822 import socket @@ -92,9 +93,9 @@ if not hasattr(socket, 'IPV6_V6ONLY'): socket.IPV6_V6ONLY = 27 try: - import cStringIO as StringIO + import io as StringIO except ImportError: - import StringIO + import io DEFAULT_BUFFER_SIZE = -1 @@ -106,7 +107,7 @@ pass _fileobject_uses_str_type = isinstance( - socket._fileobject(FauxSocket())._rbuf, basestring) + socket._fileobject(FauxSocket())._rbuf, str) del FauxSocket # this class is not longer required for anything. import threading @@ -124,13 +125,13 @@ import operator -from urllib import unquote +from urllib.parse import unquote import warnings if sys.version_info >= (3, 0): bytestr = bytes unicodestr = str - basestring = (bytes, str) + str = (bytes, str) def ntob(n, encoding='ISO-8859-1'): """Return the given native string as a byte string in the given @@ -140,8 +141,8 @@ return n.encode(encoding) else: bytestr = str - unicodestr = unicode - basestring = basestring + unicodestr = str + str = str def ntob(n, encoding='ISO-8859-1'): """Return the given native string as a byte string in the given @@ -331,8 +332,8 @@ self._check_length() return data - def next(self): - data = self.rfile.next() + def __next__(self): + data = next(self.rfile) self.bytes_read += len(data) self._check_length() return data @@ -1009,7 +1010,7 @@ try: bytes_sent = self.send(data) data = data[bytes_sent:] - except socket.error, e: + except socket.error as e: if e.args[0] not in socket_errors_nonblocking: raise @@ -1030,7 +1031,7 @@ data = self._sock.recv(size) self.bytes_read += len(data) return data - except socket.error, e: + except socket.error as e: if (e.args[0] not in socket_errors_nonblocking and e.args[0] not in socket_error_eintr): raise @@ -1051,7 +1052,7 @@ if size < 0: # Read until EOF # reset _rbuf. we consume it via buf. - self._rbuf = StringIO.StringIO() + self._rbuf = io.StringIO() while True: data = self.recv(rbufsize) if not data: @@ -1066,12 +1067,12 @@ # return. buf.seek(0) rv = buf.read(size) - self._rbuf = StringIO.StringIO() + self._rbuf = io.StringIO() self._rbuf.write(buf.read()) return rv # reset _rbuf. we consume it via buf. - self._rbuf = StringIO.StringIO() + self._rbuf = io.StringIO() while True: left = size - buf_len # recv() will malloc the amount of memory given as its @@ -1109,7 +1110,7 @@ buf.seek(0) bline = buf.readline(size) if bline.endswith('\n') or len(bline) == size: - self._rbuf = StringIO.StringIO() + self._rbuf = io.StringIO() self._rbuf.write(buf.read()) return bline del bline @@ -1120,7 +1121,7 @@ buf.seek(0) buffers = [buf.read()] # reset _rbuf. we consume it via buf. - self._rbuf = StringIO.StringIO() + self._rbuf = io.StringIO() data = None recv = self.recv while data != "\n": @@ -1132,7 +1133,7 @@ buf.seek(0, 2) # seek end # reset _rbuf. we consume it via buf. - self._rbuf = StringIO.StringIO() + self._rbuf = io.StringIO() while True: data = self.recv(self._rbufsize) if not data: @@ -1154,11 +1155,11 @@ if buf_len >= size: buf.seek(0) rv = buf.read(size) - self._rbuf = StringIO.StringIO() + self._rbuf = io.StringIO() self._rbuf.write(buf.read()) return rv # reset _rbuf. we consume it via buf. - self._rbuf = StringIO.StringIO() + self._rbuf = io.StringIO() while True: data = self.recv(self._rbufsize) if not data: @@ -1812,20 +1813,20 @@ 'Threads Idle': lambda s: getattr(self.requests, "idle", None), 'Socket Errors': 0, 'Requests': lambda s: (not s['Enabled']) and -1 or sum( - [w['Requests'](w) for w in s['Worker Threads'].values()], 0), + [w['Requests'](w) for w in list(s['Worker Threads'].values())], 0), 'Bytes Read': lambda s: (not s['Enabled']) and -1 or sum( - [w['Bytes Read'](w) for w in s['Worker Threads'].values()], 0), + [w['Bytes Read'](w) for w in list(s['Worker Threads'].values())], 0), 'Bytes Written': lambda s: (not s['Enabled']) and -1 or sum( - [w['Bytes Written'](w) for w in s['Worker Threads'].values()], + [w['Bytes Written'](w) for w in list(s['Worker Threads'].values())], 0), 'Work Time': lambda s: (not s['Enabled']) and -1 or sum( - [w['Work Time'](w) for w in s['Worker Threads'].values()], 0), + [w['Work Time'](w) for w in list(s['Worker Threads'].values())], 0), 'Read Throughput': lambda s: (not s['Enabled']) and -1 or sum( [w['Bytes Read'](w) / (w['Work Time'](w) or 1e-6) - for w in s['Worker Threads'].values()], 0), + for w in list(s['Worker Threads'].values())], 0), 'Write Throughput': lambda s: (not s['Enabled']) and -1 or sum( [w['Bytes Written'](w) / (w['Work Time'](w) or 1e-6) - for w in s['Worker Threads'].values()], 0), + for w in list(s['Worker Threads'].values())], 0), 'Worker Threads': {}, } logging.statistics["CherryPy HTTPServer %d" % id(self)] = self.stats @@ -1904,7 +1905,7 @@ getattr(self, 'ssl_certificate_chain', None)) # Select the appropriate socket - if isinstance(self.bind_addr, basestring): + if isinstance(self.bind_addr, str): # AF_UNIX socket # So we can reuse the socket... @@ -1944,7 +1945,7 @@ af, socktype, proto, canonname, sa = res try: self.bind(af, socktype, proto) - except socket.error, serr: + except socket.error as serr: msg = "%s -- (%s: %s)" % (msg, sa, serr) if self.socket: self.socket.close() @@ -2058,7 +2059,7 @@ conn = self.ConnectionClass(self, s, makefile) - if not isinstance(self.bind_addr, basestring): + if not isinstance(self.bind_addr, str): # optional values # Until we do DNS lookups, omit REMOTE_HOST if addr is None: # sometimes this can happen @@ -2127,7 +2128,7 @@ sock = getattr(self, "socket", None) if sock: - if not isinstance(self.bind_addr, basestring): + if not isinstance(self.bind_addr, str): # Touch our own socket to make accept() return immediately. try: host, port = sock.getsockname()[:2] @@ -2189,7 +2190,7 @@ def get_ssl_adapter_class(name='pyopenssl'): """Return an SSL adapter class for the given name.""" adapter = ssl_adapters[name.lower()] - if isinstance(adapter,RefactoringTool: Refactored ./cherrypy/wsgiserver/ssl_pyopenssl.py RefactoringTool: No changes to ./cherrypy/wsgiserver/ssl_builtin.py RefactoringTool: Refactored ./cherrypy/wsgiserver/__init__.py RefactoringTool: No changes to ./cherrypy/tutorial/tut10_http_errors.py RefactoringTool: No changes to ./cherrypy/tutorial/tut09_files.py RefactoringTool: No changes to ./cherrypy/tutorial/tut08_generators_and_yield.py RefactoringTool: No changes to ./cherrypy/tutorial/tut07_sessions.py RefactoringTool: No changes to ./cherrypy/tutorial/tut06_default_method.py RefactoringTool: No changes to ./cherrypy/tutorial/tut05_derived_objects.py RefactoringTool: No changes to ./cherrypy/tutorial/tut04_complex_site.py RefactoringTool: No changes to ./cherrypy/tutorial/tut03_get_and_post.py RefactoringTool: No changes to ./cherrypy/tutorial/tut02_expose_methods.py RefactoringTool: No changes to ./cherrypy/tutorial/tut01_helloworld.py RefactoringTool: Refactored ./cherrypy/test/webtest.py basestring): + if isinstance(adapter, str): last_dot = adapter.rfind(".") attr_name = adapter[last_dot + 1:] mod_path = adapter[:last_dot] @@ -2295,7 +2296,7 @@ # exc_info tuple." if self.req.sent_headers: try: - raise exc_info[0], exc_info[1], exc_info[2] + raise exc_info[0](exc_info[1]).with_traceback(exc_info[2]) finally: exc_info = None @@ -2381,7 +2382,7 @@ 'wsgi.version': (1, 0), } - if isinstance(req.server.bind_addr, basestring): + if isinstance(req.server.bind_addr, str): # AF_UNIX. This isn't really allowed by WSGI, which doesn't # address unix domain sockets. But it's better than nothing. env["SERVER_PORT"] = "" @@ -2389,7 +2390,7 @@ env["SERVER_PORT"] = str(req.server.bind_addr[1]) # Request headers - for k, v in req.inheaders.iteritems(): + for k, v in req.inheaders.items(): env["HTTP_" + k.upper().replace("-", "_")] = v # CONTENT_TYPE/CONTENT_LENGTH @@ -2419,19 +2420,19 @@ req = self.req env_10 = WSGIGateway_10.get_environ(self) env = dict([(k.decode('ISO-8859-1'), v) - for k, v in env_10.iteritems()]) - env[u'wsgi.version'] = ('u', 0) + for k, v in env_10.items()]) + env['wsgi.version'] = ('u', 0) # Request-URI - env.setdefault(u'wsgi.url_encoding', u'utf-8') + env.setdefault('wsgi.url_encoding', 'utf-8') try: - for key in [u"PATH_INFO", u"SCRIPT_NAME", u"QUERY_STRING"]: - env[key] = env_10[str(key)].decode(env[u'wsgi.url_encoding']) + for key in ["PATH_INFO", "SCRIPT_NAME", "QUERY_STRING"]: + env[key] = env_10[str(key)].decode(env['wsgi.url_encoding']) except UnicodeDecodeError: # Fall back to latin 1 so apps can transcode if needed. - env[u'wsgi.url_encoding'] = u'ISO-8859-1' - for key in [u"PATH_INFO", u"SCRIPT_NAME", u"QUERY_STRING"]: - env[key] = env_10[str(key)].decode(env[u'wsgi.url_encoding']) + env['wsgi.url_encoding'] = 'ISO-8859-1' + for key in ["PATH_INFO", "SCRIPT_NAME", "QUERY_STRING"]: + env[key] = env_10[str(key)].decode(env['wsgi.url_encoding']) for k, v in sorted(env.items()): if isinstance(v, str) and k not in ('REQUEST_URI', 'wsgi.input'): --- ./cherrypy/wsgiserver/ssl_pyopenssl.py (original) +++ ./cherrypy/wsgiserver/ssl_pyopenssl.py (refactored) @@ -68,7 +68,7 @@ time.sleep(self.ssl_retry) except SSL.WantWriteError: time.sleep(self.ssl_retry) - except SSL.SysCallError, e: + except SSL.SysCallError as e: if is_reader and e.args == (-1, 'Unexpected EOF'): return "" @@ -76,7 +76,7 @@ if is_reader and errnum in wsgiserver.socket_errors_to_ignore: return "" raise socket.error(errnum) - except SSL.Error, e: + except SSL.Error as e: if is_reader and e.args == (-1, 'Unexpected EOF'): return "" --- ./cherrypy/wsgiserver/__init__.py (original) +++ ./cherrypy/wsgiserver/__init__.py (refactored) @@ -8,7 +8,7 @@ import sys if sys.version_info < (3, 0): - from wsgiserver2 import * + from .wsgiserver2 import * else: # Le sigh. Boo for backward-incompatible syntax. exec('from .wsgiserver3 import *') --- ./cherrypy/test/webtest.py (original) +++ ./cherrypy/test/webtest.py (refactored) @@ -27,7 +27,7 @@ from unittest import * from unittest import _TextTestResult -from cherrypy._cpcompat import basestring, ntob, py3k, HTTPConnection +from cherrypy._cpcompat import str, ntob, py3k, HTTPConnection from cherrypy._cpcompat import HTTPSConnection, unicodestr @@ -124,14 +124,14 @@ if isinstance(obj, types.ModuleTyRefactoringTool: Refactored ./cherrypy/test/test_xmlrpc.py RefactoringTool: Refactored ./cherrypy/test/test_wsgiapps.py pe): return self.loadTestsFromModule(obj) elif (((py3k and isinstance(obj, type)) - or isinstance(obj, (type, types.ClassType))) + or isinstance(obj, type)) and issubclass(obj, TestCase)): return self.loadTestsFromTestCase(obj) elif isinstance(obj, types.UnboundMethodType): if py3k: return obj.__self__.__class__(obj.__name__) else: - return obj.im_class(obj.__name__) + return obj.__self__.__class__(obj.__name__) elif hasattr(obj, '__call__'): test = obj() if not isinstance(test, TestCase) and \ @@ -269,7 +269,7 @@ def _handlewebError(self, msg): print("") - print(" ERROR: %s" % msg) + print((" ERROR: %s" % msg)) if not self.interactive: raise self.failureException(msg) @@ -285,7 +285,7 @@ i = i.decode('ascii') if i not in "BHSUIRX": continue - print(i.upper()) # Also prints new line + print((i.upper())) # Also prints new line if i == "B": for x, line in enumerate(self.body.splitlines()): if (x + 1) % self.console_height == 0: @@ -300,9 +300,9 @@ elif i == "H": pprint.pprint(self.headers) elif i == "S": - print(self.status) + print((self.status)) elif i == "U": - print(self.url) + print((self.url)) elif i == "I": # return without raising the normal exception return @@ -318,7 +318,7 @@ def assertStatus(self, status, msg=None): """Fail if self.status != status.""" - if isinstance(status, basestring): + if isinstance(status, str): if not self.status == status: if msg is None: msg = 'Status (%r) != %r' % (self.status, status) @@ -333,7 +333,7 @@ # status is a tuple or list. match = False for s in status: - if isinstance(s, basestring): + if isinstance(s, str): if self.status == s: match = True break @@ -376,7 +376,7 @@ def assertHeaderItemValue(self, key, value, msg=None): """Fail if the header does not contain the specified value""" actual_value = self.assertHeader(key, msg=msg) - header_values = map(str.strip, actual_value.split(',')) + header_values = list(map(str.strip, actual_value.split(','))) if value in header_values: return value @@ -604,5 +604,5 @@ else: ServerError.on = True print("") - print("".join(traceback.format_exception(*exc))) + print(("".join(traceback.format_exception(*exc)))) return True --- ./cherrypy/test/test_xmlrpc.py (original) +++ ./cherrypy/test/test_xmlrpc.py (refactored) @@ -2,8 +2,8 @@ from cherrypy._cpcompat import py3k try: - from xmlrpclib import DateTime, Fault, ProtocolError, ServerProxy - from xmlrpclib import SafeTransport + from xmlrpc.client import DateTime, Fault, ProtocolError, ServerProxy + from xmlrpc.client import SafeTransport except ImportError: from xmlrpc.client import DateTime, Fault, ProtocolError, ServerProxy from xmlrpc.client import SafeTransport --- ./cherrypy/test/test_wsgiapps.py (original) +++ ./cherrypy/test/test_wsgiapps.py (refactored) @@ -46,7 +46,7 @@ return next(self.iter) else: def next(self): - return self.iter.next() + return next(self.iter) def close(self): if hasattr(self.appresults, "close"): @@ -69,7 +69,7 @@ return bytes(line) else: def next(this): - line = RefactoringTool: No changes to ./cherrypy/test/test_wsgi_vhost.py RefactoringTool: Refactored ./cherrypy/test/test_wsgi_ns.py RefactoringTool: No changes to ./cherrypy/test/test_virtualhost.py RefactoringTool: No changes to ./cherrypy/test/test_tutorials.py RefactoringTool: Refactored ./cherrypy/test/test_tools.py RefactoringTool: No changes to ./cherrypy/test/test_static.py RefactoringTool: Refactored ./cherrypy/test/test_states.py RefactoringTool: No changes to ./cherrypy/test/test_sessionauthenticate.py RefactoringTool: No changes to ./cherrypy/test/test_session.py RefactoringTool: No changes to ./cherrypy/test/test_routes.py RefactoringTool: Refactored ./cherrypy/test/test_request_obj.py RefactoringTool: No changes to ./cherrypy/test/test_refleaks.py RefactoringTool: No changes to ./cherrypy/test/test_proxy.py RefactoringTool: No changes to ./cherrypy/test/test_objectmapping.py RefactoringTool: Refactored ./cherrypy/test/test_misc_tools.py list(this.iter.next()) + line = list(next(this.iter)) line.reverse() return "".join(line) --- ./cherrypy/test/test_wsgi_ns.py (original) +++ ./cherrypy/test/test_wsgi_ns.py (refactored) @@ -16,8 +16,8 @@ def __iter__(self): return self - def next(self): - return self.iter.next() + def __next__(self): + return next(self.iter) def __next__(self): return next(self.iter) @@ -37,8 +37,8 @@ class CaseResults(WSGIResponse): - def next(this): - return getattr(this.iter.next(), self.to)() + def __next__(this): + return getattr(next(this.iter), self.to)() def __next__(this): return getattr(next(this.iter), self.to)() @@ -55,15 +55,15 @@ class ReplaceResults(WSGIResponse): - def next(this): - line = this.iter.next() - for k, v in self.map.iteritems(): + def __next__(this): + line = next(this.iter) + for k, v in self.map.items(): line = line.replace(k, v) return line def __next__(this): line = next(this.iter) - for k, v in self.map.items(): + for k, v in list(self.map.items()): line = line.replace(k, v) return line return ReplaceResults(res) --- ./cherrypy/test/test_tools.py (original) +++ ./cherrypy/test/test_tools.py (refactored) @@ -207,7 +207,7 @@ return "success!" def stream(self, id=None): - for x in xrange(100000000): + for x in range(100000000): yield str(x) stream._cp_config = {'response.stream': True} --- ./cherrypy/test/test_states.py (original) +++ ./cherrypy/test/test_states.py (refactored) @@ -210,7 +210,7 @@ except BadStatusLine: pass else: - print(self.body) + print((self.body)) self.fail("AssertionError: BadStatusLine not raised") engine.block() --- ./cherrypy/test/test_request_obj.py (original) +++ ./cherrypy/test/test_request_obj.py (refactored) @@ -41,7 +41,7 @@ """ def __init__(cls, name, bases, dct): type.__init__(cls, name, bases, dct) - for value in dct.values(): + for value in list(dct.values()): if isinstance(value, types.FunctionType): value.exposed = True setattr(root, name.lower(), cls()) @@ -257,7 +257,7 @@ def index(self): yield "

Choose your document

\n" yield "