mirror of
https://github.com/django/django.git
synced 2025-07-06 10:49:17 +00:00
[4.1.x] Fixed warnings per flake8 6.1.0.
Backport of 22b0b73c7732ba67db4e69fd9fa75aad84c8e5c4 from main.
This commit is contained in:
parent
05d78acb9c
commit
52533346d2
@ -9,7 +9,7 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: isort
|
||||||
- repo: https://github.com/PyCQA/flake8
|
- repo: https://github.com/PyCQA/flake8
|
||||||
rev: 5.0.0
|
rev: 6.1.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||||
|
@ -97,7 +97,7 @@ class Extract(TimezoneMixin, Transform):
|
|||||||
"TimeField, or DurationField."
|
"TimeField, or DurationField."
|
||||||
)
|
)
|
||||||
# Passing dates to functions expecting datetimes is most likely a mistake.
|
# 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",
|
"hour",
|
||||||
"minute",
|
"minute",
|
||||||
"second",
|
"second",
|
||||||
@ -296,7 +296,7 @@ class TruncBase(TimezoneMixin, Transform):
|
|||||||
has_explicit_output_field = (
|
has_explicit_output_field = (
|
||||||
class_output_field or field.__class__ is not copy.output_field.__class__
|
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)
|
isinstance(output_field, DateTimeField)
|
||||||
or copy.kind in ("hour", "minute", "second", "time")
|
or copy.kind in ("hour", "minute", "second", "time")
|
||||||
):
|
):
|
||||||
|
@ -238,7 +238,7 @@ class SchemaTests(TransactionTestCase):
|
|||||||
"SELECT {} FROM {};".format(field_name, model._meta.db_table)
|
"SELECT {} FROM {};".format(field_name, model._meta.db_table)
|
||||||
)
|
)
|
||||||
database_default = cursor.fetchall()[0][0]
|
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)
|
database_default = cast_function(database_default)
|
||||||
self.assertEqual(database_default, expected_default)
|
self.assertEqual(database_default, expected_default)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user