99from sqlmesh .core .analytics .dispatcher import AsyncEventDispatcher , NoopEventDispatcher
1010from sqlmesh .utils import str_to_bool
1111
12+ if t .TYPE_CHECKING :
13+ import sys
14+
15+ if sys .version_info >= (3 , 10 ):
16+ from typing import ParamSpec
17+ else :
18+ from typing_extensions import ParamSpec
19+
20+ _P = ParamSpec ("_P" )
21+ _T = t .TypeVar ("_T" )
22+
1223
1324def init_collector () -> AnalyticsCollector :
1425 dispatcher = (
@@ -31,9 +42,9 @@ def disable_analytics() -> None:
3142 collector = AnalyticsCollector (dispatcher = NoopEventDispatcher ())
3243
3344
34- def cli_analytics (func : t .Callable [..., t . Any ]) -> t .Callable [..., t . Any ]:
45+ def cli_analytics (func : t .Callable [_P , _T ]) -> t .Callable [_P , _T ]:
3546 @wraps (func )
36- def wrapper (* args : t . List [ t . Any ] , ** kwargs : t . Any ) -> t . Any :
47+ def wrapper (* args : _P . args , ** kwargs : _P . kwargs ) -> _T :
3748 import click
3849 from click .core import ParameterSource
3950
@@ -73,9 +84,9 @@ def wrapper(*args: t.List[t.Any], **kwargs: t.Any) -> t.Any:
7384 return wrapper
7485
7586
76- def python_api_analytics (func : t .Callable [..., t . Any ]) -> t .Callable [..., t . Any ]:
87+ def python_api_analytics (func : t .Callable [_P , _T ]) -> t .Callable [_P , _T ]:
7788 @wraps (func )
78- def wrapper (* args : t . List [ t . Any ] , ** kwargs : t . Any ) -> t . Any :
89+ def wrapper (* args : _P . args , ** kwargs : _P . kwargs ) -> _T :
7990 import inspect
8091
8192 from sqlmesh import magics
0 commit comments