Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed a few trailing backslashes.

We have always been at war with trailing backslashes.
  • Loading branch information...
commit a5b062576bda29abe93504dbcb126e644d07f9dd 1 parent ee0ef1b
Aymeric Augustin authored September 22, 2013
4  django/conf/__init__.py
@@ -139,8 +139,8 @@ def __init__(self, settings_module):
139 139
             if setting == setting.upper():
140 140
                 setting_value = getattr(mod, setting)
141 141
 
142  
-                if setting in tuple_settings and \
143  
-                        isinstance(setting_value, six.string_types):
  142
+                if (setting in tuple_settings and
  143
+                        isinstance(setting_value, six.string_types)):
144 144
                     raise ImproperlyConfigured("The %s setting must be a tuple. "
145 145
                             "Please fix your settings." % setting)
146 146
 
5  django/contrib/auth/management/__init__.py
@@ -167,8 +167,9 @@ def get_default_username(check_db=True):
167 167
 
168 168
     default_username = get_system_username()
169 169
     try:
170  
-        default_username = unicodedata.normalize('NFKD', default_username)\
171  
-            .encode('ascii', 'ignore').decode('ascii').replace(' ', '').lower()
  170
+        default_username = (unicodedata.normalize('NFKD', default_username)
  171
+                .encode('ascii', 'ignore').decode('ascii')
  172
+                .replace(' ', '').lower())
172 173
     except UnicodeDecodeError:
173 174
         return ''
174 175
 
6  django/contrib/auth/tests/test_remote_user.py
@@ -136,8 +136,7 @@ class RemoteUserNoCreateTest(RemoteUserTest):
136 136
     class that doesn't create unknown users.
137 137
     """
138 138
 
139  
-    backend =\
140  
-        'django.contrib.auth.tests.test_remote_user.RemoteUserNoCreateBackend'
  139
+    backend = 'django.contrib.auth.tests.test_remote_user.RemoteUserNoCreateBackend'
141 140
 
142 141
     def test_unknown_user(self):
143 142
         num_users = User.objects.count()
@@ -173,8 +172,7 @@ class RemoteUserCustomTest(RemoteUserTest):
173 172
     and configure_user methods.
174 173
     """
175 174
 
176  
-    backend =\
177  
-        'django.contrib.auth.tests.test_remote_user.CustomRemoteUserBackend'
  175
+    backend = 'django.contrib.auth.tests.test_remote_user.CustomRemoteUserBackend'
178 176
     # REMOTE_USER strings with email addresses for the custom backend to
179 177
     # clean.
180 178
     known_user = 'knownuser@example.com'
3  django/db/models/sql/expressions.py
@@ -111,8 +111,7 @@ def evaluate_date_modifier_node(self, node, qn, connection):
111 111
         timedelta = node.children.pop()
112 112
         sql, params = self.evaluate_node(node, qn, connection)
113 113
 
114  
-        if timedelta.days == 0 and timedelta.seconds == 0 and \
115  
-                timedelta.microseconds == 0:
  114
+        if (timedelta.days == timedelta.seconds == timedelta.microseconds == 0):
116 115
             return sql, params
117 116
 
118 117
         return connection.ops.date_interval_sql(sql, node.connector, timedelta), params
6  django/shortcuts/__init__.py
@@ -83,8 +83,10 @@ def _get_queryset(klass):
83 83
     elif isinstance(klass, ModelBase):
84 84
         manager = klass._default_manager
85 85
     else:
86  
-        klass__name = klass.__name__ if isinstance(klass, type) \
87  
-                      else klass.__class__.__name__
  86
+        if isinstance(klass, type)
  87
+            klass__name = klass.__name__
  88
+        else:
  89
+            klass__name = klass.__class__.__name__
88 90
         raise ValueError("Object is of type '%s', but must be a Django Model, "
89 91
                          "Manager, or QuerySet" % klass__name)
90 92
     return manager.all()
3  django/template/response.py
@@ -133,8 +133,7 @@ def content(self, value):
133 133
 
134 134
 
135 135
 class TemplateResponse(SimpleTemplateResponse):
136  
-    rendering_attrs = SimpleTemplateResponse.rendering_attrs + \
137  
-        ['_request', '_current_app']
  136
+    rendering_attrs = SimpleTemplateResponse.rendering_attrs + ['_request', '_current_app']
138 137
 
139 138
     def __init__(self, request, template, context=None, content_type=None,
140 139
             status=None, current_app=None):
2  django/templatetags/i18n.py
@@ -359,7 +359,7 @@ def top(self):
359 359
                     asvar = self.tag()
360 360
                 else:
361 361
                     raise TemplateSyntaxError(
362  
-                        "Only options for 'trans' are 'noop', " \
  362
+                        "Only options for 'trans' are 'noop', "
363 363
                         "'context \"xxx\"', and 'as VAR'.")
364 364
             return value, noop, asvar, message_context
365 365
     value, noop, asvar, message_context = TranslateParser(token.contents).top()
4  django/test/client.py
@@ -524,8 +524,8 @@ def login(self, **credentials):
524 524
         not available.
525 525
         """
526 526
         user = authenticate(**credentials)
527  
-        if user and user.is_active \
528  
-                and 'django.contrib.sessions' in settings.INSTALLED_APPS:
  527
+        if (user and user.is_active and
  528
+                'django.contrib.sessions' in settings.INSTALLED_APPS):
529 529
             engine = import_module(settings.SESSION_ENGINE)
530 530
 
531 531
             # Create a fake request to store login details.
5  django/test/testcases.py
@@ -734,9 +734,8 @@ def _databases_names(self, include_mirrors=True):
734 734
     def _reset_sequences(self, db_name):
735 735
         conn = connections[db_name]
736 736
         if conn.features.supports_sequence_reset:
737  
-            sql_list = \
738  
-                conn.ops.sequence_reset_by_name_sql(no_style(),
739  
-                                                    conn.introspection.sequence_list())
  737
+            sql_list = conn.ops.sequence_reset_by_name_sql(
  738
+                    no_style(), conn.introspection.sequence_list())
740 739
             if sql_list:
741 740
                 with transaction.commit_on_success_unless_managed(using=db_name):
742 741
                     cursor = conn.cursor()
4  django/utils/encoding.py
@@ -152,13 +152,13 @@ def force_bytes(s, encoding='utf-8', strings_only=False, errors='strict'):
152 152
     smart_unicode = smart_text
153 153
     force_unicode = force_text
154 154
 
155  
-smart_str.__doc__ = """\
  155
+smart_str.__doc__ = """
156 156
 Apply smart_text in Python 3 and smart_bytes in Python 2.
157 157
 
158 158
 This is suitable for writing to sys.stdout (for instance).
159 159
 """
160 160
 
161  
-force_str.__doc__ = """\
  161
+force_str.__doc__ = """
162 162
 Apply force_text in Python 3 and force_bytes in Python 2.
163 163
 """
164 164
 
2  django/utils/feedgenerator.py
@@ -272,7 +272,7 @@ def add_item_elements(self, handler, item):
272 272
 
273 273
         # Author information.
274 274
         if item["author_name"] and item["author_email"]:
275  
-            handler.addQuickElement("author", "%s (%s)" % \
  275
+            handler.addQuickElement("author", "%s (%s)" %
276 276
                 (item['author_email'], item['author_name']))
277 277
         elif item["author_email"]:
278 278
             handler.addQuickElement("author", item["author_email"])
8  django/utils/html_parser.py
@@ -59,8 +59,8 @@ def parse_starttag(self, i):
59 59
                 attrname, rest, attrvalue = m.group(1, 2, 3)
60 60
                 if not rest:
61 61
                     attrvalue = None
62  
-                elif attrvalue[:1] == '\'' == attrvalue[-1:] or \
63  
-                     attrvalue[:1] == '"' == attrvalue[-1:]:
  62
+                elif (attrvalue[:1] == '\'' == attrvalue[-1:] or
  63
+                        attrvalue[:1] == '"' == attrvalue[-1:]):
64 64
                     attrvalue = attrvalue[1:-1]
65 65
                 if attrvalue:
66 66
                     attrvalue = self.unescape(attrvalue)
@@ -72,8 +72,8 @@ def parse_starttag(self, i):
72 72
                 lineno, offset = self.getpos()
73 73
                 if "\n" in self.__starttag_text:
74 74
                     lineno = lineno + self.__starttag_text.count("\n")
75  
-                    offset = len(self.__starttag_text) \
76  
-                             - self.__starttag_text.rfind("\n")
  75
+                    offset = (len(self.__starttag_text)
  76
+                             - self.__starttag_text.rfind("\n"))
77 77
                 else:
78 78
                     offset = offset + len(self.__starttag_text)
79 79
                 self.error("junk characters in start tag: %r"
4  django/utils/http.py
@@ -256,5 +256,5 @@ def is_safe_url(url, host=None):
256 256
     if not url:
257 257
         return False
258 258
     url_info = urlparse(url)
259  
-    return (not url_info.netloc or url_info.netloc == host) and \
260  
-        (not url_info.scheme or url_info.scheme in ['http', 'https'])
  259
+    return ((not url_info.netloc or url_info.netloc == host) and
  260
+            (not url_info.scheme or url_info.scheme in ['http', 'https']))
2  tests/urlpatterns_reverse/tests.py
@@ -158,7 +158,7 @@ def test_no_urls_exception(self):
158 158
         resolver = RegexURLResolver(r'^$', self.urls)
159 159
 
160 160
         self.assertRaisesMessage(ImproperlyConfigured,
161  
-            "The included urlconf urlpatterns_reverse.no_urls "\
  161
+            "The included urlconf urlpatterns_reverse.no_urls "
162 162
             "doesn't have any patterns in it", getattr, resolver, 'url_patterns')
163 163
 
164 164
 class URLPatternReverse(TestCase):

0 notes on commit a5b0625

Please sign in to comment.
Something went wrong with that request. Please try again.