]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr: disable type checking in diskprediction_local 70094/head
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 9 Jul 2026 20:12:11 +0000 (16:12 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 9 Jul 2026 20:12:11 +0000 (16:12 -0400)
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>
src/pybind/mgr/diskprediction_local/predictor.py

index 858c52965941ccbf015633976bc7ba217418aeae..0e36a1d89c7a2fe14d2233d3c7e13e6cc8de338e 100644 (file)
@@ -26,7 +26,7 @@ import os
 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
 
@@ -119,6 +119,7 @@ class RHDiskFailurePredictor(Predictor):
 
         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