Skip to content

Commit 2cab8a0

Browse files
authored
Merge pull request #2637 from bagerard/prepare_0_24_1
Prepare release 0 24 1
2 parents dd17d73 + 968625c commit 2cab8a0

File tree

7 files changed

+30
-24
lines changed

7 files changed

+30
-24
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
fail_fast: false
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.0.1
4+
rev: v4.1.0
55
hooks:
66
- id: check-merge-conflict
77
- id: debug-statements
88
- id: trailing-whitespace
99
- id: end-of-file-fixer
1010
- repo: https://github.com/ambv/black
11-
rev: 21.5b2
11+
rev: 22.1.0
1212
hooks:
1313
- id: black
1414
- repo: https://gitlab.com/pycqa/flake8
1515
rev: 3.9.2
1616
hooks:
1717
- id: flake8
1818
- repo: https://github.com/asottile/pyupgrade
19-
rev: v2.19.1
19+
rev: v2.31.1
2020
hooks:
2121
- id: pyupgrade
2222
args: [--py36-plus]
2323
- repo: https://github.com/pycqa/isort
24-
rev: 5.8.0
24+
rev: 5.10.1
2525
hooks:
2626
- id: isort

benchmarks/test_basic_doc_ops.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,34 @@ def init_book():
3838
author_email="[email protected]",
3939
)
4040

41-
print("Doc initialization: %.3fus" % (timeit(init_book, 1000) * 10 ** 6))
41+
print("Doc initialization: %.3fus" % (timeit(init_book, 1000) * 10**6))
4242

4343
b = init_book()
44-
print("Doc getattr: %.3fus" % (timeit(lambda: b.name, 10000) * 10 ** 6))
44+
print("Doc getattr: %.3fus" % (timeit(lambda: b.name, 10000) * 10**6))
4545

4646
print(
4747
"Doc setattr: %.3fus"
48-
% (timeit(lambda: setattr(b, "name", "New name"), 10000) * 10 ** 6) # noqa B010
48+
% (timeit(lambda: setattr(b, "name", "New name"), 10000) * 10**6) # noqa B010
4949
)
5050

51-
print("Doc to mongo: %.3fus" % (timeit(b.to_mongo, 1000) * 10 ** 6))
51+
print("Doc to mongo: %.3fus" % (timeit(b.to_mongo, 1000) * 10**6))
5252

53-
print("Doc validation: %.3fus" % (timeit(b.validate, 1000) * 10 ** 6))
53+
print("Doc validation: %.3fus" % (timeit(b.validate, 1000) * 10**6))
5454

5555
def save_book():
5656
b._mark_as_changed("name")
5757
b._mark_as_changed("tags")
5858
b.save()
5959

60-
print("Save to database: %.3fus" % (timeit(save_book, 100) * 10 ** 6))
60+
print("Save to database: %.3fus" % (timeit(save_book, 100) * 10**6))
6161

6262
son = b.to_mongo()
6363
print(
64-
"Load from SON: %.3fus" % (timeit(lambda: Book._from_son(son), 1000) * 10 ** 6)
64+
"Load from SON: %.3fus" % (timeit(lambda: Book._from_son(son), 1000) * 10**6)
6565
)
6666

6767
print(
68-
"Load from database: %.3fus" % (timeit(lambda: Book.objects[0], 100) * 10 ** 6)
68+
"Load from database: %.3fus" % (timeit(lambda: Book.objects[0], 100) * 10**6)
6969
)
7070

7171
def create_and_delete_book():
@@ -75,7 +75,7 @@ def create_and_delete_book():
7575

7676
print(
7777
"Init + save to database + delete: %.3fms"
78-
% (timeit(create_and_delete_book, 10) * 10 ** 3)
78+
% (timeit(create_and_delete_book, 10) * 10**3)
7979
)
8080

8181

@@ -101,9 +101,9 @@ def init_company():
101101
)
102102

103103
company = init_company()
104-
print("Big doc to mongo: %.3fms" % (timeit(company.to_mongo, 100) * 10 ** 3))
104+
print("Big doc to mongo: %.3fms" % (timeit(company.to_mongo, 100) * 10**3))
105105

106-
print("Big doc validation: %.3fms" % (timeit(company.validate, 1000) * 10 ** 3))
106+
print("Big doc validation: %.3fms" % (timeit(company.validate, 1000) * 10**3))
107107

108108
company.save()
109109

@@ -112,17 +112,17 @@ def save_company():
112112
company._mark_as_changed("contacts")
113113
company.save()
114114

115-
print("Save to database: %.3fms" % (timeit(save_company, 100) * 10 ** 3))
115+
print("Save to database: %.3fms" % (timeit(save_company, 100) * 10**3))
116116

117117
son = company.to_mongo()
118118
print(
119119
"Load from SON: %.3fms"
120-
% (timeit(lambda: Company._from_son(son), 100) * 10 ** 3)
120+
% (timeit(lambda: Company._from_son(son), 100) * 10**3)
121121
)
122122

123123
print(
124124
"Load from database: %.3fms"
125-
% (timeit(lambda: Company.objects[0], 100) * 10 ** 3)
125+
% (timeit(lambda: Company.objects[0], 100) * 10**3)
126126
)
127127

128128
def create_and_delete_company():
@@ -132,7 +132,7 @@ def create_and_delete_company():
132132

133133
print(
134134
"Init + save to database + delete: %.3fms"
135-
% (timeit(create_and_delete_company, 10) * 10 ** 3)
135+
% (timeit(create_and_delete_company, 10) * 10**3)
136136
)
137137

138138

docs/changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ Development
88
===========
99
- (Fill this out as you fix issues and develop your features).
1010

11+
Changes in 0.24.1
12+
=================
13+
- Allow pymongo<5.0 to be pulled
14+
- Don't use deprecated property for emptiness check in queryset base #2633
15+
16+
1117
Changes in 0.24.0
1218
=================
1319
- EnumField improvements: now ``choices`` limits the values of an enum to allow

mongoengine/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
)
3030

3131

32-
VERSION = (0, 24, 0)
32+
VERSION = (0, 24, 1)
3333

3434

3535
def get_version():

mongoengine/document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def _get_capped_collection(cls):
241241
collection_name = cls._get_collection_name()
242242

243243
# Get max document limit and max byte size from meta.
244-
max_size = cls._meta.get("max_size") or 10 * 2 ** 20 # 10MB default
244+
max_size = cls._meta.get("max_size") or 10 * 2**20 # 10MB default
245245
max_documents = cls._meta.get("max_documents")
246246

247247
# MongoDB will automatically raise the size to make it a multiple of

tests/document/test_instance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class Log(Document):
129129
options = Log.objects._collection.options()
130130
assert options["capped"] is True
131131
assert options["max"] == 10
132-
assert options["size"] == 10 * 2 ** 20
132+
assert options["size"] == 10 * 2**20
133133

134134
# Check that the document with default value can be recreated
135135
class Log(Document):

tests/fields/test_float_field.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ class BigPerson(Document):
5151
big_person.height = int(0)
5252
big_person.validate()
5353

54-
big_person.height = 2 ** 500
54+
big_person.height = 2**500
5555
big_person.validate()
5656

57-
big_person.height = 2 ** 100000 # Too big for a float value
57+
big_person.height = 2**100000 # Too big for a float value
5858
with pytest.raises(ValidationError):
5959
big_person.validate()

0 commit comments

Comments
 (0)