From cec3aa4274b72fa139ad60e67387630c42c79b5a Mon Sep 17 00:00:00 2001 From: BryanFauble <17128019+BryanFauble@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:01:09 -0700 Subject: [PATCH] Remove return type hinting on decorator (#1050) --- synapseclient/core/async_utils.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/synapseclient/core/async_utils.py b/synapseclient/core/async_utils.py index fac7a63e9..07514fafd 100644 --- a/synapseclient/core/async_utils.py +++ b/synapseclient/core/async_utils.py @@ -1,14 +1,12 @@ """This utility class is to hold any utilities that are needed for async operations.""" -from typing import Any, Callable, Coroutine, Union +from typing import Callable, Union from opentelemetry import trace tracer = trace.get_tracer("synapseclient") -def otel_trace_method( - method_to_trace_name: Union[Callable[..., str], None] = None -) -> Callable[..., Callable[..., Coroutine[Any, Any, None]]]: +def otel_trace_method(method_to_trace_name: Union[Callable[..., str], None] = None): """ Decorator to trace a method with OpenTelemetry in an async environment. This function is specifically written to be used on a method within a class. @@ -31,7 +29,7 @@ async def store(self): A callable decorator that will trace the method with OpenTelemetry. """ - def decorator(f) -> Callable[..., Coroutine[Any, Any, None]]: + def decorator(func): """Function decorator.""" async def wrapper(self, *arg, **kwargs) -> None: @@ -41,8 +39,10 @@ async def wrapper(self, *arg, **kwargs) -> None: if method_to_trace_name else None ) - with tracer.start_as_current_span(trace_name or f"Synaspse::{f.__name__}"): - return await f(self, *arg, **kwargs) + with tracer.start_as_current_span( + trace_name or f"Synaspse::{func.__name__}" + ): + return await func(self, *arg, **kwargs) return wrapper