Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #1861 from milmazz/E251

Fixed flake8 E251 violations
  • Loading branch information...
commit 91078f566904e49fbf99ec6375ba627e821f6143 2 parents 08e2ece + cbc7cbb
Alex Gaynor authored November 03, 2013
4  django/contrib/admin/templatetags/admin_list.py
@@ -96,8 +96,8 @@ def result_headers(cl):
96 96
     ordering_field_columns = cl.get_ordering_field_columns()
97 97
     for i, field_name in enumerate(cl.list_display):
98 98
         text, attr = label_for_field(field_name, cl.model,
99  
-            model_admin = cl.model_admin,
100  
-            return_attr = True
  99
+            model_admin=cl.model_admin,
  100
+            return_attr=True
101 101
         )
102 102
         if attr:
103 103
             # Potentially not sortable
6  django/contrib/comments/feeds.py
@@ -21,9 +21,9 @@ def description(self):
21 21
 
22 22
     def items(self):
23 23
         qs = comments.get_model().objects.filter(
24  
-            site__pk = self.site.pk,
25  
-            is_public = True,
26  
-            is_removed = False,
  24
+            site__pk=self.site.pk,
  25
+            is_public=True,
  26
+            is_removed=False,
27 27
         )
28 28
         return qs.order_by('-submit_date')[:40]
29 29
 
30  django/contrib/comments/forms.py
@@ -132,16 +132,16 @@ def get_comment_create_data(self):
132 132
         method to add extra fields onto a custom comment model.
133 133
         """
134 134
         return dict(
135  
-            content_type = ContentType.objects.get_for_model(self.target_object),
136  
-            object_pk    = force_text(self.target_object._get_pk_val()),
137  
-            user_name    = self.cleaned_data["name"],
138  
-            user_email   = self.cleaned_data["email"],
139  
-            user_url     = self.cleaned_data["url"],
140  
-            comment      = self.cleaned_data["comment"],
141  
-            submit_date  = timezone.now(),
142  
-            site_id      = settings.SITE_ID,
143  
-            is_public    = True,
144  
-            is_removed   = False,
  135
+            content_type=ContentType.objects.get_for_model(self.target_object),
  136
+            object_pk=force_text(self.target_object._get_pk_val()),
  137
+            user_name=self.cleaned_data["name"],
  138
+            user_email=self.cleaned_data["email"],
  139
+            user_url=self.cleaned_data["url"],
  140
+            comment=self.cleaned_data["comment"],
  141
+            submit_date=timezone.now(),
  142
+            site_id=settings.SITE_ID,
  143
+            is_public=True,
  144
+            is_removed=False,
145 145
         )
146 146
 
147 147
     def check_for_duplicate_comment(self, new):
@@ -152,11 +152,11 @@ def check_for_duplicate_comment(self, new):
152 152
         possible_duplicates = self.get_comment_model()._default_manager.using(
153 153
             self.target_object._state.db
154 154
         ).filter(
155  
-            content_type = new.content_type,
156  
-            object_pk = new.object_pk,
157  
-            user_name = new.user_name,
158  
-            user_email = new.user_email,
159  
-            user_url = new.user_url,
  155
+            content_type=new.content_type,
  156
+            object_pk=new.object_pk,
  157
+            user_name=new.user_name,
  158
+            user_email=new.user_email,
  159
+            user_url=new.user_url,
160 160
         )
161 161
         for old in possible_duplicates:
162 162
             if old.submit_date.date() == new.submit_date.date() and old.comment == new.comment:
24  django/contrib/comments/templatetags/comments.py
@@ -35,8 +35,8 @@ def handle_token(cls, parser, token):
35 35
             if tokens[3] != 'as':
36 36
                 raise template.TemplateSyntaxError("Third argument in %r must be 'as'" % tokens[0])
37 37
             return cls(
38  
-                object_expr = parser.compile_filter(tokens[2]),
39  
-                as_varname = tokens[4],
  38
+                object_expr=parser.compile_filter(tokens[2]),
  39
+                as_varname=tokens[4],
40 40
             )
41 41
 
42 42
         # {% get_whatever for app.model pk as varname %}
@@ -44,9 +44,9 @@ def handle_token(cls, parser, token):
44 44
             if tokens[4] != 'as':
45 45
                 raise template.TemplateSyntaxError("Fourth argument in %r must be 'as'" % tokens[0])
46 46
             return cls(
47  
-                ctype = BaseCommentNode.lookup_content_type(tokens[2], tokens[0]),
48  
-                object_pk_expr = parser.compile_filter(tokens[3]),
49  
-                as_varname = tokens[5]
  47
+                ctype=BaseCommentNode.lookup_content_type(tokens[2], tokens[0]),
  48
+                object_pk_expr=parser.compile_filter(tokens[3]),
  49
+                as_varname=tokens[5]
50 50
             )
51 51
 
52 52
         else:
@@ -83,9 +83,9 @@ def get_queryset(self, context):
83 83
             return self.comment_model.objects.none()
84 84
 
85 85
         qs = self.comment_model.objects.filter(
86  
-            content_type = ctype,
87  
-            object_pk    = smart_text(object_pk),
88  
-            site__pk     = settings.SITE_ID,
  86
+            content_type=ctype,
  87
+            object_pk=smart_text(object_pk),
  88
+            site__pk=settings.SITE_ID,
89 89
         )
90 90
 
91 91
         # The is_public and is_removed fields are implementation details of the
@@ -166,8 +166,8 @@ def handle_token(cls, parser, token):
166 166
         # {% render_comment_form for app.models pk %}
167 167
         elif len(tokens) == 4:
168 168
             return cls(
169  
-                ctype = BaseCommentNode.lookup_content_type(tokens[2], tokens[0]),
170  
-                object_pk_expr = parser.compile_filter(tokens[3])
  169
+                ctype=BaseCommentNode.lookup_content_type(tokens[2], tokens[0]),
  170
+                object_pk_expr=parser.compile_filter(tokens[3])
171 171
             )
172 172
 
173 173
     def render(self, context):
@@ -202,8 +202,8 @@ def handle_token(cls, parser, token):
202 202
         # {% render_comment_list for app.models pk %}
203 203
         elif len(tokens) == 4:
204 204
             return cls(
205  
-                ctype = BaseCommentNode.lookup_content_type(tokens[2], tokens[0]),
206  
-                object_pk_expr = parser.compile_filter(tokens[3])
  205
+                ctype=BaseCommentNode.lookup_content_type(tokens[2], tokens[0]),
  206
+                object_pk_expr=parser.compile_filter(tokens[3])
207 207
             )
208 208
 
209 209
     def render(self, context):
60  django/contrib/comments/views/moderation.py
@@ -99,40 +99,40 @@ def perform_flag(request, comment):
99 99
     Actually perform the flagging of a comment from a request.
100 100
     """
101 101
     flag, created = comments.models.CommentFlag.objects.get_or_create(
102  
-        comment = comment,
103  
-        user    = request.user,
104  
-        flag    = comments.models.CommentFlag.SUGGEST_REMOVAL
  102
+        comment=comment,
  103
+        user=request.user,
  104
+        flag=comments.models.CommentFlag.SUGGEST_REMOVAL
105 105
     )
106 106
     signals.comment_was_flagged.send(
107  
-        sender  = comment.__class__,
108  
-        comment = comment,
109  
-        flag    = flag,
110  
-        created = created,
111  
-        request = request,
  107
+        sender=comment.__class__,
  108
+        comment=comment,
  109
+        flag=flag,
  110
+        created=created,
  111
+        request=request,
112 112
     )
113 113
 
114 114
 def perform_delete(request, comment):
115 115
     flag, created = comments.models.CommentFlag.objects.get_or_create(
116  
-        comment = comment,
117  
-        user    = request.user,
118  
-        flag    = comments.models.CommentFlag.MODERATOR_DELETION
  116
+        comment=comment,
  117
+        user=request.user,
  118
+        flag=comments.models.CommentFlag.MODERATOR_DELETION
119 119
     )
120 120
     comment.is_removed = True
121 121
     comment.save()
122 122
     signals.comment_was_flagged.send(
123  
-        sender  = comment.__class__,
124  
-        comment = comment,
125  
-        flag    = flag,
126  
-        created = created,
127  
-        request = request,
  123
+        sender=comment.__class__,
  124
+        comment=comment,
  125
+        flag=flag,
  126
+        created=created,
  127
+        request=request,
128 128
     )
129 129
 
130 130
 
131 131
 def perform_approve(request, comment):
132 132
     flag, created = comments.models.CommentFlag.objects.get_or_create(
133  
-        comment = comment,
134  
-        user    = request.user,
135  
-        flag    = comments.models.CommentFlag.MODERATOR_APPROVAL,
  133
+        comment=comment,
  134
+        user=request.user,
  135
+        flag=comments.models.CommentFlag.MODERATOR_APPROVAL,
136 136
     )
137 137
 
138 138
     comment.is_removed = False
@@ -140,24 +140,24 @@ def perform_approve(request, comment):
140 140
     comment.save()
141 141
 
142 142
     signals.comment_was_flagged.send(
143  
-        sender  = comment.__class__,
144  
-        comment = comment,
145  
-        flag    = flag,
146  
-        created = created,
147  
-        request = request,
  143
+        sender=comment.__class__,
  144
+        comment=comment,
  145
+        flag=flag,
  146
+        created=created,
  147
+        request=request,
148 148
     )
149 149
 
150 150
 # Confirmation views.
151 151
 
152 152
 flag_done = confirmation_view(
153  
-    template = "comments/flagged.html",
154  
-    doc = 'Displays a "comment was flagged" success page.'
  153
+    template="comments/flagged.html",
  154
+    doc='Displays a "comment was flagged" success page.'
155 155
 )
156 156
 delete_done = confirmation_view(
157  
-    template = "comments/deleted.html",
158  
-    doc = 'Displays a "comment was deleted" success page.'
  157
+    template="comments/deleted.html",
  158
+    doc='Displays a "comment was deleted" success page.'
159 159
 )
160 160
 approve_done = confirmation_view(
161  
-    template = "comments/approved.html",
162  
-    doc = 'Displays a "comment was approved" success page.'
  161
+    template="comments/approved.html",
  162
+    doc='Displays a "comment was approved" success page.'
163 163
 )
34  django/contrib/contenttypes/generic.py
@@ -276,14 +276,14 @@ def __get__(self, instance, instance_type=None):
276 276
 
277 277
         join_cols = self.field.get_joining_columns(reverse_join=True)[0]
278 278
         manager = RelatedManager(
279  
-            model = rel_model,
280  
-            instance = instance,
281  
-            source_col_name = qn(join_cols[0]),
282  
-            target_col_name = qn(join_cols[1]),
283  
-            content_type = content_type,
284  
-            content_type_field_name = self.field.content_type_field_name,
285  
-            object_id_field_name = self.field.object_id_field_name,
286  
-            prefetch_cache_name = self.field.attname,
  279
+            model=rel_model,
  280
+            instance=instance,
  281
+            source_col_name=qn(join_cols[0]),
  282
+            target_col_name=qn(join_cols[1]),
  283
+            content_type=content_type,
  284
+            content_type_field_name=self.field.content_type_field_name,
  285
+            object_id_field_name=self.field.object_id_field_name,
  286
+            prefetch_cache_name=self.field.attname,
287 287
         )
288 288
 
289 289
         return manager
@@ -329,15 +329,15 @@ def __call__(self, **kwargs):
329 329
             manager = getattr(self.model, kwargs.pop('manager'))
330 330
             manager_class = create_generic_related_manager(manager.__class__)
331 331
             return manager_class(
332  
-                model = self.model,
333  
-                instance = self.instance,
334  
-                symmetrical = self.symmetrical,
335  
-                source_col_name = self.source_col_name,
336  
-                target_col_name = self.target_col_name,
337  
-                content_type = self.content_type,
338  
-                content_type_field_name = self.content_type_field_name,
339  
-                object_id_field_name = self.object_id_field_name,
340  
-                prefetch_cache_name = self.prefetch_cache_name,
  332
+                model=self.model,
  333
+                instance=self.instance,
  334
+                symmetrical=self.symmetrical,
  335
+                source_col_name=self.source_col_name,
  336
+                target_col_name=self.target_col_name,
  337
+                content_type=self.content_type,
  338
+                content_type_field_name=self.content_type_field_name,
  339
+                object_id_field_name=self.object_id_field_name,
  340
+                prefetch_cache_name=self.prefetch_cache_name,
341 341
             )
342 342
         do_not_call_in_templates = True
343 343
 
6  django/contrib/contenttypes/models.py
@@ -43,9 +43,9 @@ def get_for_model(self, model, for_concrete_model=True):
43 43
             # needed around opts.verbose_name_raw because name_raw might be a
44 44
             # django.utils.functional.__proxy__ object.
45 45
             ct, created = self.get_or_create(
46  
-                app_label = opts.app_label,
47  
-                model = opts.model_name,
48  
-                defaults = {'name': smart_text(opts.verbose_name_raw)},
  46
+                app_label=opts.app_label,
  47
+                model=opts.model_name,
  48
+                defaults={'name': smart_text(opts.verbose_name_raw)},
49 49
             )
50 50
             self._add_to_cache(self.db, ct)
51 51
 
6  django/contrib/contenttypes/tests.py
@@ -271,9 +271,9 @@ def test_missing_model(self):
271 271
         is defined anymore.
272 272
         """
273 273
         ct = ContentType.objects.create(
274  
-            name = 'Old model',
275  
-            app_label = 'contenttypes',
276  
-            model = 'OldModel',
  274
+            name='Old model',
  275
+            app_label='contenttypes',
  276
+            model='OldModel',
277 277
         )
278 278
         self.assertEqual(six.text_type(ct), 'Old model')
279 279
         self.assertIsNone(ct.model_class())
8  django/contrib/flatpages/forms.py
@@ -6,10 +6,10 @@
6 6
 
7 7
 class FlatpageForm(forms.ModelForm):
8 8
     url = forms.RegexField(label=_("URL"), max_length=100, regex=r'^[-\w/\.~]+$',
9  
-        help_text = _("Example: '/about/contact/'. Make sure to have leading"
10  
-                      " and trailing slashes."),
11  
-        error_message = _("This value must contain only letters, numbers,"
12  
-                          " dots, underscores, dashes, slashes or tildes."))
  9
+        help_text=_("Example: '/about/contact/'. Make sure to have leading"
  10
+                    " and trailing slashes."),
  11
+        error_message=_("This value must contain only letters, numbers,"
  12
+                        " dots, underscores, dashes, slashes or tildes."))
13 13
 
14 14
     class Meta:
15 15
         model = FlatPage
2  django/contrib/flatpages/tests/test_middleware.py
@@ -87,7 +87,7 @@ def test_fallback_flatpage_special_chars(self):
87 87
 
88 88
 
89 89
 @override_settings(
90  
-    APPEND_SLASH = True,
  90
+    APPEND_SLASH=True,
91 91
     LOGIN_URL='/accounts/login/',
92 92
     MIDDLEWARE_CLASSES=(
93 93
         'django.middleware.common.CommonMiddleware',
2  django/contrib/flatpages/tests/test_views.py
@@ -75,7 +75,7 @@ def test_view_flatpage_special_chars(self):
75 75
 
76 76
 
77 77
 @override_settings(
78  
-    APPEND_SLASH = True,
  78
+    APPEND_SLASH=True,
79 79
     LOGIN_URL='/accounts/login/',
80 80
     MIDDLEWARE_CLASSES=(
81 81
         'django.middleware.common.CommonMiddleware',
10  django/contrib/messages/tests/base.py
@@ -58,12 +58,12 @@ class BaseTests(object):
58 58
 
59 59
     def setUp(self):
60 60
         self.settings_override = override_settings_tags(
61  
-            TEMPLATE_DIRS = (),
62  
-            TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS,
63  
-            MESSAGE_TAGS = '',
64  
-            MESSAGE_STORAGE = '%s.%s' % (self.storage_class.__module__,
  61
+            TEMPLATE_DIRS=(),
  62
+            TEMPLATE_CONTEXT_PROCESSORS=global_settings.TEMPLATE_CONTEXT_PROCESSORS,
  63
+            MESSAGE_TAGS='',
  64
+            MESSAGE_STORAGE='%s.%s' % (self.storage_class.__module__,
65 65
                                          self.storage_class.__name__),
66  
-            SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer',
  66
+            SESSION_SERIALIZER='django.contrib.sessions.serializers.JSONSerializer',
67 67
         )
68 68
         self.settings_override.enable()
69 69
 
58  django/contrib/syndication/views.py
@@ -121,23 +121,23 @@ def get_feed(self, obj, request):
121 121
         link = add_domain(current_site.domain, link, request.is_secure())
122 122
 
123 123
         feed = self.feed_type(
124  
-            title = self.__get_dynamic_attr('title', obj),
125  
-            subtitle = self.__get_dynamic_attr('subtitle', obj),
126  
-            link = link,
127  
-            description = self.__get_dynamic_attr('description', obj),
128  
-            language = settings.LANGUAGE_CODE,
129  
-            feed_url = add_domain(
  124
+            title=self.__get_dynamic_attr('title', obj),
  125
+            subtitle=self.__get_dynamic_attr('subtitle', obj),
  126
+            link=link,
  127
+            description=self.__get_dynamic_attr('description', obj),
  128
+            language=settings.LANGUAGE_CODE,
  129
+            feed_url=add_domain(
130 130
                 current_site.domain,
131 131
                 self.__get_dynamic_attr('feed_url', obj) or request.path,
132 132
                 request.is_secure(),
133 133
             ),
134  
-            author_name = self.__get_dynamic_attr('author_name', obj),
135  
-            author_link = self.__get_dynamic_attr('author_link', obj),
136  
-            author_email = self.__get_dynamic_attr('author_email', obj),
137  
-            categories = self.__get_dynamic_attr('categories', obj),
138  
-            feed_copyright = self.__get_dynamic_attr('feed_copyright', obj),
139  
-            feed_guid = self.__get_dynamic_attr('feed_guid', obj),
140  
-            ttl = self.__get_dynamic_attr('ttl', obj),
  134
+            author_name=self.__get_dynamic_attr('author_name', obj),
  135
+            author_link=self.__get_dynamic_attr('author_link', obj),
  136
+            author_email=self.__get_dynamic_attr('author_email', obj),
  137
+            categories=self.__get_dynamic_attr('categories', obj),
  138
+            feed_copyright=self.__get_dynamic_attr('feed_copyright', obj),
  139
+            feed_guid=self.__get_dynamic_attr('feed_guid', obj),
  140
+            ttl=self.__get_dynamic_attr('ttl', obj),
141 141
             **self.feed_extra_kwargs(obj)
142 142
         )
143 143
 
@@ -175,9 +175,9 @@ def get_feed(self, obj, request):
175 175
             enc_url = self.__get_dynamic_attr('item_enclosure_url', item)
176 176
             if enc_url:
177 177
                 enc = feedgenerator.Enclosure(
178  
-                    url = smart_text(enc_url),
179  
-                    length = smart_text(self.__get_dynamic_attr('item_enclosure_length', item)),
180  
-                    mime_type = smart_text(self.__get_dynamic_attr('item_enclosure_mime_type', item))
  178
+                    url=smart_text(enc_url),
  179
+                    length=smart_text(self.__get_dynamic_attr('item_enclosure_length', item)),
  180
+                    mime_type=smart_text(self.__get_dynamic_attr('item_enclosure_mime_type', item))
181 181
                 )
182 182
             author_name = self.__get_dynamic_attr('item_author_name', item)
183 183
             if author_name is not None:
@@ -197,20 +197,20 @@ def get_feed(self, obj, request):
197 197
                 updateddate = make_aware(updateddate, tz)
198 198
 
199 199
             feed.add_item(
200  
-                title = title,
201  
-                link = link,
202  
-                description = description,
203  
-                unique_id = self.__get_dynamic_attr('item_guid', item, link),
204  
-                unique_id_is_permalink = self.__get_dynamic_attr(
  200
+                title=title,
  201
+                link=link,
  202
+                description=description,
  203
+                unique_id=self.__get_dynamic_attr('item_guid', item, link),
  204
+                unique_id_is_permalink=self.__get_dynamic_attr(
205 205
                     'item_guid_is_permalink', item),
206  
-                enclosure = enc,
207  
-                pubdate = pubdate,
208  
-                updateddate = updateddate,
209  
-                author_name = author_name,
210  
-                author_email = author_email,
211  
-                author_link = author_link,
212  
-                categories = self.__get_dynamic_attr('item_categories', item),
213  
-                item_copyright = self.__get_dynamic_attr('item_copyright', item),
  206
+                enclosure=enc,
  207
+                pubdate=pubdate,
  208
+                updateddate=updateddate,
  209
+                author_name=author_name,
  210
+                author_email=author_email,
  211
+                author_link=author_link,
  212
+                categories=self.__get_dynamic_attr('item_categories', item),
  213
+                item_copyright=self.__get_dynamic_attr('item_copyright', item),
214 214
                 **self.item_extra_kwargs(item)
215 215
             )
216 216
         return feed
2  django/core/files/move.py
@@ -38,7 +38,7 @@ def _samefile(src, dst):
38 38
             os.path.normcase(os.path.abspath(dst)))
39 39
 
40 40
 
41  
-def file_move_safe(old_file_name, new_file_name, chunk_size = 1024*64, allow_overwrite=False):
  41
+def file_move_safe(old_file_name, new_file_name, chunk_size=1024*64, allow_overwrite=False):
42 42
     """
43 43
     Moves a file from one location to another in the safest way possible.
44 44
 
14  django/core/files/uploadhandler.py
@@ -193,13 +193,13 @@ def file_complete(self, file_size):
193 193
 
194 194
         self.file.seek(0)
195 195
         return InMemoryUploadedFile(
196  
-            file = self.file,
197  
-            field_name = self.field_name,
198  
-            name = self.file_name,
199  
-            content_type = self.content_type,
200  
-            size = file_size,
201  
-            charset = self.charset,
202  
-            content_type_extra = self.content_type_extra
  196
+            file=self.file,
  197
+            field_name=self.field_name,
  198
+            name=self.file_name,
  199
+            content_type=self.content_type,
  200
+            size=file_size,
  201
+            charset=self.charset,
  202
+            content_type_extra=self.content_type_extra
203 203
         )
204 204
 
205 205
 
2  django/core/management/commands/makemessages.py
@@ -239,7 +239,7 @@ def handle_noargs(self, *args, **options):
239 239
         if settings.configured:
240 240
             settings.USE_I18N = True
241 241
         else:
242  
-            settings.configure(USE_I18N = True)
  242
+            settings.configure(USE_I18N=True)
243 243
 
244 244
         self.invoked_for_django = False
245 245
         if os.path.isdir(os.path.join('conf', 'locale')):
58  django/db/migrations/autodetector.py
@@ -81,10 +81,10 @@ def _detect_changes(self):
81 81
                 self.add_to_migration(
82 82
                     app_label,
83 83
                     operations.CreateModel(
84  
-                        name = model_state.name,
85  
-                        fields = model_state.fields,
86  
-                        options = model_state.options,
87  
-                        bases = model_state.bases,
  84
+                        name=model_state.name,
  85
+                        fields=model_state.fields,
  86
+                        options=model_state.options,
  87
+                        bases=model_state.bases,
88 88
                     )
89 89
                 )
90 90
         # Phase 2 is progressively adding pending models, splitting up into two
@@ -99,10 +99,10 @@ def _detect_changes(self):
99 99
                 self.add_to_migration(
100 100
                     app_label,
101 101
                     operations.CreateModel(
102  
-                        name = model_state.name,
103  
-                        fields = model_state.fields,
104  
-                        options = model_state.options,
105  
-                        bases = model_state.bases,
  102
+                        name=model_state.name,
  103
+                        fields=model_state.fields,
  104
+                        options=model_state.options,
  105
+                        bases=model_state.bases,
106 106
                     )
107 107
                 )
108 108
                 for field_name, other_app_label, other_model_name in related_fields:
@@ -119,10 +119,10 @@ def _detect_changes(self):
119 119
                 self.add_to_migration(
120 120
                     app_label,
121 121
                     operations.CreateModel(
122  
-                        name = model_state.name,
123  
-                        fields = [(n, f) for n, f in model_state.fields if n not in bad_fields],
124  
-                        options = model_state.options,
125  
-                        bases = model_state.bases,
  122
+                        name=model_state.name,
  123
+                        fields=[(n, f) for n, f in model_state.fields if n not in bad_fields],
  124
+                        options=model_state.options,
  125
+                        bases=model_state.bases,
126 126
                     )
127 127
                 )
128 128
                 # Add the bad fields to be made in a phase 3
@@ -135,11 +135,11 @@ def _detect_changes(self):
135 135
             self.add_to_migration(
136 136
                 app_label,
137 137
                 operations.AddField(
138  
-                    model_name = model_name,
139  
-                    name = field_name,
140  
-                    field = model_state.get_field_by_name(field_name),
  138
+                    model_name=model_name,
  139
+                    name=field_name,
  140
+                    field=model_state.get_field_by_name(field_name),
141 141
                 ),
142  
-                new = True,
  142
+                new=True,
143 143
             )
144 144
             if app_label != other_app_label:
145 145
                 self.add_dependency(app_label, other_app_label)
@@ -172,9 +172,9 @@ def _detect_changes(self):
172 172
                             self.add_to_migration(
173 173
                                 app_label,
174 174
                                 operations.RenameField(
175  
-                                    model_name = model_name,
176  
-                                    old_name = removed_field_name,
177  
-                                    new_name = field_name,
  175
+                                    model_name=model_name,
  176
+                                    old_name=removed_field_name,
  177
+                                    new_name=field_name,
178 178
                                 )
179 179
                             )
180 180
                             old_field_names.remove(removed_field_name)
@@ -189,9 +189,9 @@ def _detect_changes(self):
189 189
                 self.add_to_migration(
190 190
                     app_label,
191 191
                     operations.AddField(
192  
-                        model_name = model_name,
193  
-                        name = field_name,
194  
-                        field = field,
  192
+                        model_name=model_name,
  193
+                        name=field_name,
  194
+                        field=field,
195 195
                     )
196 196
                 )
197 197
             # Old fields
@@ -199,8 +199,8 @@ def _detect_changes(self):
199 199
                 self.add_to_migration(
200 200
                     app_label,
201 201
                     operations.RemoveField(
202  
-                        model_name = model_name,
203  
-                        name = field_name,
  202
+                        model_name=model_name,
  203
+                        name=field_name,
204 204
                     )
205 205
                 )
206 206
             # The same fields
@@ -212,9 +212,9 @@ def _detect_changes(self):
212 212
                     self.add_to_migration(
213 213
                         app_label,
214 214
                         operations.AlterField(
215  
-                            model_name = model_name,
216  
-                            name = field_name,
217  
-                            field = new_model_state.get_field_by_name(field_name),
  215
+                            model_name=model_name,
  216
+                            name=field_name,
  217
+                            field=new_model_state.get_field_by_name(field_name),
218 218
                         )
219 219
                     )
220 220
             # unique_together changes
@@ -222,8 +222,8 @@ def _detect_changes(self):
222 222
                 self.add_to_migration(
223 223
                     app_label,
224 224
                     operations.AlterUniqueTogether(
225  
-                        name = model_name,
226  
-                        unique_together = new_model_state.options.get("unique_together", set()),
  225
+                        name=model_name,
  226
+                        unique_together=new_model_state.options.get("unique_together", set()),
227 227
                     )
228 228
                 )
229 229
         # Alright, now add internal dependencies
12  django/db/migrations/state.py
@@ -26,7 +26,7 @@ def add_model_state(self, model_state):
26 26
     def clone(self):
27 27
         "Returns an exact copy of this ProjectState"
28 28
         return ProjectState(
29  
-            models = dict((k, v.clone()) for k, v in self.models.items())
  29
+            models=dict((k, v.clone()) for k, v in self.models.items())
30 30
         )
31 31
 
32 32
     def render(self):
@@ -137,11 +137,11 @@ def clone(self):
137 137
             fields.append((name, field_class(*args, **kwargs)))
138 138
         # Now make a copy
139 139
         return self.__class__(
140  
-            app_label = self.app_label,
141  
-            name = self.name,
142  
-            fields = fields,
143  
-            options = dict(self.options),
144  
-            bases = self.bases,
  140
+            app_label=self.app_label,
  141
+            name=self.name,
  142
+            fields=fields,
  143
+            options=dict(self.options),
  144
+            bases=self.bases,
145 145
         )
146 146
 
147 147
     def render(self, app_cache):
8  django/db/models/loading.py
@@ -43,20 +43,20 @@ def _initialize():
43 43
         app_store=ModelDict(),
44 44
 
45 45
         # Mapping of installed app_labels to model modules for that app.
46  
-        app_labels = {},
  46
+        app_labels={},
47 47
 
48 48
         # Mapping of app_labels to a dictionary of model names to model code.
49 49
         # May contain apps that are not installed.
50 50
         app_models=ModelDict(),
51 51
 
52 52
         # Mapping of app_labels to errors raised when trying to import the app.
53  
-        app_errors = {},
  53
+        app_errors={},
54 54
 
55 55
         # Pending lookups for lazy relations
56  
-        pending_lookups = {},
  56
+        pending_lookups={},
57 57
 
58 58
         # -- Everything below here is only used when populating the cache --
59  
-        loads_installed = True,
  59
+        loads_installed=True,
60 60
         loaded=False,
61 61
         handled=set(),
62 62
         postponed=[],
2  django/dispatch/saferef.py
@@ -9,7 +9,7 @@
9 9
 import weakref
10 10
 
11 11
 
12  
-def safeRef(target, onDelete = None):
  12
+def safeRef(target, onDelete=None):
13 13
     """Return a *safe* weak reference to a callable target
14 14
 
15 15
     target -- the object to be weakly referenced, if it's a
30  django/forms/forms.py
@@ -249,29 +249,29 @@ def _html_output(self, normal_row, error_row, row_ender, help_text_html, errors_
249 249
     def as_table(self):
250 250
         "Returns this form rendered as HTML <tr>s -- excluding the <table></table>."
251 251
         return self._html_output(
252  
-            normal_row = '<tr%(html_class_attr)s><th>%(label)s</th><td>%(errors)s%(field)s%(help_text)s</td></tr>',
253  
-            error_row = '<tr><td colspan="2">%s</td></tr>',
254  
-            row_ender = '</td></tr>',
255  
-            help_text_html = '<br /><span class="helptext">%s</span>',
256  
-            errors_on_separate_row = False)
  252
+            normal_row='<tr%(html_class_attr)s><th>%(label)s</th><td>%(errors)s%(field)s%(help_text)s</td></tr>',
  253
+            error_row='<tr><td colspan="2">%s</td></tr>',
  254
+            row_ender='</td></tr>',
  255
+            help_text_html='<br /><span class="helptext">%s</span>',
  256
+            errors_on_separate_row=False)
257 257
 
258 258
     def as_ul(self):
259 259
         "Returns this form rendered as HTML <li>s -- excluding the <ul></ul>."
260 260
         return self._html_output(
261  
-            normal_row = '<li%(html_class_attr)s>%(errors)s%(label)s %(field)s%(help_text)s</li>',
262  
-            error_row = '<li>%s</li>',
263  
-            row_ender = '</li>',
264  
-            help_text_html = ' <span class="helptext">%s</span>',
265  
-            errors_on_separate_row = False)
  261
+            normal_row='<li%(html_class_attr)s>%(errors)s%(label)s %(field)s%(help_text)s</li>',
  262
+            error_row='<li>%s</li>',
  263
+            row_ender='</li>',
  264
+            help_text_html=' <span class="helptext">%s</span>',
  265
+            errors_on_separate_row=False)
266 266
 
267 267
     def as_p(self):
268 268
         "Returns this form rendered as HTML <p>s."
269 269
         return self._html_output(
270  
-            normal_row = '<p%(html_class_attr)s>%(label)s %(field)s%(help_text)s</p>',
271  
-            error_row = '%s',
272  
-            row_ender = '</p>',
273  
-            help_text_html = ' <span class="helptext">%s</span>',
274  
-            errors_on_separate_row = True)
  270
+            normal_row='<p%(html_class_attr)s>%(label)s %(field)s%(help_text)s</p>',
  271
+            error_row='%s',
  272
+            row_ender='</p>',
  273
+            help_text_html=' <span class="helptext">%s</span>',
  274
+            errors_on_separate_row=True)
275 275
 
276 276
     def non_field_errors(self):
277 277
         """
2  django/http/multipartparser.py
@@ -495,7 +495,7 @@ def __next__(self):
495 495
                 stream.unget(chunk[-rollback:])
496 496
                 return chunk[:-rollback]
497 497
 
498  
-    def _find_boundary(self, data, eof = False):
  498
+    def _find_boundary(self, data, eof=False):
499 499
         """
500 500
         Finds a multipart boundary in data.
501 501
 
2  django/middleware/csrf.py
@@ -196,7 +196,7 @@ def process_response(self, request, response):
196 196
         # the expiry timer.
197 197
         response.set_cookie(settings.CSRF_COOKIE_NAME,
198 198
                             request.META["CSRF_COOKIE"],
199  
-                            max_age = 60 * 60 * 24 * 7 * 52,
  199
+                            max_age=60 * 60 * 24 * 7 * 52,
200 200
                             domain=settings.CSRF_COOKIE_DOMAIN,
201 201
                             path=settings.CSRF_COOKIE_PATH,
202 202
                             secure=settings.CSRF_COOKIE_SECURE,
6  django/views/generic/base.py
@@ -126,9 +126,9 @@ def render_to_response(self, context, **response_kwargs):
126 126
         """
127 127
         response_kwargs.setdefault('content_type', self.content_type)
128 128
         return self.response_class(
129  
-            request = self.request,
130  
-            template = self.get_template_names(),
131  
-            context = context,
  129
+            request=self.request,
  130
+            template=self.get_template_names(),
  131
+            context=context,
132 132
             **response_kwargs
133 133
         )
134 134
 

0 notes on commit 91078f5

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