Removed a few trailing backslashes.

We have always been at war with trailing backslashes.
This commit is contained in:
Aymeric Augustin 2013-09-22 14:01:57 +02:00
parent ee0ef1b094
commit a5b062576b
14 changed files with 28 additions and 30 deletions

View File

@ -139,8 +139,8 @@ class Settings(BaseSettings):
if setting == setting.upper():
setting_value = getattr(mod, setting)
if setting in tuple_settings and \
isinstance(setting_value, six.string_types):
if (setting in tuple_settings and
isinstance(setting_value, six.string_types)):
raise ImproperlyConfigured("The %s setting must be a tuple. "
"Please fix your settings." % setting)

View File

@ -167,8 +167,9 @@ def get_default_username(check_db=True):
default_username = get_system_username()
try:
default_username = unicodedata.normalize('NFKD', default_username)\
.encode('ascii', 'ignore').decode('ascii').replace(' ', '').lower()
default_username = (unicodedata.normalize('NFKD', default_username)
.encode('ascii', 'ignore').decode('ascii')
.replace(' ', '').lower())
except UnicodeDecodeError:
return ''

View File

@ -136,8 +136,7 @@ class RemoteUserNoCreateTest(RemoteUserTest):
class that doesn't create unknown users.
"""
backend =\
'django.contrib.auth.tests.test_remote_user.RemoteUserNoCreateBackend'
backend = 'django.contrib.auth.tests.test_remote_user.RemoteUserNoCreateBackend'
def test_unknown_user(self):
num_users = User.objects.count()
@ -173,8 +172,7 @@ class RemoteUserCustomTest(RemoteUserTest):
and configure_user methods.
"""
backend =\
'django.contrib.auth.tests.test_remote_user.CustomRemoteUserBackend'
backend = 'django.contrib.auth.tests.test_remote_user.CustomRemoteUserBackend'
# REMOTE_USER strings with email addresses for the custom backend to
# clean.
known_user = 'knownuser@example.com'

View File

@ -111,8 +111,7 @@ class SQLEvaluator(object):
timedelta = node.children.pop()
sql, params = self.evaluate_node(node, qn, connection)
if timedelta.days == 0 and timedelta.seconds == 0 and \
timedelta.microseconds == 0:
if (timedelta.days == timedelta.seconds == timedelta.microseconds == 0):
return sql, params
return connection.ops.date_interval_sql(sql, node.connector, timedelta), params

View File

@ -83,8 +83,10 @@ def _get_queryset(klass):
elif isinstance(klass, ModelBase):
manager = klass._default_manager
else:
klass__name = klass.__name__ if isinstance(klass, type) \
else klass.__class__.__name__
if isinstance(klass, type)
klass__name = klass.__name__
else:
klass__name = klass.__class__.__name__
raise ValueError("Object is of type '%s', but must be a Django Model, "
"Manager, or QuerySet" % klass__name)
return manager.all()

View File

@ -133,8 +133,7 @@ class SimpleTemplateResponse(HttpResponse):
class TemplateResponse(SimpleTemplateResponse):
rendering_attrs = SimpleTemplateResponse.rendering_attrs + \
['_request', '_current_app']
rendering_attrs = SimpleTemplateResponse.rendering_attrs + ['_request', '_current_app']
def __init__(self, request, template, context=None, content_type=None,
status=None, current_app=None):

View File

@ -359,7 +359,7 @@ def do_translate(parser, token):
asvar = self.tag()
else:
raise TemplateSyntaxError(
"Only options for 'trans' are 'noop', " \
"Only options for 'trans' are 'noop', "
"'context \"xxx\"', and 'as VAR'.")
return value, noop, asvar, message_context
value, noop, asvar, message_context = TranslateParser(token.contents).top()

View File

@ -524,8 +524,8 @@ class Client(RequestFactory):
not available.
"""
user = authenticate(**credentials)
if user and user.is_active \
and 'django.contrib.sessions' in settings.INSTALLED_APPS:
if (user and user.is_active and
'django.contrib.sessions' in settings.INSTALLED_APPS):
engine = import_module(settings.SESSION_ENGINE)
# Create a fake request to store login details.

View File

@ -734,9 +734,8 @@ class TransactionTestCase(SimpleTestCase):
def _reset_sequences(self, db_name):
conn = connections[db_name]
if conn.features.supports_sequence_reset:
sql_list = \
conn.ops.sequence_reset_by_name_sql(no_style(),
conn.introspection.sequence_list())
sql_list = conn.ops.sequence_reset_by_name_sql(
no_style(), conn.introspection.sequence_list())
if sql_list:
with transaction.commit_on_success_unless_managed(using=db_name):
cursor = conn.cursor()

View File

@ -152,13 +152,13 @@ else:
smart_unicode = smart_text
force_unicode = force_text
smart_str.__doc__ = """\
smart_str.__doc__ = """
Apply smart_text in Python 3 and smart_bytes in Python 2.
This is suitable for writing to sys.stdout (for instance).
"""
force_str.__doc__ = """\
force_str.__doc__ = """
Apply force_text in Python 3 and force_bytes in Python 2.
"""

View File

@ -272,7 +272,7 @@ class Rss201rev2Feed(RssFeed):
# Author information.
if item["author_name"] and item["author_email"]:
handler.addQuickElement("author", "%s (%s)" % \
handler.addQuickElement("author", "%s (%s)" %
(item['author_email'], item['author_name']))
elif item["author_email"]:
handler.addQuickElement("author", item["author_email"])

View File

@ -59,8 +59,8 @@ else:
attrname, rest, attrvalue = m.group(1, 2, 3)
if not rest:
attrvalue = None
elif attrvalue[:1] == '\'' == attrvalue[-1:] or \
attrvalue[:1] == '"' == attrvalue[-1:]:
elif (attrvalue[:1] == '\'' == attrvalue[-1:] or
attrvalue[:1] == '"' == attrvalue[-1:]):
attrvalue = attrvalue[1:-1]
if attrvalue:
attrvalue = self.unescape(attrvalue)
@ -72,8 +72,8 @@ else:
lineno, offset = self.getpos()
if "\n" in self.__starttag_text:
lineno = lineno + self.__starttag_text.count("\n")
offset = len(self.__starttag_text) \
- self.__starttag_text.rfind("\n")
offset = (len(self.__starttag_text)
- self.__starttag_text.rfind("\n"))
else:
offset = offset + len(self.__starttag_text)
self.error("junk characters in start tag: %r"

View File

@ -256,5 +256,5 @@ def is_safe_url(url, host=None):
if not url:
return False
url_info = urlparse(url)
return (not url_info.netloc or url_info.netloc == host) and \
(not url_info.scheme or url_info.scheme in ['http', 'https'])
return ((not url_info.netloc or url_info.netloc == host) and
(not url_info.scheme or url_info.scheme in ['http', 'https']))

View File

@ -158,7 +158,7 @@ class NoURLPatternsTests(TestCase):
resolver = RegexURLResolver(r'^$', self.urls)
self.assertRaisesMessage(ImproperlyConfigured,
"The included urlconf urlpatterns_reverse.no_urls "\
"The included urlconf urlpatterns_reverse.no_urls "
"doesn't have any patterns in it", getattr, resolver, 'url_patterns')
class URLPatternReverse(TestCase):