@@ -34,7 +34,7 @@ class ExperimentResult(
34
34
"pvalue" ,
35
35
)
36
36
37
- def to_dicts (self ) -> tuple [dict [str , Any ], ...]:
37
+ def to_dicts (self ) -> tuple [dict [str , object ], ...]:
38
38
"""Convert the result to a sequence of dictionaries.
39
39
40
40
Examples:
@@ -77,11 +77,11 @@ def to_dicts(self) -> tuple[dict[str, Any], ...]:
77
77
return tuple (
78
78
{"metric" : k } | (v if isinstance (v , dict ) else v ._asdict ())
79
79
for k , v in self .items ()
80
- )
80
+ ) # type: ignore
81
81
82
82
83
83
class ExperimentResults (
84
- UserDict [tuple [Any , Any ], ExperimentResult ],
84
+ UserDict [tuple [object , object ], ExperimentResult ],
85
85
tea_tasting .utils .DictsReprMixin ,
86
86
):
87
87
"""Experiment results for multiple pairs of variants."""
@@ -95,7 +95,7 @@ class ExperimentResults(
95
95
"pvalue" ,
96
96
)
97
97
98
- def to_dicts (self ) -> tuple [dict [str , Any ], ...]:
98
+ def to_dicts (self ) -> tuple [dict [str , object ], ...]:
99
99
"""Convert the result to a sequence of dictionaries."""
100
100
return tuple (
101
101
{"variants" : str (variants )} | metric_result
@@ -111,7 +111,7 @@ class ExperimentPowerResult(
111
111
"""Result of the analysis of power in a experiment."""
112
112
default_keys = ("metric" , "power" , "effect_size" , "rel_effect_size" , "n_obs" )
113
113
114
- def to_dicts (self ) -> tuple [dict [str , Any ], ...]:
114
+ def to_dicts (self ) -> tuple [dict [str , object ], ...]:
115
115
"""Convert the result to a sequence of dictionaries."""
116
116
dicts = ()
117
117
for metric , results in self .items ():
@@ -230,7 +230,7 @@ def __init__(
230
230
def analyze (
231
231
self ,
232
232
data : narwhals .typing .IntoFrame | ibis .expr .types .Table ,
233
- control : Any = None ,
233
+ control : object = None ,
234
234
* ,
235
235
all_variants : Literal [False ] = False ,
236
236
) -> ExperimentResult :
@@ -240,7 +240,7 @@ def analyze(
240
240
def analyze (
241
241
self ,
242
242
data : narwhals .typing .IntoFrame | ibis .expr .types .Table ,
243
- control : Any = None ,
243
+ control : object = None ,
244
244
* ,
245
245
all_variants : Literal [True ] = True ,
246
246
) -> ExperimentResults :
@@ -249,7 +249,7 @@ def analyze(
249
249
def analyze (
250
250
self ,
251
251
data : narwhals .typing .IntoFrame | ibis .expr .types .Table ,
252
- control : Any = None ,
252
+ control : object = None ,
253
253
* ,
254
254
all_variants : bool = False ,
255
255
) -> ExperimentResult | ExperimentResults :
@@ -273,7 +273,7 @@ def analyze(
273
273
variants = granular_data .keys ()
274
274
else :
275
275
variants = self ._read_variants (data )
276
- variants = sorted (variants )
276
+ variants = sorted (variants ) # type: ignore
277
277
278
278
if control is not None :
279
279
variant_pairs = tuple (
@@ -318,10 +318,10 @@ def _analyze_metric(
318
318
self ,
319
319
metric : tea_tasting .metrics .MetricBase [Any ],
320
320
data : narwhals .typing .IntoFrame | ibis .expr .types .Table ,
321
- aggregated_data : dict [Any , tea_tasting .aggr .Aggregates ] | None ,
322
- granular_data : dict [Any , pa .Table ] | None ,
323
- control : Any ,
324
- treatment : Any ,
321
+ aggregated_data : dict [object , tea_tasting .aggr .Aggregates ] | None ,
322
+ granular_data : dict [object , pa .Table ] | None ,
323
+ control : object ,
324
+ treatment : object ,
325
325
) -> tea_tasting .metrics .MetricResult :
326
326
if (
327
327
isinstance (metric , tea_tasting .metrics .MetricBaseAggregated )
@@ -342,8 +342,8 @@ def _read_data(
342
342
self ,
343
343
data : narwhals .typing .IntoFrame | ibis .expr .types .Table ,
344
344
) -> tuple [
345
- dict [Any , tea_tasting .aggr .Aggregates ] | None ,
346
- dict [Any , pa .Table ] | None ,
345
+ dict [object , tea_tasting .aggr .Aggregates ] | None ,
346
+ dict [object , pa .Table ] | None ,
347
347
]:
348
348
aggr_cols = tea_tasting .metrics .AggrCols ()
349
349
gran_cols = set ()
@@ -371,7 +371,7 @@ def _read_data(
371
371
def _read_variants (
372
372
self ,
373
373
data : narwhals .typing .IntoFrame | ibis .expr .types .Table ,
374
- ) -> list [Any ]:
374
+ ) -> list [object ]:
375
375
if isinstance (data , ibis .expr .types .Table ):
376
376
return (
377
377
data .select (self .variant )
0 commit comments