Skip to content

Commit

Permalink
Ignore the remaining MyPy typing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
e10e3 committed Jan 16, 2025
1 parent f0f2bea commit c2a4aa9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions river/anomaly/pad.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ def learn_one(self, x: dict | None, y: base.typing.Target | float):
else:
self.predictive_model.learn_one(y=y, x=x)
else:
self.predictive_model.learn_one(x=x, y=y)
self.predictive_model.learn_one(x=x, y=y) # type: ignore[union-attr]

def score_one(self, x: dict, y: base.typing.Target):
# Return the predicted value of x from the predictive model, first by checking whether
# it is a time-series forecaster.
if isinstance(self.predictive_model, time_series.base.Forecaster):
y_pred = self.predictive_model.forecast(self.horizon)[0]
else:
y_pred = self.predictive_model.predict_one(x)
y_pred = self.predictive_model.predict_one(x) # type: ignore[union-attr]

# Calculate the squared error
squared_error = (y_pred - y) ** 2
Expand Down
2 changes: 1 addition & 1 deletion river/preprocessing/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def transform_many(self, X: pd.DataFrame):
# Check if the dtype is integer type and convert to corresponding float type
if np.issubdtype(dtype, np.integer):
bytes_size = dtype.itemsize
dtype = np.dtype(f"float{bytes_size * 8}")
dtype = np.dtype(f"float{bytes_size * 8}") # type: ignore[operator]

means = np.array([self.means[c] for c in X.columns], dtype=dtype)
Xt = X.values - means
Expand Down
8 changes: 4 additions & 4 deletions river/stream/qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ def simulate_qa(

mementos: list[Memento] = []

kwargs: list
kwargs_list: list

for i, (x, y, *kwargs) in enumerate(dataset):
kwargs = kwargs[0] if kwargs else None
for i, (x, y, *kwargs_list) in enumerate(dataset):
kwargs = kwargs_list[0] if kwargs_list else None

t = get_moment(i, x)
d = get_delay(x, y) # type: ignore
Expand All @@ -168,7 +168,7 @@ def simulate_qa(
)
del mementos[0]

queue(mementos, Memento(i, x, y, kwargs, t + d))
queue(mementos, Memento(i, x, y, kwargs, t + d)) # type: ignore[operator]
if copy:
x = deepcopy(x)
yield (i, x, None, kwargs) if kwargs else (i, x, None)
Expand Down

0 comments on commit c2a4aa9

Please sign in to comment.