SIENTIAPDE-1243: Fix: Resolved mypy errors and added pandas stubs. Addressed type hinting issues and suppressed mypy warnings to improve code quality and maintainability.

This commit is contained in:
Bruno Domingues
2025-10-01 17:36:47 -03:00
parent dfc190c818
commit 8bcee4c6a0
4 changed files with 16 additions and 7 deletions

View File

@@ -17,7 +17,7 @@ from os import makedirs, path, remove
import mlflow
import pandas as pd
from sientia.ModelServing import ModelServing
from sientia.ModelServing import ModelServing # type: ignore[import-untyped]
from sientia_do.observability.logger import Logger
from sientia_do.temporal.constants import DATETIME_FORMAT_WITH_TZ
@@ -214,7 +214,7 @@ class MLFlowRepository:
# load predictor model
predictor_uri = f'models:/{model_name}/production'
# load transform model
latest_production_id = self.model_serving.get_model_run_id(model_name, stage='Production')
latest_production_id = self.model_serving.get_model_info(model_name) # type: ignore[no-any-return]
transform_uri = self.model_serving.get_model_uri(latest_production_id, prediction=False)
# load
data_model = mlflow.sklearn.load_model(transform_uri)
@@ -336,11 +336,10 @@ class MLFlowRepository:
ValueError: If the experiment name is not found
"""
experiment = mlflow.get_experiment_by_name(experiment_name)
if experiment is None:
raise ValueError(f'Experiment {experiment_name} not found')
return int(experiment.experiment_id)
return experiment.experiment_id # type: ignore[no-any-return]
def get_experiment_last_run(self, experiment_id: int) -> str:
"""