Skip to content

Commit 1e7680e

Browse files
committed
chore: Formatting changes
1 parent 03d31e9 commit 1e7680e

File tree

7 files changed

+24
-29
lines changed

7 files changed

+24
-29
lines changed

django_mongoengine/document.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,11 @@ class DynamicEmbeddedDocument(
112112

113113
if TYPE_CHECKING:
114114

115-
class Document(DjangoFlavor, me.Document):
116-
...
115+
class Document(DjangoFlavor, me.Document): ...
117116

118-
class DynamicDocument(DjangoFlavor, me.DynamicDocument):
119-
...
117+
class DynamicDocument(DjangoFlavor, me.DynamicDocument): ...
120118

121119
class EmbeddedDocument(DjangoFlavor, me.EmbeddedDocument):
122120
_instance: Document
123121

124-
class DynamicEmbeddedDocument(DjangoFlavor, me.DynamicEmbeddedDocument):
125-
...
122+
class DynamicEmbeddedDocument(DjangoFlavor, me.DynamicEmbeddedDocument): ...

django_mongoengine/mongo_admin/management/commands/createmongodbsuperuser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Management utility to create superusers.
33
"""
4+
45
import getpass
56
import re
67
import sys

django_mongoengine/mongo_admin/validation.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,11 @@ def _validate(cls, model):
172172
for idx, inline in enumerate(cls.inlines):
173173
if not issubclass(inline, BaseDocumentAdmin):
174174
raise ImproperlyConfigured(
175-
"'%s.inlines[%d]' does not inherit "
176-
"from BaseModelAdmin." % (cls.__name__, idx)
175+
"'%s.inlines[%d]' does not inherit from BaseModelAdmin." % (cls.__name__, idx)
177176
)
178177
if not inline.document:
179178
raise ImproperlyConfigured(
180-
"'document' is a required attribute "
181-
"of '%s.inlines[%d]'." % (cls.__name__, idx)
179+
"'document' is a required attribute of '%s.inlines[%d]'." % (cls.__name__, idx)
182180
)
183181
if not issubclass(inline.document, BaseDocument):
184182
raise ImproperlyConfigured(
@@ -195,7 +193,7 @@ def validate_inline(cls, parent, parent_model):
195193
f = get_field(cls, cls.model, cls.model._meta, "fk_name", cls.fk_name)
196194
if not isinstance(f, models.ForeignKey):
197195
raise ImproperlyConfigured(
198-
"'%s.fk_name is not an instance of " "models.ForeignKey." % cls.__name__
196+
"'%s.fk_name is not an instance of models.ForeignKey." % cls.__name__
199197
)
200198

201199
if not issubclass(cls, EmbeddedDocumentAdmin):
@@ -217,7 +215,7 @@ def validate_inline(cls, parent, parent_model):
217215
# formset
218216
if hasattr(cls, "formset") and not issubclass(cls.formset, BaseDocumentFormSet):
219217
raise ImproperlyConfigured(
220-
"'%s.formset' does not inherit from " "BaseDocumentFormSet." % cls.__name__
218+
"'%s.formset' does not inherit from BaseDocumentFormSet." % cls.__name__
221219
)
222220

223221
# exclude
@@ -285,8 +283,7 @@ def validate_base(cls, model):
285283
check_isseq(cls, "fieldsets[%d]" % idx, fieldset)
286284
if len(fieldset) != 2:
287285
raise ImproperlyConfigured(
288-
"'%s.fieldsets[%d]' does not "
289-
"have exactly two elements." % (cls.__name__, idx)
286+
"'%s.fieldsets[%d]' does not have exactly two elements." % (cls.__name__, idx)
290287
)
291288
check_isdict(cls, "fieldsets[%d][1]" % idx, fieldset[1])
292289
if "fields" not in fieldset[1]:
@@ -347,7 +344,7 @@ def validate_base(cls, model):
347344
issubclass(cls.form, BaseModelForm)
348345
or cls.form.__class__.__name__ == "DocumentFormMetaclass"
349346
):
350-
raise ImproperlyConfigured("%s.form does not inherit from " "BaseModelForm." % cls.__name__)
347+
raise ImproperlyConfigured("%s.form does not inherit from BaseModelForm." % cls.__name__)
351348

352349
# filter_vertical
353350
if hasattr(cls, "filter_vertical"):
@@ -356,7 +353,7 @@ def validate_base(cls, model):
356353
f = get_field(cls, model, opts, "filter_vertical", field)
357354
if not isinstance(f, models.ManyToManyField):
358355
raise ImproperlyConfigured(
359-
"'%s.filter_vertical[%d]' must be " "a ManyToManyField." % (cls.__name__, idx)
356+
"'%s.filter_vertical[%d]' must be a ManyToManyField." % (cls.__name__, idx)
360357
)
361358

362359
# filter_horizontal
@@ -366,7 +363,7 @@ def validate_base(cls, model):
366363
f = get_field(cls, model, opts, "filter_horizontal", field)
367364
if not isinstance(f, ListField) and not isinstance(f.field, ReferenceField):
368365
raise ImproperlyConfigured(
369-
"'%s.filter_horizontal[%d]' must be " "a ManyToManyField." % (cls.__name__, idx)
366+
"'%s.filter_horizontal[%d]' must be a ManyToManyField." % (cls.__name__, idx)
370367
)
371368

372369
# radio_fields

django_mongoengine/mongo_auth/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def get_profile(self):
358358
if not hasattr(self, "_profile_cache"):
359359
if not getattr(settings, "AUTH_PROFILE_MODULE", False):
360360
raise SiteProfileNotAvailable(
361-
"You need to set AUTH_PROFILE_MO" "DULE in your project settings"
361+
"You need to set AUTH_PROFILE_MODULE in your project settings"
362362
)
363363
try:
364364
app_label, model_name = settings.AUTH_PROFILE_MODULE.split(".")

django_mongoengine/queryset.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,4 @@ class QuerySetManager(Generic[_M], qs.QuerySetManager):
131131
default = QuerySet
132132
if TYPE_CHECKING:
133133

134-
def __get__(self, instance: object, cls: type[_M]) -> QuerySet[_M]:
135-
...
134+
def __get__(self, instance: object, cls: type[_M]) -> QuerySet[_M]: ...

example/tumblelog/tumblelog/wsgi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
framework.
1414
1515
"""
16+
1617
import os
1718

1819
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tumblelog.settings")

tests/forms/tests.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,15 @@ def _check_structure(self, widget, structure, hint, level=0):
248248
self._check_structure(w, expected, hint, level=level + 1)
249249
else:
250250
wclass = structure["type"]
251-
assert isinstance(
252-
widget, wclass
253-
), "{hint}:{level}: widget: {widget} should be a {cls}".format(
254-
**{
255-
"hint": hint,
256-
"widget": widget,
257-
"cls": wclass,
258-
"level": level,
259-
}
251+
assert isinstance(widget, wclass), (
252+
"{hint}:{level}: widget: {widget} should be a {cls}".format(
253+
**{
254+
"hint": hint,
255+
"widget": widget,
256+
"cls": wclass,
257+
"level": level,
258+
}
259+
)
260260
)
261261

262262

0 commit comments

Comments
 (0)