From 01d77f26bd7d79197d740d156172c15ca5d3db9d Mon Sep 17 00:00:00 2001 From: eelcovdw Date: Thu, 26 Sep 2024 13:21:41 +0200 Subject: [PATCH] fix decorator returntype --- packages/syft/src/syft/util/telemetry.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/syft/src/syft/util/telemetry.py b/packages/syft/src/syft/util/telemetry.py index 99a95d991d1..e0449dad92c 100644 --- a/packages/syft/src/syft/util/telemetry.py +++ b/packages/syft/src/syft/util/telemetry.py @@ -3,6 +3,7 @@ import logging import os from typing import Any +from typing import TYPE_CHECKING from typing import TypeVar # relative @@ -131,4 +132,8 @@ def instrument_sqlalchemny() -> None: logger.error(f"Failed to load SQLAlchemyInstrumentor. {e}") -instrument = setup_instrumenter() +if TYPE_CHECKING: + # To let static type checker know the returntype of instrument decorators + instrument = no_instrument +else: + instrument = setup_instrumenter()