From ef57a58155dd5da354d11609fc91e4c157eaafd8 Mon Sep 17 00:00:00 2001 From: Bastien Gerard Date: Thu, 22 Apr 2021 10:18:15 +0200 Subject: [PATCH] housekeeping - pre-commit autoupdate --- .pre-commit-config.yaml | 4 ++-- benchmarks/test_inserts.py | 14 +++++++------- mongoengine/document.py | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 69d801a6..9e50053e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/benchmarks/test_inserts.py b/benchmarks/test_inserts.py index 4ecd48de..dcd18ff8 100644 --- a/benchmarks/test_inserts.py +++ b/benchmarks/test_inserts.py @@ -31,7 +31,7 @@ myNoddys = noddy.find() 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 @@ -54,7 +54,7 @@ myNoddys = noddy.find() 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 @@ -84,7 +84,7 @@ myNoddys = Noddy.objects() 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): @@ -102,7 +102,7 @@ myNoddys = Noddy.objects() 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): @@ -118,7 +118,7 @@ myNoddys = Noddy.objects() 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): @@ -136,7 +136,7 @@ myNoddys = Noddy.objects() '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): @@ -154,7 +154,7 @@ myNoddys = Noddy.objects() '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__": diff --git a/mongoengine/document.py b/mongoengine/document.py index a7b4cf95..fa8960fa 100644 --- a/mongoengine/document.py +++ b/mongoengine/document.py @@ -332,7 +332,7 @@ class Document(BaseDocument, metaclass=TopLevelDocumentMetaclass): _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 @@ -563,7 +563,7 @@ class Document(BaseDocument, metaclass=TopLevelDocumentMetaclass): 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