Ticket #28893: narrow.patch

File narrow.patch, 13.0 KB (added by Дилян Палаузов, 7 years ago)
  • django/core/management/commands/inspectdb.py

    diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py
    a b class Command(BaseCommand):  
    264264        to the given database table name.
    265265        """
    266266        unique_together = []
    267         for index, params in constraints.items():
     267        for params in constraints.values():
    268268            if params['unique']:
    269269                columns = params['columns']
    270270                if len(columns) > 1:
  • django/core/servers/basehttp.py

    diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py
    a b class WSGIRequestHandler(simple_server.WSGIRequestHandler):  
    128128        # the WSGI environ. This prevents header-spoofing based on ambiguity
    129129        # between underscores and dashes both normalized to underscores in WSGI
    130130        # env vars. Nginx and Apache 2.4+ both do this as well.
    131         for k, v in self.headers.items():
     131        for k in self.headers.keys():
    132132            if '_' in k:
    133133                del self.headers[k]
    134134
  • django/db/migrations/autodetector.py

    diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py
    a b class MigrationAutodetector:  
    348348                m2.dependencies.append((app_label, m1.name))
    349349
    350350        # De-dupe dependencies
    351         for app_label, migrations in self.migrations.items():
     351        for migrations in self.migrations.values():
    352352            for migration in migrations:
    353353                migration.dependencies = list(set(migration.dependencies))
    354354
    class MigrationAutodetector:  
    588588            # Generate other opns
    589589            related_dependencies = [
    590590                (app_label, model_name, name, True)
    591                 for name, field in sorted(related_fields.items())
     591                for name in sorted(related_fields.keys())
    592592            ]
    593593            related_dependencies.append((app_label, model_name, None, True))
    594594            for index in indexes:
    class MigrationAutodetector:  
    736736                    )
    737737                )
    738738            # Then remove each related field
    739             for name, field in sorted(related_fields.items()):
     739            for name in sorted(related_fields.keys()):
    740740                self.add_operation(
    741741                    app_label,
    742742                    operations.RemoveField(
    class MigrationAutodetector:  
    757757                if not related_object.many_to_many:
    758758                    dependencies.append((related_object_app_label, object_name, field_name, "alter"))
    759759
    760             for name, field in sorted(related_fields.items()):
     760            for name in sorted(related_fields.keys()):
    761761                dependencies.append((app_label, model_name, name, False))
    762762            # We're referenced in another field's through=
    763763            through_user = self.through_users.get((app_label, model_state.name_lower))
    class MigrationAutodetector:  
    11711171                next_number += 1
    11721172                migration.name = new_name
    11731173        # Now fix dependencies
    1174         for app_label, migrations in changes.items():
     1174        for migrations in changes.values():
    11751175            for migration in migrations:
    11761176                migration.dependencies = [name_map.get(d, d) for d in migration.dependencies]
    11771177        return changes
  • django/db/models/deletion.py

    diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py
    a b class Collector:  
    308308                        )
    309309
    310310        # update collected instances
    311         for model, instances_for_fieldvalues in self.field_updates.items():
     311        for instances_for_fieldvalues in self.field_updates.values():
    312312            for (field, value), instances in instances_for_fieldvalues.items():
    313313                for obj in instances:
    314314                    setattr(obj, field.attname, value)
  • django/db/models/sql/query.py

    diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
    a b class Query:  
    17491749        """
    17501750        group_by = list(self.select)
    17511751        if self.annotation_select:
    1752             for alias, annotation in self.annotation_select.items():
     1752            for annotation in self.annotation_select.values():
    17531753                for col in annotation.get_group_by_cols():
    17541754                    group_by.append(col)
    17551755        self.group_by = tuple(group_by)
  • django/test/utils.py

    diff --git a/django/test/utils.py b/django/test/utils.py
    a b def setup_databases(verbosity, interactive, keepdb=False, debug_sql=False, paral  
    159159
    160160    old_names = []
    161161
    162     for signature, (db_name, aliases) in test_databases.items():
     162    for (db_name, aliases) in test_databases.values():
    163163        first_alias = None
    164164        for alias in aliases:
    165165            connection = connections[alias]
  • django/views/debug.py

    diff --git a/django/views/debug.py b/django/views/debug.py
    a b class SafeExceptionReporterFilter(ExceptionReporterFilter):  
    164164                cleansed = request.POST.copy()
    165165                if sensitive_post_parameters == '__ALL__':
    166166                    # Cleanse all parameters.
    167                     for k, v in cleansed.items():
     167                    for k in cleansed.keys():
    168168                        cleansed[k] = CLEANSED_SUBSTITUTE
    169169                    return cleansed
    170170                else:
    class SafeExceptionReporterFilter(ExceptionReporterFilter):  
    213213        if self.is_active(request) and sensitive_variables:
    214214            if sensitive_variables == '__ALL__':
    215215                # Cleanse all variables
    216                 for name, value in tb_frame.f_locals.items():
     216                for name in tb_frame.f_locals.keys():
    217217                    cleansed[name] = CLEANSED_SUBSTITUTE
    218218            else:
    219219                # Cleanse specified variables
    220                 for name, value in tb_frame.f_locals.items():
     220                for name in tb_frame.f_locals.keys():
    221221                    if name in sensitive_variables:
    222222                        value = CLEANSED_SUBSTITUTE
    223223                    else:
  • tests/backends/postgresql/test_creation.py

    diff --git a/tests/backends/postgresql/test_creation.py b/tests/backends/postgresql/test_creation.py
    a b class DatabaseCreationTests(SimpleTestCase):  
    3333        try:
    3434            yield
    3535        finally:
    36             for name, value in kwargs.items():
     36            for name in kwargs.keys():
    3737                if name in saved_values:
    3838                    settings[name] = saved_values[name]
    3939                else:
  • tests/backends/postgresql/test_server_side_cursors.py

    diff --git a/tests/backends/postgresql/test_server_side_cursors.py b/tests/backends/postgresql/test_server_side_cursors.py
    a b class ServerSideCursorsPostgres(TestCase):  
    2727
    2828    @contextmanager
    2929    def override_db_setting(self, **kwargs):
    30         for setting, value in kwargs.items():
     30        for setting in kwargs.keys():
    3131            original_value = connection.settings_dict.get(setting)
    3232            if setting in connection.settings_dict:
    3333                self.addCleanup(operator.setitem, connection.settings_dict, setting, original_value)
  • tests/introspection/tests.py

    diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py
    a b class IntrospectionTests(TransactionTestCase):  
    176176            constraints = connection.introspection.get_constraints(cursor, Article._meta.db_table)
    177177        index = {}
    178178        index2 = {}
    179         for key, val in constraints.items():
     179        for val in constraints.values():
    180180            if val['columns'] == ['headline', 'pub_date']:
    181181                index = val
    182182            if val['columns'] == ['headline', 'response_to_id', 'pub_date', 'reporter_id']:
    class IntrospectionTests(TransactionTestCase):  
    198198            ['response_to_id'],
    199199            ['headline', 'response_to_id', 'pub_date', 'reporter_id'],
    200200        ]
    201         for key, val in constraints.items():
     201        for val in constraints.values():
    202202            if val['index'] and not (val['primary_key'] or val['unique']):
    203203                self.assertIn(val['columns'], expected_columns)
    204204                self.assertEqual(val['orders'], ['ASC'] * len(val['columns']))
  • tests/schema/tests.py

    diff --git a/tests/schema/tests.py b/tests/schema/tests.py
    a b class SchemaTests(TransactionTestCase):  
    180180        """
    181181        constraints = self.get_constraints(model._meta.db_table)
    182182        constraint_fk = None
    183         for name, details in constraints.items():
     183        for details in constraints.values():
    184184            if details['columns'] == [column] and details['foreign_key']:
    185185                constraint_fk = details['foreign_key']
    186186                break
    class SchemaTests(TransactionTestCase):  
    836836            editor.create_model(LocalBook)
    837837        # Ensure no FK constraint exists
    838838        constraints = self.get_constraints(LocalBook._meta.db_table)
    839         for name, details in constraints.items():
     839        for details in constraints.values():
    840840            if details['foreign_key']:
    841841                self.fail('Found an unexpected FK constraint to %s' % details['columns'])
    842842        old_field = LocalBook._meta.get_field("author")
    class SchemaTests(TransactionTestCase):  
    14301430            editor.create_model(Author)
    14311431        # Ensure the constraint exists
    14321432        constraints = self.get_constraints(Author._meta.db_table)
    1433         for name, details in constraints.items():
     1433        for details in constraints.values():
    14341434            if details['columns'] == ["height"] and details['check']:
    14351435                break
    14361436        else:
    class SchemaTests(TransactionTestCase):  
    14421442        with connection.schema_editor() as editor:
    14431443            editor.alter_field(Author, old_field, new_field, strict=True)
    14441444        constraints = self.get_constraints(Author._meta.db_table)
    1445         for name, details in constraints.items():
     1445        for details in constraints.values():
    14461446            if details['columns'] == ["height"] and details['check']:
    14471447                self.fail("Check constraint for height found")
    14481448        # Alter the column to re-add it
    class SchemaTests(TransactionTestCase):  
    14501450        with connection.schema_editor() as editor:
    14511451            editor.alter_field(Author, new_field, new_field2, strict=True)
    14521452        constraints = self.get_constraints(Author._meta.db_table)
    1453         for name, details in constraints.items():
     1453        for details in constraints.values():
    14541454            if details['columns'] == ["height"] and details['check']:
    14551455                break
    14561456        else:
  • tests/serializers/test_data.py

    diff --git a/tests/serializers/test_data.py b/tests/serializers/test_data.py
    a b def inherited_create(pk, klass, data):  
    106106    #     automatically is easier than manually creating both.
    107107    models.Model.save(instance)
    108108    created = [instance]
    109     for klass, field in instance._meta.parents.items():
     109    for klass in instance._meta.parents.keys():
    110110        created.append(klass.objects.get(id=pk))
    111111    return created
    112112
  • tests/validation/test_unique.py

    diff --git a/tests/validation/test_unique.py b/tests/validation/test_unique.py
    a b class GetUniqueCheckTests(unittest.TestCase):  
    4747                    (('foo', 'bar'), ('bar', 'baz'))),
    4848        }
    4949
    50         for test_name, (unique_together, normalized) in data.items():
     50        for (unique_together, normalized) in data.values():
    5151            class M(models.Model):
    5252                foo = models.IntegerField()
    5353                bar = models.IntegerField()
  • tests/view_tests/tests/test_debug.py

    diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
    a b class ExceptionReportTestMixin:  
    769769            self.assertContains(response, 'sauce', status_code=500)
    770770            self.assertNotContains(response, 'worcestershire', status_code=500)
    771771        if check_for_POST_params:
    772             for k, v in self.breakfast_data.items():
     772            for k in self.breakfast_data.keys():
    773773                # All POST parameters' names are shown.
    774774                self.assertContains(response, k, status_code=500)
    775775            # Non-sensitive POST parameters' values are shown.
    class ExceptionReportTestMixin:  
    858858            self.assertNotIn('worcestershire', body_html)
    859859
    860860            if check_for_POST_params:
    861                 for k, v in self.breakfast_data.items():
     861                for k in self.breakfast_data.keys():
    862862                    # All POST parameters' names are shown.
    863863                    self.assertIn(k, body_plain)
    864864                # Non-sensitive POST parameters' values are shown.
Back to Top