1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed E128 flake8 warnings in django/.

This commit is contained in:
Tim Graham
2016-03-28 18:33:29 -04:00
parent 2956e2f5e3
commit df8d8d4292
136 changed files with 1641 additions and 1212 deletions

View File

@@ -168,8 +168,7 @@ def floatformat(text, arg=-1):
# Avoid conversion to scientific notation by accessing `sign`, `digits`
# and `exponent` from `Decimal.as_tuple()` directly.
sign, digits, exponent = d.quantize(exp, ROUND_HALF_UP,
Context(prec=prec)).as_tuple()
sign, digits, exponent = d.quantize(exp, ROUND_HALF_UP, Context(prec=prec)).as_tuple()
digits = [six.text_type(digit) for digit in reversed(digits)]
while len(digits) <= abs(exponent):
digits.append('0')
@@ -367,8 +366,7 @@ def urlizetrunc(value, limit, autoescape=True):
Argument: Length to truncate URLs to.
"""
return mark_safe(_urlize(value, trim_url_limit=int(limit), nofollow=True,
autoescape=autoescape))
return mark_safe(_urlize(value, trim_url_limit=int(limit), nofollow=True, autoescape=autoescape))
@register.filter(is_safe=False)

View File

@@ -119,8 +119,10 @@ class Library(object):
if len(bits) >= 2 and bits[-2] == 'as':
target_var = bits[-1]
bits = bits[:-2]
args, kwargs = parse_bits(parser, bits, params,
varargs, varkw, defaults, takes_context, function_name)
args, kwargs = parse_bits(
parser, bits, params, varargs, varkw, defaults,
takes_context, function_name
)
return SimpleNode(func, takes_context, args, kwargs, target_var)
self.tag(function_name, compile_func)
return func

View File

@@ -119,15 +119,17 @@ class SimpleTemplateResponse(HttpResponse):
def __iter__(self):
if not self._is_rendered:
raise ContentNotRenderedError('The response content must be '
'rendered before it can be iterated over.')
raise ContentNotRenderedError(
'The response content must be rendered before it can be iterated over.'
)
return super(SimpleTemplateResponse, self).__iter__()
@property
def content(self):
if not self._is_rendered:
raise ContentNotRenderedError('The response content must be '
'rendered before it can be accessed.')
raise ContentNotRenderedError(
'The response content must be rendered before it can be accessed.'
)
return super(SimpleTemplateResponse, self).content
@content.setter
@@ -142,7 +144,7 @@ class TemplateResponse(SimpleTemplateResponse):
rendering_attrs = SimpleTemplateResponse.rendering_attrs + ['_request']
def __init__(self, request, template, context=None, content_type=None,
status=None, charset=None, using=None):
status=None, charset=None, using=None):
super(TemplateResponse, self).__init__(
template, context, content_type, status, charset, using)
self._request = request