From 1877b05e292172e7507901b11b2460eb99923ce1 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 3 Apr 2024 14:43:25 +0200 Subject: Moving PrintCallStack decorator. --- src/argaze/utils/UtilsFeatures.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/argaze/utils/UtilsFeatures.py b/src/argaze/utils/UtilsFeatures.py index d9d6c41..f24c562 100644 --- a/src/argaze/utils/UtilsFeatures.py +++ b/src/argaze/utils/UtilsFeatures.py @@ -167,6 +167,24 @@ def tuple_to_string(t: tuple, separator: str = ", ") -> str: return separator.join(f'\"{e}\"' for e in t) +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 + class FileWriter(DataFeatures.PipelineStepObject): """Write data into a file line by line.""" @@ -361,24 +379,6 @@ class VideoWriter(DataFeatures.PipelineStepObject, DataFeatures.SharedObject): if self.__process.poll() is None: # Resize image to adapt to video resolution - output = cv2.resize(image, dsize=(self.__width, self.__height), interpolation=cv2.INTER_LINEAR) + output = cv2.resize(image, dsize=(self.__width, self.__height), interpolation=cv2.INTER_LINEAR) self.__process.stdin.write(output.tobytes()) - -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 -- cgit v1.1