86>Aug 1 11:19:51 userdel[2637591]: delete user 'rooter'
<86>Aug 1 11:19:51 userdel[2637591]: removed group 'rooter' owned by 'rooter'
<86>Aug 1 11:19:51 userdel[2637591]: removed shadow group 'rooter' owned by 'rooter'
<86>Aug 1 11:19:51 groupadd[2637596]: group added to /etc/group: name=rooter, GID=639
<86>Aug 1 11:19:51 groupadd[2637596]: group added to /etc/gshadow: name=rooter
<86>Aug 1 11:19:51 groupadd[2637596]: new group: name=rooter, GID=639
<86>Aug 1 11:19:51 useradd[2637600]: new user: name=rooter, UID=639, GID=639, home=/root, shell=/bin/bash
<86>Aug 1 11:19:51 userdel[2637609]: delete user 'builder'
<86>Aug 1 11:19:51 userdel[2637609]: removed group 'builder' owned by 'builder'
<86>Aug 1 11:19:51 userdel[2637609]: removed shadow group 'builder' owned by 'builder'
<86>Aug 1 11:19:51 groupadd[2637618]: group added to /etc/group: name=builder, GID=640
<86>Aug 1 11:19:51 groupadd[2637618]: group added to /etc/gshadow: name=builder
<86>Aug 1 11:19:51 groupadd[2637618]: new group: name=builder, GID=640
<86>Aug 1 11:19:51 useradd[2637622]: new user: name=builder, UID=640, GID=640, home=/usr/src, shell=/bin/bash
<13>Aug 1 11:19:55 rpmi: libgdbm-1.8.3-alt10 1454943334 installed
<13>Aug 1 11:19:55 rpmi: libexpat-2.2.10-alt1 p9+261554.100.1.1 1605103337 installed
<13>Aug 1 11:19:55 rpmi: libp11-kit-0.23.15-alt2 p9+254920.2400.19.1 1601385903 installed
<13>Aug 1 11:19:55 rpmi: libtasn1-4.14-alt1 p9+235792.100.2.1 1565425233 installed
<13>Aug 1 11:19:55 rpmi: rpm-macros-alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed
<13>Aug 1 11:19:55 rpmi: alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed
<13>Aug 1 11:19:55 rpmi: ca-certificates-2020.06.29-alt1 p9+258899.100.3.1 1601998604 installed
<13>Aug 1 11:19:55 rpmi: ca-trust-0.1.2-alt1 p9+233349.100.1.1 1561655062 installed
<13>Aug 1 11:19:55 rpmi: p11-kit-trust-0.23.15-alt2 p9+254920.2400.19.1 1601385903 installed
<13>Aug 1 11:19:55 rpmi: libcrypto1.1-1.1.1k-alt1 p9+268376.100.3.1 1616721011 installed
<13>Aug 1 11:19:55 rpmi: libssl1.1-1.1.1k-alt1 p9+268376.100.3.1 1616721011 installed
<13>Aug 1 11:19:55 rpmi: python3-3.7.4-alt3 p9+249932.100.2.1 1587127349 installed
<13>Aug 1 11:19:55 rpmi: libpython3-3.7.4-alt3 p9+249932.100.2.1 1587127349 installed
<13>Aug 1 11:19:56 rpmi: python3-base-3.7.4-alt3 p9+249932.100.2.1 1587127349 installed
<13>Aug 1 11:19:56 rpmi: tests-for-installed-python3-pkgs-0.1.13.1-alt2 1535450458 installed
<13>Aug 1 11:19:56 rpmi: rpm-build-python3-0.1.13.1-alt2 1535450458 installed
<13>Aug 1 11:19:56 rpmi: rpm-macros-sphinx-1:1.6.5-alt8 p9+250806.100.2.1 1588178467 installed
<13>Aug 1 11:20:01 rpmi: python-module-repoze-2.2-alt4.git20140327 sisyphus+228552.100.1.2 1556748368 installed
<13>Aug 1 11:20:01 rpmi: python-module-sphinxcontrib-2.1.1-alt2.1.2 sisyphus+227529.1100.1.2 1555924423 installed
<13>Aug 1 11:20:01 rpmi: libsqlite3-3.33.0-alt1 p9+258834.40.2.1 1601365057 installed
<13>Aug 1 11:20:01 rpmi: python3-module-pkg_resources-1:40.8.0-alt2 sisyphus+229158.200.2.1 1557735221 installed
<13>Aug 1 11:20:01 rpmi: python-module-imagesize-1.1.0-alt1 sisyphus+229015.100.2.1 1557233756 installed
<13>Aug 1 11:20:01 rpmi: python-sphinx-objects.inv-1:2.3.8.20190514-alt1 p9+229421.100.1.1 1557927689 installed
<13>Aug 1 11:20:01 rpmi: python-module-google-0.4.2-alt2.1 sisyphus+228356.1500.3.1 1556633057 installed
<13>Aug 1 11:20:01 rpmi: python-module-markupsafe-1.1.1-alt1 p9+254838.60.14.1 1602882139 installed
<13>Aug 1 11:20:01 rpmi: python-module-enum34-1.1.6-alt3 1527251693 installed
<13>Aug 1 11:20:01 rpmi: libxapian-1.4.15-alt1 p9+258827.100.1.1 1601305423 installed
<13>Aug 1 11:20:01 rpmi: libgpg-error-1.36-alt1 p9+261942.140.4.1 1606237675 installed
<13>Aug 1 11:20:01 rpmi: libgcrypt20-1.8.5-alt3 p9+261942.200.4.1 1606237923 installed
<13>Aug 1 11:20:01 rpmi: libxslt-1.1.34-alt1.p9.1 p9+261811.300.3.1 1605513919 installed
<13>Aug 1 11:20:01 rpmi: python-modules-curses-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:01 rpmi: libtinfo-devel-6.1.20180407-alt2 sisyphus+222164.200.1.1 1550686226 installed
<13>Aug 1 11:20:01 rpmi: libncurses-devel-6.1.20180407-alt2 sisyphus+222164.200.1.1 1550686226 installed
<13>Aug 1 11:20:01 rpmi: python3-dev-3.7.4-alt3 p9+249932.100.2.1 1587127349 installed
<13>Aug 1 11:20:02 rpmi: libverto-0.3.0-alt1_7 sisyphus+225932.100.1.1 1553994919 installed
<13>Aug 1 11:20:02 rpmi: libkeyutils-1.6-alt2 sisyphus+226520.100.2.1 1554512089 installed
<13>Aug 1 11:20:02 rpmi: libcom_err-1.44.6-alt1 sisyphus+224154.100.1.1 1552091678 installed
<86>Aug 1 11:20:02 groupadd[2648014]: group added to /etc/group: name=_keytab, GID=499
<86>Aug 1 11:20:02 groupadd[2648014]: group added to /etc/gshadow: name=_keytab
<86>Aug 1 11:20:02 groupadd[2648014]: new group: name=_keytab, GID=499
<13>Aug 1 11:20:02 rpmi: libkrb5-1.17.2-alt2 p9+280683.100.2.1 1627489307 installed
<13>Aug 1 11:20:02 rpmi: libtirpc-1.0.3-alt1 1532008017 installed
<13>Aug 1 11:20:02 rpmi: libnsl2-1.1.0-alt1_1 1511548749 installed
<13>Aug 1 11:20:02 rpmi: python-modules-compiler-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:02 rpmi: python-modules-email-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:02 rpmi: python-modules-unittest-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:02 rpmi: python-modules-encodings-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:02 rpmi: python-modules-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:02 rpmi: python-modules-nis-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:02 rpmi: python-module-six-1.12.0-alt1 sisyphus+219665.100.2.1 1548148570 installed
<13>Aug 1 11:20:02 rpmi: python-module-pkg_resources-1:40.8.0-alt2 sisyphus+229158.200.2.1 1557735221 installed
<13>Aug 1 11:20:02 rpmi: python-modules-xml-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:02 rpmi: python-modules-ctypes-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:02 rpmi: python-modules-json-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:02 rpmi: python-module-jinja2-2.11.2-alt1 p9+254838.40.14.1 1602882082 installed
<13>Aug 1 11:20:02 rpmi: python-modules-multiprocessing-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:02 rpmi: python-modules-logging-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:02 rpmi: python-modules-hotshot-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:02 rpmi: python-module-chardet-3.0.4-alt1 sisyphus+227476.1700.1.2 1555756717 installed
<13>Aug 1 11:20:02 rpmi: python-tools-2to3-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:03 rpmi: python-module-whoosh-2.7.4-alt1 1527697941 installed
<13>Aug 1 11:20:03 rpmi: python-module-webencodings-0.5.1-alt1.1 1517943573 installed
<13>Aug 1 11:20:03 rpmi: python-module-webob-1.8.5-alt1 sisyphus.219072.100 1547030251 installed
<13>Aug 1 11:20:03 rpmi: python-modules-bsddb-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:03 rpmi: python-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:03 rpmi: python-strict-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003646 installed
<13>Aug 1 11:20:03 rpmi: python-modules-distutils-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:03 rpmi: python-module-pycparser-2.19-alt1 sisyphus+228366.1000.2.3 1556706938 installed
<13>Aug 1 11:20:03 rpmi: python-module-cffi-1.12.3-alt1 sisyphus+229040.200.3.1 1557316452 installed
<13>Aug 1 11:20:03 rpmi: python-module-asn1crypto-0.24.0-alt1 sisyphus+227473.1300.1.2 1555756512 installed
<13>Aug 1 11:20:03 rpmi: python-module-PyStemmer-1.0.1-alt1.2.1 1321388303 installed
<13>Aug 1 11:20:03 rpmi: python-module-snowballstemmer-1.2.0-alt2.1 1457859319 installed
<13>Aug 1 11:20:03 rpmi: python-module-cssselect-0.9.1-alt1.2 sisyphus+227479.1100.1.2 1555757152 installed
<13>Aug 1 11:20:03 rpmi: python-module-html5lib-1:0.999999999-alt4.qa1 sisyphus+227493.600.1.3 1555835341 installed
<13>Aug 1 11:20:03 rpmi: python-module-lxml-4.4.2-alt1 p9+244111.100.1.1 1578758819 installed
<13>Aug 1 11:20:03 rpmi: python-module-docutils-0.14-alt2 1535729778 installed
<13>Aug 1 11:20:03 rpmi: python-module-idna-2.8-alt1 sisyphus+227494.400.1.3 1555838720 installed
<13>Aug 1 11:20:03 rpmi: python-module-ntlm-1.1.0-alt1.2 sisyphus+228512.100.1.1 1556654575 installed
<13>Aug 1 11:20:03 rpmi: python-module-pytz-1:2016.10-alt1 1484291011 installed
<13>Aug 1 11:20:04 rpmi: python-module-babel-1:2.6.0-alt1 sisyphus+228351.2400.6.2 1556652168 installed
<13>Aug 1 11:20:04 rpmi: python-module-ipaddress-1.0.18-alt1.1 sisyphus+227494.1700.1.3 1555839523 installed
<13>Aug 1 11:20:04 rpmi: python-module-cryptography-2.6.1-alt1 sisyphus+225625.24400.91.1 1555298600 installed
<13>Aug 1 11:20:04 rpmi: python-module-OpenSSL-18.0.0-alt1 1532996168 installed
<13>Aug 1 11:20:04 rpmi: python-module-simplejson-3.15.0-alt1.qa1 sisyphus+225625.16100.91.1 1555292381 installed
<13>Aug 1 11:20:04 rpmi: python-module-ndg-0.4.2-alt1.qa1 sisyphus+227504.1300.1.2 1555853234 installed
<13>Aug 1 11:20:04 rpmi: python-module-ndg-httpsclient-0.4.2-alt1.qa1 sisyphus+227504.1300.1.2 1555853234 installed
<13>Aug 1 11:20:04 rpmi: python-module-backports-3.5.0.1-alt1.1.1 1517645428 installed
<13>Aug 1 11:20:04 rpmi: python-module-backports.ssl_match_hostname-3.5.0.1-alt1.1.1 1517645428 installed
<13>Aug 1 11:20:04 rpmi: python-module-urllib3-2:1.25.6-alt1 p9+250567.200.5.1 1590420860 installed
<13>Aug 1 11:20:04 rpmi: python-module-requests-2.23.0-alt1 p9+250567.400.5.1 1590420890 installed
<13>Aug 1 11:20:04 rpmi: python-module-typing-3.6.6-alt2 sisyphus+220108.100.1.1 1548749697 installed
<13>Aug 1 11:20:04 rpmi: python-modules-sqlite3-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:05 rpmi: python-module-SQLAlchemy-1.2.15-alt1 sisyphus+225625.4500.91.1 1555284142 installed
<13>Aug 1 11:20:05 rpmi: python-module-repoze.lru-0.6-alt2.git20140202.2 sisyphus+228533.100.1.1 1556656200 installed
<13>Aug 1 11:20:05 rpmi: python-module-xapian-1.4.15-alt1 p9+258827.200.2.1 1601308077 installed
<13>Aug 1 11:20:05 rpmi: python-module-sphinxcontrib-websupport-1.0.1-alt5 p9+247680.340.15.1 1585331199 installed
<13>Aug 1 11:20:05 rpmi: python-module-alabaster-0.7.6-alt3 sisyphus+228351.700.4.1 1556637370 installed
<13>Aug 1 11:20:05 rpmi: python-module-Pygments-2.4.2-alt3 p9+263160.400.4.1 1607939146 installed
<13>Aug 1 11:20:05 rpmi: python-module-sphinx-1:1.6.5-alt8 p9+250806.100.2.1 1588178467 installed
<13>Aug 1 11:20:05 rpmi: libnsl2-devel-1.1.0-alt1_1 1511548749 installed
<13>Aug 1 11:20:05 rpmi: python-dev-2.7.16-alt1.M90P.2 p9+260393.40.3.1 1604003681 installed
<13>Aug 1 11:20:05 rpmi: python-module-setuptools-1:40.8.0-alt2 sisyphus+229158.200.2.1 1557735221 installed
<13>Aug 1 11:20:05 rpmi: python-module-routes-2.4.1-alt1 sisyphus+227525.1400.1.2 1555924482 installed
<13>Aug 1 11:20:05 rpmi: python-module-nose-1:1.3.7-alt4.git20160316 sisyphus+229068.100.1.1 1557255939 installed
<13>Aug 1 11:20:05 rpmi: python-module-pysqlite2-2.8.3-alt1 1526055403 installed
<13>Aug 1 11:20:05 rpmi: python3-module-setuptools-1:40.8.0-alt2 sisyphus+229158.200.2.1 1557735221 installed
Building target platforms: i586
Building for target i586
Wrote: /usr/src/in/nosrpm/python-module-webhelpers-1.3-alt2.1.1.1.nosrc.rpm (w1.gzdio)
Installing python-module-webhelpers-1.3-alt2.1.1.1.src.rpm
Building target platforms: i586
Building for target i586
Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.38024
+ umask 022
+ /bin/mkdir -p /usr/src/RPM/BUILD
+ cd /usr/src/RPM/BUILD
+ cd /usr/src/RPM/BUILD
+ rm -rf python-module-webhelpers-1.3
+ echo 'Source #0 (WebHelpers-1.3.tar.gz):'
Source #0 (WebHelpers-1.3.tar.gz):
+ /bin/gzip -dc /usr/src/RPM/SOURCES/WebHelpers-1.3.tar.gz
+ /bin/tar -xf -
+ cd python-module-webhelpers-1.3
+ /bin/chmod -c -Rf u+rwX,go-w .
+ 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/webhelpers/html/render.py
RefactoringTool: Refactored ../python3/webhelpers/html/grid_demo.py
RefactoringTool: Refactored ../python3/webhelpers/html/grid.py
--- ../python3/webhelpers/html/render.py (original)
+++ ../python3/webhelpers/html/render.py (refactored)
@@ -39,8 +39,8 @@
"""An HTML-to-text formatter and HTML sanitizer.
"""
-from HTMLParser import HTMLParser
-import htmlentitydefs
+from html.parser import HTMLParser
+import html.entities
import re
import textwrap
@@ -189,12 +189,12 @@
def handle_entityref(self, name):
name = name.lower()
- if name not in htmlentitydefs.entitydefs:
+ if name not in html.entities.entitydefs:
# bad entity, just let it through
# (like a &var=value in a URL)
self.handle_data('&'+name)
return
- result = htmlentitydefs.entitydefs[name]
+ result = html.entities.entitydefs[name]
if result.startswith('&'):
self.handle_charref(result[2:-1])
else:
@@ -202,7 +202,7 @@
def handle_charref(self, name):
try:
- self.handle_data(unichr(int(name)))
+ self.handle_data(chr(int(name)))
except ValueError:
self.handle_data('&' + name)
@@ -315,7 +315,7 @@
return value.lower()
return self._default_align
- def __nonzero__(self):
+ def __bool__(self):
for t in self.text:
if t:
return True
@@ -335,7 +335,7 @@
def add_cell(self, value):
self.rows[-1].append(value)
- def __nonzero__(self):
+ def __bool__(self):
return not not self.rows
def to_text(self, context):
@@ -380,7 +380,7 @@
def normalize(text):
text = re.sub(r'\s+', ' ', text)
# nbsp:
- if not isinstance(text, unicode):
+ if not isinstance(text, str):
text = text.replace('\xa0', ' ')
return text
@@ -392,6 +392,6 @@
prog = os.path.basename(sys.argv[0])
sys.exit("usage: %s
can't have the attribute lang.
- if attributes.has_key('lang'):
+ if 'lang' in attributes:
lang = attributes['lang']
del attributes['lang']
else:
@@ -2804,7 +2804,7 @@
query = query.replace(' ', '+')
# Look for smart search.
- if self.searches.has_key(proto):
+ if proto in self.searches:
link = self.searches[proto] % query
# Fix URL.
@@ -2879,4 +2879,4 @@
if __name__ == '__main__':
- print textile('tell me about textile.', head_offset=1)
+ print(textile('tell me about textile.', head_offset=1))
--- ../python3/webhelpers/text.py (original)
+++ ../python3/webhelpers/text.py (refactored)
@@ -6,7 +6,7 @@
import re
import textwrap
-import urllib
+import urllib.request, urllib.parse, urllib.error
from webhelpers.html.tools import strip_tags
@@ -275,7 +275,7 @@
s = remove_formatting(string).lower()
s = replace_whitespace(s, '-')
s = collapse(s, '-')
- return urllib.quote(s)
+ return urllib.parse.quote(s)
def remove_formatting(string):
@@ -356,7 +356,7 @@
"(#190|frac34)": "three fourths",
"(#176|deg)": " degrees"
}
- for textiled, normal RefactoringTool: No changes to ../python3/webhelpers/pylonslib/secure_form.py
RefactoringTool: Refactored ../python3/webhelpers/pylonslib/minify.py
RefactoringTool: No changes to ../python3/webhelpers/pylonslib/grid.py
RefactoringTool: No changes to ../python3/webhelpers/pylonslib/flash.py
RefactoringTool: No changes to ../python3/webhelpers/pylonslib/_jsmin.py
RefactoringTool: No changes to ../python3/webhelpers/pylonslib/__init__.py
RefactoringTool: Refactored ../python3/webhelpers/paginate.py
RefactoringTool: Refactored ../python3/webhelpers/number.py
RefactoringTool: Refactored ../python3/webhelpers/misc.py
in replace_dict.items():
+ for textiled, normal in list(replace_dict.items()):
string = re.sub(r'\&%s;' % textiled, normal, string)
return re.sub(r'\&[^;]+;', '', string)
--- ../python3/webhelpers/pylonslib/minify.py (original)
+++ ../python3/webhelpers/pylonslib/minify.py (refactored)
@@ -29,7 +29,7 @@
import re
import os
import logging
-import StringIO
+import io
import warnings
from webhelpers.html.tags import javascript_link as __javascript_link
@@ -63,7 +63,7 @@
return sources
names = list()
- js_buffer = StringIO.StringIO()
+ js_buffer = io.StringIO()
base = os.path.commonprefix([os.path.dirname(s) for s in sources])
for source in sources:
@@ -175,7 +175,7 @@
def do_css_CSSStyleDeclaration(self, style, separator=None):
try:
color = style.getPropertyValue('color')
- if color and color is not u'':
+ if color and color is not '':
color = self.change_colors(color)
style.setProperty('color', color)
except:
--- ../python3/webhelpers/paginate.py (original)
+++ ../python3/webhelpers/paginate.py (refactored)
@@ -173,7 +173,7 @@
import re
from string import Template
-import urllib
+import urllib.request, urllib.parse, urllib.error
import warnings
from webhelpers.html import literal, HTML
@@ -247,7 +247,7 @@
def __getitem__(self, range):
if not isinstance(range, slice):
- raise Exception, "__getitem__ without slicing not supported"
+ raise Exception("__getitem__ without slicing not supported")
offset = range.start
limit = range.stop - range.start
select = self.obj.offset(offset).limit(limit)
@@ -265,7 +265,7 @@
def __getitem__(self, range):
if not isinstance(range, slice):
- raise Exception, "__getitem__ without slicing not supported"
+ raise Exception("__getitem__ without slicing not supported")
return self.obj[range]
def __len__(self):
@@ -441,7 +441,7 @@
first = self.first_item - 1
last = self.last_item
self.items = list(self.collection[first:last])
- except TypeError, e:
+ except TypeError as e:
if str(e) == "unhashable type":
# Assume this means collection is unsliceable.
raise TypeError(INCOMPATIBLE_COLLECTION_TYPE)
@@ -759,7 +759,7 @@
text = HTML.span(c=text, **self.dotdot_attr)
nav_items.append(text)
- for thispage in xrange(leftmost_page, rightmost_page+1):
+ for thispage in range(leftmost_page, rightmost_page+1):
# Hilight the current page number and do not use a link
if thispage == self.page:
text = '%s' % (thispage,)
@@ -833,7 +833,7 @@
# the controller and action manually
if config.mapper.explicit:
if hasattr(config, 'mapper_dict'):
- for k, v in config.mapper_dict.items():
+ for k, v in list(config.mapper_dict.items()):
if k != self.page_param:
link_params[k] = v
@@ -881,9 +881,9 @@
if partial:
params["partial"] = "1"
if sort:
- params = params.items()
+ params = list(params.items())
params.sort()
- qs = urllib.urlencode(params, True)
+ qs = urllib.parse.urlencode(params, True)
return "%s?%s" % (path, qs)
class PageURL(object):
--- ../python3/webhelpers/number.py (original)
+++ ../python3/webhelpers/number.py (refactored)
@@ -199,7 +199,7 @@
self.max = None
self._init_stats()
- def __nonzero__(self):
+ def __bool__(self):
"""The instance is true if it has seen any data."""
return bool(self.count)
--- ../python3/webhelpers/miscRefactoringTool: No changes to ../python3/webhelpers/mimehelper.py
RefactoringTool: Refactored ../python3/webhelpers/media.py
RefactoringTool: Refactored ../python3/webhelpers/markdown.py
.py (original)
+++ ../python3/webhelpers/misc.py (refactored)
@@ -25,7 +25,7 @@
From recipe in itertools docs.
"""
- for elm in itertools.ifilterfalse(pred, seq):
+ for elm in itertools.filterfalse(pred, seq):
return False
return True
@@ -48,7 +48,7 @@
From recipe in itertools docs.
"""
- for elm in itertools.ifilter(pred, seq):
+ for elm in filter(pred, seq):
return True
return False
@@ -70,7 +70,7 @@
From recipe in itertools docs.
"""
- for elm in itertools.ifilter(pred, seq):
+ for elm in filter(pred, seq):
return False
return True
@@ -145,8 +145,8 @@
This is mainly used to exclude abstract subclasses.
"""
if isinstance(it, dict):
- it = it.itervalues()
- class_types = (type, types.ClassType)
+ it = iter(it.values())
+ class_types = (type, type)
ignore = [class_]
if exclude:
ignore.extend(exclude)
--- ../python3/webhelpers/media.py (original)
+++ ../python3/webhelpers/media.py (refactored)
@@ -117,19 +117,19 @@
sys.exit("usage: %s FILES ...\nPrints dimensions of each image")
for file in files:
apath = os.path.abspath(file)
- print "%s:" % apath,
+ print("%s:" % apath, end=' ')
if not os.path.isfile(file):
- print "does not exist or is not a plain file"
+ print("does not exist or is not a plain file")
continue
width, height = get_dimensions(file)
if width is None and height is None:
- print "could not get dimensions"
+ print("could not get dimensions")
else:
if width is None:
width = "UNKNOWN"
if height is None:
height = "UNKNOWN"
- print "%s x %s" % (width, height)
+ print("%s x %s" % (width, height))
if __name__ == "__main__": test_get_dimensions()
--- ../python3/webhelpers/markdown.py (original)
+++ ../python3/webhelpers/markdown.py (refactored)
@@ -62,9 +62,9 @@
SMART_EMPHASIS = 1 # this_or_that does not become thisorthat
HTML_REMOVED_TEXT = "[HTML_REMOVED]" # text used instead of HTML in safe mode
-RTL_BIDI_RANGES = ( (u'\u0590', u'\u07FF'),
+RTL_BIDI_RANGES = ( ('\u0590', '\u07FF'),
# from Hebrew to Nko (includes Arabic, Syriac and Thaana)
- (u'\u2D30', u'\u2D7F'),
+ ('\u2D30', '\u2D7F'),
# Tifinagh
)
@@ -82,7 +82,7 @@
}
def removeBOM(text, encoding):
- convert = isinstance(text, unicode)
+ convert = isinstance(text, str)
for bom in BOMS[encoding]:
bom = convert and bom.decode(encoding) or bom
if text.startswith(bom):
@@ -141,7 +141,7 @@
ch = text[0]
- if not isinstance(ch, unicode) or not ch.isalpha():
+ if not isinstance(ch, str) or not ch.isalpha():
return None
else:
@@ -325,7 +325,7 @@
if self.nodeName in ['p', 'li', 'ul', 'ol',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6']:
- if not self.attribute_values.has_key("dir"):
+ if "dir" not in self.attribute_values:
if self.bidi:
bidi = self.bidi
else:
@@ -832,7 +832,7 @@
# we'll use "google" as the id
id = m.group(2).lower()
- if not self.references.has_key(id): # ignore undefined refs
+ if id not in self.references: # ignore undefined refs
return None
href, title = self.references[id]
text = m.group(2)
@@ -1136,7 +1136,7 @@
def __init__ (self):
self.regExp = {}
- for key in self.patterns.keys():
+ for key in list(self.patterns.keys()):
self.regExp[key] = re.compile("^%s$" % self.patterns[key],
re.DOTALL)
@@ -1237,7 +1237,7 @@
% (ext, extension_module_name) )
else:
- iRefactoringTool: No changes to ../python3/unfinished/sanitize_filename.py
RefactoringTool: No changes to ../python3/unfinished/opener.py
RefactoringTool: No changes to ../python3/unfinished/number_to_human_size.py
RefactoringTool: Refactored ../python3/unfinished/multimedia.py
f configs.has_key(ext):
+ if ext in configs:
configs_for_ext = configs[ext]
else:
configs_for_ext = []
@@ -1621,7 +1621,7 @@
x = parts[i]
- if isinstance(x, (str, unicode)):
+ if isinstance(x, str):
result = self._applyPattern(x, \
self.inlinePatterns[patternIndex], \
patternIndex)
@@ -1637,7 +1637,7 @@
for i in range(len(parts)):
x = parts[i]
- if isinstance(x, (str, unicode)):
+ if isinstance(x, str):
parts[i] = self.doc.createTextNode(x)
return parts
@@ -1693,7 +1693,7 @@
for item in result:
- if isinstance(item, (str, unicode)):
+ if isinstance(item, str):
if len(item) > 0:
node.insertChild(position,
self.doc.createTextNode(item))
@@ -1721,13 +1721,13 @@
self.source = source
if not self.source:
- return u""
+ return ""
try:
- self.source = unicode(self.source)
+ self.source = str(self.source)
except UnicodeDecodeError:
message(CRITICAL, 'UnicodeDecodeError: Markdown only accepts unicode or ascii input.')
- return u""
+ return ""
for pp in self.textPreprocessors:
self.source = pp.run(self.source)
@@ -1828,13 +1828,13 @@
self.config = configs
def getConfig(self, key):
- if self.config.has_key(key):
+ if key in self.config:
return self.config[key][0]
else:
return ""
def getConfigInfo(self):
- return [(key, self.config[key][1]) for key in self.config.keys()]
+ return [(key, self.config[key][1]) for key in list(self.config.keys())]
def setConfig(self, key, value):
self.config[key][0] = value
@@ -1862,7 +1862,7 @@
'encoding': None }
else:
- print OPTPARSE_WARNING
+ print(OPTPARSE_WARNING)
return None
parser = optparse.OptionParser(usage="%prog INPUTFILE [options]")
--- ../python3/unfinished/multimedia.py (original)
+++ ../python3/unfinished/multimedia.py (refactored)
@@ -87,7 +87,7 @@
"""
try:
im = Image.open(image_path)
- except IOError, e:
+ except IOError as e:
if str(e) == "cannot identify image file":
return None
else:
@@ -118,7 +118,7 @@
im = im.convert() # Convert GIF palette to RGB mode.
try:
im.thumbnail((width, height), Image.ANTIALIAS)
- except IOError, e:
+ except IOError as e:
reason = str(e)
if RX_DECODER_NOT_AVAILABLE.search(reason):
return None # PIL error, cannot thumbnail.
@@ -184,9 +184,9 @@
return os.path.join(dir, new_name)
def test():
- print "Height for 600x480 @ width 200 is", choose_height(200, 600, 480)
- print "Path 200 for a/foo.jpg is", get_thumb_path('a/foo.jpg', 200)
- print "Path 200 for a/foo.png is", get_thumb_path('a/foo.png', 200)
+ print("Height for 600x480 @ width 200 is", choose_height(200, 600, 480))
+ print("Path 200 for a/foo.jpg is", get_thumb_path('a/foo.jpg', 200))
+ print("Path 200 for a/foo.png is", get_thumb_path('a/foo.png', 200))
if __name__ == "__main__": test()
@@ -328,7 +328,7 @@
width = 200
dst = make_pdf_thumbnail2(source_file, width)
- print "Thumbnail made:", dst
+ print("Thumbnail made:", dst)
#ps_cmd = "save pop currentglobal true setglobal false/product where{pop product(Ghostscript)search{pop pop pop revision 600 ge{pop true}if}{pop}ifelse}if{/pdfdict where{pop pdfdict begin/pdfshowpage_setpage[pdfdict/pdfshowpage_setpage get{dup type/nametype eq{dup/OutputFileRefactoringTool: Refactored ../python3/unfinished/logging_optparse.py
RefactoringTool: No changes to ../python3/unfinished/document.py
RefactoringTool: Refactored ../python3/unfinished/disabled_test_pylonslib_minify.py
eq{pop/AntiRotationHack}{dup/MediaBox eq revision 650 ge and{/THB.CropHack{1 index/CropBox pget{2 index exch/MediaBox exch put}if}def/THB.CropHack cvx}if}ifelse}if}forall]cvx def end}if}if setglobal"
--- ../python3/unfinished/logging_optparse.py (original)
+++ ../python3/unfinished/logging_optparse.py (refactored)
@@ -215,5 +215,5 @@
if logger == "__main__":
# Set root logger to same level.
logging.getLogger().setLevel(level)
- except LogLevelError, e:
+ except LogLevelError as e:
parser.error("log level '%s' not defined" % e.level)
--- ../python3/unfinished/disabled_test_pylonslib_minify.py (original)
+++ ../python3/unfinished/disabled_test_pylonslib_minify.py (refactored)
@@ -79,42 +79,42 @@
# minify and combine
js_source = self.minify.javascript_link('/deep/a.js', '/b.js', combined=True, minified=True)
css_source = self.minify.stylesheet_link('/deep/a.css', '/b.css', combined=True, minified=True)
- self.assert_('"/a.b.COMBINED.min.css"' in css_source)
- self.assert_('"/a.b.COMBINED.min.js"' in js_source)
+ self.assertTrue('"/a.b.COMBINED.min.css"' in css_source)
+ self.assertTrue('"/a.b.COMBINED.min.js"' in js_source)
# combine
js_source = self.minify.javascript_link('/deep/a.js', '/b.js', combined=True)
css_source = self.minify.stylesheet_link('/deep/a.css', '/b.css', combined=True)
- self.assert_('"/a.b.COMBINED.css"' in css_source)
- self.assert_('"/a.b.COMBINED.js"' in js_source)
+ self.assertTrue('"/a.b.COMBINED.css"' in css_source)
+ self.assertTrue('"/a.b.COMBINED.js"' in js_source)
# minify
js_source = self.minify.javascript_link('/deep/a.js', '/b.js', minified=True)
css_source = self.minify.stylesheet_link('/deep/a.css', '/b.css', minified=True)
- self.assert_('"/deep/a.min.css"' in css_source)
- self.assert_('"/b.min.css"' in css_source)
- self.assert_('"/deep/a.min.js"' in js_source)
- self.assert_('"/b.min.js"' in js_source)
+ self.assertTrue('"/deep/a.min.css"' in css_source)
+ self.assertTrue('"/b.min.css"' in css_source)
+ self.assertTrue('"/deep/a.min.js"' in js_source)
+ self.assertTrue('"/b.min.js"' in js_source)
# root minify and combined
js_source = self.minify.javascript_link('/c.js', '/b.js', combined=True, minified=True)
css_source = self.minify.stylesheet_link('/c.css', '/b.css', combined=True, minified=True)
- self.assert_('"/c.b.COMBINED.min.css"' in css_source)
- self.assert_('"/c.b.COMBINED.min.js"' in js_source)
+ self.assertTrue('"/c.b.COMBINED.min.css"' in css_source)
+ self.assertTrue('"/c.b.COMBINED.min.js"' in js_source)
# root minify
js_source = self.minify.javascript_link('/c.js', '/b.js', minified=True)
css_source = self.minify.stylesheet_link('/c.css', '/b.css', minified=True)
- self.assert_('"/b.min.css"' in css_source)
- self.assert_('"/b.min.js"' in js_source)
- self.assert_('"/c.min.js"' in js_source)
- self.assert_('"/c.min.js"' in js_source)
+ self.assertTrue('"/b.min.css"' in css_source)
+ self.assertTrue('"/b.min.js"' in js_source)
+ self.assertTrue('"/c.min.js"' in js_source)
+ self.assertTrue('"/c.min.js"' in js_source)
# both root minify and combined
js_source = self.minify.javascript_link('/deep/a.js', '/deep/d.js', combined=True, minified=True)
css_source = self.minify.stylesheet_link('/deep/a.css', '/deep/d.css', combined=True, minified=True)
- self.assert_('"/deep/a.d.COMBINED.min.css"' in css_source)
- self.assert_('"/deep/a.d.COMBINED.min.js"' in js_source)
+ self.assertTrue('"/deep/a.d.COMBINED.min.css"' in css_source)
+ self.assertTrue('"/deep/a.d.COMBINED.min.js"' in js_source)
# Cleanup -- done by .tearDown()
#self.purge_files('a.b.COMBINED.min.js', 'a.b.CORefactoringTool: Refactored ../python3/unfinished/containers.py
RefactoringTool: Refactored ../python3/unfinished/baseN.py
RefactoringTool: No changes to ../python3/tests/util.py
RefactoringTool: Refactored ../python3/tests/test_tools.py
MBINED.min.css')
--- ../python3/unfinished/containers.py (original)
+++ ../python3/unfinished/containers.py (refactored)
@@ -16,7 +16,7 @@
if n > 0:
extension = [fill] * n
lis.extend(extension)
- return zip(*data)
+ return list(zip(*data))
def izip_fill(*iterables, **kw):
"""Like itertools.izip but use a default value for the missing elements
@@ -26,18 +26,18 @@
``default`` is the default value (default ``None``, must be a keyword
arg.
"""
- iterables = map(iter, iterables)
+ iterables = list(map(iter, iterables))
default = kw.pop('default', None)
if kw:
raise TypeError("unrecognized keyword arguments")
columns = len(iterables)
- columns_range = range(columns)
+ columns_range = list(range(columns))
while True:
found_data = False
row = [None] * columns
for i in columns_range:
try:
- row[i] = iterables[i].next()
+ row[i] = next(iterables[i])
found_data = True
except StopIteration:
row[i] = default
--- ../python3/unfinished/baseN.py (original)
+++ ../python3/unfinished/baseN.py (refactored)
@@ -59,7 +59,7 @@
s = list(s)
alphabet = list(alphabet)
base = len(alphabet)
- inverse_alphabet = dict(zip(alphabet, xrange(0, base)))
+ inverse_alphabet = dict(list(zip(alphabet, list(range(0, base)))))
n = 0
exp = 0
for i in reversed(s):
--- ../python3/tests/test_tools.py (original)
+++ ../python3/tests/test_tools.py (refactored)
@@ -74,50 +74,50 @@
}
result_values = {}
- for k, v in result_values_templates.iteritems():
+ for k, v in result_values_templates.items():
result_values[k] = Template(v).substitute(raw_values)
self.assertEqual(result_values["email_result"], auto_link(raw_values['email_raw'], 'email_addresses'))
- self.assertEqual(u"hello %(email_result)s" % result_values, auto_link("hello %(email_raw)s" % raw_values, 'email_addresses'))
- self.assertEqual(u"Go to %(link_result)s" % result_values, auto_link("Go to %(link_raw)s" % raw_values, 'urls'))
- self.assertEqual(u"Go to %(link_raw)s" % raw_values, auto_link("Go to %(link_raw)s" % raw_values, 'email_addresses'))
- self.assertEqual(u"Go to %(link_result)s and say hello to %(email_result)s" % result_values, auto_link("Go to %(link_raw)s and say hello to %(email_raw)s" % raw_values))
- self.assertEqual(u"Link %(link_result)s
" % result_values, auto_link(literal("Link %(link_raw)s
") % raw_values))
- self.assertEqual(u"%(link_result)s Link
" % result_values, auto_link(literal("%(link_raw)s Link
") % raw_values))
- self.assertEqual(u"Link %(link_result_with_options)s
" % result_values, auto_link(literal("Link %(link_raw)s
") % raw_values, 'all', target='_blank'))
- self.assertEqual(u"Go to %(link_result)s." % result_values, auto_link("Go to %(link_raw)s." % raw_values))
- self.assertEqual(u"Go to %(link_result)s, then say hello to %(email_result)s.
" % result_values, auto_link(literal("Go to %(link_raw)s, then say hello to %(email_raw)s.
") % raw_values))
- self.assertEqual(u"Go to %(link2_result)s" % result_values, auto_link("Go to %(link2_raw)s" % raw_values, 'urls'))
- self.assertEqual(u"Go to %(link2_raw)s" % raw_values, auto_link("Go to %(link2_raw)s" % raw_values, 'email_addresses'))
- self.assertEqual(u"Link %(link2_result)s
" % result_values, auto_link(literal("Link %(link2_raw)s
") % raw_values))
- self.assertEqual(u"%(link2_result)s Link
" % result_values, auto_link(literal("%(link2_raw)s Link
") % raw_values))
- self.assertEqual(u"Go to %(link2_result)s." % result_values, auto_link(literal("Go to %(link2_raw)s.") % raw_values))
- self.assertEqual(u"Say hello to %(email_result)s, then go to %(link2_result)s.
" % result_values, auto_link(literal("Say hello to %(email_raw)s, then go to %(link2_raw)s.
") % raw_values))
- self.assertEqual(u"Go to %(link3_result)s" % result_values, auto_link("Go to %(link3_raw)s" % raw_values, 'urls'))
- self.assertEqual(u"Go to %(link3_raw)s" % raw_values, auto_link("Go to %(link3_raw)s" % raw_values, 'email_addresses'))
- self.assertEqual(u"Link %(link3_result)s
" % result_values, auto_link(literal("Link %(link3_raw)s
") % raw_values))
- self.assertEqual(u"%(link3_result)s Link
" % result_values, auto_link(literal("%(link3_raw)s Link
") % raw_values))
- self.assertEqual(u"Go to %(link3_result)s." % result_values, auto_link("Go to %(link3_raw)s." % raw_values))
- self.assertEqual(u"Go to %(link3_result)s. seriously, %(link3_result)s? i think I'll say hello to %(email_result)s. instead.
" % result_values, auto_link(literal("Go to %(link3_raw)s. seriously, %(link3_raw)s? i think I'll say hello to %(email_raw)s. instead.
") % raw_values))
- self.assertEqual(u"Link %(link4_result)s
" % result_values, auto_link(literal("Link %(link4_raw)s
") % raw_values))
- self.assertEqual(u"%(link4_result)s Link
" % result_values, auto_link(literal("%(link4_raw)s Link
") % raw_values))
- self.assertEqual(u"%(link5_result)s Link
" % result_values, auto_link(literal("%(link5_raw)s Link
") % raw_values))
- self.assertEqual(u"%(link6_result)s Link
" % result_values, auto_link(literal("%(link6_raw)s Link
") % raw_values))
- self.assertEqual(u"%(link7_result)s Link
" % result_values, auto_link(literal("%(link7_raw)s Link
") % raw_values))
- self.assertEqual(u"Go to %(link8_result)s" % result_values, auto_link("Go to %(link8_raw)s" % raw_values, 'urls'))
- self.assertEqual(u"Go to %(link8_raw)s" % raw_values, auto_link("Go to %(link8_raw)s" % raw_values, 'email_addresses'))
- self.assertEqual(u"Link %(link8_result)s
" % result_values, auto_link(literal("Link %(link8_raw)s
") % raw_values))
- self.assertEqual(u"%(link8_result)s Link
" % result_values, auto_link(literal("%(link8_raw)s Link
") % raw_values))
- self.assertEqual(u"Go to %(link8_result)s." % result_values, auto_link("Go to %(link8_raw)s." % raw_values))
- self.assertEqual(u"Go to %(link8_result)s. seriously, %(link8_result)s? i think I'll say hello to %(email_result)s. instead.
" % result_values, auto_link(literal("Go to %(link8_raw)s. seriously, %(link8_raw)s? i think I'll say hello to %(email_raw)s. instead.
") % raw_values))
- self.assertEqual(u"Go to %(link9_result)s" % result_values, auto_link("Go to %(link9_raw)s" % raw_values, 'urls'))
- self.assertEqual(u"Go to %(link9_raw)s" % raw_values, auto_link("Go to %(link9_raw)s" % raw_values, 'email_addresses'))
- self.assertEqual(u"Link %(link9_result)s
" % result_values, auto_link(literal("Link %(link9_raw)s
") % raw_values))
- self.assertEqual(u"%(link9_result)s Link
" % result_values, auto_link(literal("%(link9_raw)s Link
") % raw_values))
- self.assertEqual(u"Go to %(link9_result)s." % result_values, auto_link("Go to %(link9_raw)s." % raw_values))
- self.assertEqual(u"Go to %(link9_result)s. seriously, %(link9_result)s? i think I'll say hello to %(email_result)s. instead.
" % result_values, auto_link(literal("Go to %(link9_raw)s. seriously, %(link9_raw)s? i think I'll say hello to %(email_raw)s. instead.
") % raw_values))
- self.assertEqual(u"", auto_link(None))
- self.assertEqual(u"", auto_link(""))
+ self.assertEqual("hello %(email_result)s" % result_values, auto_link("hello %(email_raw)s" % raw_values, 'email_addresses'))
+ self.assertEqual("Go to %(link_result)s" % result_values, auto_link("Go to %(link_raw)s" % raw_values, 'urls'))
+ self.assertEqual("Go to %(link_raw)s" % raw_values, auto_link("Go to %(link_raw)s" % raw_values, 'email_addresses'))
+ self.assertEqual("Go to %(link_result)s and say hello to %(email_result)s" % result_values, auto_link("Go to %(link_raw)s and say hello to %(email_raw)s" % raw_values))
+ self.assertEqual("Link %(link_result)s
" % result_values, auto_link(literal("Link %(link_raw)s
") % raw_values))
+ self.assertEqual("%(link_result)s Link
" % result_values, auto_link(literal("%(link_raw)s Link
") % raw_values))
+ self.assertEqual("Link %(link_result_with_options)s
" % result_values, auto_link(literal("Link %(link_raw)s
") % raw_values, 'all', target='_blank'))
+ self.assertEqual("Go to %(link_result)s." % result_values, auto_link("Go to %(link_raw)s." % raw_values))
+ self.assertEqual("Go to %(link_result)s, then say hello to %(email_result)s.
" % result_values, auto_link(literal("Go to %(link_raw)s, then say hello to %(email_raw)s.
") % raw_values))
+ self.assertEqual("Go to %(link2_result)s" % result_values, auto_link("Go to %(link2_raw)s" % raw_values, 'urls'))
+ self.assertEqual("Go to %(link2_raw)s" % raw_values, auto_link("Go to %(link2_raw)s" % raw_values, 'email_addresses'))
+ self.assertEqual("Link %(link2_result)s
" % result_values, auto_link(literal("Link %(link2_raw)s
") % raw_values))
+ self.assertEqual("%(link2_result)s Link
" % result_values, auto_link(literal("%(link2_raw)s Link
") % raw_values))
+ self.assertEqual("Go to %(link2_result)s." % result_values, auto_link(literal("Go to %(link2_raw)s.") % raw_values))
+ self.assertEqual("Say hello to %(email_result)s, then go to %(link2_result)s.
" % result_values, auto_link(literal("Say hello to %(email_raw)s, then go to %(link2_raw)s.
") % raw_values))
+ self.assertEqual("Go to %(link3_result)s" % result_values, auto_link("Go to %(link3_raw)s" % raw_values, 'urls'))
+ self.assertEqual("Go to %(link3_raw)s" % raw_values, auto_link("Go to %(link3_raw)s" % raw_values, 'email_addresses'))
+ self.assertEqual("Link %(link3_result)s
" % result_values, auto_link(literal("Link %(link3_raw)s
") % raw_values))
+ self.assertEqual("%(link3_result)s Link
" % result_values, auto_link(literal("%(link3_raw)s Link
") % raw_values))
+ self.assertEqual("Go to %(link3_result)s." % result_values, auto_link("Go to %(link3_raw)s." % raw_values))
+ self.assertEqual("Go to %(link3_result)s. seriously, %(link3_result)s? i think I'll say hello to %(email_result)s. instead.
" % result_values, auto_link(literal("Go to %(link3_raw)s. seriously, %(link3_raw)s? i think I'll say hello to %(email_raw)s. instead.
") % raw_values))
+ self.assertEqual("Link %(link4_result)s
" % result_values, auto_link(literal("Link %(link4_raw)s
") % raw_values))
+ self.assertEqual("%(link4_result)s Link
" % result_values, auto_link(literal("%(link4_raw)s Link
") % raw_values))
+ self.assertEqual("%(link5_result)s Link
" % result_values, auto_link(literal("%(link5_raw)s Link
") % raw_values))
+ self.assertEqual("%(link6_result)s Link
" % result_values, auto_link(literal("%(link6_raw)s Link
") % raw_values))
+ self.assertEqual("%(link7_result)s Link
" % result_values, auto_link(literal("%(link7_raw)s Link
") % raw_values))
+ self.assertEqual("Go to %(link8_result)s" % result_values, auto_link("Go to %(link8_raw)s" % raw_values, 'urls'))
+ self.assertEqual("Go to %(link8_raw)s" % raw_values, auto_link("Go to %(link8_raw)s" % raw_values, 'email_addresses'))
+ self.assertEqual("Link %(link8_result)s
" % result_values, auto_link(literal("Link %(link8_raw)s
") % raw_values))
+ self.assertEqual("%(link8_result)s Link
" % result_values, auto_link(literal("%(link8_raw)s Link
") % raw_values))
+ self.assertEqual("Go to %(link8_result)s." % result_values, auto_link("Go to %(link8_raw)s." % raw_values))
+ self.assertEqual("Go to %(link8_result)s. seriously, %(link8_result)s? i think I'll say hello to %(email_result)s. instead.
" % result_values, auto_link(literal("Go to %(link8_raw)s. seriously, %(link8_raw)s? i think I'll say hello to %(email_raw)s. instead.
") % raw_values))
+ self.assertEqual("Go to %(link9_result)s" % result_values, auto_link("Go to %(link9_raw)s" % raw_values, 'urls'))
+ self.assertEqual("Go to %(link9_raw)s" % raw_values, auto_link("Go to %(link9_raw)s" % raw_values, 'email_addresses'))
+ self.assertEqual("Link %(link9_result)s
" % result_values, auto_link(literal("Link %(link9_raw)s
") % raw_values))
+ self.assertEqual("%(link9_result)s Link
" % result_values, auto_link(literal("%(link9_raw)s Link
") % raw_values))
+ self.assertEqual("Go to %(link9_result)s." % result_values, auto_link("Go to %(link9_raw)s." % raw_values))
+ self.assertEqual("Go to %(link9_result)s. seriously, %(link9_result)s? i think I'll say hello to %(email_result)s. instead.
" % result_values, auto_link(literal("Go to %(link9_raw)s. seriously, %(link9_raw)s? i think I'll say hello to %(email_raw)s. instead.
") % raw_values))
+ self.assertEqual("", auto_link(None))
+ self.assertEqual("", auto_link(""))
# Failing test: PylonsHQ bug #657
#self.assertEqual(u'<www.google.com>', auto_link(""))
@@ -131,80 +131,80 @@
class TestURLHelper(WebHelpersTestCase):
def test_button_to_with_straight_url(self):
- self.assertEqual(u"",
+ self.assertEqual("",
button_to("Hello", "http://www.example.com"))
def test_button_to_with_query(self):
- self.assertEqual(u"",
+ self.assertEqual("",
button_to("Hello", "http://www.example.com/q1=v1&q2=v2"))
def test_button_to_with_escaped_query(self):
- self.assertEqual(u"",
+ self.assertEqual("",
button_to("Hello", "http://www.example.com/q1=v1&q2=v2"))
def test_button_to_with_query_and_no_name(self):
- self.assertEqual(u"",
+ self.assertEqual("",
button_to(None, "http://www.example.com?q1=v1&q2=v2"))
def test_button_to_enabled_disabled(self):
- self.assertEqual(u"",
+ self.assertEqual("",
button_to("Hello", "http://www.example.com", disabled=False))
- self.assertEqual(u"",
+ self.assertEqual("",
button_to("Hello", "http://www.example.com", disabled=True))
def test_button_to_with_method_delete(self):
- self.assertEqual(u"",
+ self.assertEqual("",
button_to("Hello", "http://www.example.com", method='DELETE'))
- self.assertEqual(u"",
+ self.assertEqual("",
button_to("Hello", "http://www.example.com", method='delete'))
def test_button_to_with_method_get(self):
- self.assertEqual(u"",
+ self.assertEqual("",
button_to("Hello", "http://www.example.com", method='get'))
- self.assertEqual(u"",
+ self.assertEqual("",
button_to("Hello", "http://www.example.com", method='GET'))
def test_button_to_with_img(self):
- self.assertEqual(u'',
+ self.assertEqual('',
button_to("Edit", '/content/edit/3', type='image', src='/images/icon_delete.gif'))
- self.assertEqual(u'',
+ self.assertEqual('',
button_to("Submit", '/content/submit/3', type='image', src='submit.png', alt='Complete the form'))
def test_mail_to(self):
- self.assertEqual(u'justin@example.com', mail_to("justin@example.com"))
- self.assertEqual(u'Justin Example', mail_to("justin@example.com", "Justin Example"))
- self.assertEqual(u'Justin Example',
+ self.assertEqual('justin@example.com', mail_to("justin@example.com"))
+ self.assertEqual('Justin Example', mail_to("justin@example.com", "Justin Example"))
+ self.assertEqual('Justin Example',
mail_to("justin@example.com", "Justin Example", class_="admin"))
def test_mail_to_with_javascript(self):
- self.assertEqual(u"", mail_to("me@domain.com", "My email", encode = "javascript"))
+ self.assertEqual("", mail_to("me@domain.com", "My email", encode = "javascript"))
def test_mail_to_with_options(self):
- self.assertEqual(u'My email',
+ self.assertEqual('My email',
mail_to("me@example.com", "My email", cc="ccaddress@example.com",
bcc="bccaddress@example.com", subject="This is an example email",
body="This is the body of the message."))
def test_mail_to_with_img(self):
- self.assertEqual(u'',
+ self.assertEqual('',
mail_to('feedback@example.com', HTML.literal('')))
def test_mail_to_with_hex(self):
- self.assertEqual(u"My email",
+ self.assertEqual("My email",
mail_to("me@domain.com", "My email", encode = "hex"))
- self.assertEqual(u"me@domain.com",
+ self.assertEqual("me@domain.com",
mail_to("me@domain.com", None, encode = "hex"))
def test_mail_to_with_replace_options(self):
- self.assertEqual(u'wolfgang(at)stufenlos(dot)net',
+ self.assertEqual('wolfgang(at)stufenlos(dot)net',
mail_to("wolfgang@stufenlos.net", None, replace_at="(at)", replace_dot="(dot)"))
- self.assertEqual(u"me(at)domain.com",
+ self.assertEqual("me(at)domain.com",
mail_to("me@domain.com", None, encode = "hex", replace_at = "(at)"))
- self.assertEqual(u"My email",
+ self.assertEqual("My email",
mail_to("me@domain.com", "My email", encode = "hex", replace_at = "(at)"))
- self.assertEqual(u"me(at)domain(dot)com",
+ self.assertEqual("me(at)domain(dot)com",
mail_to("me@domain.com", None, encode = "hex", replace_at = "(at)", replace_dot = "(dot)"))
- self.assertEqual(u"",
+ self.assertEqual("",
mail_to("me@domain.com", "My email", encode = "javascript", replace_at = "(at)", replace_dot = "(dot)"))
@@ -247,9 +247,9 @@
style="color:red"))
def test_highlight_literal(self):
- eq_(literal(u'The <red> cat.'),
+ eq_(literal('The <red> cat.'),
highlight("The cat.", "at"))
- eq_(literal(u'The cat.'),
+ eq_(literal('The cat.'),
highlight(literal("The cat."), "at"))
def test_highlight_legacy_highlighter(self):
@@ -259,15 +259,15 @@
class TestStripTagsHelper(WebHelpersTestCase):
def test_compare_strip_tags_to_sanitize(self):
- text = u'I really like steak!'
+ text = 'I really like steak!'
eq_(strip_tags(text), render.sanitize(text))
if __name__ == '__main__':
- suite = map(unittest.makeSuite, [
+ suite = list(map(unittest.makeSuite, [
TestToolsHelper,
TestHighlightHelper,
TestURLHelper,
TestStripTagsHelper,
- ])
+ ]))
for testsuite in suite:
unittest.TextTestRunner(verbosity=1).run(testsuite)
--- ../python3/tests/test_text.py (original)
+++ ../python3/tests/test_text.py (refactored)
@@ -27,8 +27,8 @@
excerpt('This is a beautiful? morning', 'beautiful', 5))
def test_excerpt_with_utf8(self):
--- ../python3/tests/test_tags.py (original)
+++ ../python3/tests/test_tags.py (refactored)
@@ -11,148 +11,148 @@
def test_check_box(self):
eq_(
checkbox("admin"),
- u'',
+ '',
)
def test_form(self):
eq_(
form(url="http://www.example.com"),
- u'