Skip to content

Commit 8c91967

Browse files
cetagostiniclaude
andcommitted
Fix mypy union-attr errors in PanelRegression
Existing type: ignore[attr-defined] comments did not cover the union-attr error that mypy now flags on self.model.idata.posterior (self.model.idata is Any | None). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8d954f8 commit 8c91967

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

causalpy/experiments/panel_regression.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ def get_plot_data_bayesian(self, **kwargs: Any) -> pd.DataFrame:
557557
"""
558558
# Get posterior predictions
559559
if isinstance(self.model, PyMCModel):
560-
mu = self.model.idata.posterior["mu"] # type: ignore[attr-defined]
560+
mu = self.model.idata.posterior["mu"] # type: ignore[attr-defined,union-attr]
561561
pred_mean = mu.mean(dim=["chain", "draw"]).values.flatten()
562562
pred_lower = mu.quantile(0.025, dim=["chain", "draw"]).values.flatten()
563563
pred_upper = mu.quantile(0.975, dim=["chain", "draw"]).values.flatten()
@@ -673,7 +673,7 @@ def plot_unit_effects(
673673

674674
if isinstance(self.model, PyMCModel):
675675
# Bayesian: get posterior means
676-
beta = self.model.idata.posterior["beta"] # type: ignore[attr-defined]
676+
beta = self.model.idata.posterior["beta"] # type: ignore[attr-defined,union-attr]
677677
unit_fe_indices = [self.labels.index(name) for name in unit_fe_names]
678678

679679
# Get mean and std for each unit FE

0 commit comments

Comments
 (0)