<86>Feb 2 11:02:06 userdel[1676027]: delete user 'rooter' <86>Feb 2 11:02:06 userdel[1676027]: removed group 'rooter' owned by 'rooter' <86>Feb 2 11:02:06 userdel[1676027]: removed shadow group 'rooter' owned by 'rooter' <86>Feb 2 11:02:06 groupadd[1676032]: group added to /etc/group: name=rooter, GID=537 <86>Feb 2 11:02:06 groupadd[1676032]: group added to /etc/gshadow: name=rooter <86>Feb 2 11:02:06 groupadd[1676032]: new group: name=rooter, GID=537 <86>Feb 2 11:02:06 useradd[1676036]: new user: name=rooter, UID=537, GID=537, home=/root, shell=/bin/bash <86>Feb 2 11:02:06 userdel[1676043]: delete user 'builder' <86>Feb 2 11:02:06 userdel[1676043]: removed group 'builder' owned by 'builder' <86>Feb 2 11:02:06 userdel[1676043]: removed shadow group 'builder' owned by 'builder' <86>Feb 2 11:02:06 groupadd[1676048]: group added to /etc/group: name=builder, GID=538 <86>Feb 2 11:02:06 groupadd[1676048]: group added to /etc/gshadow: name=builder <86>Feb 2 11:02:06 groupadd[1676048]: new group: name=builder, GID=538 <86>Feb 2 11:02:06 useradd[1676052]: new user: name=builder, UID=538, GID=538, home=/usr/src, shell=/bin/bash <13>Feb 2 11:02:09 rpmi: libgdbm-1.8.3-alt10 1454943334 installed <13>Feb 2 11:02:09 rpmi: libexpat-2.2.4-alt1 1503305345 installed <13>Feb 2 11:02:09 rpmi: libp11-kit-0.23.15-alt1 sisyphus+226408.100.2.1 1554288204 installed <13>Feb 2 11:02:09 rpmi: libtasn1-4.14-alt1 p9+235792.100.2.1 1565425233 installed <13>Feb 2 11:02:09 rpmi: rpm-macros-alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed <13>Feb 2 11:02:09 rpmi: alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed <13>Feb 2 11:02:09 rpmi: ca-certificates-2019.10.28-alt1 p9+240634.100.1.1 1573575926 installed <13>Feb 2 11:02:09 rpmi: ca-trust-0.1.2-alt1 p9+233349.100.1.1 1561655062 installed <13>Feb 2 11:02:09 rpmi: p11-kit-trust-0.23.15-alt1 sisyphus+226408.100.2.1 1554288204 installed <13>Feb 2 11:02:09 rpmi: libcrypto1.1-1.1.1d-alt1.1 p9+237853.200.3.1 1569251834 installed <13>Feb 2 11:02:09 rpmi: libssl1.1-1.1.1d-alt1.1 p9+237853.200.3.1 1569251834 installed <13>Feb 2 11:02:09 rpmi: python3-3.7.4-alt2 p9+239459.100.1.1 1571444790 installed <13>Feb 2 11:02:10 rpmi: libpython3-3.7.4-alt2 p9+239459.100.1.1 1571444790 installed <13>Feb 2 11:02:11 rpmi: python3-base-3.7.4-alt2 p9+239459.100.1.1 1571444790 installed <13>Feb 2 11:02:11 rpmi: tests-for-installed-python3-pkgs-0.1.13.1-alt2 1535450458 installed <13>Feb 2 11:02:11 rpmi: rpm-build-python3-0.1.13.1-alt2 1535450458 installed <13>Feb 2 11:02:19 rpmi: python3-module-pkg_resources-1:40.8.0-alt2 sisyphus+229158.200.2.1 1557735221 installed <13>Feb 2 11:02:19 rpmi: python-modules-curses-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:19 rpmi: libtinfo-devel-6.1.20180407-alt2 sisyphus+222164.200.1.1 1550686226 installed <13>Feb 2 11:02:19 rpmi: libncurses-devel-6.1.20180407-alt2 sisyphus+222164.200.1.1 1550686226 installed <13>Feb 2 11:02:19 rpmi: python3-dev-3.7.4-alt2 p9+239459.100.1.1 1571444790 installed <13>Feb 2 11:02:19 rpmi: libverto-0.3.0-alt1_7 sisyphus+225932.100.1.1 1553994919 installed <13>Feb 2 11:02:19 rpmi: libkeyutils-1.6-alt2 sisyphus+226520.100.2.1 1554512089 installed <13>Feb 2 11:02:19 rpmi: libcom_err-1.44.6-alt1 sisyphus+224154.100.1.1 1552091678 installed <86>Feb 2 11:02:19 groupadd[1681119]: group added to /etc/group: name=_keytab, GID=499 <86>Feb 2 11:02:19 groupadd[1681119]: group added to /etc/gshadow: name=_keytab <86>Feb 2 11:02:19 groupadd[1681119]: new group: name=_keytab, GID=499 <13>Feb 2 11:02:19 rpmi: libkrb5-1.17.1-alt1 p9+242852.100.2.1 1576572639 installed <13>Feb 2 11:02:19 rpmi: libtirpc-1.0.3-alt1 1532008017 installed <13>Feb 2 11:02:19 rpmi: libnsl2-1.1.0-alt1_1 1511548749 installed <13>Feb 2 11:02:19 rpmi: python-modules-compiler-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:19 rpmi: python-modules-email-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:19 rpmi: python-modules-unittest-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:19 rpmi: python-modules-encodings-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-modules-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-modules-nis-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-modules-ctypes-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-modules-multiprocessing-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-modules-logging-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-tools-2to3-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-modules-xml-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-modules-hotshot-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-modules-bsddb-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-modules-distutils-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-module-pkg_resources-1:40.8.0-alt2 sisyphus+229158.200.2.1 1557735221 installed <13>Feb 2 11:02:20 rpmi: libnsl2-devel-1.1.0-alt1_1 1511548749 installed <13>Feb 2 11:02:20 rpmi: python-dev-2.7.16-alt1.M90P.1 p9+244933.100.1.1 1579867218 installed <13>Feb 2 11:02:20 rpmi: python-module-setuptools-1:40.8.0-alt2 sisyphus+229158.200.2.1 1557735221 installed <13>Feb 2 11:02:20 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-zope.app.workflow-3.5.0-alt4.2.nosrc.rpm Installing python-module-zope.app.workflow-3.5.0-alt4.2.src.rpm Building target platforms: i586 Building for target i586 Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.21682 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + rm -rf python-module-zope.app.workflow-3.5.0 + echo 'Source #0 (python-module-zope.app.workflow-3.5.0.tar):' Source #0 (python-module-zope.app.workflow-3.5.0.tar): + /bin/tar -xf /usr/src/RPM/SOURCES/python-module-zope.app.workflow-3.5.0.tar + cd python-module-zope.app.workflow-3.5.0 + /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: No changes to ../python3/src/zope/app/workflow/tests/workflowsetup.py RefactoringTool: Refactored ../python3/src/zope/app/workflow/tests/test_instance.py RefactoringTool: No changes to ../python3/src/zope/app/workflow/tests/test_definition.py RefactoringTool: No changes to ../python3/src/zope/app/workflow/testing.py RefactoringTool: Refactored ../python3/src/zope/app/workflow/stateful/xmlimportexport.py --- ../python3/src/zope/app/workflow/tests/test_instance.py (original) +++ ../python3/src/zope/app/workflow/tests/test_instance.py (refactored) @@ -51,27 +51,27 @@ di = DummyInstance() pica = ProcessInstanceContainerAdapter(annotations) - self.assertEqual(annotations.keys(), [WFKey,]) + self.assertEqual(list(annotations.keys()), [WFKey,]) self.assertEqual(len(pica), 0) - self.assertEqual(pica.keys(), []) - self.assertEqual(pica.items(), []) - self.assertEqual(pica.values(), []) + self.assertEqual(list(pica.keys()), []) + self.assertEqual(list(pica.items()), []) + self.assertEqual(list(pica.values()), []) self.assertEqual(pica.get('nothing', 1), 1) self.assertRaises(TypeError, pica.__setitem__, 123, None) pica['dummy'] = di self.assertEqual(len(pica), 1) - self.assertEqual(pica.keys(), ['dummy']) - self.assertEqual(pica.values(), [di]) - self.assertEqual(pica.items(), [('dummy', di,),]) + self.assertEqual(list(pica.keys()), ['dummy']) + self.assertEqual(list(pica.values()), [di]) + self.assertEqual(list(pica.items()), [('dummy', di,),]) self.assertEqual(pica['dummy'], di) self.assertEqual(pica.get('dummy', 1), di) - self.failUnless('dummy' in pica) + self.assertTrue('dummy' in pica) del pica['dummy'] self.assertEqual(len(pica), 0) - self.failIf('dummy' in pica) + self.assertFalse('dummy' in pica) def test_suite(): --- ../python3/src/zope/app/workflow/stateful/xmlimportexport.py (original) +++ ../python3/src/zope/app/workflow/stateful/xmlimportexport.py (refactored) @@ -78,7 +78,7 @@ def startWorkflow(self, attrs): dc = IZopeDublinCore(self.context) - dc.title = attrs.get('title', u'') + dc.title = attrs.get('title', '') def startSchema(self, attrs): name = attrs['name'].encode(self.encoding).strip() @@ -96,11 +96,11 @@ perm = None else: perm = zope.component.getUtility(IPermission, perm_id) - if not fieldName in perms.keys(): + if not fieldName in list(perms.keys()): perms[fieldName] = (CheckerPublic, CheckerPublic) - if type == u'get': + if type == 'get': perms[fieldName] = (perm, perms[fieldName][1]) - if type == u'set': + if type == 'set': perms[fieldName] = (perms[fieldName][0], perm) def startState(self, attrs): @@ -108,17 +108,17 @@ if name == 'INITIAL': state = self.context.getState('INITIAL') dc = IZopeDublinCore(state) - dc.title = attrs.get('title', u'') + dc.title = attrs.get('title', '') else: state = State() dc = IZopeDublinCore(state) - dc.title = attrs.get('title', u'') + dc.title = attrs.get('title', '') self.context.addState(name, state) def startTransition(self, attrs): name = attrs['name'] - permission = attrs.get('permission', u'zope.Public') - if permission == u'zope.Public': + permission = attrs.get('permission', 'zope.Public') + if permission == 'zope.Public': permission = CheckerPublic trans = Transition( sourceState = attrs['sourceState'], @@ -129,7 +129,7 @@ triggerMode = attrs['triggerMode'] ) dc = IZopeDublinCore(trans) - dc.title = attrs.get('title', u'') + dc.title = attrs.get('title', '') self.context.addTransition(name, trans) @@ -172,7 +172,7 @@ return IZopeDublinCore(obj) def getPermissionId(self, permission): - if isinstance(permission, str) or isinstance(permission, unicode): + if isinstance(permission, str) or isinstance(permission, str): return permission if permission is CheckerPublic: return 'zope.Public' @@ -184,7 +184,7 @@ def getSchemaPeRefactoringTool: Refactored ../python3/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py rmissions(self): info = [] perms = self.context.schemaPermissions - for field, (getPerm, setPerm) in perms.items(): + for field, (getPerm, setPerm) in list(perms.items()): info.append({'fieldName': field, 'type': 'get', 'id': self.getPermissionId(getPerm)}) --- ../python3/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py (original) +++ ../python3/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py (refactored) @@ -16,7 +16,7 @@ $Id: test_xmlimportexport.py 67630 2006-04-27 00:54:03Z jim $ """ import unittest -from StringIO import StringIO +from io import StringIO import zope.component from zope.interface import implements, classImplements, Interface @@ -43,7 +43,7 @@ class ISchema(Interface): title = TextLine( - title=u"Title", + title="Title", required=True) @@ -138,20 +138,20 @@ self.assertEqual(len(testpd.transitions), 3) st = testpd.states['INITIAL'] - self.assert_(isinstance(st, State)) + self.assertTrue(isinstance(st, State)) self.assertEqual(IZopeDublinCore(st).title, 'initial') st = testpd.states['state1'] - self.assert_(isinstance(st, State)) + self.assertTrue(isinstance(st, State)) self.assertEqual(IZopeDublinCore(st).title, 'State1') st = testpd.states['state2'] - self.assert_(isinstance(st, State)) + self.assertTrue(isinstance(st, State)) self.assertEqual(IZopeDublinCore(st).title, 'State2') tr = testpd.transitions['initial_state1'] - self.assert_(isinstance(tr, Transition)) + self.assertTrue(isinstance(tr, Transition)) self.assertEqual(IZopeDublinCore(tr).title, 'INITIALtoState1') self.assertEqual(tr.sourceState, 'INITIAL') @@ -162,7 +162,7 @@ self.assertEqual(tr.triggerMode, 'Automatic') tr = testpd.transitions['state1_state2'] - self.assert_(isinstance(tr, Transition)) + self.assertTrue(isinstance(tr, Transition)) self.assertEqual(IZopeDublinCore(tr).title, 'State1toState2') self.assertEqual(tr.sourceState, 'state1') @@ -173,7 +173,7 @@ self.assertEqual(tr.triggerMode, 'Manual') tr = testpd.transitions['state2_initial'] - self.assert_(isinstance(tr, Transition)) + self.assertTrue(isinstance(tr, Transition)) self.assertEqual(IZopeDublinCore(tr).title, 'State2toINITIAL') self.assertEqual(tr.sourceState, 'state2') @@ -189,43 +189,43 @@ handler.doImport(xml_text) handler = XMLExportHandler(testpd) xml = handler.doExport() - self.assert_( + self.assertTrue( '' in xml) - self.assert_( + self.assertTrue( '' in xml) - self.assert_( + self.assertTrue( '' in xml) - self.assert_( + self.assertTrue( '' in xml) - self.assert_( + self.assertTrue( '' in xml) - self.assert_('' in xml) - self.assert_('' in xml) - self.assert_('' in xml) - - self.assert_('' in xml) - - self.assert_('' in xml) - - self.assert_('' in xml) + self.assertTrue('' in xml) + self.assertTrue('' in xml) + self.assertTrue('' in xml) + + self.assertTrue('' in xml) + + self.assertTrue('' in xml) + + self.assertTrue('' in xml) def test_suite(): --- ../python3/src/zope/app/workflow/stateful/tests/test_instance.py (original) +++ ../python3/src/zope/app/workflow/stateful/tests/test_instance.py (refactored) @@ -60,9 +60,9 @@ class ITestDataSchema(Interface): - text = Text(title=u'a text', default=u'no text') - - value = Int(title=u'an int', default=1) + text = Text(title='a text', default='no text') + + value = Int(title='an int', default=1) def sort(l): @@ -109,18 +109,18 @@ pi = self.pi data = pi.data - self.assert_(ITestDataSchema.providedBy(data)) + self.assertTrue(ITestDataSchema.providedBy(data)) self.assertEqual(data.text, 'no text') self.assertEqual(data.value, 1) data.text = 'another text' - self.assert_(IBeforeRelevantDataChangeEvent.providedBy(events[0])) - self.assert_(IAfterRelevantDataChangeEvent.providedBy(events[-1])) + self.assertTrue(IBeforeRelevantDataChangeEvent.providedBy(events[0])) + self.assertTrue(IAfterRelevantDataChangeEvent.providedBy(events[-1])) clearEvents() data.value = 10 - self.assert_(IBeforeRelevantDataChangeEvent.providedBy(events[0])) - self.assert_(IAfterRelevantDataChangeEvent.providedBy(events[-1])) + self.assertTrue(IBeforeRelevantDataChangeEvent.providedBy(events[0])) + self.assertTrue(IAfterRelevantDataChangeEvent.providedBy(events[-1])) self.assertEqual(data.text, 'another text') self.assertEqual(data.value, 10) @@ -134,44 +134,44 @@ clearEvents() pi.fireTransition('show') - self.assert_(IBeforeTransitionEvent.providedBy(events[0])) - self.assert_(IAfterTransitionEvent.providedBy(events[-1])) + self.assertTrue(IBeforeTransitionEvent.providedBy(events[0])) + self.assertTrue(IAfterTransitionEvent.providedBy(events[-1])) self.assertEqual(pi.staRefactoringTool: Refactored ../python3/src/zope/app/workflow/stateful/tests/test_definition.py tus, 'private') self.assertEqual(sort(pi.getOutgoingTransitions()), ['publish_direct', 'submit_pending']) clearEvents() pi.fireTransition('submit_pending') - self.assert_(IBeforeTransitionEvent.providedBy(events[0])) - self.assert_(IAfterTransitionEvent.providedBy(events[-1])) + self.assertTrue(IBeforeTransitionEvent.providedBy(events[0])) + self.assertTrue(IAfterTransitionEvent.providedBy(events[-1])) self.assertEqual(pi.status, 'pending') self.assertEqual(sort(pi.getOutgoingTransitions()), ['publish_pending', 'retract_pending']) clearEvents() pi.fireTransition('publish_pending') - self.assert_(IBeforeTransitionEvent.providedBy(events[0])) - self.assert_(IAfterTransitionEvent.providedBy(events[-1])) + self.assertTrue(IBeforeTransitionEvent.providedBy(events[0])) + self.assertTrue(IAfterTransitionEvent.providedBy(events[-1])) self.assertEqual(pi.status, 'published') self.assertEqual(sort(pi.getOutgoingTransitions()), ['retract_published']) clearEvents() pi.fireTransition('retract_published') - self.assert_(IBeforeTransitionEvent.providedBy(events[0])) - self.assert_(IAfterTransitionEvent.providedBy(events[-1])) + self.assertTrue(IBeforeTransitionEvent.providedBy(events[0])) + self.assertTrue(IAfterTransitionEvent.providedBy(events[-1])) self.assertEqual(pi.status, 'private') clearEvents() pi.fireTransition('submit_pending') - self.assert_(IBeforeTransitionEvent.providedBy(events[0])) - self.assert_(IAfterTransitionEvent.providedBy(events[-1])) + self.assertTrue(IBeforeTransitionEvent.providedBy(events[0])) + self.assertTrue(IAfterTransitionEvent.providedBy(events[-1])) self.assertEqual(pi.status, 'pending') clearEvents() pi.fireTransition('retract_pending') - self.assert_(IBeforeTransitionEvent.providedBy(events[0])) - self.assert_(IAfterTransitionEvent.providedBy(events[-1])) + self.assertTrue(IBeforeTransitionEvent.providedBy(events[0])) + self.assertTrue(IAfterTransitionEvent.providedBy(events[-1])) self.assertEqual(pi.status, 'private') --- ../python3/src/zope/app/workflow/stateful/tests/test_definition.py (original) +++ ../python3/src/zope/app/workflow/stateful/tests/test_definition.py (refactored) @@ -41,7 +41,7 @@ class IDummyDataSchema(Interface): - text = TextLine(title=u'a text', default=u'no text') + text = TextLine(title='a text', default='no text') # TODO: Tests missing for: @@ -80,9 +80,9 @@ names = pd.getStateNames() - self.failUnless('st1' in names) - self.failUnless('st2' in names) - self.failUnless(pd.getInitialStateName() in names) + self.assertTrue('st1' in names) + self.assertTrue('st2' in names) + self.assertTrue(pd.getInitialStateName() in names) def testGetState(self): pd = self.pd @@ -98,17 +98,17 @@ names = pd.getStateNames() self.assertRaises(KeyError, pd.getState, 'st1') - self.failIf('st1' in names) - self.failUnless('st2' in names) - self.failUnless(pd.getInitialStateName() in names) + self.assertFalse('st1' in names) + self.assertTrue('st2' in names) + self.assertTrue(pd.getInitialStateName() in names) def testGetTransistionNames(self): pd = self.pd names = pd.getTransitionNames() - self.failUnless('tr1' in names) - self.failUnless('tr2' in names) + self.assertTrue('tr1' in names) + self.assertTrue('tr2' in names) def testGetTransation(self): pd = self.pd @@ -124,8 +124,8 @@ names = pd.getTransitionNames() self.assertRaises(KeyError, pd.getTransition, 'tr1') - self.failIf('tr1' in names) - self.failUnless('tr2' in names) RefactoringTool: Refactored ../python3/src/zope/app/workflow/stateful/tests/test_contentworkflow.py RefactoringTool: Refactored ../python3/src/zope/app/workflow/stateful/testobject.py RefactoringTool: Refactored ../python3/src/zope/app/workflow/stateful/interfaces.py + self.assertFalse('tr1' in names) + self.assertTrue('tr2' in names) # this needs a rather complicated setup # that is done in the test_instance.py tests @@ -159,11 +159,11 @@ def testGetStateNames(self): pd = self.pd - names = pd.states.keys() - - self.failUnless('st1' in names) - self.failUnless('st2' in names) - self.failUnless(pd.getInitialStateName() in names) + names = list(pd.states.keys()) + + self.assertTrue('st1' in names) + self.assertTrue('st2' in names) + self.assertTrue(pd.getInitialStateName() in names) def testGetState(self): pd = self.pd @@ -179,17 +179,17 @@ names = pd.getStateNames() self.assertRaises(KeyError, pd.states.__getitem__, 'st1') - self.failIf('st1' in names) - self.failUnless('st2' in names) - self.failUnless(pd.getInitialStateName() in names) + self.assertFalse('st1' in names) + self.assertTrue('st2' in names) + self.assertTrue(pd.getInitialStateName() in names) def testGetTransistionNames(self): pd = self.pd - names = pd.transitions.keys() - - self.failUnless('tr1' in names) - self.failUnless('tr2' in names) + names = list(pd.transitions.keys()) + + self.assertTrue('tr1' in names) + self.assertTrue('tr2' in names) def testGetTransation(self): pd = self.pd @@ -202,11 +202,11 @@ pd = self.pd del pd.transitions['tr1'] - names = pd.transitions.keys() + names = list(pd.transitions.keys()) self.assertRaises(KeyError, pd.transitions.__getitem__, 'tr1') - self.failIf('tr1' in names) - self.failUnless('tr2' in names) + self.assertFalse('tr1' in names) + self.assertTrue('tr2' in names) --- ../python3/src/zope/app/workflow/stateful/tests/test_contentworkflow.py (original) +++ ../python3/src/zope/app/workflow/stateful/tests/test_contentworkflow.py (refactored) @@ -133,12 +133,12 @@ def test_getInterfacesForProcessName(self): manager = self.getManager() - ifaces = manager.getInterfacesForProcessName(u'default') + ifaces = manager.getInterfacesForProcessName('default') self.assertEqual(len(ifaces), 2) for iface in [IFace1, IFace2]: - self.failUnless(iface in ifaces) + self.assertTrue(iface in ifaces) self.assertEqual( - manager.getInterfacesForProcessName(u'foo'), ()) + manager.getInterfacesForProcessName('foo'), ()) def test_notify(self): # setup ProcessDefinitions @@ -158,7 +158,7 @@ event = ObjectCreatedEvent(obj) NewObjectProcessInstanceCreator(obj, event) pi = obj.__annotations__['zope.app.worfklow.ProcessInstanceContainer'] - self.assertEqual(pi.keys(), ['definition2', 'definition1']) + self.assertEqual(list(pi.keys()), ['definition2', 'definition1']) def test_suite(): --- ../python3/src/zope/app/workflow/stateful/testobject.py (original) +++ ../python3/src/zope/app/workflow/stateful/testobject.py (refactored) @@ -24,24 +24,24 @@ class ITestObject(Interface): test = TextLine( - title=u"Test Attribute", - description=u"This is a test attribute.", - default=u"foo", + title="Test Attribute", + description="This is a test attribute.", + default="foo", required=True) class IWorkflowData(Interface): title = TextLine( - title=u"Title", + title="Title", required=True) number = Int( - title=u"Number", + title="Number", required=True) class TestObject(Persistent): implements(ITestObject) - test = u"foo" + test = "foo" --- ../python3/src/zope/app/workflow/stateful/interfaces.py (original) +++ ../python3/src/zope/app/workflow/stateful/interfaces.py (refactored) @@ -25,9 +25,9 @@ from zope.app.workflow.interfaces import IProcessInstance from zope.app.workflow.interfaces imporRefactoringTool: Refactored ../python3/src/zope/app/workflow/stateful/instance.py t IProcessDefinitionElementContainer -AUTOMATIC = u'Automatic' -MANUAL = u'Manual' -INITIAL = u'INITIAL' +AUTOMATIC = 'Automatic' +MANUAL = 'Manual' +INITIAL = 'INITIAL' class ITransitionEvent(IWorkflowEvent): @@ -96,39 +96,39 @@ """Stateful workflow transition.""" sourceState = zope.schema.Choice( - title=_(u"Source State"), - description=_(u"Name of the source state."), - vocabulary=u"Workflow State Names", + title=_("Source State"), + description=_("Name of the source state."), + vocabulary="Workflow State Names", required=True) destinationState = zope.schema.Choice( - title=_(u"Destination State"), - description=_(u"Name of the destination state."), - vocabulary=u"Workflow State Names", + title=_("Destination State"), + description=_("Name of the destination state."), + vocabulary="Workflow State Names", required=True) condition = zope.schema.TextLine( - title=_(u"Condition"), - description=_(u"""The condition that is evaluated to decide if the + title=_("Condition"), + description=_("""The condition that is evaluated to decide if the transition can be fired or not."""), required=False) script = zope.schema.TextLine( - title=_(u"Script"), - description=_(u"""The script that is evaluated to decide if the + title=_("Script"), + description=_("""The script that is evaluated to decide if the transition can be fired or not."""), required=False) permission = zope.schema.Choice( - title=_(u"The permission needed to fire the Transition."), + title=_("The permission needed to fire the Transition."), vocabulary="Permission Ids", default=CheckerPublic, required=True) triggerMode = zope.schema.Choice( - title=_(u"Trigger Mode"), - description=_(u"How the Transition is triggered (Automatic/Manual)"), + title=_("Trigger Mode"), + description=_("How the Transition is triggered (Automatic/Manual)"), default=MANUAL, values=[MANUAL, AUTOMATIC]) @@ -144,16 +144,16 @@ """Interface for stateful workflow process definition.""" relevantDataSchema = zope.schema.Choice( - title=_(u"Workflow-Relevant Data Schema"), - description=_(u"Specifies the schema that characterizes the workflow " - u"relevant data of a process instance, found in pd.data."), + title=_("Workflow-Relevant Data Schema"), + description=_("Specifies the schema that characterizes the workflow " + "relevant data of a process instance, found in pd.data."), vocabulary="Interfaces", default=None, required=False) - schemaPermissions = Attribute(u"A dictionary that maps set/get permissions" - u"on the schema's fields. Entries looks as" - u"follows: {fieldname:(set_perm, get_perm)}") + schemaPermissions = Attribute("A dictionary that maps set/get permissions" + "on the schema's fields. Entries looks as" + "follows: {fieldname:(set_perm, get_perm)}") states = Attribute("State objects container.") --- ../python3/src/zope/app/workflow/stateful/instance.py (original) +++ ../python3/src/zope/app/workflow/stateful/instance.py (refactored) @@ -90,7 +90,7 @@ self.__schema = None # Add the new attributes, if there was a schema passed in if schema is not None: - for name, field in getFields(schema).items(): + for name, field in list(getFields(schema).items()): setattr(self, name, field.default) self.__schema = schema directlyProvides(self, schema) @@ -118,7 +118,7 @@ return super(RelevantData, self).__setattr__(key, value) is_schema_field = (self.__schema is not NRefactoringTool: Refactored ../python3/src/zope/app/workflow/stateful/definition.py RefactoringTool: Refactored ../python3/src/zope/app/workflow/stateful/contentworkflow.py RefactoringTool: Refactored ../python3/src/zope/app/workflow/stateful/browser/tests/test_processdefinition.py one and - key in getFields(self.__schema).keys()) + key in list(getFields(self.__schema).keys())) if is_schema_field: process = self.__parent__ @@ -271,7 +271,7 @@ script = transition.script if not script: return True - if isinstance(script, (str, unicode)): + if isinstance(script, str): sm = getSiteManager(self) script = sm.resolve(script) return script(contexts) @@ -280,7 +280,7 @@ ret = [] contexts = self._getContext() - for name, trans in clean_pd.transitions.items(): + for name, trans in list(clean_pd.transitions.items()): if self.status == trans.sourceState: # check permissions permission = trans.permission --- ../python3/src/zope/app/workflow/stateful/definition.py (original) +++ ../python3/src/zope/app/workflow/stateful/definition.py (refactored) @@ -163,7 +163,7 @@ def getStateNames(self): """See workflow.stateful.IStatefulProcessDefinition""" - return self.states.keys() + return list(self.states.keys()) def getInitialStateName(self): """See workflow.stateful.IStatefulProcessDefinition""" @@ -185,7 +185,7 @@ def getTransitionNames(self): """See workflow.stateful.IStatefulProcessDefinition""" - return self.transitions.keys() + return list(self.transitions.keys()) def createProcessInstance(self, definition_name): """See workflow.IProcessDefinition""" @@ -235,7 +235,7 @@ def __iter__(self): """See zope.container.interfaces.IReadContainer""" - return iter(self.keys()) + return iter(list(self.keys())) def keys(self): """See zope.container.interfaces.IReadContainer""" @@ -243,11 +243,11 @@ def values(self): """See zope.container.interfaces.IReadContainer""" - return map(self.get, self.keys()) + return list(map(self.get, list(self.keys()))) def items(self): """See zope.container.interfaces.IReadContainer""" - return [(key, self.get(key)) for key in self.keys()] + return [(key, self.get(key)) for key in list(self.keys())] def __len__(self): """See zope.container.interfaces.IReadContainer""" --- ../python3/src/zope/app/workflow/stateful/contentworkflow.py (original) +++ ../python3/src/zope/app/workflow/stateful/contentworkflow.py (refactored) @@ -46,7 +46,7 @@ for pd_name in cwf.getProcessDefinitionNamesForObject(obj): - if pd_name in pi_container.keys(): + if pd_name in list(pi_container.keys()): continue try: pi = createProcessInstance(cwf, pd_name) @@ -77,21 +77,21 @@ def getInterfacesForProcessName(self, name): ifaces = [] - for iface, names in self._registry.items(): + for iface, names in list(self._registry.items()): if name in names: ifaces.append(iface) return tuple(ifaces) def register(self, iface, name): """See zope.app.workflow.interfacess.stateful.IContentProcessRegistry""" - if iface not in self._registry.keys(): + if iface not in list(self._registry.keys()): self._registry[iface] = () self._registry[iface] += (name,) def unregister(self, iface, name): """See zope.app.workflow.interfacess.stateful.IContentProcessRegistry""" names = list(self._registry[iface]) - names = filter(lambda n: n != name, names) + names = [n for n in names if n != name] if not names: del self._registry[iface] else: --- ../python3/src/zope/app/workflow/stateful/browser/tests/test_processdefinition.py (original) +++ ../python3/src/zope/app/workflow/stateful/browser/tests/test_processdefinition.py (refactored) @@ -22,7 +22,7 @@ from zope.app.workflow.stateful.definition import StatefulProcessDefinition from zope.apRefactoringTool: Refactored ../python3/src/zope/app/workflow/stateful/browser/tests/test_contentworkflowsmanager.py RefactoringTool: No changes to ../python3/src/zope/app/workflow/stateful/browser/interfaces.py RefactoringTool: Refactored ../python3/src/zope/app/workflow/stateful/browser/instance.py p.workflow.testing import AppWorkflowLayer -xml=u""" +xml=""" @@ -71,7 +71,7 @@ self.assertEqual(response.getStatus(), 200) body = response.getBody() - self.assert_(body.find("I'm a stateful ProcessInstance") >= 0) + self.assertTrue(body.find("I'm a stateful ProcessInstance") >= 0) response = self.publish( self.basepath + '/pd/edit.html', @@ -79,7 +79,7 @@ self.assertEqual(response.getStatus(), 200) body = ' '.join(response.getBody().split()) - self.assert_(body.find('Set Workflow-Relevant Data Schema') >= 0) + self.assertTrue(body.find('Set Workflow-Relevant Data Schema') >= 0) response = self.publish( self.basepath + '/pd/registration.html', @@ -87,7 +87,7 @@ self.assertEqual(response.getStatus(), 200) body = ' '.join(response.getBody().split()) - self.assert_(body.find("This object isn't yet registered.") >=0) + self.assertTrue(body.find("This object isn't yet registered.") >=0) def test_transitions(self): response = self.publish( @@ -103,7 +103,7 @@ self.assertEqual(response.getStatus(), 200) body = ' '.join(response.getBody().split()) - self.assert_(body.find('INITIAL') >= 0) + self.assertTrue(body.find('INITIAL') >= 0) def test_xmlimport(self): response = self.publish( @@ -112,10 +112,10 @@ self.assertEqual(response.getStatus(), 200) body = ' '.join(response.getBody().split()) - self.assert_(body.find('Import / Export Process Definitions:') >= 0) - self.assert_(body.find( + self.assertTrue(body.find('Import / Export Process Definitions:') >= 0) + self.assertTrue(body.find( 'Manage States') >=0 ) - self.assert_(body.find( + self.assertTrue(body.find( 'Manage Transitions') >=0) response = self.publish( @@ -135,9 +135,9 @@ self.assertEqual(response.getStatus(), 200) body = ' '.join(response.getBody().split()) - self.assert_(body.find('initial_foo') >= 0) + self.assertTrue(body.find('initial_foo') >= 0) - self.assert_(body.find('Import was successfull!') >= 0) + self.assertTrue(body.find('Import was successfull!') >= 0) def test_suite(): --- ../python3/src/zope/app/workflow/stateful/browser/tests/test_contentworkflowsmanager.py (original) +++ ../python3/src/zope/app/workflow/stateful/browser/tests/test_contentworkflowsmanager.py (refactored) @@ -67,10 +67,10 @@ self.assertEqual(response.getStatus(), 200) body = ' '.join(response.getBody().split()) - self.assert_(body.find( + self.assertTrue(body.find( '