<86>Jan 26 06:50:06 userdel[11760]: delete user 'rooter' <86>Jan 26 06:50:06 userdel[11760]: removed group 'rooter' owned by 'rooter' <86>Jan 26 06:50:06 userdel[11760]: removed shadow group 'rooter' owned by 'rooter' <86>Jan 26 06:50:06 groupadd[11774]: group added to /etc/group: name=rooter, GID=600 <86>Jan 26 06:50:06 groupadd[11774]: group added to /etc/gshadow: name=rooter <86>Jan 26 06:50:06 groupadd[11774]: new group: name=rooter, GID=600 <86>Jan 26 06:50:06 useradd[11785]: new user: name=rooter, UID=600, GID=600, home=/root, shell=/bin/bash <86>Jan 26 06:50:06 userdel[11802]: delete user 'builder' <86>Jan 26 06:50:06 userdel[11802]: removed group 'builder' owned by 'builder' <86>Jan 26 06:50:06 userdel[11802]: removed shadow group 'builder' owned by 'builder' <86>Jan 26 06:50:06 groupadd[11815]: group added to /etc/group: name=builder, GID=601 <86>Jan 26 06:50:06 groupadd[11815]: group added to /etc/gshadow: name=builder <86>Jan 26 06:50:06 groupadd[11815]: new group: name=builder, GID=601 <86>Jan 26 06:50:06 useradd[11826]: new user: name=builder, UID=601, GID=601, home=/usr/src, shell=/bin/bash <13>Jan 26 06:50:11 rpmi: libexpat-2.1.0-alt1 1347469773 installed <13>Jan 26 06:50:11 rpmi: libpng15-1.5.28-alt1 1484572069 installed <13>Jan 26 06:50:11 rpmi: libwayland-client-1.12.0-alt1 1475000260 installed <13>Jan 26 06:50:11 rpmi: libgdbm-1.8.3-alt10 1454943334 installed <13>Jan 26 06:50:11 rpmi: python-sphinx-objects.inv-1:2.3.7.20170117-alt1 1484721065 installed <13>Jan 26 06:50:11 rpmi: libsqlite3-3.15.2-alt1 1480432278 installed <13>Jan 26 06:50:11 rpmi: libgpg-error-1.20-alt1.1 1449204244 installed <13>Jan 26 06:50:11 rpmi: libgcrypt20-1.6.6-alt1 1471552782 installed <13>Jan 26 06:50:11 rpmi: libxslt-1.1.28-alt4 1448210408 installed <13>Jan 26 06:50:11 rpmi: libdbi-1.0-alt1.cvs20092729.2 1300001781 installed <13>Jan 26 06:50:11 rpmi: libdatrie-0.2.8-alt1_5 1410185970 installed <13>Jan 26 06:50:11 rpmi: libthai-0.1.25-alt1_1 1482119595 installed <13>Jan 26 06:50:11 rpmi: libpixman-3:0.34.0-alt1 1480491657 installed <13>Jan 26 06:50:11 rpmi: libgraphite2-1.3.9-alt1 1482128024 installed <13>Jan 26 06:50:11 rpmi: libharfbuzz-1.4.2-alt1 1485254798 installed <13>Jan 26 06:50:11 rpmi: libfreetype-2.6.3-alt1 1455987209 installed <13>Jan 26 06:50:11 rpmi: fontconfig-2.12.1-alt1 1471005373 installed Updating fonts cache: <29>Jan 26 06:50:12 fontconfig: Updating fonts cache: succeeded [ DONE ] <13>Jan 26 06:50:13 rpmi: fonts-ttf-dejavu-2.37-alt1 1469992619 installed <13>Jan 26 06:50:13 rpmi: libwayland-server-1.12.0-alt1 1475000260 installed <13>Jan 26 06:50:13 rpmi: libxshmfence-1.2-alt1 1420972190 installed <13>Jan 26 06:50:13 rpmi: libpciaccess-1:0.13.4-alt1 1431681690 installed <13>Jan 26 06:50:13 rpmi: libdrm-1:2.4.74-alt1 1484221443 installed <13>Jan 26 06:50:13 rpmi: libgbm-4:13.0.3-alt1 1484223040 installed <13>Jan 26 06:50:13 rpmi: libX11-locales-3:1.6.4-alt1 1480493483 installed <13>Jan 26 06:50:13 rpmi: libXdmcp-1.1.1-alt1 1334617701 installed <13>Jan 26 06:50:13 rpmi: libXau-1.0.8-alt1 1369565808 installed <13>Jan 26 06:50:13 rpmi: libxcb-1.12-alt1 1471592579 installed <13>Jan 26 06:50:13 rpmi: libX11-3:1.6.4-alt1 1480493483 installed <13>Jan 26 06:50:13 rpmi: libXext-1.3.3-alt1 1409902959 installed <13>Jan 26 06:50:13 rpmi: libXrender-0.9.8-alt1 1371312112 installed <13>Jan 26 06:50:13 rpmi: libXft-2.3.2-alt1 1409902660 installed <13>Jan 26 06:50:13 rpmi: libXxf86vm-1.1.3-alt1 1369984835 installed <13>Jan 26 06:50:13 rpmi: libXdamage-1.1.3-alt4 1297162593 installed <13>Jan 26 06:50:13 rpmi: libXfixes-5.0.1-alt1 1369809608 installed <13>Jan 26 06:50:13 rpmi: libGL-4:13.0.3-alt1 1484223040 installed <13>Jan 26 06:50:13 rpmi: libEGL-4:13.0.3-alt1 1484223040 installed <13>Jan 26 06:50:13 rpmi: libcairo-1:1.14.4-alt1 1447005511 installed <13>Jan 26 06:50:13 rpmi: libpango-1.40.3-alt1 1473777869 installed <13>Jan 26 06:50:13 rpmi: librrd4-1.5.4-alt2 1464439526 installed <13>Jan 26 06:50:13 rpmi: libtinfo-devel-5.9-alt8 1456756589 installed <13>Jan 26 06:50:13 rpmi: libncurses-devel-5.9-alt8 1456756589 installed <13>Jan 26 06:50:13 rpmi: python-modules-curses-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:13 rpmi: libverto-0.2.6-alt1_6 1455633232 installed <13>Jan 26 06:50:13 rpmi: libkeyutils-1.5.9-alt2 1464351238 installed <13>Jan 26 06:50:13 rpmi: libcom_err-1.42.13-alt2 1449075923 installed <13>Jan 26 06:50:13 rpmi: ca-certificates-2016.09.28-alt1 1475233825 installed <13>Jan 26 06:50:14 rpmi: libcrypto10-1.0.2j-alt1 1474898021 installed <13>Jan 26 06:50:14 rpmi: libkrb5-1.14.2-alt2 1465464128 installed <13>Jan 26 06:50:14 rpmi: libssl10-1.0.2j-alt1 1474898021 installed <13>Jan 26 06:50:14 rpmi: rpm-build-python3-0.1.11-alt1 1484131403 installed <13>Jan 26 06:50:14 rpmi: python3-3.5.1-alt7 1462447642 installed <13>Jan 26 06:50:15 rpmi: python3-base-3.5.1-alt7 1462447642 installed <13>Jan 26 06:50:15 rpmi: python-modules-compiler-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-modules-email-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-modules-unittest-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-modules-encodings-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-modules-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-modules-xml-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python3-module-setuptools-1:18.1-alt4 1469693421 installed <13>Jan 26 06:50:15 rpmi: python-modules-hotshot-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-modules-ctypes-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python3-module-six-1.10.0-alt1 1483422782 installed <13>Jan 26 06:50:15 rpmi: python-modules-multiprocessing-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-modules-logging-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-tools-2to3-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-modules-bsddb-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-strict-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-module-genshi-0.7-alt1.1.1.1 1460400448 installed <13>Jan 26 06:50:15 rpmi: python-dev-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:15 rpmi: python-module-setuptools-1:18.1-alt4 1469693421 installed <13>Jan 26 06:50:16 rpmi: python-module-six-1.10.0-alt1 1483422782 installed <13>Jan 26 06:50:16 rpmi: python-module-html5lib-1:0.999999-alt1.1.1.1 1460400556 installed <13>Jan 26 06:50:16 rpmi: python-module-lxml-3.5.0-alt2.beta1.git20150727 1462232478 installed <13>Jan 26 06:50:16 rpmi: python-module-cssselect-0.9.1-alt1.1 1457858257 installed <13>Jan 26 06:50:16 rpmi: python-module-py-1.4.32-alt1 1484069457 installed <13>Jan 26 06:50:16 rpmi: python-modules-json-2.7.11-alt3 1460726037 installed <13>Jan 26 06:50:16 rpmi: python-module-pytest-3.0.5-alt1 1485077941 installed <13>Jan 26 06:50:16 rpmi: python3-module-cssselect-0.9.1-alt1.1 1457858257 installed <13>Jan 26 06:50:16 rpmi: python3-module-genshi-0.7-alt1.1.1.1 1460400448 installed <13>Jan 26 06:50:16 rpmi: python3-module-html5lib-1:0.999999-alt1.1.1.1 1460400556 installed <13>Jan 26 06:50:16 rpmi: python3-module-lxml-3.5.0-alt2.beta1.git20150727 1462232478 installed <13>Jan 26 06:50:16 rpmi: python3-module-pytz-1:2016.10-alt1 1484291011 installed <13>Jan 26 06:50:17 rpmi: python3-module-babel-1:2.3.4-alt1 1477346033 installed <13>Jan 26 06:50:17 rpmi: python3-module-imagesize-0.7.1-alt1 1461387704 installed <13>Jan 26 06:50:17 rpmi: python3-module-markupsafe-0.23-alt1.2.1 1459594456 installed <13>Jan 26 06:50:17 rpmi: python3-module-jinja2-tests-2.9-alt1.dev.git20150726.1.1.1.1 1484417882 installed <13>Jan 26 06:50:17 rpmi: python3-module-jinja2-2.9-alt1.dev.git20150726.1.1.1.1 1484417882 installed <13>Jan 26 06:50:17 rpmi: python3-module-snowballstemmer-1.2.0-alt2.1 1457859319 installed <13>Jan 26 06:50:17 rpmi: python3-module-whoosh-2.7.0-alt1.hg20150805.1.1 1457859779 installed <13>Jan 26 06:50:17 rpmi: python3-module-py-1.4.32-alt1 1484069457 installed <13>Jan 26 06:50:17 rpmi: python3-module-pytest-3.0.5-alt1 1485077941 installed <13>Jan 26 06:50:17 rpmi: python3-modules-sqlite3-3.5.1-alt7 1462447642 installed <13>Jan 26 06:50:17 rpmi: python3-module-SQLAlchemy-1.0.12-alt1 1461160349 installed <13>Jan 26 06:50:17 rpmi: python3-module-docutils-0.13.1-alt1 1484230885 installed <13>Jan 26 06:50:17 rpmi: python3-module-alabaster-0.7.6-alt2.git20150703 1461344248 installed <13>Jan 26 06:50:18 rpmi: python3-module-sphinx-1:1.4.1-alt2 1461380581 installed <13>Jan 26 06:50:18 rpmi: python3-module-Pygments-2.1.3-alt1 1461350990 installed <13>Jan 26 06:50:18 rpmi: python3-module-setuptools-tests-1:18.1-alt4 1469693421 installed <13>Jan 26 06:50:18 rpmi: python-module-setuptools-tests-1:18.1-alt4 1469693421 installed <13>Jan 26 06:50:18 rpmi: python-module-docutils-0.13.1-alt1 1484230885 installed <13>Jan 26 06:50:18 rpmi: python-module-RRDtool-0.1.1-alt1.git20141011.1.1 1459589656 installed <13>Jan 26 06:50:18 rpmi: python3-module-RRDtool-0.1.1-alt1.git20141011.1.1 1459589656 installed Installing python-module-pyrrd-0.1.0-alt1.git20120117.1.1.src.rpm Building target platforms: i586 Building for target i586 Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.623 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + rm -rf python-module-pyrrd-0.1.0 + echo 'Source #0 (python-module-pyrrd-0.1.0.tar):' Source #0 (python-module-pyrrd-0.1.0.tar): + /bin/tar -xf /usr/src/RPM/SOURCES/python-module-pyrrd-0.1.0.tar + cd python-module-pyrrd-0.1.0 + /bin/chmod -c -Rf u+rwX,go-w . + echo 'Patch #0 (pyrrd-0.1.1-fix.patch):' Patch #0 (pyrrd-0.1.1-fix.patch): + /usr/bin/patch -p1 patching file pyrrd/backend/common.py patching file pyrrd/backend/external.py patching file pyrrd/rrd.py patching file pyrrd/testing/suite.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: No changes to ../python3/setup.py RefactoringTool: No changes to ../python3/sandbox/oubiwann/file-format/rrdmaker.py RefactoringTool: No changes to ../python3/sandbox/oubiwann/file-format/2ds1rra1entry.py RefactoringTool: No changes to ../python3/sandbox/oubiwann/file-format/1ds1rra2entry.py RefactoringTool: No changes to ../python3/sandbox/oubiwann/file-format/1ds1rra1entry.py RefactoringTool: Refactored ../python3/pyrrd/rrd.py RefactoringTool: Refactored ../python3/pyrrd/util/dist.py --- ../python3/pyrrd/rrd.py (original) +++ ../python3/pyrrd/rrd.py (refactored) @@ -18,10 +18,10 @@ ValueError: Names must be shorter than 19 characters """ if name != re.sub('[^A-Za-z0-9_]', '', name): - raise ValueError, "Names must consist only of the characters " + \ - "A-Z, a-z, 0-9, _" + raise ValueError("Names must consist only of the characters " + \ + "A-Z, a-z, 0-9, _") if len(name) > 18: - raise ValueError, "Names must be shorter than 19 characters" + raise ValueError("Names must be shorter than 19 characters") def validateDSType(dsType): @@ -38,8 +38,8 @@ return dsType else: valid = ' '.join(valid) - raise ValueError, 'A data source type must be one of the ' + \ - 'following: %s' % valid + raise ValueError('A data source type must be one of the ' + \ + 'following: %s' % valid) def validateRRACF(consolidationFunction): @@ -60,8 +60,8 @@ return cf else: valid = ' '.join(valid) - raise ValueError, "An RRA's consolidation function must be " + \ - "one of the following: %s" % valid + raise ValueError("An RRA's consolidation function must be " + \ + "one of the following: %s" % valid) class RRD(mapper.RRDMapper): @@ -100,7 +100,7 @@ mode="w", backend=external): super(RRD, self).__init__() if filename == None: - raise ValueError, "You must provide a filename." + raise ValueError("You must provide a filename.") self.filename = filename if not start or isinstance(start, datetime): self.start = util.epoch(start) @@ -161,9 +161,9 @@ ('somefile', ['--template', u'ds0', '1000000:value', '1000001:anothervalue']) >>> my_rrd.values = [] """ - values = ':'.join([unicode(x) for x in values]) + values = ':'.join([str(x) for x in values]) self.values.append((timeOrData, values)) - self.lastupdate = float(unicode(timeOrData).split(":")[0]) + self.lastupdate = float(str(timeOrData).split(":")[0]) # for backwards compatibility bufferValues = bufferValue @@ -171,7 +171,7 @@ def create(self, debug=False): data = self.backend.prepareObject('create', self) if debug: - print data + print(data) self.backend.create(*data) # XXX this can be uncommented when we're doing full database imports with @@ -195,7 +195,7 @@ if self.values: data = self.backend.prepareObject('update', self) if debug: - print data + print(data) if not dryRun: self.backend.update(debug=debug, *data) self.values = [] @@ -391,9 +391,9 @@ maxval='U', rpn=None): super(DataSource, self).__init__() if dsName == None: - raise ValueError, "You must provide a name for the data source." + raise ValueError("You must provide a name for the data source.") if dsType == None: - raise ValueError, "You must provide a type for the data source." + raise ValueError("You must provide a type for the data source.") self.name = dsName self.type = dsType self.minimal_heartbeat = heartbeat @@ -466,7 +466,7 @@ super(RRA, self).__init__() if cf == None: msg = "You must provide a value for the consolidation function." - raise ValueError, msg + raise ValueError(msg) self.cf = cf self.xff = xff self.steps = steps --- ../python3/pyrrd/util/dist.py (original) +++ ../python3/pyrrd/util/dist.py (refactored) @@ -58,13 +58,13 @@ """ import docutils.utils import docutils.parsers.rst - import StringIO + import io doc = docutils.utils.new_document('validator') # our desired settings doc.reporter.halt_level = 5 doc.reporter.report_level = 1 - RefactoringTool: No changes to ../python3/pyrrd/util/__init__.py RefactoringTool: Refactored ../python3/pyrrd/tests/test_rrd.py stream = doc.reporter.stream = StringIO.StringIO() + stream = doc.reporter.stream = io.StringIO() # docutils buglets (?) doc.settings.tab_width = 2 doc.settings.pep_references = doc.settings.rfc_references = False @@ -82,7 +82,7 @@ """ if hasDocutils(): return _validateReST(text) - print " *** No docutils; can't validate ReST." + print(" *** No docutils; can't validate ReST.") return '' @@ -102,7 +102,7 @@ f.close() tmp.append('\n\n') else: - print "Warning: '%s' not a legal ReST filename." + print("Warning: '%s' not a legal ReST filename.") tmp.append(arg) if len(tmp) == 1: res = tmp[0] @@ -118,14 +118,14 @@ f.close() report = validateReST(res) if report: - print report + print(report) if stop_on_errors: - print 'ReST validation error' - print - print 'See the following:' - print ' http://docutils.sourceforge.net/docs/user/rst/cheatsheet.txt' - print ' http://docutils.sourceforge.net/docs/user/rst/quickstart.html' - print + print('ReST validation error') + print() + print('See the following:') + print(' http://docutils.sourceforge.net/docs/user/rst/cheatsheet.txt') + print(' http://docutils.sourceforge.net/docs/user/rst/quickstart.html') + print() raise ValueError('ReST validation error') return res --- ../python3/pyrrd/tests/test_rrd.py (original) +++ ../python3/pyrrd/tests/test_rrd.py (refactored) @@ -8,12 +8,12 @@ def test_creationDefaults(self): filename = '/tmp/test.rrd' rrd = RRD(filename, start=920804400) - self.assertEquals(rrd.filename, filename) - self.assertEquals(rrd.ds, []) - self.assertEquals(rrd.rra, []) - self.assertEquals(rrd.values, []) - self.assertEquals(rrd.step, 300) - self.assertEquals(rrd.lastupdate, None) + self.assertEqual(rrd.filename, filename) + self.assertEqual(rrd.ds, []) + self.assertEqual(rrd.rra, []) + self.assertEqual(rrd.values, []) + self.assertEqual(rrd.step, 300) + self.assertEqual(rrd.lastupdate, None) def test_creation(self): dss = [] @@ -23,14 +23,14 @@ rras.append(RRA(cf='AVERAGE', xff=0.5, steps=1, rows=24)) rras.append(RRA(cf='AVERAGE', xff=0.5, steps=6, rows=10)) rrd = RRD(filename, ds=dss, rra=rras, start=920804400) - self.assertEquals(rrd.filename, filename) - self.assertEquals(repr(rrd.ds), "[DS:speed:COUNTER:600:U:U]") - self.assertEquals( + self.assertEqual(rrd.filename, filename) + self.assertEqual(repr(rrd.ds), "[DS:speed:COUNTER:600:U:U]") + self.assertEqual( repr(rrd.rra), "[RRA:AVERAGE:0.5:1:24, RRA:AVERAGE:0.5:6:10]") - self.assertEquals(rrd.values, []) - self.assertEquals(rrd.step, 300) - self.assertEquals(rrd.lastupdate, None) + self.assertEqual(rrd.values, []) + self.assertEqual(rrd.step, 300) + self.assertEqual(rrd.lastupdate, None) def test_creationDSsAndRRAs(self): dss1 = [] @@ -40,15 +40,15 @@ rras1.append(RRA(cf='AVERAGE', xff=0.5, steps=1, rows=24)) rras1.append(RRA(cf='AVERAGE', xff=0.5, steps=6, rows=10)) rrd1 = RRD(filename, ds=dss1, rra=rras1, start=920804400) - self.assertEquals(repr(rrd1.ds), "[DS:speed:COUNTER:600:U:U]") - self.assertEquals( + self.assertEqual(repr(rrd1.ds), "[DS:speed:COUNTER:600:U:U]") + self.assertEqual( repr(rrd1.rra), "[RRA:AVERAGE:0.5:1:24, RRA:AVERAGE:0.5:6:10]") filename = '/tmp/test2.rrd' rrd2 = RRD(filename, start=920804400) - self.assertEquals(rrd2.ds, []) - self.assertEquals(rrd2.rra,[]) + self.assertEqual(rrd2.ds, []) + sRefactoringTool: Refactored ../python3/pyrrd/tests/test_node.py RefactoringTool: Refactored ../python3/pyrrd/tests/test_mapper.py elf.assertEqual(rrd2.rra,[]) dss3 = [] rras3 = [] @@ -58,7 +58,7 @@ rras3.append(RRA(cf='AVERAGE', xff=0.5, steps=12, rows=10)) rrd3 = RRD(filename, ds=dss3, rra=rras3, start=920804400) - self.assertEquals(repr(rrd3.ds), "[DS:speed:COUNTER:300:U:U]") - self.assertEquals( + self.assertEqual(repr(rrd3.ds), "[DS:speed:COUNTER:300:U:U]") + self.assertEqual( repr(rrd3.rra), "[RRA:AVERAGE:0.5:2:24, RRA:AVERAGE:0.5:12:10]") --- ../python3/pyrrd/tests/test_node.py (original) +++ ../python3/pyrrd/tests/test_node.py (refactored) @@ -12,9 +12,9 @@ def test_creation(self): rrd = RRDXMLNode(self.tree) - self.assertEquals(rrd.getAttribute("version"), "0003") - self.assertEquals(rrd.getAttribute("step"), "300") - self.assertEquals(rrd.getAttribute("lastupdate"), "920804400") + self.assertEqual(rrd.getAttribute("version"), "0003") + self.assertEqual(rrd.getAttribute("step"), "300") + self.assertEqual(rrd.getAttribute("lastupdate"), "920804400") def test_creationDS(self): dsChecks = [ @@ -27,10 +27,10 @@ ("value", "0.0000000000e+00"), ("unknown_sec", "0")] rrd = RRDXMLNode(self.tree) - self.assertEquals(len(rrd.ds), 1) + self.assertEqual(len(rrd.ds), 1) ds = rrd.ds[0] for name, value in dsChecks: - self.assertEquals(ds.getAttribute(name), value) + self.assertEqual(ds.getAttribute(name), value) def test_creationRRA(self): rra1Checks = [ @@ -40,21 +40,21 @@ ("cf", "AVERAGE"), ("pdp_per_row", "6")] rrd = RRDXMLNode(self.tree) - self.assertEquals(len(rrd.rra), 2) + self.assertEqual(len(rrd.rra), 2) rra1 = rrd.rra[0] for name, value in rra1Checks: - self.assertEquals(rra1.getAttribute(name), value) + self.assertEqual(rra1.getAttribute(name), value) rra2 = rrd.rra[1] for name, value in rra2Checks: - self.assertEquals(rra2.getAttribute(name), value) + self.assertEqual(rra2.getAttribute(name), value) def test_creationRRAParams(self): rrd = RRDXMLNode(self.tree) - self.assertEquals(len(rrd.rra), 2) + self.assertEqual(len(rrd.rra), 2) rra1 = rrd.rra[0] - self.assertEquals(rra1.getAttribute("xff"), "5.0000000000e-01") + self.assertEqual(rra1.getAttribute("xff"), "5.0000000000e-01") rra2 = rrd.rra[1] - self.assertEquals(rra2.getAttribute("xff"), "5.0000000000e-01") + self.assertEqual(rra2.getAttribute("xff"), "5.0000000000e-01") def test_creationRRACDPPrep(self): dsChecks = [ @@ -64,13 +64,13 @@ ("unknown_datapoints", "0")] rrd = RRDXMLNode(self.tree) cdpPrep1 = rrd.rra[0].cdp_prep - self.assertEquals(len(cdpPrep1.ds), 1) + self.assertEqual(len(cdpPrep1.ds), 1) for name, value in dsChecks: - self.assertEquals(cdpPrep1.ds[0].getAttribute(name), value) + self.assertEqual(cdpPrep1.ds[0].getAttribute(name), value) cdpPrep2 = rrd.rra[1].cdp_prep - self.assertEquals(len(cdpPrep2.ds), 1) + self.assertEqual(len(cdpPrep2.ds), 1) for name, value in dsChecks: - self.assertEquals(cdpPrep2.ds[0].getAttribute(name), value) + self.assertEqual(cdpPrep2.ds[0].getAttribute(name), value) def test_creationIncludeData(self): rrd = RRDXMLNode(self.tree, includeData=True) --- ../python3/pyrrd/tests/test_mapper.py (original) +++ ../python3/pyrrd/tests/test_mapper.py (refactored) @@ -28,49 +28,49 @@ def test_map(self): rrd = self.makeMapper() - self.assertEquals(rrd.version, 3) - self.assertEquals(rrd.step, 300) - self.assertEquals(rrd.lastupdate, 920804400) + self.assertEqual(rrd.version, 3) + self.assertEqual(rrd.step, 300) + self.assertEqual(rrd.lastupdate, 920804400) def test_maRefactoringTool: Refactored ../python3/pyrrd/testing/suite.py RefactoringTool: Refactored ../python3/pyrrd/testing/runner.py RefactoringTool: No changes to ../python3/pyrrd/testing/result.py RefactoringTool: No changes to ../python3/pyrrd/testing/dump.py RefactoringTool: No changes to ../python3/pyrrd/testing/base.py RefactoringTool: No changes to ../python3/pyrrd/node.py RefactoringTool: No changes to ../python3/pyrrd/meta.py RefactoringTool: Refactored ../python3/pyrrd/mapper.py pDS(self): rrd = self.makeMapper() - self.assertEquals(len(rrd.ds), 1) + self.assertEqual(len(rrd.ds), 1) ds = rrd.ds[0] - self.assertEquals(ds.name, "speed") - self.assertEquals(ds.type, "COUNTER") - self.assertEquals(ds.minimal_heartbeat, 600) - self.assertEquals(ds.min, "NaN") - self.assertEquals(ds.max, "NaN") + self.assertEqual(ds.name, "speed") + self.assertEqual(ds.type, "COUNTER") + self.assertEqual(ds.minimal_heartbeat, 600) + self.assertEqual(ds.min, "NaN") + self.assertEqual(ds.max, "NaN") def test_mapRRA(self): rrd = self.makeMapper() - self.assertEquals(len(rrd.rra), 2) + self.assertEqual(len(rrd.rra), 2) rra1 = rrd.rra[0] - self.assertEquals(rra1.cf, "AVERAGE") - self.assertEquals(rra1.pdp_per_row, 1) + self.assertEqual(rra1.cf, "AVERAGE") + self.assertEqual(rra1.pdp_per_row, 1) rra2 = rrd.rra[1] - self.assertEquals(rra2.cf, "AVERAGE") - self.assertEquals(rra2.pdp_per_row, 6) + self.assertEqual(rra2.cf, "AVERAGE") + self.assertEqual(rra2.pdp_per_row, 6) def test_mapRRAParams(self): rrd = self.makeMapper() rra1 = rrd.rra[0] - self.assertEquals(rra1.xff, 0.5) + self.assertEqual(rra1.xff, 0.5) rra2 = rrd.rra[1] - self.assertEquals(rra2.xff, 0.5) + self.assertEqual(rra2.xff, 0.5) def test_mapRRACDPPrep(self): rrd = self.makeMapper() ds1 = rrd.rra[0].ds - self.assertEquals(len(ds1), 1) - self.assertEquals(ds1[0].primary_value, 0.0) - self.assertEquals(ds1[0].secondary_value, 0.0) - self.assertEquals(str(ds1[0].value), str(NaN())) - self.assertEquals(ds1[0].unknown_datapoints, 0) + self.assertEqual(len(ds1), 1) + self.assertEqual(ds1[0].primary_value, 0.0) + self.assertEqual(ds1[0].secondary_value, 0.0) + self.assertEqual(str(ds1[0].value), str(NaN())) + self.assertEqual(ds1[0].unknown_datapoints, 0) ds2 = rrd.rra[1].ds - self.assertEquals(len(ds2), 1) - self.assertEquals(len(ds1), 1) - self.assertEquals(ds2[0].primary_value, 0.0) - self.assertEquals(ds2[0].secondary_value, 0.0) - self.assertEquals(str(ds2[0].value), str(NaN())) - self.assertEquals(ds2[0].unknown_datapoints, 0) + self.assertEqual(len(ds2), 1) + self.assertEqual(len(ds1), 1) + self.assertEqual(ds2[0].primary_value, 0.0) + self.assertEqual(ds2[0].secondary_value, 0.0) + self.assertEqual(str(ds2[0].value), str(NaN())) + self.assertEqual(ds2[0].unknown_datapoints, 0) --- ../python3/pyrrd/testing/suite.py (original) +++ ../python3/pyrrd/testing/suite.py (refactored) @@ -21,7 +21,7 @@ if filename in skipFiles: return False if path in skipFiles: - print "skip it!" + print("skip it!") return False return True --- ../python3/pyrrd/testing/runner.py (original) +++ ../python3/pyrrd/testing/runner.py (refactored) @@ -34,7 +34,7 @@ def get_suite(loader, top_level_directory, options): - print options.test_specific + print(options.test_specific) if options.test_specific: suite = loader.loadTestsFromName(options.test_specific) elif hasattr(loader, "discover"): --- ../python3/pyrrd/mapper.py (original) +++ ../python3/pyrrd/mapper.py (refactored) @@ -14,7 +14,7 @@ __skip_repr__ = [] def setAttributes(self, attributes): - for name, value in attributes.items(): + for name, value in list(attributes.items()): if name not in self.__skip_repr__: setattr(self, name, value) @@ -31,10 +31,10 @@ self.setAttributes(node.attributes) def printInfo(self): - for name, value in self.getData().items(): - if value is None: - continue - print "%s = %s" % (name, unicode(value)) + for name, value in list(self.getData().items()): + RefactoringTool: Refactored ../python3/pyrrd/graph.py if value is None: + continue + print("%s = %s" % (name, str(value))) class RowMapper(Mapper): @@ -64,11 +64,11 @@ ] def printInfo(self, prefix, index): - for name, value in self.getData().items(): - if value is None: - continue - print "%s.cdp_prep[%s].%s = %s" % ( - prefix, index, name, unicode(value)) + for name, value in list(self.getData().items()): + if value is None: + continue + print("%s.cdp_prep[%s].%s = %s" % ( + prefix, index, name, str(value))) class CDPPrepMapper(Mapper, DSMixin): @@ -114,10 +114,10 @@ def printInfo(self, index): prefix = "rra[%s]" % index - for name, value in self.getData().items(): - if value is None: - continue - print "%s.%s = %s" % (prefix, name, unicode(value)) + for name, value in list(self.getData().items()): + if value is None: + continue + print("%s.%s = %s" % (prefix, name, str(value))) for index, ds in enumerate(self.ds): ds.printInfo(prefix, index) @@ -138,11 +138,11 @@ ] def printInfo(self): - for name, value in self.getData().items(): + for name, value in list(self.getData().items()): if value is None: continue if name != self.name: - print "ds[%s].%s = %s" % (self.name, name, unicode(value)) + print("ds[%s].%s = %s" % (self.name, name, str(value))) class RRDMapper(Mapper, DSMixin): --- ../python3/pyrrd/graph.py (original) +++ ../python3/pyrrd/graph.py (refactored) @@ -21,10 +21,10 @@ ValueError: Names must be shorter than 255 characters ''' if name != re.sub('[^A-Za-z0-9_-]', '', name): - raise ValueError, "Names must consist only of the characters " + \ - "A-Z, a-z, 0-9, -, _" + raise ValueError("Names must consist only of the characters " + \ + "A-Z, a-z, 0-9, -, _") if len(name) > 255: - raise ValueError, "Names must be shorter than 255 characters" + raise ValueError("Names must be shorter than 255 characters") return name def escapeColons(data): @@ -54,8 +54,8 @@ ''' if isinstance(instance, objType): return instance - raise TypeError, "%s instance is not of type %s" % ( - type(instance).__name__, objType.__name__) + raise TypeError("%s instance is not of type %s" % ( + type(instance).__name__, objType.__name__)) def validateImageFormat(format): ''' @@ -74,8 +74,8 @@ return format else: valid = ' '.join(valid) - raise ValueError, 'The image format must be one of the ' + \ - 'following: %s' % valid + raise ValueError('The image format must be one of the ' + \ + 'following: %s' % valid) class DataDefinition(object): ''' @@ -163,7 +163,7 @@ self.cdef): msg = ("vname, rrdfile, dsName, and cdef " + "are all required attributes and cannot be None.") - raise ValueError, msg + raise ValueError(msg) main = 'DEF:%(vname)s=%(rrdfile)s:%(dsName)s:%(cdef)s' % ( self.__dict__) tail = '' @@ -220,9 +220,9 @@ ''' def __init__(self, vname=None, rpn=None): if vname == None: - raise ValueError, "You must provide a variable definition name." + raise ValueError("You must provide a variable definition name.") if rpn == None: - raise ValueError, "You must provide an RPN statement(s)." + raise ValueError("You must provide an RPN statement(s).") self.vname = validateVName(vname) self.rpn = rpn self.abbr = 'VDEF' @@ -477,12 +477,12 @@ self.stack = stack if value: if not (isinstance(value, str) or isinstance(value, int)): - raise ValueError, "The parameter 'value' must be RefactoringTool: Refactored ../python3/pyrrd/backend/external.py " + \ - "either a string or an integer." + raise ValueError("The parameter 'value' must be " + \ + "either a string or an integer.") else: if not defObj: - raise Exception, "You must provide either a value " + \ - "or a definition object." + raise Exception("You must provide either a value " + \ + "or a definition object.") else: value = defObj.vname self.vname = value @@ -495,7 +495,7 @@ ''' main = self.abbr if self.width: - main += unicode(self.width) + main += str(self.width) main += ':%s' % self.vname if self.color: main += self.color @@ -551,23 +551,23 @@ ''' def __init__(self, defObj=None, color=None, fraction=None, legend=''): if not defObj: - raise Exception, "You must provide either a value " + \ - "or a definition object." + raise Exception("You must provide either a value " + \ + "or a definition object.") else: value1 = defObj.vname if fraction: if not (isinstance(fraction, float) or isinstance(fraction, int)): - raise TypeError, "The parameter 'fraction' must" + \ - "be a float value between 0 and 1." + raise TypeError("The parameter 'fraction' must" + \ + "be a float value between 0 and 1.") else: if 0 <= fraction <= 1: value2 = fraction else: - raise ValueError, "The parameter 'fraction' must" + \ - "be a value between 0 and 1." + raise ValueError("The parameter 'fraction' must" + \ + "be a value between 0 and 1.") if not color: - raise ValueError, "Missing required parameter color" + raise ValueError("Missing required parameter color") self.vname = value1 @@ -682,7 +682,7 @@ def __repr__(self): joiner = ' --color ' - params = self.__dict__.items() + params = list(self.__dict__.items()) params.sort() attrs = [ name.upper()+color for name,color in params if color ] return joiner.join(attrs) @@ -847,7 +847,7 @@ ''' data = self.backend.prepareObject('graph', self) if debug: - print data + print(data) self.backend.graph(*data) --- ../python3/pyrrd/backend/external.py (original) +++ ../python3/pyrrd/backend/external.py (refactored) @@ -16,7 +16,7 @@ close_fds=close_fds) (stdout, stderr) = process.communicate() if stderr: - print command + print(command) #import pdb;pdb.set_trace() raise ExternalCommandError(stderr.strip()) if process.returncode != 0: @@ -141,7 +141,7 @@ for line in lines[2:]: time, data = line.split(":") data = [common.coerce(datum) for datum in data.split()] - results["time"][int(time)] = dict(zip(dsNames, data)) + results["time"][int(time)] = dict(list(zip(dsNames, data))) for dsName, datum in zip(dsNames, data): results["ds"].setdefault(dsName, []) results["ds"][dsName].append((int(time), common.coerce(datum))) @@ -281,8 +281,8 @@ if function == 'create': validParams = ['start', 'step'] params = common.buildParameters(obj, validParams) - data = [unicode(x) for x in obj.ds] - data += [unicode(x) for x in obj.rra] + data = [str(x) for x in obj.ds] + data += [str(x) for x in obj.rra] return (obj.filename, params + data) if function == 'update': @@ -316,7 +316,7 @@ 'force_rules_legend', 'tabwidth', 'base', 'color', 'imgformat', 'slope_mode'] params = common.buildParameters(obj, validParams) - datRefactoringTool: Refactored ../python3/pyrrd/backend/common.py RefactoringTool: Refactored ../python3/pyrrd/backend/tests/test_external.py RefactoringTool: Refactored ../python3/pyrrd/backend/tests/test_bindings.py RefactoringTool: No changes to ../python3/pyrrd/backend/native/format.py RefactoringTool: Refactored ../python3/pyrrd/backend/bindings.py a = [unicode(x) for x in obj.data] + data = [str(x) for x in obj.data] return (obj.filename, params + data) --- ../python3/pyrrd/backend/common.py (original) +++ ../python3/pyrrd/backend/common.py (refactored) @@ -23,12 +23,12 @@ try: return float(value) except ValueError: - value = unicode(value).lower() + value = str(value).lower() if value in ["unkn", "u"]: return None elif value == "nan": return NaN() - raise ValueError, "Unexpected type for data (%s)" % value + raise ValueError("Unexpected type for data (%s)" % value) def iterParse(lines): @@ -92,7 +92,7 @@ param = param.replace("_", "-") if isinstance(attr, bool): attr = "" - params.extend(["--%s" % param, unicode(attr)]) + params.extend(["--%s" % param, str(attr)]) return [x for x in params if x] --- ../python3/pyrrd/backend/tests/test_external.py (original) +++ ../python3/pyrrd/backend/tests/test_external.py (refactored) @@ -1,4 +1,4 @@ -from cStringIO import StringIO +from io import StringIO import os import sys import tempfile @@ -29,7 +29,7 @@ "step)") try: self.rrd.update() - except ExternalCommandError, error: + except ExternalCommandError as error: self.assertTrue(str(error).startswith("ERROR:")) self.assertTrue(str(error).endswith(expected)) @@ -66,5 +66,5 @@ if obtained.startswith("filename"): self.assertTrue(expected.strip().startswith("filename")) else: - self.assertEquals(obtained.strip(), expected.strip()) + self.assertEqual(obtained.strip(), expected.strip()) sys.stdout = originalStdout --- ../python3/pyrrd/backend/tests/test_bindings.py (original) +++ ../python3/pyrrd/backend/tests/test_bindings.py (refactored) @@ -1,4 +1,4 @@ -from cStringIO import StringIO +from io import StringIO import os import sys import tempfile @@ -54,7 +54,7 @@ if obtained.startswith("filename"): self.assertTrue(expected.strip().startswith("filename")) else: - self.assertEquals(obtained.strip(), expected.strip()) + self.assertEqual(obtained.strip(), expected.strip()) def test_infoReadMode(self): expectedOutput = """ @@ -92,10 +92,10 @@ rrd.info(useBindings=True, stream=output) for obtained, expected in zip( output.getvalue().split("\n"), expectedOutput): - print "obtained:", obtained - print "expected:", expected + print("obtained:", obtained) + print("expected:", expected) if obtained.startswith("filename"): self.assertTrue(expected.strip().startswith("filename")) else: - self.assertEquals(obtained.strip(), expected.strip()) + self.assertEqual(obtained.strip(), expected.strip()) sys.stdout = originalStdout --- ../python3/pyrrd/backend/bindings.py (original) +++ ../python3/pyrrd/backend/bindings.py (refactored) @@ -157,8 +157,8 @@ # right now) args = [str(x) for x in args] if debug: - print "function:", function - print "args:", args + print("function:", function) + print("args:", args) return function(*args) @@ -444,8 +444,8 @@ if function == 'create': validParams = ['start', 'step'] params = buildParameters(obj, validParams) - params += [unicode(x) for x in obj.ds] - params += [unicode(x) for x in obj.rra] + params += [str(x) for x in obj.ds] + params += [str(x) for x in obj.rra] return (obj.filename, params) if function == 'update': @@ -478,7 +478,7 @@ 'force_rules_legend', 'tabwidth', 'base', 'color', 'imgformat', 'slope_mode'] params = buildParameters(obj, validParams) - params += [unicode(x) for x in obj.data] + pRefactoringTool: No changes to ../python3/examples/example5.py RefactoringTool: Refactored ../python3/examples/example4.py RefactoringTool: Refactored ../python3/examples/example3.py RefactoringTool: No changes to ../python3/examples/example2.py RefactoringTool: No changes to ../python3/examples/example1.py RefactoringTool: Files that were modified: RefactoringTool: ../python3/setup.py RefactoringTool: ../python3/sandbox/oubiwann/file-format/rrdmaker.py RefactoringTool: ../python3/sandbox/oubiwann/file-format/2ds1rra1entry.py RefactoringTool: ../python3/sandbox/oubiwann/file-format/1ds1rra2entry.py RefactoringTool: ../python3/sandbox/oubiwann/file-format/1ds1rra1entry.py RefactoringTool: ../python3/pyrrd/rrd.py RefactoringTool: ../python3/pyrrd/util/dist.py RefactoringTool: ../python3/pyrrd/util/__init__.py RefactoringTool: ../python3/pyrrd/tests/test_rrd.py RefactoringTool: ../python3/pyrrd/tests/test_node.py RefactoringTool: ../python3/pyrrd/tests/test_mapper.py RefactoringTool: ../python3/pyrrd/testing/suite.py RefactoringTool: ../python3/pyrrd/testing/runner.py RefactoringTool: ../python3/pyrrd/testing/result.py RefactoringTool: ../python3/pyrrd/testing/dump.py RefactoringTool: ../python3/pyrrd/testing/base.py RefactoringTool: ../python3/pyrrd/node.py RefactoringTool: ../python3/pyrrd/meta.py RefactoringTool: ../python3/pyrrd/mapper.py RefactoringTool: ../python3/pyrrd/graph.py RefactoringTool: ../python3/pyrrd/backend/external.py RefactoringTool: ../python3/pyrrd/backend/common.py RefactoringTool: ../python3/pyrrd/backend/tests/test_external.py RefactoringTool: ../python3/pyrrd/backend/tests/test_bindings.py RefactoringTool: ../python3/pyrrd/backend/native/format.py RefactoringTool: ../python3/pyrrd/backend/bindings.py RefactoringTool: ../python3/examples/example5.py RefactoringTool: ../python3/examples/example4.py RefactoringTool: ../python3/examples/example3.py RefactoringTool: ../python3/examples/example2.py RefactoringTool: ../python3/examples/example1.py arams += [str(x) for x in obj.data] return (obj.filename, params) --- ../python3/examples/example4.py (original) +++ ../python3/examples/example4.py (refactored) @@ -42,7 +42,7 @@ # let's generate some data... currentTime = startTime -for i in xrange(maxSteps): +for i in range(maxSteps): currentTime += step # lets update the RRD/purge the buffer ever 100 entires if i % 100 == 0: --- ../python3/examples/example3.py (original) +++ ../python3/examples/example3.py (refactored) @@ -36,7 +36,7 @@ # let's generate some data... currentTime = startTime -for i in xrange(maxSteps): +for i in range(maxSteps): currentTime += step # lets update the RRD/purge the buffer ever 100 entires if i % 100 == 0 and myRRD.values: + exit 0 Executing(%build): /bin/sh -e /usr/src/tmp/rpm-tmp.65861 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd python-module-pyrrd-0.1.0 + CFLAGS='-pipe -Wall -g -O2 -march=i586 -mtune=generic' + export CFLAGS + CXXFLAGS='-pipe -Wall -g -O2 -march=i586 -mtune=generic' + export CXXFLAGS + FFLAGS='-pipe -Wall -g -O2 -march=i586 -mtune=generic' + export FFLAGS + /usr/bin/python setup.py build --debug Traceback (most recent call last): File "setup.py", line 24, in out=True), File "/usr/src/RPM/BUILD/python-module-pyrrd-0.1.0/pyrrd/util/dist.py", line 119, in catReST report = validateReST(res) File "/usr/src/RPM/BUILD/python-module-pyrrd-0.1.0/pyrrd/util/dist.py", line 84, in validateReST return _validateReST(text) File "/usr/src/RPM/BUILD/python-module-pyrrd-0.1.0/pyrrd/util/dist.py", line 74, in _validateReST parser.parse(text, doc) File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/__init__.py", line 185, in parse self.statemachine.run(inputlines, document, inliner=self.inliner) File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 157, in run inliner.init_customizations(document.settings) File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 470, in init_customizations if settings.character_level_inline_markup: AttributeError: Values instance has no attribute 'character_level_inline_markup' error: Bad exit status from /usr/src/tmp/rpm-tmp.65861 (%build) RPM build errors: Bad exit status from /usr/src/tmp/rpm-tmp.65861 (%build) Command exited with non-zero status 1 4.26user 0.25system 0:04.51elapsed 100%CPU (0avgtext+0avgdata 17004maxresident)k 0inputs+0outputs (0major+27360minor)pagefaults 0swaps hsh-rebuild: rebuild of `python-module-pyrrd-0.1.0-alt1.git20120117.1.1.src.rpm' failed. Command exited with non-zero status 1 28.19user 6.00system 0:34.82elapsed 98%CPU (0avgtext+0avgdata 134116maxresident)k 424inputs+0outputs (0major+347196minor)pagefaults 0swaps