|
1 |
| -from __future__ import absolute_import, division, unicode_literals |
2 |
| - |
3 | 1 | from colorsys import hsv_to_rgb
|
4 | 2 | import cProfile
|
5 | 3 | import inspect
|
6 | 4 | import os
|
7 | 5 | from pstats import Stats
|
8 |
| -from six import PY2 |
9 | 6 |
|
10 | 7 | from django.urls import resolve
|
11 | 8 | from django.utils.translation import gettext_lazy as _
|
12 | 9 | from django.utils.safestring import mark_safe
|
13 |
| -try: |
14 |
| - from django.utils.six.moves import cStringIO |
15 |
| -except ImportError: |
16 |
| - from io import StringIO as cStringIO |
| 10 | +from io import StringIO |
17 | 11 | from debug_toolbar.panels import Panel
|
18 | 12 | from django.views.generic.base import View
|
19 | 13 |
|
@@ -145,7 +139,7 @@ def line_stats_text(self):
|
145 | 139 | if self._line_stats_text is None:
|
146 | 140 | lstats = self.statobj.line_stats
|
147 | 141 | if self.func in lstats.timings:
|
148 |
| - out = cStringIO() |
| 142 | + out = StringIO() |
149 | 143 | fn, lineno, name = self.func
|
150 | 144 | try:
|
151 | 145 | show_func(fn,
|
@@ -179,10 +173,7 @@ def _unwrap_closure_and_profile(self, func):
|
179 | 173 | self.line_profiler.add_function(func)
|
180 | 174 | for subfunc in getattr(func, 'profile_additional', []):
|
181 | 175 | self._unwrap_closure_and_profile(subfunc)
|
182 |
| - if PY2: |
183 |
| - func_closure = func.func_closure |
184 |
| - else: |
185 |
| - func_closure = func.__closure__ |
| 176 | + func_closure = func.__closure__ |
186 | 177 |
|
187 | 178 | if func_closure:
|
188 | 179 | for cell in func_closure:
|
|
0 commit comments