Browse Source

Fixed warnings per flake8 6.1.0.

Mariusz Felisiak 1 year ago
parent
commit
22b0b73c77
3 changed files with 4 additions and 4 deletions
  1. 1 1
      .pre-commit-config.yaml
  2. 2 2
      django/db/models/functions/datetime.py
  3. 1 1
      tests/schema/tests.py

+ 1 - 1
.pre-commit-config.yaml

@@ -15,7 +15,7 @@ repos:
     hooks:
       - id: isort
   - repo: https://github.com/PyCQA/flake8
-    rev: 6.0.0
+    rev: 6.1.0
     hooks:
       - id: flake8
   - repo: https://github.com/pre-commit/mirrors-eslint

+ 2 - 2
django/db/models/functions/datetime.py

@@ -97,7 +97,7 @@ class Extract(TimezoneMixin, Transform):
                 "TimeField, or DurationField."
             )
         # Passing dates to functions expecting datetimes is most likely a mistake.
-        if type(field) == DateField and copy.lookup_name in (
+        if type(field) is DateField and copy.lookup_name in (
             "hour",
             "minute",
             "second",
@@ -310,7 +310,7 @@ class TruncBase(TimezoneMixin, Transform):
         has_explicit_output_field = (
             class_output_field or field.__class__ is not copy.output_field.__class__
         )
-        if type(field) == DateField and (
+        if type(field) is DateField and (
             isinstance(output_field, DateTimeField)
             or copy.kind in ("hour", "minute", "second", "time")
         ):

+ 1 - 1
tests/schema/tests.py

@@ -242,7 +242,7 @@ class SchemaTests(TransactionTestCase):
                 "SELECT {} FROM {};".format(field_name, model._meta.db_table)
             )
             database_default = cursor.fetchall()[0][0]
-            if cast_function and type(database_default) != type(expected_default):
+            if cast_function and type(database_default) is not type(expected_default):
                 database_default = cast_function(database_default)
             self.assertEqual(database_default, expected_default)