Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/ambv/black
rev: 26.5.1
rev: 26.10.1
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.3.0
rev: 7.5.0
hooks:
- id: flake8
additional_dependencies:
- importlib_metadata<5
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
rev: v3.22.0
hooks:
- id: pyupgrade
args: [--py310-plus]
- repo: https://github.com/pycqa/isort
rev: 9.0.0a3
rev: 10.0.0b3
hooks:
- id: isort
2 changes: 1 addition & 1 deletion mongoengine/base/metaclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def get_auto_id_names(mcs, new_class):
of ('auto_id_X', '_auto_id_X') if the default name is already taken.
"""
id_name, id_db_name = ("id", "_id")
existing_fields = {field_name for field_name in new_class._fields}
existing_fields = {*new_class._fields}
existing_db_fields = {v.db_field for v in new_class._fields.values()}
if id_name not in existing_fields and id_db_name not in existing_db_fields:
return id_name, id_db_name
Expand Down
2 changes: 1 addition & 1 deletion mongoengine/dereference.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __call__(self, items, max_depth=1, instance=None, name=None):
# cheapest way to convert a queryset to a list
# list(queryset) uses a count() query to determine length
if isinstance(items, QuerySet):
items = [i for i in items]
items = [*items]

self.max_depth = max_depth
doc_type = None
Expand Down
10 changes: 5 additions & 5 deletions tests/queryset/test_queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1254,13 +1254,13 @@ def test_repeated_iteration(self):
self.Person(name="Person 2").save()

queryset = self.Person.objects
people1 = [person for person in queryset]
people2 = [person for person in queryset]
people1 = [*queryset]
people2 = [*queryset]

# Check that it still works even if iteration is interrupted.
for _person in queryset:
break
people3 = [person for person in queryset]
people3 = [*queryset]

assert people1 == people2
assert people1 == people3
Expand Down Expand Up @@ -5593,7 +5593,7 @@ class Person(Document):
assert q == 0
people = Person.objects

[x for x in people]
[*people]
assert 100 == len(people._result_cache)

import platform
Expand Down Expand Up @@ -5625,7 +5625,7 @@ class Person(Document):
assert q == 0
people = Person.objects.no_cache()

[x for x in people]
[*people]
assert q == 1

list(people)
Expand Down
Loading
Loading