Skip to content

Commit 93e2416

Browse files
committed
Remove uninstall_tracker from operation_tracker as unused
1 parent 04ec6c1 commit 93e2416

File tree

1 file changed

+2
-29
lines changed

1 file changed

+2
-29
lines changed

flask_mongoengine/operation_tracker.py

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"updates",
1919
"removes",
2020
"install_tracker",
21-
"uninstall_tracker",
2221
"reset",
2322
"response_sizes",
2423
]
@@ -486,33 +485,6 @@ def install_tracker():
486485
pymongo.command_cursor.CommandCursor._unpack_response = _unpack_response
487486

488487

489-
def uninstall_tracker():
490-
if pymongo.collection.Collection.insert == _insert:
491-
pymongo.collection.Collection.insert = _original_methods["insert"]
492-
if pymongo.collection.Collection.insert_one == _insert_one:
493-
pymongo.collection.Collection.insert_one = _original_methods["insert_one"]
494-
if pymongo.collection.Collection.insert_many == _insert_many:
495-
pymongo.collection.Collection.insert_many = _original_methods["insert_many"]
496-
if pymongo.collection.Collection.update == _update:
497-
pymongo.collection.Collection.update = _original_methods["update"]
498-
if pymongo.collection.Collection.update_one == _update_one:
499-
pymongo.collection.Collection.update_one = _original_methods["update_one"]
500-
if pymongo.collection.Collection.update_many == _update_many:
501-
pymongo.collection.Collection.update_many = _original_methods["update_many"]
502-
if pymongo.collection.Collection.remove == _remove:
503-
pymongo.collection.Collection.remove = _original_methods["remove"]
504-
if pymongo.collection.Collection.delete_one == _delete_one:
505-
pymongo.collection.Collection.delete_one = _original_methods["delete_one"]
506-
if pymongo.collection.Collection.delete_many == _delete_many:
507-
pymongo.collection.Collection.delete_many = _original_methods["delete_many"]
508-
if pymongo.cursor.Cursor._refresh == _cursor_refresh:
509-
pymongo.cursor.Cursor._refresh = _original_methods["cursor_refresh"]
510-
if pymongo.command_cursor.CommandCursor._unpack_response == _unpack_response:
511-
pymongo.command_cursor.CommandCursor._unpack_response = _original_methods[
512-
"_unpack_response"
513-
]
514-
515-
516488
def reset():
517489
global queries, inserts, updates, removes, response_sizes
518490
queries = []
@@ -548,7 +520,8 @@ def _tidy_stacktrace():
548520
fname = sys._getframe(i).f_code.co_filename
549521
if ".html" in fname:
550522
fnames.append(fname)
551-
except Exception:
523+
# Stack can have not enough frames
524+
except ValueError:
552525
break
553526
fnames = list(set(fnames))
554527
trace = []

0 commit comments

Comments
 (0)