86>Mar 22 16:19:05 userdel[4027411]: delete user 'rooter' <86>Mar 22 16:19:05 userdel[4027411]: removed group 'rooter' owned by 'rooter' <86>Mar 22 16:19:05 userdel[4027411]: removed shadow group 'rooter' owned by 'rooter' <86>Mar 22 16:19:05 groupadd[4027420]: group added to /etc/group: name=rooter, GID=630 <86>Mar 22 16:19:05 groupadd[4027420]: group added to /etc/gshadow: name=rooter <86>Mar 22 16:19:05 groupadd[4027420]: new group: name=rooter, GID=630 <86>Mar 22 16:19:05 useradd[4027425]: new user: name=rooter, UID=630, GID=630, home=/root, shell=/bin/bash <86>Mar 22 16:19:05 userdel[4027437]: delete user 'builder' <86>Mar 22 16:19:05 userdel[4027437]: removed group 'builder' owned by 'builder' <86>Mar 22 16:19:05 userdel[4027437]: removed shadow group 'builder' owned by 'builder' <86>Mar 22 16:19:05 groupadd[4027445]: group added to /etc/group: name=builder, GID=631 <86>Mar 22 16:19:05 groupadd[4027445]: group added to /etc/gshadow: name=builder <86>Mar 22 16:19:05 groupadd[4027445]: new group: name=builder, GID=631 <86>Mar 22 16:19:06 useradd[4027449]: new user: name=builder, UID=631, GID=631, home=/usr/src, shell=/bin/bash <13>Mar 22 16:19:07 rpmi: libgdbm-1.8.3-alt10 1454943334 installed <13>Mar 22 16:19:07 rpmi: libexpat-2.2.10-alt1 sisyphus+259966.100.1.1 1602824518 installed <13>Mar 22 16:19:07 rpmi: libp11-kit-0.23.15-alt2 sisyphus+252784.100.2.2 1591274901 installed <13>Mar 22 16:19:07 rpmi: libtasn1-4.16.0-alt1 sisyphus+245480.100.1.1 1580825062 installed <13>Mar 22 16:19:07 rpmi: rpm-macros-alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed <13>Mar 22 16:19:07 rpmi: alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed <13>Mar 22 16:19:07 rpmi: ca-certificates-2021.01.27-alt1 sisyphus+265371.200.1.1 1611759824 installed <13>Mar 22 16:19:07 rpmi: ca-trust-0.1.2-alt1 sisyphus+233348.100.1.1 1561653823 installed <13>Mar 22 16:19:07 rpmi: p11-kit-trust-0.23.15-alt2 sisyphus+252784.100.2.2 1591274901 installed <13>Mar 22 16:19:07 rpmi: libcrypto1.1-1.1.1j-alt1 sisyphus+267718.100.1.1 1615557676 installed <13>Mar 22 16:19:08 rpmi: libssl1.1-1.1.1j-alt1 sisyphus+267718.100.1.1 1615557676 installed <13>Mar 22 16:19:08 rpmi: python3-3.9.2-alt1 sisyphus+267062.100.1.1 1614381721 installed <13>Mar 22 16:19:08 rpmi: python3-base-3.9.2-alt1 sisyphus+267062.100.1.1 1614381721 installed <13>Mar 22 16:19:08 rpmi: libpython3-3.9.2-alt1 sisyphus+267062.100.1.1 1614381721 installed <13>Mar 22 16:19:08 rpmi: tests-for-installed-python3-pkgs-0.1.13.1-alt2 1535450458 installed <13>Mar 22 16:19:08 rpmi: rpm-build-python3-0.1.13.1-alt2 1535450458 installed <13>Mar 22 16:19:10 rpmi: python-modules-compiler-2.7.18-alt4 sisyphus+266950.200.2.1 1614241383 installed <13>Mar 22 16:19:10 rpmi: python-modules-email-2.7.18-alt4 sisyphus+266950.200.2.1 1614241383 installed <13>Mar 22 16:19:10 rpmi: python-modules-unittest-2.7.18-alt4 sisyphus+266950.200.2.1 1614241383 installed <13>Mar 22 16:19:11 rpmi: python-modules-2.7.18-alt4 sisyphus+266950.200.2.1 1614241383 installed <13>Mar 22 16:19:11 rpmi: python-modules-encodings-2.7.18-alt4 sisyphus+266950.200.2.1 1614241383 installed <13>Mar 22 16:19:11 rpmi: python-modules-ctypes-2.7.18-alt4 sisyphus+266950.200.2.1 1614241383 installed <13>Mar 22 16:19:11 rpmi: python-modules-multiprocessing-2.7.18-alt4 sisyphus+266950.200.2.1 1614241383 installed <13>Mar 22 16:19:11 rpmi: python-modules-logging-2.7.18-alt4 sisyphus+266950.200.2.1 1614241383 installed <13>Mar 22 16:19:11 rpmi: python-tools-2to3-2.7.18-alt4 sisyphus+266950.200.2.1 1614241383 installed <13>Mar 22 16:19:11 rpmi: python3-module-xmpp-0.5.0-alt4 sisyphus+245271.100.1.1 1580376902 installed Building target platforms: i586 Building for target i586 Wrote: /usr/src/in/nosrpm/python3-module-jabberbot-0.16-alt2.nosrc.rpm (w1.gzdio) <13>Mar 22 16:19:12 rpmi: python3-module-pkg_resources-1:46.1.3-alt2 sisyphus+260458.600.6.1 1603876498 installed <13>Mar 22 16:19:12 rpmi: libtinfo-devel-6.2.20210123-alt1 sisyphus+265425.100.1.1 1611851433 installed <13>Mar 22 16:19:12 rpmi: libncurses-devel-6.2.20210123-alt1 sisyphus+265425.100.1.1 1611851433 installed <13>Mar 22 16:19:12 rpmi: python3-dev-3.9.2-alt1 sisyphus+267062.100.1.1 1614381721 installed <13>Mar 22 16:19:12 rpmi: python3-module-setuptools-1:46.1.3-alt2 sisyphus+260458.600.6.1 1603876498 installed Installing python3-module-jabberbot-0.16-alt2.src.rpm Building target platforms: i586 Building for target i586 Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.50926 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + rm -rf jabberbot-0.16 + echo 'Source #0 (jabberbot-0.16.tar.gz):' Source #0 (jabberbot-0.16.tar.gz): + /bin/gzip -dc /usr/src/RPM/SOURCES/jabberbot-0.16.tar.gz + /bin/tar -xf - + cd jabberbot-0.16 + /bin/chmod -c -Rf u+rwX,go-w . + find -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 ./setup.py RefactoringTool: Refactored ./jabberbot.py --- ./jabberbot.py (original) +++ ./jabberbot.py (refactored) @@ -31,15 +31,15 @@ import os import re import sys -import thread +import _thread try: import xmpp except ImportError: - print >> sys.stderr, """ + print(""" You need to install xmpppy from http://xmpppy.sf.net/. On Debian-based systems, install the python-xmpp package. - """ + """, file=sys.stderr) sys.exit(-1) import time @@ -462,7 +462,7 @@ "
" + \ text.encode('utf-8') + "")) message.addChild(node=html) - except Exception, e: + except Exception as e: # Didn't work, incorrect markup or something. self.log.debug('An error while building a xhtml message. '\ 'Fallback to normal messagebody') @@ -509,7 +509,7 @@ If the parameter 'only_available' is True, the broadcast will not go to users whose status is not 'Available'.""" - for jid, (show, status) in self.__seen.items(): + for jid, (show, status) in list(self.__seen.items()): if not only_available or show is self.AVAILABLE: self.send(jid, message) @@ -546,11 +546,11 @@ self.status_type_changed(jid, self.OFFLINE) try: - subscription = self.roster.getSubscription(unicode(jid.__str__())) - except KeyError, e: + subscription = self.roster.getSubscription(str(jid.__str__())) + except KeyError as e: # User not on our roster subscription = None - except AttributeError, e: + except AttributeError as e: # Recieved presence update before roster built return @@ -635,7 +635,7 @@ if jid not in self.__seen: self.log.info('Ignoring message from unseen guest: %s' % jid) self.log.debug("I've seen: %s" % - ["%s" % x for x in self.__seen.keys()]) + ["%s" % x for x in list(self.__seen.keys())]) return # Remember the last-talked-in message thread for replies @@ -653,7 +653,7 @@ def execute_and_send(): try: reply = self.commands[cmd](mess, args) - except Exception, e: + except Exception as e: self.log.exception('An error happened while processing '\ 'a message ("%s") from %s: %s"' % (text, jid, traceback.format_exc(e))) @@ -663,7 +663,7 @@ # Experimental! # if command should be executed in a seperate thread do it if self.commands[cmd]._jabberbot_command_thread: - thread.start_new_thread(execute_and_send, ()) + _thread.start_new_thread(execute_and_send, ()) else: execute_and_send() else: @@ -726,13 +726,12 @@ usage = '\n'.join(sorted([ '%s: %s' % (name, (command.__doc__ or \ '(undocumented)').strip().split('\n', 1)[0]) - for (name, command) in self.commands.iteritems() \ + for (name, command) in self.commands.items() \ if name != (self.__command_prefix + 'help') \ and not command._jabberbot_command_hidden ])) - usage = '\n\n' + '\n\n'.join(filter(None, - [usage, self.MSG_HELP_TAIL % {'helpcommand': - self.__command_prefix + 'help'}])) + usage = '\n\n' + '\n\n'.join([_f for _f in [usage, self.MSG_HELP_TAIL % {'helpcommand': + self.__command_prefix + 'help'}] if _f]) else: description = '' if (args not in self.commands and @@ -747,7 +746,7 @@ top = self.top_of_help_message() bottom = self.bottom_of_help_message() - return ''.join(filter(None, [top, description, usage, bottom])) + return ''.join([_f for _f in RefactoringTool: Refactored ./examples/uptime.py RefactoringTool: No changes to ./examples/twitterbot.py RefactoringTool: Refactored ./examples/tunes.py RefactoringTool: No changes to ./examples/muc.py RefactoringTool: No changes to ./examples/broadcast.py RefactoringTool: Files that were modified: RefactoringTool: ./setup.py RefactoringTool: ./jabberbot.py RefactoringTool: ./examples/uptime.py RefactoringTool: ./examples/twitterbot.py RefactoringTool: ./examples/tunes.py RefactoringTool: ./examples/muc.py RefactoringTool: ./examples/broadcast.py [top, description, usage, bottom] if _f]) def idle_proc(self): """This function will be called in the main loop.""" @@ -769,7 +768,7 @@ #logging.debug('Got response: ' + str(res)) if res is None: self.on_ping_timeout() - except IOError, e: + except IOError as e: logging.error('Error pinging the server: %s, '\ 'treating as ping timeout.' % e) self.on_ping_timeout() --- ./examples/uptime.py (original) +++ ./examples/uptime.py (refactored) @@ -31,9 +31,9 @@ if __name__ == '__main__': if len(sys.argv) != 3: - print >>sys.stderr, """ + print(""" Usage: %s