From f2d8027c9aea93750fc4213d9e733c8575e89502 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 26 Oct 2013 10:50:40 -0700 Subject: [PATCH] Fixed up some more flake8 violations (this particular violation still has many occurrences in the tests/ dir so it can't be removed from setup.cfg yet) --- django/contrib/gis/geos/linestring.py | 2 +- .../gis/geos/tests/test_geos_mutation.py | 28 +++++++-------- .../gis/geos/tests/test_mutable_list.py | 34 +++++++++---------- django/contrib/gis/tests/geo3d/tests.py | 2 +- django/contrib/gis/tests/geoapp/tests.py | 2 +- django/contrib/gis/tests/inspectapp/tests.py | 2 +- django/contrib/gis/tests/layermap/tests.py | 2 +- django/contrib/gis/utils/ogrinfo.py | 2 +- django/core/management/color.py | 2 +- django/core/management/commands/dumpdata.py | 2 +- django/dispatch/saferef.py | 4 +-- django/forms/forms.py | 2 +- django/forms/widgets.py | 2 +- django/http/cookie.py | 2 +- django/templatetags/i18n.py | 4 +-- django/test/testcases.py | 4 +-- django/test/utils.py | 4 +-- django/utils/cache.py | 2 +- django/utils/checksums.py | 2 +- django/utils/dates.py | 26 +++++++------- django/utils/http.py | 2 +- django/utils/translation/trans_real.py | 2 +- django/views/debug.py | 2 +- 23 files changed, 68 insertions(+), 68 deletions(-) diff --git a/django/contrib/gis/geos/linestring.py b/django/contrib/gis/geos/linestring.py index 0182646fa0d..be23ea485ff 100644 --- a/django/contrib/gis/geos/linestring.py +++ b/django/contrib/gis/geos/linestring.py @@ -62,7 +62,7 @@ class LineString(GEOSGeometry): for i in xrange(ncoords): if numpy_coords: - cs[i] = coords[i,:] + cs[i] = coords[i, :] elif isinstance(coords[i], Point): cs[i] = coords[i].tuple else: diff --git a/django/contrib/gis/geos/tests/test_geos_mutation.py b/django/contrib/gis/geos/tests/test_geos_mutation.py index 2db2940819d..a5512cf123d 100644 --- a/django/contrib/gis/geos/tests/test_geos_mutation.py +++ b/django/contrib/gis/geos/tests/test_geos_mutation.py @@ -109,7 +109,7 @@ class GEOSMutationTest(unittest.TestCase): # _set_single ls._set_single(0, (-50, 25)) - self.assertEqual(ls.coords, ((-50.0, 25.0),(4.0, 1.0),(6.0, -1.0)), 'LineString _set_single') + self.assertEqual(ls.coords, ((-50.0, 25.0), (4.0, 1.0), (6.0, -1.0)), 'LineString _set_single') # _set_list ls._set_list(2, ((-50.0, 25.0), (6.0, -1.0))) @@ -121,23 +121,23 @@ class GEOSMutationTest(unittest.TestCase): def test05_Polygon(self): 'Testing Polygon mutations' - for pg in (Polygon(((1,0),(4,1),(6,-1),(8,10),(1,0)), - ((5,4),(6,4),(6,3),(5,4))), + for pg in (Polygon(((1, 0), (4, 1), (6, -1), (8, 10), (1, 0)), + ((5, 4), (6, 4), (6, 3), (5, 4))), fromstr('POLYGON ((1 0,4 1,6 -1,8 10,1 0),(5 4,6 4,6 3,5 4))')): self.assertEqual(pg._get_single_external(0), - LinearRing((1,0),(4,1),(6,-1),(8,10),(1,0)), + LinearRing((1, 0), (4, 1), (6, -1), (8, 10), (1, 0)), 'Polygon _get_single_external(0)') self.assertEqual(pg._get_single_external(1), - LinearRing((5,4),(6,4),(6,3),(5,4)), + LinearRing((5, 4), (6, 4), (6, 3), (5, 4)), 'Polygon _get_single_external(1)') # _set_list - pg._set_list(2, (((1,2),(10,0),(12,9),(-1,15),(1,2)), - ((4,2),(5,2),(5,3),(4,2)))) + pg._set_list(2, (((1, 2), (10, 0), (12, 9), (-1, 15), (1, 2)), + ((4, 2), (5, 2), (5, 3), (4, 2)))) self.assertEqual( pg.coords, - (((1.0,2.0),(10.0,0.0),(12.0,9.0),(-1.0,15.0),(1.0,2.0)), - ((4.0,2.0),(5.0,2.0),(5.0,3.0),(4.0,2.0))), + (((1.0, 2.0), (10.0, 0.0), (12.0, 9.0), (-1.0, 15.0), (1.0, 2.0)), + ((4.0, 2.0), (5.0, 2.0), (5.0, 3.0), (4.0, 2.0))), 'Polygon _set_list') lsa = Polygon(*pg.coords) @@ -146,13 +146,13 @@ class GEOSMutationTest(unittest.TestCase): def test06_Collection(self): 'Testing Collection mutations' - for mp in (MultiPoint(*map(Point,((3,4),(-1,2),(5,-4),(2,8)))), + for mp in (MultiPoint(*map(Point, ((3, 4), (-1, 2), (5, -4), (2, 8)))), fromstr('MULTIPOINT (3 4,-1 2,5 -4,2 8)')): - self.assertEqual(mp._get_single_external(2), Point(5,-4), 'Collection _get_single_external') + self.assertEqual(mp._get_single_external(2), Point(5, -4), 'Collection _get_single_external') - mp._set_list(3, map(Point,((5,5),(3,-2),(8,1)))) - self.assertEqual(mp.coords, ((5.0,5.0),(3.0,-2.0),(8.0,1.0)), 'Collection _set_list') + mp._set_list(3, map(Point, ((5, 5), (3, -2), (8, 1)))) + self.assertEqual(mp.coords, ((5.0, 5.0), (3.0, -2.0), (8.0, 1.0)), 'Collection _set_list') - lsa = MultiPoint(*map(Point,((5,5),(3,-2),(8,1)))) + lsa = MultiPoint(*map(Point, ((5, 5), (3, -2), (8, 1)))) for f in geos_function_tests: self.assertEqual(f(lsa), f(mp), 'MultiPoint ' + f.__name__) diff --git a/django/contrib/gis/geos/tests/test_mutable_list.py b/django/contrib/gis/geos/tests/test_mutable_list.py index b052222753e..c8a8cc7b30d 100644 --- a/django/contrib/gis/geos/tests/test_mutable_list.py +++ b/django/contrib/gis/geos/tests/test_mutable_list.py @@ -79,20 +79,20 @@ class ListMixinTest(unittest.TestCase): self.assertEqual(pl[:i], ul[:i], 'slice [:%d]' % (i)) for j in self.limits_plus(1): - self.assertEqual(pl[i:j], ul[i:j], 'slice [%d:%d]' % (i,j)) + self.assertEqual(pl[i:j], ul[i:j], 'slice [%d:%d]' % (i, j)) for k in self.step_range(): - self.assertEqual(pl[i:j:k], ul[i:j:k], 'slice [%d:%d:%d]' % (i,j,k)) + self.assertEqual(pl[i:j:k], ul[i:j:k], 'slice [%d:%d:%d]' % (i, j, k)) for k in self.step_range(): - self.assertEqual(pl[i::k], ul[i::k], 'slice [%d::%d]' % (i,k)) - self.assertEqual(pl[:i:k], ul[:i:k], 'slice [:%d:%d]' % (i,k)) + self.assertEqual(pl[i::k], ul[i::k], 'slice [%d::%d]' % (i, k)) + self.assertEqual(pl[:i:k], ul[:i:k], 'slice [:%d:%d]' % (i, k)) for k in self.step_range(): self.assertEqual(pl[::k], ul[::k], 'slice [::%d]' % (k)) def test02_setslice(self): 'Slice assignment' - def setfcn(x,i,j,k,L): + def setfcn(x, i, j, k, L): x[i:j:k] = range(L) pl, ul = self.lists_of_len() for slen in range(self.limit + 1): @@ -166,23 +166,23 @@ class ListMixinTest(unittest.TestCase): pl, ul = self.lists_of_len(Len) del pl[i:j] del ul[i:j] - self.assertEqual(pl[:], ul[:], 'del slice [%d:%d]' % (i,j)) + self.assertEqual(pl[:], ul[:], 'del slice [%d:%d]' % (i, j)) for k in list(range(-Len - 1, 0)) + list(range(1, Len)): pl, ul = self.lists_of_len(Len) del pl[i:j:k] del ul[i:j:k] - self.assertEqual(pl[:], ul[:], 'del slice [%d:%d:%d]' % (i,j,k)) + self.assertEqual(pl[:], ul[:], 'del slice [%d:%d:%d]' % (i, j, k)) for k in list(range(-Len - 1, 0)) + list(range(1, Len)): pl, ul = self.lists_of_len(Len) del pl[:i:k] del ul[:i:k] - self.assertEqual(pl[:], ul[:], 'del slice [:%d:%d]' % (i,k)) + self.assertEqual(pl[:], ul[:], 'del slice [:%d:%d]' % (i, k)) pl, ul = self.lists_of_len(Len) del pl[i::k] del ul[i::k] - self.assertEqual(pl[:], ul[:], 'del slice [%d::%d]' % (i,k)) + self.assertEqual(pl[:], ul[:], 'del slice [%d::%d]' % (i, k)) for k in list(range(-Len - 1, 0)) + list(range(1, Len)): pl, ul = self.lists_of_len(Len) @@ -231,8 +231,8 @@ class ListMixinTest(unittest.TestCase): ul.append(40) self.assertEqual(pl[:], ul[:], 'append') - pl.extend(range(50,55)) - ul.extend(range(50,55)) + pl.extend(range(50, 55)) + ul.extend(range(50, 55)) self.assertEqual(pl[:], ul[:], 'extend') pl.reverse() @@ -241,8 +241,8 @@ class ListMixinTest(unittest.TestCase): for i in self.limits_plus(1): pl, ul = self.lists_of_len() - pl.insert(i,50) - ul.insert(i,50) + pl.insert(i, 50) + ul.insert(i, 50) self.assertEqual(pl[:], ul[:], 'insert at %d' % i) for i in self.limits_plus(0): @@ -292,17 +292,17 @@ class ListMixinTest(unittest.TestCase): def setfcn(x, i, v): x[i] = v self.assertRaises(TypeError, setfcn, ul, 2, 'hello') - self.assertRaises(TypeError, setfcn, ul, slice(0,3,2), ('hello','goodbye')) + self.assertRaises(TypeError, setfcn, ul, slice(0, 3, 2), ('hello', 'goodbye')) def test08_min_length(self): 'Length limits' pl, ul = self.lists_of_len() ul._minlength = 1 - def delfcn(x,i): + def delfcn(x, i): del x[:i] - def setfcn(x,i): + def setfcn(x, i): x[:i] = [] for i in range(self.limit - ul._minlength + 1, self.limit + 1): self.assertRaises(ValueError, delfcn, ul, i) @@ -363,7 +363,7 @@ class ListMixinTest(unittest.TestCase): def test_12_arithmetic(self): 'Arithmetic' pl, ul = self.lists_of_len() - al = list(range(10,14)) + al = list(range(10, 14)) self.assertEqual(list(pl + al), list(ul + al), 'add') self.assertEqual(type(ul), type(ul + al), 'type of add result') self.assertEqual(list(al + pl), list(al + ul), 'radd') diff --git a/django/contrib/gis/tests/geo3d/tests.py b/django/contrib/gis/tests/geo3d/tests.py index b528e1faeab..f9a8eb5760c 100644 --- a/django/contrib/gis/tests/geo3d/tests.py +++ b/django/contrib/gis/tests/geo3d/tests.py @@ -196,7 +196,7 @@ class Geo3DTest(TestCase): """ self._load_city_data() # `SELECT ST_Extent3D(point) FROM geo3d_city3d;` - ref_extent3d = (-123.305196, -41.315268, 14,174.783117, 48.462611, 1433) + ref_extent3d = (-123.305196, -41.315268, 14, 174.783117, 48.462611, 1433) extent1 = City3D.objects.aggregate(Extent3D('point'))['point__extent3d'] extent2 = City3D.objects.extent3d() diff --git a/django/contrib/gis/tests/geoapp/tests.py b/django/contrib/gis/tests/geoapp/tests.py index 5dd56b45a94..a3f673d5f06 100644 --- a/django/contrib/gis/tests/geoapp/tests.py +++ b/django/contrib/gis/tests/geoapp/tests.py @@ -24,7 +24,7 @@ if HAS_GEOS and not spatialite: def postgis_bug_version(): - spatial_version = getattr(connection.ops, "spatial_version", (0,0,0)) + spatial_version = getattr(connection.ops, "spatial_version", (0, 0, 0)) return spatial_version and (2, 0, 0) <= spatial_version <= (2, 0, 1) diff --git a/django/contrib/gis/tests/inspectapp/tests.py b/django/contrib/gis/tests/inspectapp/tests.py index 7655fde5845..17642ea8df3 100644 --- a/django/contrib/gis/tests/inspectapp/tests.py +++ b/django/contrib/gis/tests/inspectapp/tests.py @@ -26,7 +26,7 @@ class InspectDbTests(TestCase): """ out = StringIO() call_command('inspectdb', - table_name_filter=lambda tn:tn.startswith('inspectapp_'), + table_name_filter=lambda tn: tn.startswith('inspectapp_'), stdout=out) output = out.getvalue() self.assertIn('geom = models.PolygonField()', output) diff --git a/django/contrib/gis/tests/layermap/tests.py b/django/contrib/gis/tests/layermap/tests.py index ded73fc1749..e32ab8c22d6 100644 --- a/django/contrib/gis/tests/layermap/tests.py +++ b/django/contrib/gis/tests/layermap/tests.py @@ -255,7 +255,7 @@ class LayerMapTest(TestCase): # Testing the `step` keyword -- should get the same counties # regardless of we use a step that divides equally, that is odd, # or that is larger than the dataset. - for st in (4,7,1000): + for st in (4, 7, 1000): clear_counties() lm.save(step=st, strict=True) self.county_helper(county_feat=False) diff --git a/django/contrib/gis/utils/ogrinfo.py b/django/contrib/gis/utils/ogrinfo.py index d9c3e091558..32f3371e426 100644 --- a/django/contrib/gis/utils/ogrinfo.py +++ b/django/contrib/gis/utils/ogrinfo.py @@ -31,7 +31,7 @@ def ogrinfo(data_source, num_features=10): print(" extent: %s - %s" % (extent_tup[0:2], extent_tup[2:4])) print("Displaying the first %s features ====" % num_features) - width = max(*map(len,layer.fields)) + width = max(*map(len, layer.fields)) fmt = " %%%ss: %%s" % width for j, feature in enumerate(layer[:num_features]): print("=== Feature %s" % j) diff --git a/django/core/management/color.py b/django/core/management/color.py index 21826c6b687..46a1de2a9eb 100644 --- a/django/core/management/color.py +++ b/django/core/management/color.py @@ -34,7 +34,7 @@ def color_style(): # Use that palette as the basis for populating # the palette as defined in the environment. for role in termcolors.PALETTES[termcolors.NOCOLOR_PALETTE]: - format = color_settings.get(role,{}) + format = color_settings.get(role, {}) setattr(style, role, termcolors.make_style(**format)) # For backwards compatibility, # set style for ERROR_OUTPUT == ERROR diff --git a/django/core/management/commands/dumpdata.py b/django/core/management/commands/dumpdata.py index e177a99b5fc..03215ae41c1 100644 --- a/django/core/management/commands/dumpdata.py +++ b/django/core/management/commands/dumpdata.py @@ -18,7 +18,7 @@ class Command(BaseCommand): make_option('--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, help='Nominates a specific database to dump ' 'fixtures from. Defaults to the "default" database.'), - make_option('-e', '--exclude', dest='exclude',action='append', default=[], + make_option('-e', '--exclude', dest='exclude', action='append', default=[], help='An appname or appname.ModelName to exclude (use multiple --exclude to exclude multiple apps/models).'), make_option('-n', '--natural', action='store_true', dest='use_natural_keys', default=False, help='Use natural keys if they are available.'), diff --git a/django/dispatch/saferef.py b/django/dispatch/saferef.py index c40dbba462c..5a5fd45c4b1 100644 --- a/django/dispatch/saferef.py +++ b/django/dispatch/saferef.py @@ -90,7 +90,7 @@ class BoundMethodWeakref(object): else: base = super(BoundMethodWeakref, cls).__new__(cls) cls._allInstances[key] = base - base.__init__(target, onDelete, *arguments,**named) + base.__init__(target, onDelete, *arguments, **named) return base def __init__(self, target, onDelete=None): @@ -139,7 +139,7 @@ class BoundMethodWeakref(object): Currently this is a two-tuple of the id()'s of the target object and the target function respectively. """ - return (id(target.__self__),id(target.__func__)) + return (id(target.__self__), id(target.__func__)) calculateKey = classmethod(calculateKey) def __str__(self): diff --git a/django/forms/forms.py b/django/forms/forms.py index 15c3e2c3f88..d9be2cd3f8e 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -235,7 +235,7 @@ class BaseForm(object): # not be able to conscript the last row for our purposes, # so insert a new, empty row. last_row = (normal_row % {'errors': '', 'label': '', - 'field': '', 'help_text':'', + 'field': '', 'help_text': '', 'html_class_attr': html_class_attr}) output.append(last_row) output[-1] = last_row[:-len(row_ender)] + str_hidden + row_ender diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 3b5c460ef9e..58bcabef983 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -28,7 +28,7 @@ __all__ = ( 'SplitDateTimeWidget', 'SplitHiddenDateTimeWidget', ) -MEDIA_TYPES = ('css','js') +MEDIA_TYPES = ('css', 'js') @python_2_unicode_compatible class Media(object): diff --git a/django/http/cookie.py b/django/http/cookie.py index eef0c35759f..7084c877661 100644 --- a/django/http/cookie.py +++ b/django/http/cookie.py @@ -38,7 +38,7 @@ else: # (real val, encoded_val) val, encoded = super(SimpleCookie, self).value_encode(val) - encoded = encoded.replace(";", "\\073").replace(",","\\054") + encoded = encoded.replace(";", "\\073").replace(",", "\\054") # If encoded now contains any quoted chars, we need double quotes # around the whole string. if "\\" in encoded and not encoded.startswith('"'): diff --git a/django/templatetags/i18n.py b/django/templatetags/i18n.py index 22fb4eb1a73..fc8029d738d 100644 --- a/django/templatetags/i18n.py +++ b/django/templatetags/i18n.py @@ -341,9 +341,9 @@ def do_translate(parser, token): if value[0] == "'": m = re.match("^'([^']+)'(\|.*$)", value) if m: - value = '"%s"%s' % (m.group(1).replace('"','\\"'), m.group(2)) + value = '"%s"%s' % (m.group(1).replace('"', '\\"'), m.group(2)) elif value[-1] == "'": - value = '"%s"' % value[1:-1].replace('"','\\"') + value = '"%s"' % value[1:-1].replace('"', '\\"') noop = False asvar = None diff --git a/django/test/testcases.py b/django/test/testcases.py index 161053c611a..b2d386cc449 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -375,7 +375,7 @@ class SimpleTestCase(unittest.TestCase): # Search all contexts for the error. found_form = False - for i,context in enumerate(contexts): + for i, context in enumerate(contexts): if form not in context: continue found_form = True @@ -600,7 +600,7 @@ class SimpleTestCase(unittest.TestCase): self.assertEqual(optional.clean(e), empty_value) # test that max_length and min_length are always accepted if issubclass(fieldclass, CharField): - field_kwargs.update({'min_length':2, 'max_length':20}) + field_kwargs.update({'min_length': 2, 'max_length': 20}) self.assertTrue(isinstance(fieldclass(*field_args, **field_kwargs), fieldclass)) diff --git a/django/test/utils.py b/django/test/utils.py index ee90f77e0c4..60c67e1fc69 100644 --- a/django/test/utils.py +++ b/django/test/utils.py @@ -285,8 +285,8 @@ def compare_xml(want, got): return node want, got = strip_quotes(want, got) - want = want.replace('\\n','\n') - got = got.replace('\\n','\n') + want = want.replace('\\n', '\n') + got = got.replace('\\n', '\n') # If the string is not a complete xml document, we may need to add a # root element. This allow us to compare fragments, like "" diff --git a/django/utils/cache.py b/django/utils/cache.py index 7a77f911ced..375c34d7adc 100644 --- a/django/utils/cache.py +++ b/django/utils/cache.py @@ -258,7 +258,7 @@ def learn_cache_key(request, response, cache_timeout=None, key_prefix=None, cach def _to_tuple(s): - t = s.split('=',1) + t = s.split('=', 1) if len(t) == 2: return t[0].lower(), t[1] return t[0].lower(), True diff --git a/django/utils/checksums.py b/django/utils/checksums.py index 94c002967a0..7bd21c95e00 100644 --- a/django/utils/checksums.py +++ b/django/utils/checksums.py @@ -2,7 +2,7 @@ Common checksum routines. """ -__all__ = ['luhn',] +__all__ = ['luhn'] from django.utils import six diff --git a/django/utils/dates.py b/django/utils/dates.py index a1c0fa254c4..37746294b84 100644 --- a/django/utils/dates.py +++ b/django/utils/dates.py @@ -3,29 +3,29 @@ from django.utils.translation import ugettext_lazy as _, pgettext_lazy WEEKDAYS = { - 0:_('Monday'), 1:_('Tuesday'), 2:_('Wednesday'), 3:_('Thursday'), 4:_('Friday'), - 5:_('Saturday'), 6:_('Sunday') + 0: _('Monday'), 1: _('Tuesday'), 2: _('Wednesday'), 3: _('Thursday'), 4: _('Friday'), + 5: _('Saturday'), 6: _('Sunday') } WEEKDAYS_ABBR = { - 0:_('Mon'), 1:_('Tue'), 2:_('Wed'), 3:_('Thu'), 4:_('Fri'), - 5:_('Sat'), 6:_('Sun') + 0: _('Mon'), 1: _('Tue'), 2: _('Wed'), 3: _('Thu'), 4: _('Fri'), + 5: _('Sat'), 6: _('Sun') } WEEKDAYS_REV = { - 'monday':0, 'tuesday':1, 'wednesday':2, 'thursday':3, 'friday':4, - 'saturday':5, 'sunday':6 + 'monday': 0, 'tuesday': 1, 'wednesday': 2, 'thursday': 3, 'friday': 4, + 'saturday': 5, 'sunday': 6 } MONTHS = { - 1:_('January'), 2:_('February'), 3:_('March'), 4:_('April'), 5:_('May'), 6:_('June'), - 7:_('July'), 8:_('August'), 9:_('September'), 10:_('October'), 11:_('November'), - 12:_('December') + 1: _('January'), 2: _('February'), 3: _('March'), 4: _('April'), 5: _('May'), 6: _('June'), + 7: _('July'), 8: _('August'), 9: _('September'), 10: _('October'), 11: _('November'), + 12: _('December') } MONTHS_3 = { - 1:_('jan'), 2:_('feb'), 3:_('mar'), 4:_('apr'), 5:_('may'), 6:_('jun'), - 7:_('jul'), 8:_('aug'), 9:_('sep'), 10:_('oct'), 11:_('nov'), 12:_('dec') + 1: _('jan'), 2: _('feb'), 3: _('mar'), 4: _('apr'), 5: _('may'), 6: _('jun'), + 7: _('jul'), 8: _('aug'), 9: _('sep'), 10: _('oct'), 11: _('nov'), 12: _('dec') } MONTHS_3_REV = { - 'jan':1, 'feb':2, 'mar':3, 'apr':4, 'may':5, 'jun':6, 'jul':7, 'aug':8, - 'sep':9, 'oct':10, 'nov':11, 'dec':12 + 'jan': 1, 'feb': 2, 'mar': 3, 'apr': 4, 'may': 5, 'jun': 6, 'jul': 7, 'aug': 8, + 'sep': 9, 'oct': 10, 'nov': 11, 'dec': 12 } MONTHS_AP = { # month names in Associated Press style 1: pgettext_lazy('abbrev. month', 'Jan.'), diff --git a/django/utils/http.py b/django/utils/http.py index 3b1a36098ce..897b1456c4d 100644 --- a/django/utils/http.py +++ b/django/utils/http.py @@ -78,7 +78,7 @@ def urlencode(query, doseq=0): query = query.items() return original_urlencode( [(force_str(k), - [force_str(i) for i in v] if isinstance(v, (list,tuple)) else force_str(v)) + [force_str(i) for i in v] if isinstance(v, (list, tuple)) else force_str(v)) for k, v in query], doseq) diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index c8c7bddb143..58ea64447de 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -641,7 +641,7 @@ def templatize(src, origin=None): out.write(' _(%s) ' % cmatch.group(1)) for p in parts[1:]: if p.find(':_(') >= 0: - out.write(' %s ' % p.split(':',1)[1]) + out.write(' %s ' % p.split(':', 1)[1]) else: out.write(blankout(p, 'F')) elif t.token_type == TOKEN_COMMENT: diff --git a/django/views/debug.py b/django/views/debug.py index 71b35364047..6db63b782ec 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -40,7 +40,7 @@ def cleanse_setting(key, value): cleansed = CLEANSED_SUBSTITUTE else: if isinstance(value, dict): - cleansed = dict((k, cleanse_setting(k, v)) for k,v in value.items()) + cleansed = dict((k, cleanse_setting(k, v)) for k, v in value.items()) else: cleansed = value except TypeError: