Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion confidence_interval_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from IPython.display import HTML
import pandas as pd
import six
from six.moves import range
from six.moves import range # pyrefly: ignore[missing-source-for-stubs]


CSS = '''
Expand Down
6 changes: 3 additions & 3 deletions metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ def get_extra_idx(self, return_superset=False):
"""
extra_idx = self.extra_index[:] # pyrefly: ignore[bad-index]
children_idx = [
c.get_extra_idx(return_superset)
c.get_extra_idx(return_superset) # pyrefly: ignore[missing-attribute]
for c in self.children
if utils.is_metric(c)
]
Expand Down Expand Up @@ -1406,7 +1406,7 @@ def get_sql_and_with_clause(self, table, split_by, global_filter, indexes,
sql.Filters(self.where_).add(local_filter).remove(global_filter)
)
children_sql = [
c.get_sql_and_with_clause(table, split_by, global_filter, indexes,
c.get_sql_and_with_clause(table, split_by, global_filter, indexes, # pyrefly: ignore[missing-attribute]
local_filter, with_data)[0]
for c in self.children
]
Expand Down Expand Up @@ -1653,7 +1653,7 @@ def get_sql_and_with_clause(self, table, split_by, global_filter, indexes,

if not isinstance(self.children[0], Metric):
constant = self.children[0]
query, with_data = self.children[1].get_sql_and_with_clause(
query, with_data = self.children[1].get_sql_and_with_clause( # pyrefly: ignore[missing-attribute]
table, split_by, global_filter, indexes, local_filter, with_data)
query.columns = sql.Columns(
(c if c in indexes else op(constant, c) for c in query.columns))
Expand Down
2 changes: 1 addition & 1 deletion models.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(
'y must be a 1D array but is %iD!' % operations.count_features(y)
)
if isinstance(x, metrics.MetricList):
x = list(x.children)
x = list(x.children) # pyrefly: ignore[bad-assignment]
elif isinstance(x, (metrics.Metric, str)):
x = [x]
elif x:
Expand Down
40 changes: 20 additions & 20 deletions operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def get_sql_and_with_clause(self, table, split_by, global_filter, indexes,
sql.Filters(self.where_).add(local_filter).remove(global_filter)
)
all_split_by = sql.Columns(split_by).add(self.extra_split_by)
child_sql, with_data = self.children[0].get_sql_and_with_clause(
child_sql, with_data = self.children[0].get_sql_and_with_clause( # pyrefly: ignore[missing-attribute]
table, all_split_by, global_filter, indexes, local_filter, with_data)
child_table = sql.Datasource(child_sql, 'DistributionRaw')
child_table_alias = with_data.merge(child_table)
Expand Down Expand Up @@ -554,7 +554,7 @@ def get_change_raw_sql(
sql.Filters(self.where_).add(local_filter).remove(global_filter)
)
groupby = sql.Columns(split_by).add(self.extra_split_by)
raw_table_sql, with_data = self.children[0].get_sql_and_with_clause(
raw_table_sql, with_data = self.children[0].get_sql_and_with_clause( # pyrefly: ignore[missing-attribute]
table, groupby, global_filter, indexes, local_filter, with_data
)
return raw_table_sql, with_data
Expand Down Expand Up @@ -965,7 +965,7 @@ def get_change_raw_sql(
)
all_split_by = sql.Columns(split_by).add(self.extra_split_by)
all_indexes = sql.Columns(split_by).add(self.extra_index)
child_sql, with_data = self.children[0].get_sql_and_with_clause(
child_sql, with_data = self.children[0].get_sql_and_with_clause( # pyrefly: ignore[missing-attribute]
table, all_split_by, global_filter, indexes, local_filter, with_data)
child_table = sql.Datasource(child_sql, 'PrePostRaw')
child_table_alias = with_data.merge(child_table)
Expand Down Expand Up @@ -1036,7 +1036,7 @@ def get_equivalent_without_filter(self, *auxiliary_cols):
self.name_tmpl, # pyrefly: ignore[bad-argument-type]
)
for b, c in zip(self.child, self.covariates)
], where=self.children[0].where_)
], where=self.children[0].where_) # pyrefly: ignore[missing-attribute]


class CUPED(AbsoluteChange):
Expand Down Expand Up @@ -1308,7 +1308,7 @@ def get_change_raw_sql(
)
all_split_by = sql.Columns(split_by).add(self.extra_split_by)
all_indexes = sql.Columns(split_by).add(self.extra_index)
child_sql, with_data = self.children[0].get_sql_and_with_clause(
child_sql, with_data = self.children[0].get_sql_and_with_clause( # pyrefly: ignore[missing-attribute]
table, all_split_by, global_filter, indexes, local_filter, with_data)
child_table = sql.Datasource(child_sql, 'CUPEDRaw')
child_table_alias = with_data.merge(child_table)
Expand Down Expand Up @@ -1384,7 +1384,7 @@ def get_equivalent_without_filter(self, *auxiliary_cols):
self.name_tmpl, # pyrefly: ignore[bad-argument-type]
)
for b, c in zip(self.child, self.covariates)
], where=self.children[0].where_)
], where=self.children[0].where_) # pyrefly: ignore[missing-attribute]


class MH(Comparison):
Expand Down Expand Up @@ -1457,13 +1457,13 @@ def compute_children(self,
children = []
for m in child.children:
util_metric = metrics.MetricList(
[metrics.MetricList(m.children, where=m.where_)], where=child.where_
[metrics.MetricList(m.children, where=m.where_)], where=child.where_ # pyrefly: ignore[missing-attribute]
)
children.append(
self.compute_util_metric_on(
util_metric, df, split_by, cache_key=cache_key))
return children
util_metric = metrics.MetricList(child.children, where=child.where_)
util_metric = metrics.MetricList(child.children, where=child.where_) # pyrefly: ignore[missing-attribute]
return self.compute_util_metric_on(
util_metric, df, split_by, cache_key=cache_key)

Expand Down Expand Up @@ -1512,7 +1512,7 @@ def compute_children_sql(self, table, split_by=None, execute=None, mode=None):
children = []
for m in child.children:
util_metric = metrics.MetricList(
[metrics.MetricList(m.children, where=m.where_)], where=child.where_
[metrics.MetricList(m.children, where=m.where_)], where=child.where_ # pyrefly: ignore[missing-attribute]
)
c = self.compute_util_metric_on_sql(
util_metric,
Expand All @@ -1522,7 +1522,7 @@ def compute_children_sql(self, table, split_by=None, execute=None, mode=None):
mode=mode)
children.append(c)
return children
util_metric = metrics.MetricList(child.children, where=child.where_)
util_metric = metrics.MetricList(child.children, where=child.where_) # pyrefly: ignore[missing-attribute]
return self.compute_util_metric_on_sql(
util_metric, table, split_by + self.extra_split_by, execute, mode=mode) # pyrefly: ignore[unsupported-operation]

Expand Down Expand Up @@ -1598,7 +1598,7 @@ def get_sql_and_with_clause(self, table, split_by, global_filter, indexes,
grandchildren.append(metrics.MetricList(m.children, where=m.where_))
util_metric = metrics.MetricList(grandchildren, where=child.where_)
else:
util_metric = metrics.MetricList(child.children, where=child.where_)
util_metric = metrics.MetricList(child.children, where=child.where_) # pyrefly: ignore[missing-attribute]

cond_cols = sql.Columns(self.extra_index)
groupby = sql.Columns(split_by).add(self.extra_split_by)
Expand Down Expand Up @@ -1666,13 +1666,13 @@ def get_sql_and_with_clause(self, table, split_by, global_filter, indexes,
alias=alias_tmpl.format(c.name))) # pyrefly: ignore[missing-attribute]
else:
with_data2 = copy.deepcopy(with_data)
util = metrics.MetricList(child.children[:1], where=child.where_)
util = metrics.MetricList(child.children[:1], where=child.where_) # pyrefly: ignore[missing-attribute]
numer_sql, with_data2 = util.get_sql_and_with_clause(
table, groupby, global_filter, util_indexes, local_filter, with_data2)
with_data2.merge(sql.Datasource(numer_sql))
numer = numer_sql.columns[-1].alias
with_data2 = copy.deepcopy(with_data)
util = metrics.MetricList(child.children[1:], where=child.where_)
util = metrics.MetricList(child.children[1:], where=child.where_) # pyrefly: ignore[missing-attribute]
denom_sql, with_data2 = util.get_sql_and_with_clause(
table, groupby, global_filter, util_indexes, local_filter, with_data2)
with_data2.merge(sql.Datasource(denom_sql))
Expand Down Expand Up @@ -2048,7 +2048,7 @@ def compute_on_samples(
cache_key, sample = keyed_sample
if cache_key is None:
# If samples are unlikely to repeat, don't save res to self.cache.
res = self.children[0].compute_on(sample, split_by, melted=True)
res = self.children[0].compute_on(sample, split_by, melted=True) # pyrefly: ignore[missing-attribute]
else:
res = self.compute_child(
sample, split_by, melted=True, cache_key=cache_key
Expand Down Expand Up @@ -2517,7 +2517,7 @@ def get_sql_and_with_clause(
)
se_alias = with_data.merge(sql.Datasource(se, name + 'SE'))

pt_est, with_data = self.children[0].get_sql_and_with_clause(
pt_est, with_data = self.children[0].get_sql_and_with_clause( # pyrefly: ignore[missing-attribute]
table, split_by, global_filter, indexes, local_filter, with_data
)
pt_est_alias = with_data.merge(
Expand Down Expand Up @@ -2870,7 +2870,7 @@ def compute_children_sql(
m.name = m.var
leafs = metrics.MetricList(tuple(set(leafs)))
if len(leafs) == 1:
leafs.name = leafs.children[0].name
leafs.name = leafs.children[0].name # pyrefly: ignore[missing-attribute]
bucket_res = self.compute_util_metric_on_sql(
leafs, table, all_split_by, execute, mode=mode
)
Expand Down Expand Up @@ -3310,7 +3310,7 @@ def compute_children_sql(
resampled.with_data = with_data
replicates = []
for _ in range(self.n_replicates // batch_size):
bst = self.children[0].compute_on_sql(
bst = self.children[0].compute_on_sql( # pyrefly: ignore[missing-attribute]
resampled, ['meterstick_resample_idx'] + split_by, execute, True, mode
)
replicates.append(bst.unstack('meterstick_resample_idx'))
Expand All @@ -3325,7 +3325,7 @@ def compute_children_sql(
)
resampled = with_data2.children.popitem()[1]
resampled.with_data = with_data2
bst = self.children[0].compute_on_sql(
bst = self.children[0].compute_on_sql( # pyrefly: ignore[missing-attribute]
resampled, ['meterstick_resample_idx'] + split_by, execute, True, mode
)
replicates.append(bst.unstack('meterstick_resample_idx'))
Expand Down Expand Up @@ -4403,7 +4403,7 @@ def get_sql_and_with_clause(
local_filter = (
sql.Filters(self.where_).add(local_filter).remove(global_filter)
)
child_sql, with_data = self.children[0].get_sql_and_with_clause(
child_sql, with_data = self.children[0].get_sql_and_with_clause( # pyrefly: ignore[missing-attribute]
table, split_by, global_filter, indexes, local_filter, with_data)
columns = sql.Columns()
for c in child_sql.all_columns:
Expand Down Expand Up @@ -4576,7 +4576,7 @@ def _check_and_update_for_log_transformed_abs_change(self):
# Deepcopy the relevant parts of the tree to avoid modifying the original.
ci_method = copy.deepcopy(ci_method)
ab = ci_method.children[0]
log_transform = ab.children[0]
log_transform = ab.children[0] # pyrefly: ignore[missing-attribute]

self.name_tmpl = '{}'
log_transform = LogTransform(
Expand Down
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,4 +697,4 @@ def pcollection_to_df_via_file_io(
if not res:
return pd.DataFrame()
concat_res = pd.concat(res, ignore_index=True)
return concat_res
return concat_res # pyrefly: ignore[bad-return]