From 305757aec19c9d5111e4d76095ae0acd66163e4b Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Fri, 26 Jan 2024 12:45:07 +0100 Subject: Applied Black's 2024 stable style. https://github.com/psf/black/releases/tag/24.1.0 --- django/forms/models.py | 10 +++++++--- django/forms/widgets.py | 22 +++++++++++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'django/forms') diff --git a/django/forms/models.py b/django/forms/models.py index 6a2608c0b3..cd6986d72a 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -2,6 +2,7 @@ Helper functions for creating Form classes from Django models and database field objects. """ + from itertools import chain from django.core.exceptions import ( @@ -830,9 +831,12 @@ class BaseModelFormSet(BaseFormSet, AltersData): ) # Reduce Model instances to their primary key values row_data = tuple( - d._get_pk_val() if hasattr(d, "_get_pk_val") - # Prevent "unhashable type: list" errors later on. - else tuple(d) if isinstance(d, list) else d + ( + d._get_pk_val() + if hasattr(d, "_get_pk_val") + # Prevent "unhashable type: list" errors later on. + else tuple(d) if isinstance(d, list) else d + ) for d in row_data ) if row_data and None not in row_data: diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 2c734052d5..4fae110d5e 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -101,9 +101,11 @@ class Media: def render_js(self): return [ - path.__html__() - if hasattr(path, "__html__") - else format_html('', self.absolute_path(path)) + ( + path.__html__() + if hasattr(path, "__html__") + else format_html('', self.absolute_path(path)) + ) for path in self._js ] @@ -113,12 +115,14 @@ class Media: media = sorted(self._css) return chain.from_iterable( [ - path.__html__() - if hasattr(path, "__html__") - else format_html( - '', - self.absolute_path(path), - medium, + ( + path.__html__() + if hasattr(path, "__html__") + else format_html( + '', + self.absolute_path(path), + medium, + ) ) for path in self._css[medium] ] -- cgit v1.3