Skip to content

Commit 4df0f8f

Browse files
committed
update hooks and autoformat with newer black
1 parent e006c25 commit 4df0f8f

17 files changed

+5
-21
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repos:
88
- id: trailing-whitespace
99
- id: end-of-file-fixer
1010
- repo: https://github.com/ambv/black
11-
rev: 22.12.0
11+
rev: 23.1.0
1212
hooks:
1313
- id: black
1414
- repo: https://github.com/pycqa/flake8
@@ -23,6 +23,6 @@ repos:
2323
- id: pyupgrade
2424
args: [--py36-plus]
2525
- repo: https://github.com/pycqa/isort
26-
rev: 5.11.4
26+
rev: 5.12.0
2727
hooks:
2828
- id: isort

mongoengine/base/document.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ def __delattr__(self, *args, **kwargs):
161161
def __setattr__(self, name, value):
162162
# Handle dynamic data only if an initialised dynamic document
163163
if self._dynamic and not self._dynamic_lock:
164-
165164
if name not in self._fields_ordered and not name.startswith("_"):
166165
DynamicField = _import_class("DynamicField")
167166
field = DynamicField(db_field=name, null=True)

mongoengine/base/metaclasses.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ def __new__(mcs, name, bases, attrs):
178178
f.owner_document = new_class
179179
delete_rule = getattr(f, "reverse_delete_rule", DO_NOTHING)
180180
if isinstance(f, CachedReferenceField):
181-
182181
if issubclass(new_class, EmbeddedDocument):
183182
raise InvalidDocumentError(
184183
"CachedReferenceFields is not allowed in EmbeddedDocuments"

mongoengine/connection.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ def _get_connection_settings(
102102

103103
resolved_hosts = []
104104
for entity in conn_host:
105-
106105
# Reject old mongomock integration
107106
# To be removed in a few versions after 0.27.0
108107
if entity.startswith("mongomock://") or kwargs.get("is_mock"):

mongoengine/dereference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ def _fetch_objects(self, doc_type=None):
165165
"""Fetch all references and convert to their document objects"""
166166
object_map = {}
167167
for collection, dbrefs in self.reference_map.items():
168-
169168
# we use getattr instead of hasattr because hasattr swallows any exception under python2
170169
# so it could hide nasty things without raising exceptions (cfr bug #1688))
171170
ref_document_cls_exists = getattr(collection, "objects", None) is not None

mongoengine/document.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,6 @@ def ensure_indexes(cls):
918918
# If _cls is being used (for polymorphism), it needs an index,
919919
# only if another index doesn't begin with _cls
920920
if index_cls and not cls_indexed and cls._meta.get("allow_inheritance"):
921-
922921
# we shouldn't pass 'cls' to the collection.ensureIndex options
923922
# because of https://jira.mongodb.org/browse/SERVER-769
924923
if "cls" in index_opts:

mongoengine/fields.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,6 @@ def prepare_query_value(self, op, value):
981981
self.error("List is too long")
982982

983983
if self.field:
984-
985984
# If the value is iterable and it's not a string nor a
986985
# BaseDocument, call prepare_query_value for each of its items.
987986
if (
@@ -2216,7 +2215,6 @@ def __get__(self, instance, owner):
22162215
return value
22172216

22182217
def __set__(self, instance, value):
2219-
22202218
if value is None and instance._initialised:
22212219
value = self.generate()
22222220

mongoengine/queryset/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,6 @@ def order_by(self, *keys):
11201120
new_ordering = queryset._get_order_by(keys)
11211121

11221122
if queryset._cursor_obj:
1123-
11241123
# If a cursor object has already been created, apply the sort to it
11251124
if new_ordering:
11261125
queryset._cursor_obj.sort(new_ordering)

mongoengine/queryset/queryset.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def _iter_results(self):
8787

8888
pos = 0
8989
while True:
90-
9190
# For all positions lower than the length of the current result
9291
# cache, serve the docs straight from the cache w/o hitting the
9392
# database.

tests/document/test_instance.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,6 @@ class Doc(Document):
15261526
assert my_doc.int_field == 1
15271527

15281528
def test_document_update(self):
1529-
15301529
# try updating a non-saved document
15311530
with pytest.raises(OperationError):
15321531
person = self.Person(name="dcrosta")

0 commit comments

Comments
 (0)