86>Feb 3 01:18:59 userdel[116320]: delete user 'rooter'
<86>Feb 3 01:18:59 userdel[116320]: removed group 'rooter' owned by 'rooter'
<86>Feb 3 01:18:59 userdel[116320]: removed shadow group 'rooter' owned by 'rooter'
<86>Feb 3 01:18:59 groupadd[116349]: group added to /etc/group: name=rooter, GID=615
<86>Feb 3 01:18:59 groupadd[116349]: group added to /etc/gshadow: name=rooter
<86>Feb 3 01:18:59 groupadd[116349]: new group: name=rooter, GID=615
<86>Feb 3 01:18:59 useradd[116369]: new user: name=rooter, UID=615, GID=615, home=/root, shell=/bin/bash
<86>Feb 3 01:18:59 userdel[116407]: delete user 'builder'
<86>Feb 3 01:18:59 userdel[116407]: removed group 'builder' owned by 'builder'
<86>Feb 3 01:18:59 userdel[116407]: removed shadow group 'builder' owned by 'builder'
<86>Feb 3 01:18:59 groupadd[116427]: group added to /etc/group: name=builder, GID=616
<86>Feb 3 01:18:59 groupadd[116427]: group added to /etc/gshadow: name=builder
<86>Feb 3 01:18:59 groupadd[116427]: new group: name=builder, GID=616
<86>Feb 3 01:18:59 useradd[116460]: new user: name=builder, UID=616, GID=616, home=/usr/src, shell=/bin/bash
<13>Feb 3 01:19:02 rpmi: libexpat-2.2.4-alt0.M80P.1 1503871120 installed
<13>Feb 3 01:19:02 rpmi: libgdbm-1.8.3-alt10 1454943313 installed
<13>Feb 3 01:19:02 rpmi: libtinfo-devel-5.9-alt8 1456756459 installed
<13>Feb 3 01:19:02 rpmi: libncurses-devel-5.9-alt8 1456756459 installed
<13>Feb 3 01:19:02 rpmi: python-modules-curses-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:02 rpmi: libverto-0.2.6-alt1_6 1455633234 installed
<13>Feb 3 01:19:02 rpmi: libkeyutils-1.5.10-alt0.M80P.2 p8+216694.100.6.1 1547827915 installed
<13>Feb 3 01:19:02 rpmi: libcom_err-1.42.13-alt2 1449075846 installed
<13>Feb 3 01:19:02 rpmi: ca-certificates-2016.02.25-alt1 1462368370 installed
<13>Feb 3 01:19:02 rpmi: libcrypto10-1.0.2n-alt0.M80P.1 1512766129 installed
<13>Feb 3 01:19:02 rpmi: libssl10-1.0.2n-alt0.M80P.1 1512766129 installed
<86>Feb 3 01:19:02 groupadd[129354]: group added to /etc/group: name=_keytab, GID=499
<86>Feb 3 01:19:02 groupadd[129354]: group added to /etc/gshadow: name=_keytab
<86>Feb 3 01:19:02 groupadd[129354]: new group: name=_keytab, GID=499
<13>Feb 3 01:19:02 rpmi: libkrb5-1.14.6-alt1.M80P.1 1525355673 installed
<13>Feb 3 01:19:02 rpmi: python3-base-3.5.4-alt2.M80P.1 1527753911 installed
<13>Feb 3 01:19:02 rpmi: python3-3.5.4-alt2.M80P.1 1527753911 installed
<13>Feb 3 01:19:03 rpmi: python-modules-compiler-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:03 rpmi: rpm-build-python3-0.1.10.10-alt1.M80P.1 1530521451 installed
<13>Feb 3 01:19:03 rpmi: libpython3-3.5.4-alt2.M80P.1 1527753911 installed
<13>Feb 3 01:19:03 rpmi: python3-module-py-1.4.34-alt0.M80P.1 1503506764 installed
<13>Feb 3 01:19:03 rpmi: python3-dev-3.5.4-alt2.M80P.1 1527753911 installed
<13>Feb 3 01:19:03 rpmi: python-modules-email-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:03 rpmi: python3-module-pytest-3.2.1-alt0.M80P.1 1503499784 installed
<13>Feb 3 01:19:03 rpmi: python3-module-setuptools-1:18.5-alt0.M80P.1 1497527461 installed
<13>Feb 3 01:19:03 rpmi: python-modules-unittest-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:03 rpmi: python-modules-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:03 rpmi: python-modules-ctypes-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:03 rpmi: python-modules-encodings-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:03 rpmi: python-modules-multiprocessing-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:03 rpmi: python-modules-logging-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:03 rpmi: python-tools-2to3-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:03 rpmi: python-modules-xml-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:03 rpmi: python-modules-hotshot-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:03 rpmi: python-modules-bsddb-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:03 rpmi: python-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:04 rpmi: python-dev-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:04 rpmi: python-module-py-1.4.34-alt0.M80P.1 1503506764 installed
<13>Feb 3 01:19:04 rpmi: python-modules-json-2.7.11-alt6.M80P.1 1527682470 installed
<13>Feb 3 01:19:04 rpmi: python-module-pytest-3.2.1-alt0.M80P.1 1503499784 installed
<13>Feb 3 01:19:04 rpmi: python-module-setuptools-1:18.5-alt0.M80P.1 1497527461 installed
Installing python-module-django-debug-toolbar-0.8.5-alt1.gitbf39bb.1.src.rpm
Building target platforms: x86_64
Building for target x86_64
Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.73184
+ umask 022
+ /bin/mkdir -p /usr/src/RPM/BUILD
+ cd /usr/src/RPM/BUILD
+ cd /usr/src/RPM/BUILD
+ rm -rf python-module-django-debug-toolbar-0.8.5
+ echo 'Source #0 (python-module-django-debug-toolbar-0.8.5.tar):'
Source #0 (python-module-django-debug-toolbar-0.8.5.tar):
+ /bin/tar -xf /usr/src/RPM/SOURCES/python-module-django-debug-toolbar-0.8.5.tar
+ cd python-module-django-debug-toolbar-0.8.5
+ /bin/chmod -c -Rf u+rwX,go-w .
+ cp -fR . ../python3
+ exit 0
Executing(%build): /bin/sh -e /usr/src/tmp/rpm-tmp.73184
+ umask 022
+ /bin/mkdir -p /usr/src/RPM/BUILD
+ cd /usr/src/RPM/BUILD
+ cd python-module-django-debug-toolbar-0.8.5
+ CFLAGS='-pipe -Wall -g -O2'
+ export CFLAGS
+ CXXFLAGS='-pipe -Wall -g -O2'
+ export CXXFLAGS
+ FFLAGS='-pipe -Wall -g -O2'
+ export FFLAGS
+ /usr/bin/python setup.py build
running build
running build_py
creating build
creating build/lib
creating build/lib/example
copying example/urls.py -> build/lib/example
copying example/settings.py -> build/lib/example
copying example/manage.py -> build/lib/example
copying example/__init__.py -> build/lib/example
creating build/lib/debug_toolbar
copying debug_toolbar/views.py -> build/lib/debug_toolbar
copying debug_toolbar/urls.py -> build/lib/debug_toolbar
copying debug_toolbar/runtests.py -> build/lib/debug_toolbar
copying debug_toolbar/models.py -> build/lib/debug_toolbar
copying debug_toolbar/middleware.py -> build/lib/debug_toolbar
copying debug_toolbar/__init__.py -> build/lib/debug_toolbar
creating build/lib/debug_toolbar/utils
copying debug_toolbar/utils/__init__.py -> build/lib/debug_toolbar/utils
creating build/lib/debug_toolbar/toolbar
copying debug_toolbar/toolbar/loader.py -> build/lib/debug_toolbar/toolbar
copying debug_toolbar/toolbar/__init__.py -> build/lib/debug_toolbar/toolbar
creating build/lib/debug_toolbar/tests
copying debug_toolbar/tests/views.py -> build/lib/debug_toolbar/tests
copying debug_toolbar/tests/urls.py -> build/lib/debug_toolbar/tests
copying debug_toolbar/tests/tests.py -> build/lib/debug_toolbar/tests
copying debug_toolbar/tests/__init__.py -> build/lib/debug_toolbar/tests
creating build/lib/debug_toolbar/panels
copying debug_toolbar/panels/version.py -> build/lib/debug_toolbar/panels
copying debug_toolbar/panels/timer.py -> build/lib/debug_toolbar/panels
copying debug_toolbar/panels/template.py -> build/lib/debug_toolbar/panels
copying debug_toolbar/panels/sql.py -> build/lib/debug_toolbar/panels
copying debug_toolbar/panels/signals.py -> build/lib/debug_toolbar/panels
copying debug_toolbar/panels/settings_vars.py -> build/lib/debug_toolbar/panels
copying debug_toolbar/panels/request_vars.py -> build/lib/debug_toolbar/panels
copying debug_toolbar/panels/profiling.py -> build/lib/debug_toolbar/panels
copying debug_toolbar/panels/logger.py -> build/lib/debug_toolbar/panels
copying debug_toolbar/panels/headers.py -> build/lib/debug_toolbar/panels
copying debug_toolbar/panels/cache.py -> build/lib/debug_toolbar/panels
copying debug_toolbar/panels/__init__.py -> build/lib/debug_toolbar/panels
creating build/lib/debug_toolbar/management
copying debug_toolbar/management/__init__.py -> build/lib/debug_toolbar/management
creating build/lib/debug_toolbar/utils/tracking
copying debug_toolbar/utils/tracking/db.py -> build/lib/debug_toolbar/utils/tracking
copying debug_toolbar/utils/tracking/__init__.py -> build/lib/debug_toolbar/utils/tracking
creating build/lib/debug_toolbar/utils/sqlparse
copying debug_toolbar/utils/sqlparse/tokens.py -> build/lib/debug_toolbar/utils/sqlparse
copying debug_toolbar/utils/sqlparse/sql.py -> build/lib/debug_toolbar/utils/sqlparse
copying debug_toolbar/utils/sqlparse/lexer.py -> build/lib/debug_toolbar/utils/sqlparse
copying debug_toolbar/utils/sqlparse/keywords.py -> build/lib/debug_toolbar/utils/sqlparse
copying debug_toolbar/utils/sqlparse/formatter.py -> build/lib/debug_toolbar/utils/sqlparse
copying debug_toolbar/utils/sqlparse/filters.py -> build/lib/debug_toolbar/utils/sqlparse
copying debug_toolbar/utils/sqlparse/__init__.py -> build/lib/debug_toolbar/utils/sqlparse
creating build/lib/debug_toolbar/utils/compat
copying debug_toolbar/utils/compat/db.py -> build/lib/debug_toolbar/utils/compat
copying debug_toolbar/utils/compat/__init__.py -> build/lib/debug_toolbar/utils/compat
creating build/lib/debug_toolbar/utils/sqlparse/engine
copying debug_toolbar/utils/sqlparse/engine/grouping.py -> build/lib/debug_toolbar/utils/sqlparse/engine
copying debug_toolbar/utils/sqlparse/engine/filter.py -> build/lib/debug_toolbar/utils/sqlparse/engine
copying debug_toolbar/utils/sqlparse/engine/__init__.py -> build/lib/debug_toolbar/utils/sqlparse/engine
creating build/lib/debug_toolbar/management/commands
copying debug_toolbar/management/commands/debugsqlshell.py -> build/lib/debug_toolbar/management/commands
copying debug_toolbar/management/commands/__init__.py -> build/lib/debug_toolbar/management/commands
running egg_info
creating django_debug_toolbar.egg-info
writing django_debug_toolbar.egg-info/PKG-INFO
writing top-level names to django_debug_toolbar.egg-info/top_level.txt
writing dependency_links to django_debug_toolbar.egg-info/dependency_links.txt
writing manifest file 'django_debug_toolbar.egg-info/SOURCES.txt'
reading manifest file 'django_debug_toolbar.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'django_debug_toolbar.egg-info/SOURCES.txt'
creating build/lib/debug_toolbar/media
creating build/lib/debug_toolbar/media/debug_toolbar
copying debug_toolbar/media/debug_toolbar/Makefile -> build/lib/debug_toolbar/media/debug_toolbar
creating build/lib/debug_toolbar/media/debug_toolbar/css
copying debug_toolbar/media/debug_toolbar/css/toolbar.css -> build/lib/debug_toolbar/media/debug_toolbar/css
copying debug_toolbar/media/debug_toolbar/css/toolbar.min.css -> build/lib/debug_toolbar/media/debug_toolbar/css
creating build/lib/debug_toolbar/media/debug_toolbar/img
copying debug_toolbar/media/debug_toolbar/img/back.png -> build/lib/debug_toolbar/media/debug_toolbar/img
copying debug_toolbar/media/debug_toolbar/img/back_hover.png -> build/lib/debug_toolbar/media/debug_toolbar/img
copying debug_toolbar/media/debug_toolbar/img/close.png -> build/lib/debug_toolbar/media/debug_toolbar/img
copying debug_toolbar/media/debug_toolbar/img/close_hover.png -> build/lib/debug_toolbar/media/debug_toolbar/img
copying debug_toolbar/media/debug_toolbar/img/djdt_vertical.png -> build/lib/debug_toolbar/media/debug_toolbar/img
copying debug_toolbar/media/debug_toolbar/img/dot.gif -> build/lib/debug_toolbar/media/debug_toolbar/img
copying debug_toolbar/media/debug_toolbar/img/indicator.png -> build/lib/debug_toolbar/media/debug_toolbar/img
copying debug_toolbar/media/debug_toolbar/img/panel_bg.png -> build/lib/debug_toolbar/media/debug_toolbar/img
creating build/lib/debug_toolbar/media/debug_toolbar/js
copying debug_toolbar/media/debug_toolbar/js/jquery.cookie.js -> build/lib/debug_toolbar/media/debug_toolbar/js
copying debug_toolbar/media/debug_toolbar/js/jquery.js -> build/lib/debug_toolbar/media/debug_toolbar/js
copying debug_toolbar/media/debug_toolbar/js/toolbar.js -> build/lib/debug_toolbar/media/debug_toolbar/js
copying debug_toolbar/media/debug_toolbar/js/toolbar.min.js -> build/lib/debug_toolbar/media/debug_toolbar/js
creating build/lib/debug_toolbar/templates
creating build/lib/debug_toolbar/templates/debug_toolbar
copying debug_toolbar/templates/debug_toolbar/base.html -> build/lib/debug_toolbar/templates/debug_toolbar
copying debug_toolbar/templates/debug_toolbar/redirect.html -> build/lib/debug_toolbar/templates/debug_toolbar
creating build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/cache.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/headers.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/logger.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/profiling.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/request_vars.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/settings_vars.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/signals.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/sql.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/sql_explain.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/sql_profile.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/sql_select.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/template_source.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/templates.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/timer.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
copying debug_toolbar/templates/debug_toolbar/panels/versions.html -> build/lib/debug_toolbar/templates/debug_toolbar/panels
+ pushd ../python3
~/RPM/BUILD/python3 ~/RPM/BUILD/python-module-django-debug-toolbar-0.8.5
+ 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: No changes to ./example/urls.py
RefactoringTool: No changes to ./example/settings.py
RefactoringTool: Refactored ./example/manage.py
RefactoringTool: No changes to ./debug_toolbar/views.py
RefactoringTool: No changes to ./debug_toolbar/utils/tracking/db.py
RefactoringTool: Refactored ./debug_toolbar/utils/tracking/__init__.py
RefactoringTool: No changes to ./debug_toolbar/utils/sqlparse/tokens.py
RefactoringTool: Refactored ./debug_toolbar/utils/sqlparse/sql.py
RefactoringTool: Refactored ./debug_toolbar/utils/sqlparse/lexer.py
--- ./example/manage.py (original)
+++ ./example/manage.py (refactored)
@@ -1,7 +1,7 @@
#!/usr/bin/env python
from django.core.management import execute_manager
try:
- import settings # Assumed to be in the same directory.
+ from . import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
--- ./debug_toolbar/utils/tracking/__init__.py (original)
+++ ./debug_toolbar/utils/tracking/__init__.py (refactored)
@@ -32,7 +32,7 @@
try:
for callback in callbacks[hook].get(id(sender), []):
callback(sender=sender, **kwargs)
- except Exception, e:
+ except Exception as e:
# Log the exception, dont mess w/ the underlying function
logging.exception(e)
@@ -49,7 +49,7 @@
raise NotImplementedError
elif hasattr(func, 'im_class'):
# for unbound methods
- setattr(func.im_class, func.__name__, wrapped)
+ setattr(func.__self__.__class__, func.__name__, wrapped)
else:
raise NotImplementedError
--- ./debug_toolbar/utils/sqlparse/sql.py (original)
+++ ./debug_toolbar/utils/sqlparse/sql.py (refactored)
@@ -23,7 +23,7 @@
self.ttype = ttype
def __str__(self):
- return unicode(self).encode('latin-1')
+ return str(self).encode('latin-1')
def __repr__(self):
short = self._get_repr_value()
@@ -35,15 +35,15 @@
def to_unicode(self):
"""Returns a unicode representation of this object."""
- return unicode(self)
+ return str(self)
def _get_repr_name(self):
return str(self.ttype).split('.')[-1]
def _get_repr_value(self):
- raw = unicode(self)
+ raw = str(self)
if len(raw) > 7:
- short = raw[:6]+u'...'
+ short = raw[:6]+'...'
else:
short = raw
return re.sub('\s+', ' ', short)
@@ -67,7 +67,7 @@
type_matched = self.ttype in ttype
if not type_matched or values is None:
return type_matched
- if isinstance(values, basestring):
+ if isinstance(values, str):
values = set([values])
if regex:
if self.ttype is T.Keyword:
@@ -110,10 +110,10 @@
Token.__init__(self, None, None)
def __unicode__(self):
- return ''.join(unicode(x) for x in self.flatten())
+ return ''.join(str(x) for x in self.flatten())
def __str__(self):
- return unicode(self).encode('latin-1')
+ return str(self).encode('latin-1')
def _get_repr_name(self):
return self.__class__.__name__
@@ -190,7 +190,7 @@
def token_next_match(self, idx, ttype, value, regex=False):
"""Returns next token where it's ``match`` method returns ``True``."""
- if type(idx) != types.IntType:
+ if type(idx) != int:
idx = self.token_index(idx)
for token in self.tokens[idx:]:
if token.match(ttype, value, regex):
--- ./debug_toolbar/utils/sqlparse/lexer.py (original)
+++ ./debug_toolbar/utils/sqlparse/lexer.py (refactored)
@@ -17,6 +17,7 @@
from debug_toolbar.utils.sqlparse.keywords import KEYWORDS, KEYWORDS_COMMON
from debug_toolbar.utils.sqlparse.tokens import *
from debug_toolbar.utils.sqlparse.tokens import _TokenType
+import collections
class include(str):
@@ -75,11 +76,11 @@
try:
rex = re.compile(tdef[0], rflags).match
- except Exception, err:
+ except Exception as err:
raise ValueError("uncompilable regex %r in state %r of %r: %s" %
(tdef[0], state, cls, err))
- assert type(tdef[1]) is _TokenType or callable(tdef[1]), \
+ assert type(tdef[1]) is _TokenType or isinstance(tdefRefactoringTool: No changes to ./debug_toolbar/utils/sqlparse/keywords.py
RefactoringTool: No changes to ./debug_toolbar/utils/sqlparse/formatter.py
RefactoringTool: Refactored ./debug_toolbar/utils/sqlparse/filters.py
RefactoringTool: No changes to ./debug_toolbar/utils/sqlparse/engine/grouping.py
RefactoringTool: No changes to ./debug_toolbar/utils/sqlparse/engine/filter.py
RefactoringTool: No changes to ./debug_toolbar/utils/sqlparse/engine/__init__.py
RefactoringTool: Refactored ./debug_toolbar/utils/sqlparse/__init__.py
RefactoringTool: No changes to ./debug_toolbar/utils/compat/db.py
RefactoringTool: Refactored ./debug_toolbar/utils/__init__.py
RefactoringTool: No changes to ./debug_toolbar/urls.py
RefactoringTool: Refactored ./debug_toolbar/toolbar/loader.py
[1], collections.Callable), \
'token type must be simple type or callable, not %r' % (tdef[1],)
if len(tdef) == 2:
@@ -126,7 +127,7 @@
cls._tmpname = 0
processed = cls._all_tokens[cls.__name__] = {}
#tokendefs = tokendefs or cls.tokens[name]
- for state in cls.tokens.keys():
+ for state in list(cls.tokens.keys()):
cls._process_state(cls.tokens, processed, state)
return processed
@@ -145,9 +146,7 @@
-class Lexer:
-
- __metaclass__ = LexerMeta
+class Lexer(metaclass=LexerMeta):
encoding = 'utf-8'
stripall = False
@@ -205,12 +204,12 @@
Also preprocess the text, i.e. expand tabs and strip it if
wanted and applies registered filters.
"""
- if not isinstance(text, unicode):
+ if not isinstance(text, str):
if self.encoding == 'guess':
try:
text = text.decode('utf-8')
- if text.startswith(u'\ufeff'):
- text = text[len(u'\ufeff'):]
+ if text.startswith('\ufeff'):
+ text = text[len('\ufeff'):]
except UnicodeDecodeError:
text = text.decode('latin1')
elif self.encoding == 'chardet':
@@ -297,7 +296,7 @@
pos += 1
statestack = ['root']
statetokens = tokendefs['root']
- yield pos, Text, u'\n'
+ yield pos, Text, '\n'
continue
yield pos, Error, text[pos]
pos += 1
--- ./debug_toolbar/utils/sqlparse/filters.py (original)
+++ ./debug_toolbar/utils/sqlparse/filters.py (refactored)
@@ -58,7 +58,7 @@
if case is None:
case = 'upper'
assert case in ['lower', 'upper', 'capitalize']
- self.convert = getattr(unicode, case)
+ self.convert = getattr(str, case)
def process(self, stack, stream):
for ttype, value in stream:
@@ -149,7 +149,7 @@
def _get_offset(self, token):
all_ = list(self._curr_stmt.flatten())
idx = all_.index(token)
- raw = ''.join(unicode(x) for x in all_[:idx+1])
+ raw = ''.join(str(x) for x in all_[:idx+1])
line = raw.splitlines()[-1]
# Now take current offset into account and return relative offset.
full_offset = len(line)-(len(self.char*(self.width*self.indent)))
--- ./debug_toolbar/utils/sqlparse/__init__.py (original)
+++ ./debug_toolbar/utils/sqlparse/__init__.py (refactored)
@@ -55,5 +55,5 @@
"""
stack = engine.FilterStack()
stack.split_statements = True
- return [unicode(stmt) for stmt in stack.run(sql)]
+ return [str(stmt) for stmt in stack.run(sql)]
--- ./debug_toolbar/utils/__init__.py (original)
+++ ./debug_toolbar/utils/__init__.py (refactored)
@@ -1,13 +1,13 @@
import os.path
import django
-import SocketServer
+import socketserver
from django.conf import settings
from django.views.debug import linebreak_iter
# Figure out some paths
django_path = os.path.realpath(os.path.dirname(django.__file__))
-socketserver_path = os.path.realpath(os.path.dirname(SocketServer.__file__))
+socketserver_path = os.path.realpath(os.path.dirname(socketserver.__file__))
def ms_from_timedelta(td):
"""
--- ./debug_toolbar/toolbar/loader.py (original)
+++ ./debug_toolbar/toolbar/loader.py (refactored)
@@ -16,7 +16,7 @@
base_url = self.request.META.get('SCRIPT_NAME', '')
self.config = {
'INTERCEPT_REDIRECTS': True,
- 'MEDIA_URL': u'%s/__debug__/m/' % base_url
+ 'MEDIA_URL': '%s/__debug__/m/' % base_url
}
# Check if settings has a DEBUG_TOOLBAR_CONFIG and updated config
self.config.update(getattr(settings, 'DEBUG_TOOLBAR_CONFIG', {}))
@@ -40,7 +40,7 @@
self.load_panels()
def _get_panels(self):
- return self._panels.values()
+ return list(self._paRefactoringTool: No changes to ./debug_toolbar/tests/urls.py
RefactoringTool: Refactored ./debug_toolbar/tests/tests.py
nels.values())
panels = property(_get_panels)
def get_panel(self, cls):
@@ -61,16 +61,16 @@
try:
dot = panel_path.rindex('.')
except ValueError:
- raise exceptions.ImproperlyConfigured, '%s isn\'t a debug panel module' % panel_path
+ raise exceptions.ImproperlyConfigured('%s isn\'t a debug panel module' % panel_path)
panel_module, panel_classname = panel_path[:dot], panel_path[dot+1:]
try:
mod = __import__(panel_module, {}, {}, [''])
- except ImportError, e:
- raise exceptions.ImproperlyConfigured, 'Error importing debug panel %s: "%s"' % (panel_module, e)
+ except ImportError as e:
+ raise exceptions.ImproperlyConfigured('Error importing debug panel %s: "%s"' % (panel_module, e))
try:
panel_class = getattr(mod, panel_classname)
except AttributeError:
- raise exceptions.ImproperlyConfigured, 'Toolbar Panel module "%s" does not define a "%s" class' % (panel_module, panel_classname)
+ raise exceptions.ImproperlyConfigured('Toolbar Panel module "%s" does not define a "%s" class' % (panel_module, panel_classname))
try:
panel_instance = panel_class(context=self.template_context)
--- ./debug_toolbar/tests/tests.py (original)
+++ ./debug_toolbar/tests/tests.py (refactored)
@@ -7,13 +7,13 @@
from django.test import TestCase
from dingus import Dingus
-import thread
+import _thread
class BaseTestCase(TestCase):
def setUp(self):
request = Dingus('request')
toolbar = DebugToolbar(request)
- DebugToolbarMiddleware.debug_toolbars[thread.get_ident()] = toolbar
+ DebugToolbarMiddleware.debug_toolbars[_thread.get_ident()] = toolbar
self.toolbar = toolbar
class DebugToolbarTestCase(BaseTestCase):
@@ -21,19 +21,19 @@
def test_middleware(self):
resp = self.client.get('/execute_sql/')
- self.assertEquals(resp.status_code, 200)
+ self.assertEqual(resp.status_code, 200)
class SQLPanelTestCase(BaseTestCase):
def test_recording(self):
panel = self.toolbar.get_panel(SQLDebugPanel)
- self.assertEquals(len(panel._queries), 0)
+ self.assertEqual(len(panel._queries), 0)
list(User.objects.all())
# ensure query was logged
- self.assertEquals(len(panel._queries), 1)
+ self.assertEqual(len(panel._queries), 1)
query = panel._queries[0]
- self.assertEquals(query[0], 'default')
+ self.assertEqual(query[0], 'default')
self.assertTrue('sql' in query[1])
self.assertTrue('duration' in query[1])
self.assertTrue('stacktrace' in query[1])
@@ -59,23 +59,23 @@
foo.update(kwargs)
self.assertTrue(hasattr(module_func, '__wrapped__'))
- self.assertEquals(len(callbacks['before']), 1)
+ self.assertEqual(len(callbacks['before']), 1)
module_func('hi', foo='bar')
self.assertTrue('sender' in foo, foo)
# best we can do
- self.assertEquals(foo['sender'].__name__, 'module_func')
+ self.assertEqual(foo['sender'].__name__, 'module_func')
self.assertTrue('start' in foo, foo)
self.assertTrue(foo['start'] > 0)
self.assertTrue('stop' not in foo, foo)
self.assertTrue('args' in foo, foo)
self.assertTrue(len(foo['args']), 1)
- self.assertEquals(foo['args'][0], 'hi')
+ self.assertEqual(foo['args'][0], 'hi')
self.assertTrue('kwargs' in foo, foo)
self.assertTrue(len(foo['kwargs']), 1)
self.assertTrue('foo' in foo['kwargs'])
- self.assertEquals(foo['kwargs']['foo'], 'bar')
+ self.assertEqual(foo['kwargs']['foo'], 'bar')
callbacks['before'] = {}
@@ -84,23 +84,23 @@
foo.update(kwargs)
self.assertTrue(hasattr(TrackingTestCase.class_func, '__RefactoringTool: Refactored ./debug_toolbar/tests/__init__.py
RefactoringTool: No changes to ./debug_toolbar/runtests.py
RefactoringTool: Refactored ./debug_toolbar/panels/version.py
RefactoringTool: No changes to ./debug_toolbar/panels/timer.py
RefactoringTool: Refactored ./debug_toolbar/panels/template.py
wrapped__'))
- self.assertEquals(len(callbacks['before']), 1)
+ self.assertEqual(len(callbacks['before']), 1)
self.class_func('hello', foo='bar')
self.assertTrue('sender' in foo, foo)
# best we can do
- self.assertEquals(foo['sender'].__name__, 'class_func')
+ self.assertEqual(foo['sender'].__name__, 'class_func')
self.assertTrue('start' in foo, foo)
self.assertTrue(foo['start'] > 0)
self.assertTrue('stop' not in foo, foo)
self.assertTrue('args' in foo, foo)
self.assertTrue(len(foo['args']), 2)
- self.assertEquals(foo['args'][1], 'hello')
+ self.assertEqual(foo['args'][1], 'hello')
self.assertTrue('kwargs' in foo, foo)
self.assertTrue(len(foo['kwargs']), 1)
self.assertTrue('foo' in foo['kwargs'])
- self.assertEquals(foo['kwargs']['foo'], 'bar')
+ self.assertEqual(foo['kwargs']['foo'], 'bar')
# callbacks['before'] = {}
#
@@ -128,24 +128,24 @@
foo.update(kwargs)
self.assertTrue(hasattr(module_func, '__wrapped__'))
- self.assertEquals(len(callbacks['after']), 1)
+ self.assertEqual(len(callbacks['after']), 1)
module_func('hi', foo='bar')
self.assertTrue('sender' in foo, foo)
# best we can do
- self.assertEquals(foo['sender'].__name__, 'module_func')
+ self.assertEqual(foo['sender'].__name__, 'module_func')
self.assertTrue('start' in foo, foo)
self.assertTrue(foo['start'] > 0)
self.assertTrue('stop' in foo, foo)
self.assertTrue(foo['stop'] > foo['start'])
self.assertTrue('args' in foo, foo)
self.assertTrue(len(foo['args']), 1)
- self.assertEquals(foo['args'][0], 'hi')
+ self.assertEqual(foo['args'][0], 'hi')
self.assertTrue('kwargs' in foo, foo)
self.assertTrue(len(foo['kwargs']), 1)
self.assertTrue('foo' in foo['kwargs'])
- self.assertEquals(foo['kwargs']['foo'], 'bar')
+ self.assertEqual(foo['kwargs']['foo'], 'bar')
callbacks['after'] = {}
@@ -154,21 +154,21 @@
foo.update(kwargs)
self.assertTrue(hasattr(TrackingTestCase.class_func, '__wrapped__'))
- self.assertEquals(len(callbacks['after']), 1)
+ self.assertEqual(len(callbacks['after']), 1)
self.class_func('hello', foo='bar')
self.assertTrue('sender' in foo, foo)
# best we can do
- self.assertEquals(foo['sender'].__name__, 'class_func')
+ self.assertEqual(foo['sender'].__name__, 'class_func')
self.assertTrue('start' in foo, foo)
self.assertTrue(foo['start'] > 0)
self.assertTrue('stop' in foo, foo)
self.assertTrue(foo['stop'] > foo['start'])
self.assertTrue('args' in foo, foo)
self.assertTrue(len(foo['args']), 2)
- self.assertEquals(foo['args'][1], 'hello')
+ self.assertEqual(foo['args'][1], 'hello')
self.assertTrue('kwargs' in foo, foo)
self.assertTrue(len(foo['kwargs']), 1)
self.assertTrue('foo' in foo['kwargs'])
- self.assertEquals(foo['kwargs']['foo'], 'bar')
+ self.assertEqual(foo['kwargs']['foo'], 'bar')
--- ./debug_toolbar/tests/__init__.py (original)
+++ ./debug_toolbar/tests/__init__.py (refactored)
@@ -1 +1 @@
-from tests import *
+from .tests import *
--- ./debug_toolbar/panels/version.py (original)
+++ ./debug_toolbar/panels/version.py (refactored)
@@ -7,6 +7,7 @@
import debug_toolbar
from debug_toolbar.panels import DebugPanel
+import collections
class VersionDebugPanel(DebugPanel):
@@ -36,7 +37,7 @@
app = sys.modules[app]
if hasattr(app, 'get_version'):
get_version = app.get_version
- if callable(get_version):
+ if isinstance(get_version, collections.Callable):
version = get_version()
else:
version = get_version
-RefactoringTool: Refactored ./debug_toolbar/panels/sql.py
RefactoringTool: Refactored ./debug_toolbar/panels/signals.py
RefactoringTool: No changes to ./debug_toolbar/panels/settings_vars.py
RefactoringTool: Refactored ./debug_toolbar/panels/request_vars.py
RefactoringTool: Refactored ./debug_toolbar/panels/profiling.py
-- ./debug_toolbar/panels/template.py (original)
+++ ./debug_toolbar/panels/template.py (refactored)
@@ -90,7 +90,7 @@
context_list = []
for context_layer in context_data.dicts:
if hasattr(context_layer, 'items'):
- for key, value in context_layer.items():
+ for key, value in list(context_layer.items()):
# Replace any request elements - they have a large
# unicode representation and the request data is
# already made available from the Request Vars panel.
--- ./debug_toolbar/panels/sql.py (original)
+++ ./debug_toolbar/panels/sql.py (refactored)
@@ -143,7 +143,7 @@
(0, 0, 256), # green
]
factor = int(256.0/(len(self._databases)*2.5))
- for n, db in enumerate(self._databases.itervalues()):
+ for n, db in enumerate(self._databases.values()):
rgb = [0, 0, 0]
color = n % 3
rgb[color] = 256 - n/3*factor
@@ -191,7 +191,7 @@
stacktrace = []
for frame in query['stacktrace']:
- params = map(escape, frame[0].rsplit('/', 1) + list(frame[1:]))
+ params = list(map(escape, frame[0].rsplit('/', 1) + list(frame[1:])))
stacktrace.append('{0}/{1} in {3}({2})\n {4}"'.format(*params))
query['stacktrace'] = mark_safe('\n'.join(stacktrace))
i += 1
@@ -201,7 +201,7 @@
context = self.context.copy()
context.update({
- 'databases': sorted(self._databases.items(), key=lambda x: -x[1]['time_spent']),
+ 'databases': sorted(list(self._databases.items()), key=lambda x: -x[1]['time_spent']),
'queries': [q for a, q in self._queries],
'sql_time': self._sql_time,
})
--- ./debug_toolbar/panels/signals.py (original)
+++ ./debug_toolbar/panels/signals.py (refactored)
@@ -60,7 +60,7 @@
def content(self):
signals = []
- keys = self.signals.keys()
+ keys = list(self.signals.keys())
keys.sort()
for name in keys:
signal = self.signals[name]
@@ -73,9 +73,9 @@
if receiver is None:
continue
if getattr(receiver, 'im_self', None) is not None:
- text = "method %s on %s object" % (receiver.__name__, receiver.im_self.__class__.__name__)
+ text = "method %s on %s object" % (receiver.__name__, receiver.__self__.__class__.__name__)
elif getattr(receiver, 'im_class', None) is not None:
- text = "method %s on %s" % (receiver.__name__, receiver.im_class.__name__)
+ text = "method %s on %s" % (receiver.__name__, receiver.__self__.__class__.__name__)
else:
text = "function %s" % receiver.__name__
receivers.append(text)
--- ./debug_toolbar/panels/request_vars.py (original)
+++ ./debug_toolbar/panels/request_vars.py (refactored)
@@ -38,7 +38,7 @@
})
if hasattr(self.request, 'session'):
context.update({
- 'session': [(k, self.request.session.get(k)) for k in self.request.session.iterkeys()]
+ 'session': [(k, self.request.session.get(k)) for k in self.request.session.keys()]
})
return render_to_string('debug_toolbar/panels/request_vars.html', context)
--- ./debug_toolbar/panels/profiling.py (original)
+++ ./debug_toolbar/panels/profiling.py (refactored)
@@ -1,4 +1,4 @@
-from __future__ import division
+
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
@@ -14,7 +14,7 @@
def get_root_func(self):
if self.__root RefactoringTool: No changes to ./debug_toolbar/panels/logger.py
RefactoringTool: No changes to ./debug_toolbar/panels/headers.py
RefactoringTool: Refactored ./debug_toolbar/panels/cache.py
RefactoringTool: No changes to ./debug_toolbar/panels/__init__.py
RefactoringTool: Refactored ./debug_toolbar/middleware.py
RefactoringTool: Refactored ./debug_toolbar/management/commands/debugsqlshell.py
is None:
- for func, (cc, nc, tt, ct, callers) in self.stats.iteritems():
+ for func, (cc, nc, tt, ct, callers) in self.stats.items():
if len(callers) == 0:
self.__root = func
break
@@ -23,7 +23,7 @@
def print_call_tree_node(self, function, depth, max_depth, cum_filter=0.1):
self.print_line(function, depth=depth)
if depth < max_depth:
- for called in self.all_callees[function].keys():
+ for called in list(self.all_callees[function].keys()):
if self.stats[called][3] >= cum_filter:
self.print_call_tree_node(called, depth+1, max_depth, cum_filter=cum_filter)
@@ -75,7 +75,7 @@
i=0
h,s,v = self.hsv
count = len(self.statobj.all_callees[self.func])
- for func, stats in self.statobj.all_callees[self.func].iteritems():
+ for func, stats in self.statobj.all_callees[self.func].items():
i += 1
h1 = h + (i/count)/(self.depth+1)
if stats[3] == 0:
--- ./debug_toolbar/panels/cache.py (original)
+++ ./debug_toolbar/panels/cache.py (refactored)
@@ -62,7 +62,7 @@
this_time = time.time() - t
self.total_time += this_time * 1000
self.get_many += 1
- for key, value in results.iteritems():
+ for key, value in results.items():
if value is None:
self.misses += 1
else:
--- ./debug_toolbar/middleware.py (original)
+++ ./debug_toolbar/middleware.py (refactored)
@@ -1,7 +1,7 @@
"""
Debug Toolbar middleware
"""
-import thread
+import _thread
from django.conf import settings
from django.http import HttpResponseRedirect
@@ -35,7 +35,7 @@
@classmethod
def get_current(cls):
- return cls.debug_toolbars.get(thread.get_ident())
+ return cls.debug_toolbars.get(_thread.get_ident())
def __init__(self):
self.override_url = True
@@ -44,7 +44,7 @@
self.show_toolbar = self._show_toolbar # default
# The tag to attach the toolbar to
- self.tag= u'