From e8a7436941f56d27b0096c93ef4ea1da13a5b95f Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Thu, 15 May 2014 19:41:55 +0200 Subject: [PATCH] [1.7.x] Harmonized some PEP 0263 coding preambles Backport of e520a73ee from master. --- django/contrib/flatpages/tests/test_models.py | 2 +- django/contrib/gis/tests/layermap/tests.py | 2 +- django/core/checks/__init__.py | 2 +- django/core/management/commands/migrate.py | 2 +- django/core/management/commands/sqlmigrate.py | 2 +- django/db/migrations/writer.py | 2 +- docs/ref/migration-operations.txt | 2 +- docs/topics/migrations.txt | 4 ++-- tests/admin_ordering/models.py | 2 +- tests/admin_views/tests.py | 2 +- tests/admin_widgets/tests.py | 2 +- tests/aggregation/models.py | 2 +- tests/aggregation_regress/models.py | 2 +- tests/basic/models.py | 2 +- tests/handlers/tests.py | 2 +- tests/i18n/contenttypes/tests.py | 2 +- tests/inline_formsets/models.py | 2 +- tests/mail/tests.py | 2 +- tests/migrations/test_autodetector.py | 2 +- tests/migrations/test_commands.py | 2 +- tests/migrations/test_migrations/0001_initial.py | 2 +- tests/migrations/test_migrations/0002_second.py | 2 +- tests/migrations/test_migrations_2/0001_initial.py | 2 +- tests/migrations/test_migrations_conflict/0001_initial.py | 2 +- .../test_migrations_conflict/0002_conflicting_second.py | 2 +- tests/migrations/test_migrations_conflict/0002_second.py | 2 +- tests/migrations/test_migrations_custom_user/0001_initial.py | 2 +- tests/migrations/test_migrations_squashed/0001_initial.py | 2 +- .../migrations/test_migrations_squashed/0001_squashed_0002.py | 2 +- tests/migrations/test_migrations_squashed/0002_second.py | 2 +- tests/migrations/test_migrations_unmigdep/0001_initial.py | 2 +- tests/migrations/test_optimizer.py | 2 +- tests/migrations/test_writer.py | 2 +- tests/model_regress/models.py | 2 +- tests/modeladmin/models.py | 2 +- tests/template_tests/filters.py | 2 +- tests/template_tests/test_context.py | 2 +- tests/template_tests/urls.py | 2 +- tests/test_client/tests.py | 2 +- tests/text/tests.py | 2 +- tests/utils_tests/test_jslex.py | 2 +- tests/view_tests/tests/test_json.py | 2 +- tests/view_tests/tests/test_specials.py | 2 +- tests/view_tests/urls.py | 2 +- 44 files changed, 45 insertions(+), 45 deletions(-) diff --git a/django/contrib/flatpages/tests/test_models.py b/django/contrib/flatpages/tests/test_models.py index af12c420e0..f091f3e0ea 100644 --- a/django/contrib/flatpages/tests/test_models.py +++ b/django/contrib/flatpages/tests/test_models.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals diff --git a/django/contrib/gis/tests/layermap/tests.py b/django/contrib/gis/tests/layermap/tests.py index df6f22c38a..ff00db3748 100644 --- a/django/contrib/gis/tests/layermap/tests.py +++ b/django/contrib/gis/tests/layermap/tests.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from copy import copy diff --git a/django/core/checks/__init__.py b/django/core/checks/__init__.py index cd4d5cebea..0d2780abd3 100644 --- a/django/core/checks/__init__.py +++ b/django/core/checks/__init__.py @@ -1,4 +1,4 @@ -# -*- coding: utf8 -*- +# -*- coding: utf-8 -*- from __future__ import unicode_literals from .messages import (CheckMessage, diff --git a/django/core/management/commands/migrate.py b/django/core/management/commands/migrate.py index 2451e60b72..aab656bb2e 100644 --- a/django/core/management/commands/migrate.py +++ b/django/core/management/commands/migrate.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from optparse import make_option from collections import OrderedDict diff --git a/django/core/management/commands/sqlmigrate.py b/django/core/management/commands/sqlmigrate.py index e828733f2c..e8ced69c21 100644 --- a/django/core/management/commands/sqlmigrate.py +++ b/django/core/management/commands/sqlmigrate.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from optparse import make_option diff --git a/django/db/migrations/writer.py b/django/db/migrations/writer.py index 0e2eeef85a..da6aed4308 100644 --- a/django/db/migrations/writer.py +++ b/django/db/migrations/writer.py @@ -304,7 +304,7 @@ class MigrationWriter(object): MIGRATION_TEMPLATE = """\ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/docs/ref/migration-operations.txt b/docs/ref/migration-operations.txt index 9c7a5d497e..40ef3849ac 100644 --- a/docs/ref/migration-operations.txt +++ b/docs/ref/migration-operations.txt @@ -192,7 +192,7 @@ class in the migration file, and just pass it to ``RunPython``. Here's an example of using ``RunPython`` to create some initial objects on a ``Country`` model:: - # encoding: utf8 + # -*- coding: utf-8 -*- from django.db import models, migrations def forwards_func(apps, schema_editor): diff --git a/docs/topics/migrations.txt b/docs/topics/migrations.txt index 4f75fcff56..8a5359fec4 100644 --- a/docs/topics/migrations.txt +++ b/docs/topics/migrations.txt @@ -338,7 +338,7 @@ the file in the right place, suggest a name, and add dependencies for you):: Then, open up the file; it should look something like this:: - # encoding: utf8 + # -*- coding: utf-8 -*- from django.db import models, migrations class Migration(migrations.Migration): @@ -365,7 +365,7 @@ combined values of ``first_name`` and ``last_name`` (we've come to our senses and realized that not everyone has first and last names). All we need to do is use the historical model and iterate over the rows:: - # encoding: utf8 + # -*- coding: utf-8 -*- from django.db import models, migrations def combine_names(apps, schema_editor): diff --git a/tests/admin_ordering/models.py b/tests/admin_ordering/models.py index fb99d2dac5..91831edc2b 100644 --- a/tests/admin_ordering/models.py +++ b/tests/admin_ordering/models.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from django.contrib import admin from django.db import models diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 2c7d02a541..fbea1d49c7 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals import os diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 3c6846073f..56374d7534 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -1,4 +1,4 @@ -# encoding: utf-8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from datetime import datetime, timedelta diff --git a/tests/aggregation/models.py b/tests/aggregation/models.py index 691737c17e..0ca20def3e 100644 --- a/tests/aggregation/models.py +++ b/tests/aggregation/models.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from django.db import models from django.utils.encoding import python_2_unicode_compatible diff --git a/tests/aggregation_regress/models.py b/tests/aggregation_regress/models.py index 4d495b4a75..e8714668ba 100644 --- a/tests/aggregation_regress/models.py +++ b/tests/aggregation_regress/models.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation ) diff --git a/tests/basic/models.py b/tests/basic/models.py index 5e67b0dca9..d9fa08a056 100644 --- a/tests/basic/models.py +++ b/tests/basic/models.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- """ 1. Bare-bones model diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py index ae8b9529f5..8789f392b4 100644 --- a/tests/handlers/tests.py +++ b/tests/handlers/tests.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals diff --git a/tests/i18n/contenttypes/tests.py b/tests/i18n/contenttypes/tests.py index 3e25867616..70314b737b 100644 --- a/tests/i18n/contenttypes/tests.py +++ b/tests/i18n/contenttypes/tests.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals import os diff --git a/tests/inline_formsets/models.py b/tests/inline_formsets/models.py index 383122dbd7..f29362e321 100644 --- a/tests/inline_formsets/models.py +++ b/tests/inline_formsets/models.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from django.db import models from django.utils.encoding import python_2_unicode_compatible diff --git a/tests/mail/tests.py b/tests/mail/tests.py index 06292b3cb6..0ea819ffbd 100644 --- a/tests/mail/tests.py +++ b/tests/mail/tests.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals import asyncore diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py index 510fd27b0b..54361f00ed 100644 --- a/tests/migrations/test_autodetector.py +++ b/tests/migrations/test_autodetector.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from django.test import TestCase, override_settings from django.db.migrations.autodetector import MigrationAutodetector from django.db.migrations.questioner import MigrationQuestioner diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py index 74881f8510..129e80b92c 100644 --- a/tests/migrations/test_commands.py +++ b/tests/migrations/test_commands.py @@ -184,7 +184,7 @@ class MakeMigrationsTests(MigrationTestBase): with codecs.open(initial_file, 'r', encoding='utf-8') as fp: content = fp.read() - self.assertTrue('# encoding: utf8' in content) + self.assertTrue('# -*- coding: utf-8 -*-' in content) self.assertTrue('migrations.CreateModel' in content) if six.PY3: diff --git a/tests/migrations/test_migrations/0001_initial.py b/tests/migrations/test_migrations/0001_initial.py index 3544610eb4..581d536814 100644 --- a/tests/migrations/test_migrations/0001_initial.py +++ b/tests/migrations/test_migrations/0001_initial.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/tests/migrations/test_migrations/0002_second.py b/tests/migrations/test_migrations/0002_second.py index 5da381677c..9dd60fade2 100644 --- a/tests/migrations/test_migrations/0002_second.py +++ b/tests/migrations/test_migrations/0002_second.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/tests/migrations/test_migrations_2/0001_initial.py b/tests/migrations/test_migrations_2/0001_initial.py index cb15a04956..02cbd97fcc 100644 --- a/tests/migrations/test_migrations_2/0001_initial.py +++ b/tests/migrations/test_migrations_2/0001_initial.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/tests/migrations/test_migrations_conflict/0001_initial.py b/tests/migrations/test_migrations_conflict/0001_initial.py index 3544610eb4..581d536814 100644 --- a/tests/migrations/test_migrations_conflict/0001_initial.py +++ b/tests/migrations/test_migrations_conflict/0001_initial.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/tests/migrations/test_migrations_conflict/0002_conflicting_second.py b/tests/migrations/test_migrations_conflict/0002_conflicting_second.py index cf83d7b036..4057636177 100644 --- a/tests/migrations/test_migrations_conflict/0002_conflicting_second.py +++ b/tests/migrations/test_migrations_conflict/0002_conflicting_second.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/tests/migrations/test_migrations_conflict/0002_second.py b/tests/migrations/test_migrations_conflict/0002_second.py index 0595de83f0..c525ea08a0 100644 --- a/tests/migrations/test_migrations_conflict/0002_second.py +++ b/tests/migrations/test_migrations_conflict/0002_second.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/tests/migrations/test_migrations_custom_user/0001_initial.py b/tests/migrations/test_migrations_custom_user/0001_initial.py index f8e6ce4b0d..d7c37151f1 100644 --- a/tests/migrations/test_migrations_custom_user/0001_initial.py +++ b/tests/migrations/test_migrations_custom_user/0001_initial.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/tests/migrations/test_migrations_squashed/0001_initial.py b/tests/migrations/test_migrations_squashed/0001_initial.py index 3544610eb4..581d536814 100644 --- a/tests/migrations/test_migrations_squashed/0001_initial.py +++ b/tests/migrations/test_migrations_squashed/0001_initial.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/tests/migrations/test_migrations_squashed/0001_squashed_0002.py b/tests/migrations/test_migrations_squashed/0001_squashed_0002.py index b357e3f6f8..a5f591cbf7 100644 --- a/tests/migrations/test_migrations_squashed/0001_squashed_0002.py +++ b/tests/migrations/test_migrations_squashed/0001_squashed_0002.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/tests/migrations/test_migrations_squashed/0002_second.py b/tests/migrations/test_migrations_squashed/0002_second.py index 0595de83f0..c525ea08a0 100644 --- a/tests/migrations/test_migrations_squashed/0002_second.py +++ b/tests/migrations/test_migrations_squashed/0002_second.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/tests/migrations/test_migrations_unmigdep/0001_initial.py b/tests/migrations/test_migrations_unmigdep/0001_initial.py index ff19085563..6503f9f05b 100644 --- a/tests/migrations/test_migrations_unmigdep/0001_initial.py +++ b/tests/migrations/test_migrations_unmigdep/0001_initial.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/tests/migrations/test_optimizer.py b/tests/migrations/test_optimizer.py index b73c41a698..346d30ae28 100644 --- a/tests/migrations/test_optimizer.py +++ b/tests/migrations/test_optimizer.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from django.test import TestCase from django.db.migrations.optimizer import MigrationOptimizer diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py index 6a85ba8ca3..58b5aa6cac 100644 --- a/tests/migrations/test_writer.py +++ b/tests/migrations/test_writer.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals import datetime diff --git a/tests/model_regress/models.py b/tests/model_regress/models.py index 82efb9c783..7dacfc9c90 100644 --- a/tests/model_regress/models.py +++ b/tests/model_regress/models.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from django.db import models from django.utils.encoding import python_2_unicode_compatible diff --git a/tests/modeladmin/models.py b/tests/modeladmin/models.py index 8f57a9fa82..8457e60876 100644 --- a/tests/modeladmin/models.py +++ b/tests/modeladmin/models.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from django.contrib.auth.models import User from django.db import models from django.utils.encoding import python_2_unicode_compatible diff --git a/tests/template_tests/filters.py b/tests/template_tests/filters.py index ad85d0cb0b..24efe7cc86 100644 --- a/tests/template_tests/filters.py +++ b/tests/template_tests/filters.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- """ Tests for template filters (as opposed to template tags). diff --git a/tests/template_tests/test_context.py b/tests/template_tests/test_context.py index dac74b36e3..c5ad3e1d50 100644 --- a/tests/template_tests/test_context.py +++ b/tests/template_tests/test_context.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from unittest import TestCase diff --git a/tests/template_tests/urls.py b/tests/template_tests/urls.py index f3720bbda7..58d1a18bb6 100644 --- a/tests/template_tests/urls.py +++ b/tests/template_tests/urls.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf.urls import patterns, url diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py index a29d627000..a212f406a3 100644 --- a/tests/test_client/tests.py +++ b/tests/test_client/tests.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- """ 39. Testing using the Test Client diff --git a/tests/text/tests.py b/tests/text/tests.py index c14f3baf82..9ac6414b21 100644 --- a/tests/text/tests.py +++ b/tests/text/tests.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase diff --git a/tests/utils_tests/test_jslex.py b/tests/utils_tests/test_jslex.py index 97e6dbc109..9def423969 100644 --- a/tests/utils_tests/test_jslex.py +++ b/tests/utils_tests/test_jslex.py @@ -1,5 +1,5 @@ +# -*- coding: utf-8 -*- """Tests for jslex.""" -# encoding: utf-8 # originally from https://bitbucket.org/ned/jslex from django.test import TestCase diff --git a/tests/view_tests/tests/test_json.py b/tests/view_tests/tests/test_json.py index b236e60c7d..5570812c87 100644 --- a/tests/view_tests/tests/test_json.py +++ b/tests/view_tests/tests/test_json.py @@ -1,4 +1,4 @@ -# encoding: utf8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals import json diff --git a/tests/view_tests/tests/test_specials.py b/tests/view_tests/tests/test_specials.py index 0b933ac0de..a705b07faa 100644 --- a/tests/view_tests/tests/test_specials.py +++ b/tests/view_tests/tests/test_specials.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase diff --git a/tests/view_tests/urls.py b/tests/view_tests/urls.py index edf1bc56db..25e0395432 100644 --- a/tests/view_tests/urls.py +++ b/tests/view_tests/urls.py @@ -1,4 +1,4 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- from os import path from django.conf.urls import patterns, url, include