1
0
mirror of https://github.com/django/django.git synced 2025-10-29 08:36:09 +00:00

Refs #33476 -- Refactored problematic code before reformatting by Black.

In these cases Black produces unexpected results, e.g.

def make_random_password(
    self,
    length=10,
    allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789',
):

or

cursor.execute("""
SELECT ...
""",
    [table name],
)
This commit is contained in:
Mariusz Felisiak
2022-02-03 11:20:46 +01:00
committed by GitHub
parent c9d6e3595c
commit c5cd878382
53 changed files with 227 additions and 217 deletions

View File

@@ -523,8 +523,7 @@ class QuerySet:
)
if not unique_fields and db_features.supports_update_conflicts_with_target:
raise ValueError(
'Unique fields that can trigger the upsert must be '
'provided.'
'Unique fields that can trigger the upsert must be provided.'
)
# Updating primary keys and non-concrete fields is forbidden.
update_fields = [self.model._meta.get_field(name) for name in update_fields]
@@ -930,8 +929,7 @@ class QuerySet:
self._not_support_combined_queries('contains')
if self._fields is not None:
raise TypeError(
'Cannot call QuerySet.contains() after .values() or '
'.values_list().'
'Cannot call QuerySet.contains() after .values() or .values_list().'
)
try:
if obj._meta.concrete_model != self.model._meta.concrete_model:
@@ -1739,8 +1737,7 @@ class Prefetch:
)
):
raise ValueError(
'Prefetch querysets cannot use raw(), values(), and '
'values_list().'
'Prefetch querysets cannot use raw(), values(), and values_list().'
)
if to_attr:
self.prefetch_to = LOOKUP_SEP.join(lookup.split(LOOKUP_SEP)[:-1] + [to_attr])