diff options
author | django-bot <ops@djangoproject.com> | 2022-02-03 20:24:19 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-02-07 20:37:05 +0100 |
commit | 9c19aff7c7561e3a82978a272ecdaad40dda5c00 (patch) | |
tree | f0506b668a013d0063e5fba3dbf4863b466713ba /django/contrib/postgres/aggregates/general.py | |
parent | f68fa8b45dfac545cfc4111d4e52804c86db68d3 (diff) | |
download | django-9c19aff7c7561e3a82978a272ecdaad40dda5c00.tar.gz |
Refs #33476 -- Reformatted code with Black.
Diffstat (limited to 'django/contrib/postgres/aggregates/general.py')
-rw-r--r-- | django/contrib/postgres/aggregates/general.py | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/django/contrib/postgres/aggregates/general.py b/django/contrib/postgres/aggregates/general.py index d90ca50e2b..f8b40fb709 100644 --- a/django/contrib/postgres/aggregates/general.py +++ b/django/contrib/postgres/aggregates/general.py @@ -1,16 +1,20 @@ import warnings from django.contrib.postgres.fields import ArrayField -from django.db.models import ( - Aggregate, BooleanField, JSONField, TextField, Value, -) +from django.db.models import Aggregate, BooleanField, JSONField, TextField, Value from django.utils.deprecation import RemovedInDjango50Warning from .mixins import OrderableAggMixin __all__ = [ - 'ArrayAgg', 'BitAnd', 'BitOr', 'BitXor', 'BoolAnd', 'BoolOr', 'JSONBAgg', - 'StringAgg', + "ArrayAgg", + "BitAnd", + "BitOr", + "BitXor", + "BoolAnd", + "BoolOr", + "JSONBAgg", + "StringAgg", ] @@ -35,17 +39,17 @@ class DeprecatedConvertValueMixin: class ArrayAgg(DeprecatedConvertValueMixin, OrderableAggMixin, Aggregate): - function = 'ARRAY_AGG' - template = '%(function)s(%(distinct)s%(expressions)s %(ordering)s)' + function = "ARRAY_AGG" + template = "%(function)s(%(distinct)s%(expressions)s %(ordering)s)" allow_distinct = True # RemovedInDjango50Warning deprecation_value = property(lambda self: []) deprecation_msg = ( - 'In Django 5.0, ArrayAgg() will return None instead of an empty list ' - 'if there are no rows. Pass default=None to opt into the new behavior ' - 'and silence this warning or default=Value([]) to keep the previous ' - 'behavior.' + "In Django 5.0, ArrayAgg() will return None instead of an empty list " + "if there are no rows. Pass default=None to opt into the new behavior " + "and silence this warning or default=Value([]) to keep the previous " + "behavior." ) @property @@ -54,35 +58,35 @@ class ArrayAgg(DeprecatedConvertValueMixin, OrderableAggMixin, Aggregate): class BitAnd(Aggregate): - function = 'BIT_AND' + function = "BIT_AND" class BitOr(Aggregate): - function = 'BIT_OR' + function = "BIT_OR" class BitXor(Aggregate): - function = 'BIT_XOR' + function = "BIT_XOR" class BoolAnd(Aggregate): - function = 'BOOL_AND' + function = "BOOL_AND" output_field = BooleanField() class BoolOr(Aggregate): - function = 'BOOL_OR' + function = "BOOL_OR" output_field = BooleanField() class JSONBAgg(DeprecatedConvertValueMixin, OrderableAggMixin, Aggregate): - function = 'JSONB_AGG' - template = '%(function)s(%(distinct)s%(expressions)s %(ordering)s)' + function = "JSONB_AGG" + template = "%(function)s(%(distinct)s%(expressions)s %(ordering)s)" allow_distinct = True output_field = JSONField() # RemovedInDjango50Warning - deprecation_value = '[]' + deprecation_value = "[]" deprecation_msg = ( "In Django 5.0, JSONBAgg() will return None instead of an empty list " "if there are no rows. Pass default=None to opt into the new behavior " @@ -92,13 +96,13 @@ class JSONBAgg(DeprecatedConvertValueMixin, OrderableAggMixin, Aggregate): class StringAgg(DeprecatedConvertValueMixin, OrderableAggMixin, Aggregate): - function = 'STRING_AGG' - template = '%(function)s(%(distinct)s%(expressions)s %(ordering)s)' + function = "STRING_AGG" + template = "%(function)s(%(distinct)s%(expressions)s %(ordering)s)" allow_distinct = True output_field = TextField() # RemovedInDjango50Warning - deprecation_value = '' + deprecation_value = "" deprecation_msg = ( "In Django 5.0, StringAgg() will return None instead of an empty " "string if there are no rows. Pass default=None to opt into the new " |