1
0
mirror of https://github.com/django/django.git synced 2025-08-21 01:09:13 +00:00

Refs #36500 -- Corrected rewrapped long lines fixed via a script.

Manually reformatted some comments and docstrings where autofix_w505.py
changed the meaning of the formatting.
This commit is contained in:
Mike Edmunds 2025-07-22 20:44:22 -07:00 committed by nessita
parent 69a93a88ed
commit 78298b5162
14 changed files with 47 additions and 39 deletions

View File

@ -343,8 +343,7 @@ FORMAT_MODULE_PATH = None
DATE_FORMAT = "N j, Y" DATE_FORMAT = "N j, Y"
# Default formatting for datetime objects. See all available format strings # Default formatting for datetime objects. See all available format strings
# here: # here: https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATETIME_FORMAT = "N j, Y, P" DATETIME_FORMAT = "N j, Y, P"
# Default formatting for time objects. See all available format strings here: # Default formatting for time objects. See all available format strings here:
@ -362,8 +361,7 @@ YEAR_MONTH_FORMAT = "F Y"
MONTH_DAY_FORMAT = "F j" MONTH_DAY_FORMAT = "F j"
# Default short formatting for date objects. See all available format strings # Default short formatting for date objects. See all available format strings
# here: # here: https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
SHORT_DATE_FORMAT = "m/d/Y" SHORT_DATE_FORMAT = "m/d/Y"
# Default short formatting for datetime objects. # Default short formatting for datetime objects.

View File

@ -181,8 +181,7 @@ class GEOSCoordSeq(GEOSBase):
def kml(self): def kml(self):
"Return the KML representation for the coordinates." "Return the KML representation for the coordinates."
# Getting the substitution string depending on whether the coordinates # Getting the substitution string depending on whether the coordinates
# have # have a Z dimension.
# a Z dimension.
if self.hasz: if self.hasz:
substr = "%s,%s,%s " substr = "%s,%s,%s "
else: else:

View File

@ -58,8 +58,7 @@ def load_geos():
# Getting the GEOS C library. The C interface (CDLL) is used for # Getting the GEOS C library. The C interface (CDLL) is used for
# both *NIX and Windows. # both *NIX and Windows.
# See the GEOS C API source code for more details on the library function # See the GEOS C API source code for more details on the library function
# calls: # calls: https://libgeos.org/doxygen/geos__c_8h_source.html
# https://libgeos.org/doxygen/geos__c_8h_source.html
_lgeos = CDLL(lib_path) _lgeos = CDLL(lib_path)
# Here we set up the prototypes for the initGEOS_r and finishGEOS_r # Here we set up the prototypes for the initGEOS_r and finishGEOS_r
# routines. These functions aren't actually called until they are # routines. These functions aren't actually called until they are

View File

@ -215,8 +215,8 @@ def naturaltime(value):
class NaturalTimeFormatter: class NaturalTimeFormatter:
time_strings = { time_strings = {
# Translators: delta will contain a string like '2 months' or '1 month, # Translators: delta will contain a string like '2 months' or
# 2 weeks' # '1 month, 2 weeks'
"past-day": gettext_lazy("%(delta)s ago"), "past-day": gettext_lazy("%(delta)s ago"),
# Translators: please keep a non-breaking space (U+00A0) between count # Translators: please keep a non-breaking space (U+00A0) between count
# and time unit. # and time unit.
@ -248,8 +248,8 @@ class NaturalTimeFormatter:
"an hour from now", "%(count)s hours from now", "count", "an hour from now", "%(count)s hours from now", "count",
), ),
# fmt: on # fmt: on
# Translators: delta will contain a string like '2 months' or '1 month, # Translators: delta will contain a string like '2 months' or
# 2 weeks' # '1 month, 2 weeks'
"future-day": gettext_lazy("%(delta)s from now"), "future-day": gettext_lazy("%(delta)s from now"),
} }
past_substrings = { past_substrings = {

View File

@ -370,8 +370,8 @@ class TupleIn(TupleLookupMixin, In):
return super(TupleLookupMixin, self).as_sql(compiler, connection) return super(TupleLookupMixin, self).as_sql(compiler, connection)
# e.g.: (a, b, c) in [(x1, y1, z1), (x2, y2, z2)] as SQL: # e.g.: (a, b, c) in [(x1, y1, z1), (x2, y2, z2)] as SQL:
# WHERE (a = x1 AND b = y1 AND c = z1) OR (a = x2 AND b = y2 AND c = # WHERE (a = x1 AND b = y1 AND c = z1)
# z2) # OR (a = x2 AND b = y2 AND c = z2)
root = WhereNode([], connector=OR) root = WhereNode([], connector=OR)
lhs = self.lhs lhs = self.lhs

View File

@ -756,8 +756,8 @@ class QuerySet(AltersData):
save() on each of the instances, do not send any pre/post_save save() on each of the instances, do not send any pre/post_save
signals, and do not set the primary key attribute if it is an signals, and do not set the primary key attribute if it is an
autoincrement field (except if autoincrement field (except if
features.can_return_rows_from_bulk_insert=True). Multi-table models are features.can_return_rows_from_bulk_insert=True).
not supported. Multi-table models are not supported.
""" """
# When you bulk insert you don't get the primary keys back (if it's an # When you bulk insert you don't get the primary keys back (if it's an
# autoincrement, except if can_return_rows_from_bulk_insert=True), so # autoincrement, except if can_return_rows_from_bulk_insert=True), so
@ -2561,7 +2561,7 @@ def prefetch_one_level(instances, prefetcher, lookup, level):
# of instances, and returns a tuple: # of instances, and returns a tuple:
# (queryset of instances of self.model that are related to passed in # (queryset of instances of self.model that are related to passed in
# instances, # instances,
# callable that gets value to be matched for returned instances, # callable that gets value to be matched for returned instances,
# callable that gets value to be matched for passed in instances, # callable that gets value to be matched for passed in instances,
# boolean that is True for singly related objects, # boolean that is True for singly related objects,

View File

@ -76,8 +76,8 @@ class Join:
def as_sql(self, compiler, connection): def as_sql(self, compiler, connection):
""" """
Generate the full Generate the full
LEFT OUTER JOIN sometable ON sometable.somecol = LEFT OUTER JOIN sometable
othertable.othercol, params ON sometable.somecol = othertable.othercol, params
clause for this join. clause for this join.
""" """
join_conditions = [] join_conditions = []

View File

@ -2635,7 +2635,8 @@ class Query(BaseExpression):
Return a lookup usable for doing outerq.filter(lookup=self) and a Return a lookup usable for doing outerq.filter(lookup=self) and a
boolean indicating if the joins in the prefix contain a LEFT OUTER boolean indicating if the joins in the prefix contain a LEFT OUTER
join. _""" join.
"""
all_paths = [] all_paths = []
for _, paths in names_with_path: for _, paths in names_with_path:
all_paths.extend(paths) all_paths.extend(paths)

View File

@ -1,8 +1,8 @@
"""Multi-consumer multi-producer dispatching mechanism """Multi-consumer multi-producer dispatching mechanism
Originally based on pydispatch (BSD) Originally based on pydispatch (BSD)
https://pypi.org/project/PyDispatcher/2.0.1/ See license.txt for original https://pypi.org/project/PyDispatcher/2.0.1/
license. See license.txt for original license.
Heavily modified for Django's purposes. Heavily modified for Django's purposes.
""" """

View File

@ -29,8 +29,14 @@ class Signal:
Internal attributes: Internal attributes:
receivers: receivers:
[((id(receiver), id(sender)), ref(receiver), ref(sender), [
is_async)] (
(id(receiver), id(sender)),
ref(receiver),
ref(sender),
is_async,
)
]
sender_receivers_cache: sender_receivers_cache:
WeakKeyDictionary[sender, list[receiver]] WeakKeyDictionary[sender, list[receiver]]
""" """

View File

@ -114,8 +114,8 @@ class BoundField(RenderableFieldMixin):
def as_text(self, attrs=None, **kwargs): def as_text(self, attrs=None, **kwargs):
""" """
Return a string of HTML for representing this as an <input Return a string of HTML for representing this as an
type="text">. <input type="text">.
""" """
return self.as_widget(TextInput(), attrs, **kwargs) return self.as_widget(TextInput(), attrs, **kwargs)
@ -125,8 +125,8 @@ class BoundField(RenderableFieldMixin):
def as_hidden(self, attrs=None, **kwargs): def as_hidden(self, attrs=None, **kwargs):
""" """
Return a string of HTML for representing this as an <input Return a string of HTML for representing this as an
type="hidden">. <input type="hidden">.
""" """
return self.as_widget(self.field.hidden_widget(), attrs, **kwargs) return self.as_widget(self.field.hidden_widget(), attrs, **kwargs)

View File

@ -127,17 +127,16 @@ class Field:
# error_messages -- An optional dictionary to override the default # error_messages -- An optional dictionary to override the default
# messages that the field will raise. # messages that the field will raise.
# show_hidden_initial -- Boolean that specifies if it is needed to # show_hidden_initial -- Boolean that specifies if it is needed to
# render a # render a hidden widget with initial value
# hidden widget with initial value after widget. # after widget.
# validators -- List of additional validators to use # validators -- List of additional validators to use
# localize -- Boolean that specifies if the field should be localized. # localize -- Boolean that specifies if the field should be localized.
# disabled -- Boolean that specifies whether the field is disabled, # disabled -- Boolean that specifies whether the field is disabled,
# that # that is its widget is shown in the form but not editable.
# is its widget is shown in the form but not editable.
# label_suffix -- Suffix to be added to the label. Overrides # label_suffix -- Suffix to be added to the label. Overrides
# form's label_suffix. # form's label_suffix.
# bound_field_class -- BoundField class to use in # bound_field_class -- BoundField class to use in
# Field.get_bound_field. # Field.get_bound_field.
self.required, self.label, self.initial = required, label, initial self.required, self.label, self.initial = required, label, initial
self.show_hidden_initial = show_hidden_initial self.show_hidden_initial = show_hidden_initial
self.help_text = help_text self.help_text = help_text

View File

@ -2279,9 +2279,14 @@ class BaseEmailBackendTests(MailTestsMixin):
gettext_lazy("test@example.com"), gettext_lazy("test@example.com"),
# RemovedInDjango70Warning: uncomment these cases when support for # RemovedInDjango70Warning: uncomment these cases when support for
# deprecated (name, address) tuples is removed. # deprecated (name, address) tuples is removed.
# [("nobody", "nobody@example.com"), ("other", # [
# "other@example.com")], [["nobody", "nobody@example.com"], # ("nobody", "nobody@example.com"),
# ["other", "other@example.com"]], # ("other", "other@example.com")
# ],
# [
# ["nobody", "nobody@example.com"],
# ["other", "other@example.com"]
# ],
[("name", "test", "example.com")], [("name", "test", "example.com")],
[("Name <test@example.com",)], [("Name <test@example.com",)],
[[]], [[]],

View File

@ -51,9 +51,10 @@ class ExtraAssertMixin:
:param method: The assertion method to test. :param method: The assertion method to test.
:param method_args: Positional arguments to pass to the method. :param method_args: Positional arguments to pass to the method.
:param expected_msg: The expected base error message (required :param expected_msg: The expected base error message (required
keyword-only). :param msg_prefix: Optional prefix to be added to the keyword-only).
message in the second subTest. :param method_kwargs: Keyword arguments :param msg_prefix: Optional prefix to be added to the message in the
to pass to the method. second subTest.
:param method_kwargs: Keyword arguments to pass to the method.
Used internally for testing Django's assertions. Used internally for testing Django's assertions.
""" """