housekeeping - pre-commit autoupdate
This commit is contained in:
parent
9680259904
commit
ef57a58155
@ -12,11 +12,11 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
- repo: https://gitlab.com/pycqa/flake8
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
rev: 3.9.0
|
rev: 3.9.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v2.11.0
|
rev: v2.13.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: [--py36-plus]
|
args: [--py36-plus]
|
||||||
|
@ -31,7 +31,7 @@ myNoddys = noddy.find()
|
|||||||
print("-" * 100)
|
print("-" * 100)
|
||||||
print("PyMongo: Creating 10000 dictionaries.")
|
print("PyMongo: Creating 10000 dictionaries.")
|
||||||
t = timeit.Timer(stmt=stmt, setup=setup)
|
t = timeit.Timer(stmt=stmt, setup=setup)
|
||||||
print("{}s".format(t.timeit(1)))
|
print(f"{t.timeit(1)}s")
|
||||||
|
|
||||||
stmt = """
|
stmt = """
|
||||||
from pymongo import MongoClient, WriteConcern
|
from pymongo import MongoClient, WriteConcern
|
||||||
@ -54,7 +54,7 @@ myNoddys = noddy.find()
|
|||||||
print("-" * 100)
|
print("-" * 100)
|
||||||
print('PyMongo: Creating 10000 dictionaries (write_concern={"w": 0}).')
|
print('PyMongo: Creating 10000 dictionaries (write_concern={"w": 0}).')
|
||||||
t = timeit.Timer(stmt=stmt, setup=setup)
|
t = timeit.Timer(stmt=stmt, setup=setup)
|
||||||
print("{}s".format(t.timeit(1)))
|
print(f"{t.timeit(1)}s")
|
||||||
|
|
||||||
setup = """
|
setup = """
|
||||||
from pymongo import MongoClient
|
from pymongo import MongoClient
|
||||||
@ -84,7 +84,7 @@ myNoddys = Noddy.objects()
|
|||||||
print("-" * 100)
|
print("-" * 100)
|
||||||
print("MongoEngine: Creating 10000 dictionaries.")
|
print("MongoEngine: Creating 10000 dictionaries.")
|
||||||
t = timeit.Timer(stmt=stmt, setup=setup)
|
t = timeit.Timer(stmt=stmt, setup=setup)
|
||||||
print("{}s".format(t.timeit(1)))
|
print(f"{t.timeit(1)}s")
|
||||||
|
|
||||||
stmt = """
|
stmt = """
|
||||||
for i in range(10000):
|
for i in range(10000):
|
||||||
@ -102,7 +102,7 @@ myNoddys = Noddy.objects()
|
|||||||
print("-" * 100)
|
print("-" * 100)
|
||||||
print("MongoEngine: Creating 10000 dictionaries (using a single field assignment).")
|
print("MongoEngine: Creating 10000 dictionaries (using a single field assignment).")
|
||||||
t = timeit.Timer(stmt=stmt, setup=setup)
|
t = timeit.Timer(stmt=stmt, setup=setup)
|
||||||
print("{}s".format(t.timeit(1)))
|
print(f"{t.timeit(1)}s")
|
||||||
|
|
||||||
stmt = """
|
stmt = """
|
||||||
for i in range(10000):
|
for i in range(10000):
|
||||||
@ -118,7 +118,7 @@ myNoddys = Noddy.objects()
|
|||||||
print("-" * 100)
|
print("-" * 100)
|
||||||
print('MongoEngine: Creating 10000 dictionaries (write_concern={"w": 0}).')
|
print('MongoEngine: Creating 10000 dictionaries (write_concern={"w": 0}).')
|
||||||
t = timeit.Timer(stmt=stmt, setup=setup)
|
t = timeit.Timer(stmt=stmt, setup=setup)
|
||||||
print("{}s".format(t.timeit(1)))
|
print(f"{t.timeit(1)}s")
|
||||||
|
|
||||||
stmt = """
|
stmt = """
|
||||||
for i in range(10000):
|
for i in range(10000):
|
||||||
@ -136,7 +136,7 @@ myNoddys = Noddy.objects()
|
|||||||
'MongoEngine: Creating 10000 dictionaries (write_concern={"w": 0}, validate=False).'
|
'MongoEngine: Creating 10000 dictionaries (write_concern={"w": 0}, validate=False).'
|
||||||
)
|
)
|
||||||
t = timeit.Timer(stmt=stmt, setup=setup)
|
t = timeit.Timer(stmt=stmt, setup=setup)
|
||||||
print("{}s".format(t.timeit(1)))
|
print(f"{t.timeit(1)}s")
|
||||||
|
|
||||||
stmt = """
|
stmt = """
|
||||||
for i in range(10000):
|
for i in range(10000):
|
||||||
@ -154,7 +154,7 @@ myNoddys = Noddy.objects()
|
|||||||
'MongoEngine: Creating 10000 dictionaries (force_insert=True, write_concern={"w": 0}, validate=False).'
|
'MongoEngine: Creating 10000 dictionaries (force_insert=True, write_concern={"w": 0}, validate=False).'
|
||||||
)
|
)
|
||||||
t = timeit.Timer(stmt=stmt, setup=setup)
|
t = timeit.Timer(stmt=stmt, setup=setup)
|
||||||
print("{}s".format(t.timeit(1)))
|
print(f"{t.timeit(1)}s")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -332,7 +332,7 @@ class Document(BaseDocument, metaclass=TopLevelDocumentMetaclass):
|
|||||||
_refs=None,
|
_refs=None,
|
||||||
save_condition=None,
|
save_condition=None,
|
||||||
signal_kwargs=None,
|
signal_kwargs=None,
|
||||||
**kwargs
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""Save the :class:`~mongoengine.Document` to the database. If the
|
"""Save the :class:`~mongoengine.Document` to the database. If the
|
||||||
document already exists, it will be updated, otherwise it will be
|
document already exists, it will be updated, otherwise it will be
|
||||||
@ -563,7 +563,7 @@ class Document(BaseDocument, metaclass=TopLevelDocumentMetaclass):
|
|||||||
if not getattr(ref, "_changed_fields", True):
|
if not getattr(ref, "_changed_fields", True):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
ref_id = "{},{}".format(ref.__class__.__name__, str(ref._data))
|
ref_id = f"{ref.__class__.__name__},{str(ref._data)}"
|
||||||
if ref and ref_id not in _refs:
|
if ref and ref_id not in _refs:
|
||||||
_refs.append(ref_id)
|
_refs.append(ref_id)
|
||||||
kwargs["_refs"] = _refs
|
kwargs["_refs"] = _refs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user