From 98724e4bf76cebdcd0765e75e39ba9e458501c1b Mon Sep 17 00:00:00 2001 From: BryanFauble <17128019+BryanFauble@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:51:31 -0700 Subject: [PATCH] Sonar cloud flagged issues --- synapseclient/core/async_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/synapseclient/core/async_utils.py b/synapseclient/core/async_utils.py index 5a621d43b..4962028e3 100644 --- a/synapseclient/core/async_utils.py +++ b/synapseclient/core/async_utils.py @@ -1,5 +1,5 @@ """This utility class is to hold any utilities that are needed for async operations.""" -from typing import Any, Callable, Coroutine +from typing import Any, Callable, Coroutine, Union from opentelemetry import trace @@ -7,7 +7,7 @@ def otel_trace_method( - method_to_trace_name, + method_to_trace_name: Union[Callable[..., str], None] = None, ) -> Callable[..., Callable[..., Coroutine[Any, Any, None]]]: """ Decorator to trace a method with OpenTelemetry in an async environment. This function @@ -32,7 +32,10 @@ async def store(self): """ def decorator(f) -> Callable[..., Coroutine[Any, Any, None]]: + """Function decorator.""" + async def wrapper(self, *arg, **kwargs) -> None: + """Wrapper for the function to be traced.""" trace_name = ( method_to_trace_name(self, *arg, **kwargs) if method_to_trace_name