Skip to content

Commit

Permalink
Merge pull request #2503 from bagerard/precommit_update
Browse files Browse the repository at this point in the history
housekeeping - pre-commit autoupdate
  • Loading branch information
bagerard committed Apr 23, 2021
2 parents 9680259 + ef57a58 commit fc0fb31
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ repos:
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.0
rev: 3.9.1
hooks:
- id: flake8
- repo: https://github.com/asottile/pyupgrade
rev: v2.11.0
rev: v2.13.0
hooks:
- id: pyupgrade
args: [--py36-plus]
Expand Down
14 changes: 7 additions & 7 deletions benchmarks/test_inserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def main():
print("-" * 100)
print("PyMongo: Creating 10000 dictionaries.")
t = timeit.Timer(stmt=stmt, setup=setup)
print("{}s".format(t.timeit(1)))
print(f"{t.timeit(1)}s")

stmt = """
from pymongo import MongoClient, WriteConcern
Expand All @@ -54,7 +54,7 @@ def main():
print("-" * 100)
print('PyMongo: Creating 10000 dictionaries (write_concern={"w": 0}).')
t = timeit.Timer(stmt=stmt, setup=setup)
print("{}s".format(t.timeit(1)))
print(f"{t.timeit(1)}s")

setup = """
from pymongo import MongoClient
Expand Down Expand Up @@ -84,7 +84,7 @@ class Noddy(Document):
print("-" * 100)
print("MongoEngine: Creating 10000 dictionaries.")
t = timeit.Timer(stmt=stmt, setup=setup)
print("{}s".format(t.timeit(1)))
print(f"{t.timeit(1)}s")

stmt = """
for i in range(10000):
Expand All @@ -102,7 +102,7 @@ class Noddy(Document):
print("-" * 100)
print("MongoEngine: Creating 10000 dictionaries (using a single field assignment).")
t = timeit.Timer(stmt=stmt, setup=setup)
print("{}s".format(t.timeit(1)))
print(f"{t.timeit(1)}s")

stmt = """
for i in range(10000):
Expand All @@ -118,7 +118,7 @@ class Noddy(Document):
print("-" * 100)
print('MongoEngine: Creating 10000 dictionaries (write_concern={"w": 0}).')
t = timeit.Timer(stmt=stmt, setup=setup)
print("{}s".format(t.timeit(1)))
print(f"{t.timeit(1)}s")

stmt = """
for i in range(10000):
Expand All @@ -136,7 +136,7 @@ class Noddy(Document):
'MongoEngine: Creating 10000 dictionaries (write_concern={"w": 0}, validate=False).'
)
t = timeit.Timer(stmt=stmt, setup=setup)
print("{}s".format(t.timeit(1)))
print(f"{t.timeit(1)}s")

stmt = """
for i in range(10000):
Expand All @@ -154,7 +154,7 @@ class Noddy(Document):
'MongoEngine: Creating 10000 dictionaries (force_insert=True, write_concern={"w": 0}, validate=False).'
)
t = timeit.Timer(stmt=stmt, setup=setup)
print("{}s".format(t.timeit(1)))
print(f"{t.timeit(1)}s")


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions mongoengine/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def save(
_refs=None,
save_condition=None,
signal_kwargs=None,
**kwargs
**kwargs,
):
"""Save the :class:`~mongoengine.Document` to the database. If the
document already exists, it will be updated, otherwise it will be
Expand Down Expand Up @@ -563,7 +563,7 @@ def cascade_save(self, **kwargs):
if not getattr(ref, "_changed_fields", True):
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:
_refs.append(ref_id)
kwargs["_refs"] = _refs
Expand Down

0 comments on commit fc0fb31

Please sign in to comment.