housekeeping - pre-commit autoupdate
This commit is contained in:
		| @@ -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] | ||||
|   | ||||
| @@ -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__": | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user