Disable type checking in the __preprocess function of
diskprediction_local. This function is already collecting a lot of
`type: ignore` comments and adding more is getting difficult due to
the structure of this function. This time we were hitting errors
like:
diskprediction_local/predictor.py:160: error: Value of type "NDArray?[Any]" is not indexable [index]
diskprediction_local/predictor.py:161: error: "NDArray?[Any]" has no attribute "shape" [attr-defined]
on python 3.12.
Fixes: https://tracker.ceph.com/issues/78117
Signed-off-by: John Mulligan <jmulligan@redhat.com>
import json
import pickle
import logging
-from typing import Any, Dict, List, Optional, Sequence, Tuple
+from typing import Any, Dict, List, Optional, Sequence, Tuple, no_type_check
import numpy as np
self.model_dirpath = model_dirpath
+ @no_type_check
def __preprocess(self, disk_days: Sequence[DevSmartT], manufacturer: str) -> Optional[np.ndarray]:
"""Scales and transforms input dataframe to feed it to prediction model