aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2024-02-20 14:56:59 +0100
committerThéo de la Hogue2024-02-20 14:56:59 +0100
commit5cc9ec620ff94287e7f622c927b5a928588e2a7a (patch)
tree0c3373dd18c20b5a1e85bbe6d9f0faddf1a9d94c /src
parent511f641239ee40f9fc142c9d2873298924e4bc41 (diff)
downloadargaze-5cc9ec620ff94287e7f622c927b5a928588e2a7a.zip
argaze-5cc9ec620ff94287e7f622c927b5a928588e2a7a.tar.gz
argaze-5cc9ec620ff94287e7f622c927b5a928588e2a7a.tar.bz2
argaze-5cc9ec620ff94287e7f622c927b5a928588e2a7a.tar.xz
Adding PrintCallStack decorator to help in debug process.
Diffstat (limited to 'src')
-rw-r--r--src/argaze/utils/UtilsFeatures.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/argaze/utils/UtilsFeatures.py b/src/argaze/utils/UtilsFeatures.py
index da7565b..0a22aaf 100644
--- a/src/argaze/utils/UtilsFeatures.py
+++ b/src/argaze/utils/UtilsFeatures.py
@@ -10,6 +10,7 @@ __license__ = "BSD"
from typing import Tuple
import time
import types
+import traceback
import numpy
import cv2
@@ -261,4 +262,22 @@ class VideoWriter():
# Terminate the sub-process
# Note: We don't have to terminate the sub-process (after process.wait(), the sub-process is supposed to be closed).
- self.__process.terminate() \ No newline at end of file
+ self.__process.terminate()
+
+def PrintCallStack(method):
+ """Define a decorator to print call stack until the decorated method."""
+
+ def wrapper(self, *args, **kwargs):
+ """Wrap method to print call stack before its call.
+
+ Parameters:
+ args: method arguments.
+ kwargs: extra arguments.
+ """
+ print(f'Call stack until method \'{method.__name__}\':', )
+
+ traceback.print_stack()
+
+ return method(self, *args, **kwargs)
+
+ return wrapper \ No newline at end of file