From cbc7cbbc5b5ef03059d8876074560635f2f647b7 Mon Sep 17 00:00:00 2001 From: Milton Mazzarri Date: Sun, 3 Nov 2013 03:22:11 -0600 Subject: [PATCH] Fixed flake8 E251 violations --- .../contrib/admin/templatetags/admin_list.py | 4 +- django/contrib/comments/feeds.py | 6 +- django/contrib/comments/forms.py | 30 +++++----- .../contrib/comments/templatetags/comments.py | 24 ++++---- django/contrib/comments/views/moderation.py | 60 +++++++++---------- django/contrib/contenttypes/generic.py | 34 +++++------ django/contrib/contenttypes/models.py | 6 +- django/contrib/contenttypes/tests.py | 6 +- django/contrib/flatpages/forms.py | 8 +-- .../flatpages/tests/test_middleware.py | 2 +- django/contrib/flatpages/tests/test_views.py | 2 +- django/contrib/messages/tests/base.py | 10 ++-- django/contrib/syndication/views.py | 58 +++++++++--------- django/core/files/move.py | 2 +- django/core/files/uploadhandler.py | 14 ++--- .../core/management/commands/makemessages.py | 2 +- django/db/migrations/autodetector.py | 58 +++++++++--------- django/db/migrations/state.py | 12 ++-- django/db/models/loading.py | 8 +-- django/dispatch/saferef.py | 2 +- django/forms/forms.py | 30 +++++----- django/http/multipartparser.py | 2 +- django/middleware/csrf.py | 2 +- django/views/generic/base.py | 6 +- 24 files changed, 194 insertions(+), 194 deletions(-) diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index e75f1a2a609..534f4c4681a 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -96,8 +96,8 @@ def result_headers(cl): ordering_field_columns = cl.get_ordering_field_columns() for i, field_name in enumerate(cl.list_display): text, attr = label_for_field(field_name, cl.model, - model_admin = cl.model_admin, - return_attr = True + model_admin=cl.model_admin, + return_attr=True ) if attr: # Potentially not sortable diff --git a/django/contrib/comments/feeds.py b/django/contrib/comments/feeds.py index 2e0d4c3dc56..ec2d4cdbbca 100644 --- a/django/contrib/comments/feeds.py +++ b/django/contrib/comments/feeds.py @@ -21,9 +21,9 @@ class LatestCommentFeed(Feed): def items(self): qs = comments.get_model().objects.filter( - site__pk = self.site.pk, - is_public = True, - is_removed = False, + site__pk=self.site.pk, + is_public=True, + is_removed=False, ) return qs.order_by('-submit_date')[:40] diff --git a/django/contrib/comments/forms.py b/django/contrib/comments/forms.py index 17d2ef8f094..36943135210 100644 --- a/django/contrib/comments/forms.py +++ b/django/contrib/comments/forms.py @@ -132,16 +132,16 @@ class CommentDetailsForm(CommentSecurityForm): method to add extra fields onto a custom comment model. """ return dict( - content_type = ContentType.objects.get_for_model(self.target_object), - object_pk = force_text(self.target_object._get_pk_val()), - user_name = self.cleaned_data["name"], - user_email = self.cleaned_data["email"], - user_url = self.cleaned_data["url"], - comment = self.cleaned_data["comment"], - submit_date = timezone.now(), - site_id = settings.SITE_ID, - is_public = True, - is_removed = False, + content_type=ContentType.objects.get_for_model(self.target_object), + object_pk=force_text(self.target_object._get_pk_val()), + user_name=self.cleaned_data["name"], + user_email=self.cleaned_data["email"], + user_url=self.cleaned_data["url"], + comment=self.cleaned_data["comment"], + submit_date=timezone.now(), + site_id=settings.SITE_ID, + is_public=True, + is_removed=False, ) def check_for_duplicate_comment(self, new): @@ -152,11 +152,11 @@ class CommentDetailsForm(CommentSecurityForm): possible_duplicates = self.get_comment_model()._default_manager.using( self.target_object._state.db ).filter( - content_type = new.content_type, - object_pk = new.object_pk, - user_name = new.user_name, - user_email = new.user_email, - user_url = new.user_url, + content_type=new.content_type, + object_pk=new.object_pk, + user_name=new.user_name, + user_email=new.user_email, + user_url=new.user_url, ) for old in possible_duplicates: if old.submit_date.date() == new.submit_date.date() and old.comment == new.comment: diff --git a/django/contrib/comments/templatetags/comments.py b/django/contrib/comments/templatetags/comments.py index 44ac3d588b6..476612c75d2 100644 --- a/django/contrib/comments/templatetags/comments.py +++ b/django/contrib/comments/templatetags/comments.py @@ -35,8 +35,8 @@ class BaseCommentNode(six.with_metaclass(RenameBaseCommentNodeMethods, template. if tokens[3] != 'as': raise template.TemplateSyntaxError("Third argument in %r must be 'as'" % tokens[0]) return cls( - object_expr = parser.compile_filter(tokens[2]), - as_varname = tokens[4], + object_expr=parser.compile_filter(tokens[2]), + as_varname=tokens[4], ) # {% get_whatever for app.model pk as varname %} @@ -44,9 +44,9 @@ class BaseCommentNode(six.with_metaclass(RenameBaseCommentNodeMethods, template. if tokens[4] != 'as': raise template.TemplateSyntaxError("Fourth argument in %r must be 'as'" % tokens[0]) return cls( - ctype = BaseCommentNode.lookup_content_type(tokens[2], tokens[0]), - object_pk_expr = parser.compile_filter(tokens[3]), - as_varname = tokens[5] + ctype=BaseCommentNode.lookup_content_type(tokens[2], tokens[0]), + object_pk_expr=parser.compile_filter(tokens[3]), + as_varname=tokens[5] ) else: @@ -83,9 +83,9 @@ class BaseCommentNode(six.with_metaclass(RenameBaseCommentNodeMethods, template. return self.comment_model.objects.none() qs = self.comment_model.objects.filter( - content_type = ctype, - object_pk = smart_text(object_pk), - site__pk = settings.SITE_ID, + content_type=ctype, + object_pk=smart_text(object_pk), + site__pk=settings.SITE_ID, ) # The is_public and is_removed fields are implementation details of the @@ -166,8 +166,8 @@ class RenderCommentFormNode(CommentFormNode): # {% render_comment_form for app.models pk %} elif len(tokens) == 4: return cls( - ctype = BaseCommentNode.lookup_content_type(tokens[2], tokens[0]), - object_pk_expr = parser.compile_filter(tokens[3]) + ctype=BaseCommentNode.lookup_content_type(tokens[2], tokens[0]), + object_pk_expr=parser.compile_filter(tokens[3]) ) def render(self, context): @@ -202,8 +202,8 @@ class RenderCommentListNode(CommentListNode): # {% render_comment_list for app.models pk %} elif len(tokens) == 4: return cls( - ctype = BaseCommentNode.lookup_content_type(tokens[2], tokens[0]), - object_pk_expr = parser.compile_filter(tokens[3]) + ctype=BaseCommentNode.lookup_content_type(tokens[2], tokens[0]), + object_pk_expr=parser.compile_filter(tokens[3]) ) def render(self, context): diff --git a/django/contrib/comments/views/moderation.py b/django/contrib/comments/views/moderation.py index 484ceac02cd..24ba42fb04c 100644 --- a/django/contrib/comments/views/moderation.py +++ b/django/contrib/comments/views/moderation.py @@ -99,40 +99,40 @@ def perform_flag(request, comment): Actually perform the flagging of a comment from a request. """ flag, created = comments.models.CommentFlag.objects.get_or_create( - comment = comment, - user = request.user, - flag = comments.models.CommentFlag.SUGGEST_REMOVAL + comment=comment, + user=request.user, + flag=comments.models.CommentFlag.SUGGEST_REMOVAL ) signals.comment_was_flagged.send( - sender = comment.__class__, - comment = comment, - flag = flag, - created = created, - request = request, + sender=comment.__class__, + comment=comment, + flag=flag, + created=created, + request=request, ) def perform_delete(request, comment): flag, created = comments.models.CommentFlag.objects.get_or_create( - comment = comment, - user = request.user, - flag = comments.models.CommentFlag.MODERATOR_DELETION + comment=comment, + user=request.user, + flag=comments.models.CommentFlag.MODERATOR_DELETION ) comment.is_removed = True comment.save() signals.comment_was_flagged.send( - sender = comment.__class__, - comment = comment, - flag = flag, - created = created, - request = request, + sender=comment.__class__, + comment=comment, + flag=flag, + created=created, + request=request, ) def perform_approve(request, comment): flag, created = comments.models.CommentFlag.objects.get_or_create( - comment = comment, - user = request.user, - flag = comments.models.CommentFlag.MODERATOR_APPROVAL, + comment=comment, + user=request.user, + flag=comments.models.CommentFlag.MODERATOR_APPROVAL, ) comment.is_removed = False @@ -140,24 +140,24 @@ def perform_approve(request, comment): comment.save() signals.comment_was_flagged.send( - sender = comment.__class__, - comment = comment, - flag = flag, - created = created, - request = request, + sender=comment.__class__, + comment=comment, + flag=flag, + created=created, + request=request, ) # Confirmation views. flag_done = confirmation_view( - template = "comments/flagged.html", - doc = 'Displays a "comment was flagged" success page.' + template="comments/flagged.html", + doc='Displays a "comment was flagged" success page.' ) delete_done = confirmation_view( - template = "comments/deleted.html", - doc = 'Displays a "comment was deleted" success page.' + template="comments/deleted.html", + doc='Displays a "comment was deleted" success page.' ) approve_done = confirmation_view( - template = "comments/approved.html", - doc = 'Displays a "comment was approved" success page.' + template="comments/approved.html", + doc='Displays a "comment was approved" success page.' ) diff --git a/django/contrib/contenttypes/generic.py b/django/contrib/contenttypes/generic.py index 26af7f0d3fd..8b7161251b0 100644 --- a/django/contrib/contenttypes/generic.py +++ b/django/contrib/contenttypes/generic.py @@ -276,14 +276,14 @@ class ReverseGenericRelatedObjectsDescriptor(object): join_cols = self.field.get_joining_columns(reverse_join=True)[0] manager = RelatedManager( - model = rel_model, - instance = instance, - source_col_name = qn(join_cols[0]), - target_col_name = qn(join_cols[1]), - content_type = content_type, - content_type_field_name = self.field.content_type_field_name, - object_id_field_name = self.field.object_id_field_name, - prefetch_cache_name = self.field.attname, + model=rel_model, + instance=instance, + source_col_name=qn(join_cols[0]), + target_col_name=qn(join_cols[1]), + content_type=content_type, + content_type_field_name=self.field.content_type_field_name, + object_id_field_name=self.field.object_id_field_name, + prefetch_cache_name=self.field.attname, ) return manager @@ -329,15 +329,15 @@ def create_generic_related_manager(superclass): manager = getattr(self.model, kwargs.pop('manager')) manager_class = create_generic_related_manager(manager.__class__) return manager_class( - model = self.model, - instance = self.instance, - symmetrical = self.symmetrical, - source_col_name = self.source_col_name, - target_col_name = self.target_col_name, - content_type = self.content_type, - content_type_field_name = self.content_type_field_name, - object_id_field_name = self.object_id_field_name, - prefetch_cache_name = self.prefetch_cache_name, + model=self.model, + instance=self.instance, + symmetrical=self.symmetrical, + source_col_name=self.source_col_name, + target_col_name=self.target_col_name, + content_type=self.content_type, + content_type_field_name=self.content_type_field_name, + object_id_field_name=self.object_id_field_name, + prefetch_cache_name=self.prefetch_cache_name, ) do_not_call_in_templates = True diff --git a/django/contrib/contenttypes/models.py b/django/contrib/contenttypes/models.py index 75859bfa163..aec15d66648 100644 --- a/django/contrib/contenttypes/models.py +++ b/django/contrib/contenttypes/models.py @@ -43,9 +43,9 @@ class ContentTypeManager(models.Manager): # needed around opts.verbose_name_raw because name_raw might be a # django.utils.functional.__proxy__ object. ct, created = self.get_or_create( - app_label = opts.app_label, - model = opts.model_name, - defaults = {'name': smart_text(opts.verbose_name_raw)}, + app_label=opts.app_label, + model=opts.model_name, + defaults={'name': smart_text(opts.verbose_name_raw)}, ) self._add_to_cache(self.db, ct) diff --git a/django/contrib/contenttypes/tests.py b/django/contrib/contenttypes/tests.py index b73307d85f6..8a0010061e2 100644 --- a/django/contrib/contenttypes/tests.py +++ b/django/contrib/contenttypes/tests.py @@ -271,9 +271,9 @@ class ContentTypesTests(TestCase): is defined anymore. """ ct = ContentType.objects.create( - name = 'Old model', - app_label = 'contenttypes', - model = 'OldModel', + name='Old model', + app_label='contenttypes', + model='OldModel', ) self.assertEqual(six.text_type(ct), 'Old model') self.assertIsNone(ct.model_class()) diff --git a/django/contrib/flatpages/forms.py b/django/contrib/flatpages/forms.py index 883ec37f44b..7e3a39e88d7 100644 --- a/django/contrib/flatpages/forms.py +++ b/django/contrib/flatpages/forms.py @@ -6,10 +6,10 @@ from django.utils.translation import ugettext, ugettext_lazy as _ class FlatpageForm(forms.ModelForm): url = forms.RegexField(label=_("URL"), max_length=100, regex=r'^[-\w/\.~]+$', - help_text = _("Example: '/about/contact/'. Make sure to have leading" - " and trailing slashes."), - error_message = _("This value must contain only letters, numbers," - " dots, underscores, dashes, slashes or tildes.")) + help_text=_("Example: '/about/contact/'. Make sure to have leading" + " and trailing slashes."), + error_message=_("This value must contain only letters, numbers," + " dots, underscores, dashes, slashes or tildes.")) class Meta: model = FlatPage diff --git a/django/contrib/flatpages/tests/test_middleware.py b/django/contrib/flatpages/tests/test_middleware.py index 8f1becb0b28..dd1a0192cea 100644 --- a/django/contrib/flatpages/tests/test_middleware.py +++ b/django/contrib/flatpages/tests/test_middleware.py @@ -87,7 +87,7 @@ class FlatpageMiddlewareTests(TestCase): @override_settings( - APPEND_SLASH = True, + APPEND_SLASH=True, LOGIN_URL='/accounts/login/', MIDDLEWARE_CLASSES=( 'django.middleware.common.CommonMiddleware', diff --git a/django/contrib/flatpages/tests/test_views.py b/django/contrib/flatpages/tests/test_views.py index 1f7093bb126..056641e301d 100644 --- a/django/contrib/flatpages/tests/test_views.py +++ b/django/contrib/flatpages/tests/test_views.py @@ -75,7 +75,7 @@ class FlatpageViewTests(TestCase): @override_settings( - APPEND_SLASH = True, + APPEND_SLASH=True, LOGIN_URL='/accounts/login/', MIDDLEWARE_CLASSES=( 'django.middleware.common.CommonMiddleware', diff --git a/django/contrib/messages/tests/base.py b/django/contrib/messages/tests/base.py index 648ec4c221b..cae2e094126 100644 --- a/django/contrib/messages/tests/base.py +++ b/django/contrib/messages/tests/base.py @@ -58,12 +58,12 @@ class BaseTests(object): def setUp(self): self.settings_override = override_settings_tags( - TEMPLATE_DIRS = (), - TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS, - MESSAGE_TAGS = '', - MESSAGE_STORAGE = '%s.%s' % (self.storage_class.__module__, + TEMPLATE_DIRS=(), + TEMPLATE_CONTEXT_PROCESSORS=global_settings.TEMPLATE_CONTEXT_PROCESSORS, + MESSAGE_TAGS='', + MESSAGE_STORAGE='%s.%s' % (self.storage_class.__module__, self.storage_class.__name__), - SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer', + SESSION_SERIALIZER='django.contrib.sessions.serializers.JSONSerializer', ) self.settings_override.enable() diff --git a/django/contrib/syndication/views.py b/django/contrib/syndication/views.py index 9878070d4b5..12d2c4b1af1 100644 --- a/django/contrib/syndication/views.py +++ b/django/contrib/syndication/views.py @@ -121,23 +121,23 @@ class Feed(object): link = add_domain(current_site.domain, link, request.is_secure()) feed = self.feed_type( - title = self.__get_dynamic_attr('title', obj), - subtitle = self.__get_dynamic_attr('subtitle', obj), - link = link, - description = self.__get_dynamic_attr('description', obj), - language = settings.LANGUAGE_CODE, - feed_url = add_domain( + title=self.__get_dynamic_attr('title', obj), + subtitle=self.__get_dynamic_attr('subtitle', obj), + link=link, + description=self.__get_dynamic_attr('description', obj), + language=settings.LANGUAGE_CODE, + feed_url=add_domain( current_site.domain, self.__get_dynamic_attr('feed_url', obj) or request.path, request.is_secure(), ), - author_name = self.__get_dynamic_attr('author_name', obj), - author_link = self.__get_dynamic_attr('author_link', obj), - author_email = self.__get_dynamic_attr('author_email', obj), - categories = self.__get_dynamic_attr('categories', obj), - feed_copyright = self.__get_dynamic_attr('feed_copyright', obj), - feed_guid = self.__get_dynamic_attr('feed_guid', obj), - ttl = self.__get_dynamic_attr('ttl', obj), + author_name=self.__get_dynamic_attr('author_name', obj), + author_link=self.__get_dynamic_attr('author_link', obj), + author_email=self.__get_dynamic_attr('author_email', obj), + categories=self.__get_dynamic_attr('categories', obj), + feed_copyright=self.__get_dynamic_attr('feed_copyright', obj), + feed_guid=self.__get_dynamic_attr('feed_guid', obj), + ttl=self.__get_dynamic_attr('ttl', obj), **self.feed_extra_kwargs(obj) ) @@ -175,9 +175,9 @@ class Feed(object): enc_url = self.__get_dynamic_attr('item_enclosure_url', item) if enc_url: enc = feedgenerator.Enclosure( - url = smart_text(enc_url), - length = smart_text(self.__get_dynamic_attr('item_enclosure_length', item)), - mime_type = smart_text(self.__get_dynamic_attr('item_enclosure_mime_type', item)) + url=smart_text(enc_url), + length=smart_text(self.__get_dynamic_attr('item_enclosure_length', item)), + mime_type=smart_text(self.__get_dynamic_attr('item_enclosure_mime_type', item)) ) author_name = self.__get_dynamic_attr('item_author_name', item) if author_name is not None: @@ -197,20 +197,20 @@ class Feed(object): updateddate = make_aware(updateddate, tz) feed.add_item( - title = title, - link = link, - description = description, - unique_id = self.__get_dynamic_attr('item_guid', item, link), - unique_id_is_permalink = self.__get_dynamic_attr( + title=title, + link=link, + description=description, + unique_id=self.__get_dynamic_attr('item_guid', item, link), + unique_id_is_permalink=self.__get_dynamic_attr( 'item_guid_is_permalink', item), - enclosure = enc, - pubdate = pubdate, - updateddate = updateddate, - author_name = author_name, - author_email = author_email, - author_link = author_link, - categories = self.__get_dynamic_attr('item_categories', item), - item_copyright = self.__get_dynamic_attr('item_copyright', item), + enclosure=enc, + pubdate=pubdate, + updateddate=updateddate, + author_name=author_name, + author_email=author_email, + author_link=author_link, + categories=self.__get_dynamic_attr('item_categories', item), + item_copyright=self.__get_dynamic_attr('item_copyright', item), **self.item_extra_kwargs(item) ) return feed diff --git a/django/core/files/move.py b/django/core/files/move.py index 2462dbee2ed..fddee565b45 100644 --- a/django/core/files/move.py +++ b/django/core/files/move.py @@ -38,7 +38,7 @@ def _samefile(src, dst): os.path.normcase(os.path.abspath(dst))) -def file_move_safe(old_file_name, new_file_name, chunk_size = 1024*64, allow_overwrite=False): +def file_move_safe(old_file_name, new_file_name, chunk_size=1024*64, allow_overwrite=False): """ Moves a file from one location to another in the safest way possible. diff --git a/django/core/files/uploadhandler.py b/django/core/files/uploadhandler.py index 4b23d48fb4b..995e97a2f66 100644 --- a/django/core/files/uploadhandler.py +++ b/django/core/files/uploadhandler.py @@ -193,13 +193,13 @@ class MemoryFileUploadHandler(FileUploadHandler): self.file.seek(0) return InMemoryUploadedFile( - file = self.file, - field_name = self.field_name, - name = self.file_name, - content_type = self.content_type, - size = file_size, - charset = self.charset, - content_type_extra = self.content_type_extra + file=self.file, + field_name=self.field_name, + name=self.file_name, + content_type=self.content_type, + size=file_size, + charset=self.charset, + content_type_extra=self.content_type_extra ) diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py index 03ddface55e..b0e040fe552 100644 --- a/django/core/management/commands/makemessages.py +++ b/django/core/management/commands/makemessages.py @@ -239,7 +239,7 @@ class Command(NoArgsCommand): if settings.configured: settings.USE_I18N = True else: - settings.configure(USE_I18N = True) + settings.configure(USE_I18N=True) self.invoked_for_django = False if os.path.isdir(os.path.join('conf', 'locale')): diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py index 872d61e0e37..702221028f2 100644 --- a/django/db/migrations/autodetector.py +++ b/django/db/migrations/autodetector.py @@ -81,10 +81,10 @@ class MigrationAutodetector(object): self.add_to_migration( app_label, operations.CreateModel( - name = model_state.name, - fields = model_state.fields, - options = model_state.options, - bases = model_state.bases, + name=model_state.name, + fields=model_state.fields, + options=model_state.options, + bases=model_state.bases, ) ) # Phase 2 is progressively adding pending models, splitting up into two @@ -99,10 +99,10 @@ class MigrationAutodetector(object): self.add_to_migration( app_label, operations.CreateModel( - name = model_state.name, - fields = model_state.fields, - options = model_state.options, - bases = model_state.bases, + name=model_state.name, + fields=model_state.fields, + options=model_state.options, + bases=model_state.bases, ) ) for field_name, other_app_label, other_model_name in related_fields: @@ -119,10 +119,10 @@ class MigrationAutodetector(object): self.add_to_migration( app_label, operations.CreateModel( - name = model_state.name, - fields = [(n, f) for n, f in model_state.fields if n not in bad_fields], - options = model_state.options, - bases = model_state.bases, + name=model_state.name, + fields=[(n, f) for n, f in model_state.fields if n not in bad_fields], + options=model_state.options, + bases=model_state.bases, ) ) # Add the bad fields to be made in a phase 3 @@ -135,11 +135,11 @@ class MigrationAutodetector(object): self.add_to_migration( app_label, operations.AddField( - model_name = model_name, - name = field_name, - field = model_state.get_field_by_name(field_name), + model_name=model_name, + name=field_name, + field=model_state.get_field_by_name(field_name), ), - new = True, + new=True, ) if app_label != other_app_label: self.add_dependency(app_label, other_app_label) @@ -172,9 +172,9 @@ class MigrationAutodetector(object): self.add_to_migration( app_label, operations.RenameField( - model_name = model_name, - old_name = removed_field_name, - new_name = field_name, + model_name=model_name, + old_name=removed_field_name, + new_name=field_name, ) ) old_field_names.remove(removed_field_name) @@ -189,9 +189,9 @@ class MigrationAutodetector(object): self.add_to_migration( app_label, operations.AddField( - model_name = model_name, - name = field_name, - field = field, + model_name=model_name, + name=field_name, + field=field, ) ) # Old fields @@ -199,8 +199,8 @@ class MigrationAutodetector(object): self.add_to_migration( app_label, operations.RemoveField( - model_name = model_name, - name = field_name, + model_name=model_name, + name=field_name, ) ) # The same fields @@ -212,9 +212,9 @@ class MigrationAutodetector(object): self.add_to_migration( app_label, operations.AlterField( - model_name = model_name, - name = field_name, - field = new_model_state.get_field_by_name(field_name), + model_name=model_name, + name=field_name, + field=new_model_state.get_field_by_name(field_name), ) ) # unique_together changes @@ -222,8 +222,8 @@ class MigrationAutodetector(object): self.add_to_migration( app_label, operations.AlterUniqueTogether( - name = model_name, - unique_together = new_model_state.options.get("unique_together", set()), + name=model_name, + unique_together=new_model_state.options.get("unique_together", set()), ) ) # Alright, now add internal dependencies diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py index b85c9971b41..bcdf890bd72 100644 --- a/django/db/migrations/state.py +++ b/django/db/migrations/state.py @@ -26,7 +26,7 @@ class ProjectState(object): def clone(self): "Returns an exact copy of this ProjectState" return ProjectState( - models = dict((k, v.clone()) for k, v in self.models.items()) + models=dict((k, v.clone()) for k, v in self.models.items()) ) def render(self): @@ -137,11 +137,11 @@ class ModelState(object): fields.append((name, field_class(*args, **kwargs))) # Now make a copy return self.__class__( - app_label = self.app_label, - name = self.name, - fields = fields, - options = dict(self.options), - bases = self.bases, + app_label=self.app_label, + name=self.name, + fields=fields, + options=dict(self.options), + bases=self.bases, ) def render(self, app_cache): diff --git a/django/db/models/loading.py b/django/db/models/loading.py index 125630bec8f..ec32e860517 100644 --- a/django/db/models/loading.py +++ b/django/db/models/loading.py @@ -43,20 +43,20 @@ def _initialize(): app_store=ModelDict(), # Mapping of installed app_labels to model modules for that app. - app_labels = {}, + app_labels={}, # Mapping of app_labels to a dictionary of model names to model code. # May contain apps that are not installed. app_models=ModelDict(), # Mapping of app_labels to errors raised when trying to import the app. - app_errors = {}, + app_errors={}, # Pending lookups for lazy relations - pending_lookups = {}, + pending_lookups={}, # -- Everything below here is only used when populating the cache -- - loads_installed = True, + loads_installed=True, loaded=False, handled=set(), postponed=[], diff --git a/django/dispatch/saferef.py b/django/dispatch/saferef.py index c6fca2be7b6..c18c7e3c579 100644 --- a/django/dispatch/saferef.py +++ b/django/dispatch/saferef.py @@ -9,7 +9,7 @@ import traceback import weakref -def safeRef(target, onDelete = None): +def safeRef(target, onDelete=None): """Return a *safe* weak reference to a callable target target -- the object to be weakly referenced, if it's a diff --git a/django/forms/forms.py b/django/forms/forms.py index 51a3b928ae9..15bbff229b9 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -249,29 +249,29 @@ class BaseForm(object): def as_table(self): "Returns this form rendered as HTML s -- excluding the
." return self._html_output( - normal_row = '%(label)s%(errors)s%(field)s%(help_text)s', - error_row = '%s', - row_ender = '', - help_text_html = '
%s', - errors_on_separate_row = False) + normal_row='%(label)s%(errors)s%(field)s%(help_text)s', + error_row='%s', + row_ender='', + help_text_html='
%s', + errors_on_separate_row=False) def as_ul(self): "Returns this form rendered as HTML
  • s -- excluding the
      ." return self._html_output( - normal_row = '%(errors)s%(label)s %(field)s%(help_text)s
    • ', - error_row = '
    • %s
    • ', - row_ender = '', - help_text_html = ' %s', - errors_on_separate_row = False) + normal_row='%(errors)s%(label)s %(field)s%(help_text)s', + error_row='
    • %s
    • ', + row_ender='', + help_text_html=' %s', + errors_on_separate_row=False) def as_p(self): "Returns this form rendered as HTML

      s." return self._html_output( - normal_row = '%(label)s %(field)s%(help_text)s

      ', - error_row = '%s', - row_ender = '

      ', - help_text_html = ' %s', - errors_on_separate_row = True) + normal_row='%(label)s %(field)s%(help_text)s

      ', + error_row='%s', + row_ender='

      ', + help_text_html=' %s', + errors_on_separate_row=True) def non_field_errors(self): """ diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py index dcf2d1ae0df..21617255a8c 100644 --- a/django/http/multipartparser.py +++ b/django/http/multipartparser.py @@ -495,7 +495,7 @@ class BoundaryIter(six.Iterator): stream.unget(chunk[-rollback:]) return chunk[:-rollback] - def _find_boundary(self, data, eof = False): + def _find_boundary(self, data, eof=False): """ Finds a multipart boundary in data. diff --git a/django/middleware/csrf.py b/django/middleware/csrf.py index b28676ab18e..54019fb4c58 100644 --- a/django/middleware/csrf.py +++ b/django/middleware/csrf.py @@ -196,7 +196,7 @@ class CsrfViewMiddleware(object): # the expiry timer. response.set_cookie(settings.CSRF_COOKIE_NAME, request.META["CSRF_COOKIE"], - max_age = 60 * 60 * 24 * 7 * 52, + max_age=60 * 60 * 24 * 7 * 52, domain=settings.CSRF_COOKIE_DOMAIN, path=settings.CSRF_COOKIE_PATH, secure=settings.CSRF_COOKIE_SECURE, diff --git a/django/views/generic/base.py b/django/views/generic/base.py index 2487ccba520..745c5ec1fc9 100644 --- a/django/views/generic/base.py +++ b/django/views/generic/base.py @@ -126,9 +126,9 @@ class TemplateResponseMixin(object): """ response_kwargs.setdefault('content_type', self.content_type) return self.response_class( - request = self.request, - template = self.get_template_names(), - context = context, + request=self.request, + template=self.get_template_names(), + context=context, **response_kwargs )