Skip to content

Commit 77df51b

Browse files
committed
Merge branch 'list-comprehension' of git://github.com/jdufresne/django-debug-toolbar
* 'list-comprehension' of git://github.com/jdufresne/django-debug-toolbar: Replace uses of map with list comprehension or generator expressions
2 parents 00d9277 + bec3ea1 commit 77df51b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

debug_toolbar/panels/sql/tracking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def _quote_params(self, params):
9292
return params
9393
if isinstance(params, dict):
9494
return {key: self._quote_expr(value) for key, value in params.items()}
95-
return list(map(self._quote_expr, params))
95+
return [self._quote_expr(p) for p in params]
9696

9797
def _decode(self, param):
9898
try:
@@ -113,7 +113,7 @@ def _record(self, method, sql, params):
113113
stacktrace = []
114114
_params = ''
115115
try:
116-
_params = json.dumps(list(map(self._decode, params)))
116+
_params = json.dumps([self._decode(p) for p in params])
117117
except Exception:
118118
pass # object not JSON serializable
119119

debug_toolbar/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import re
66
import sys
77
from importlib import import_module
8+
from itertools import chain
89

910
import django
1011
from django.core.exceptions import ImproperlyConfigured
@@ -71,7 +72,7 @@ def tidy_stacktrace(stack):
7172
def render_stacktrace(trace):
7273
stacktrace = []
7374
for frame in trace:
74-
params = map(escape, frame[0].rsplit(os.path.sep, 1) + list(frame[1:]))
75+
params = (escape(v) for v in chain(frame[0].rsplit(os.path.sep, 1), frame[1:]))
7576
params_dict = {six.text_type(idx): v for idx, v in enumerate(params)}
7677
try:
7778
stacktrace.append('<span class="djdt-path">%(0)s/</span>'

0 commit comments

Comments
 (0)