SIENTIAPDE-1243: Add type ignores and fix datetime index formatting in gates and model repository.

This commit is contained in:
Bruno Domingues
2025-10-01 17:44:45 -03:00
parent 8bcee4c6a0
commit ef3c2a0c8a
2 changed files with 10 additions and 10 deletions

View File

@@ -126,9 +126,9 @@ class Gates(BaseActivity):
self.error(f'Filter {fil} not found', metadata)
continue
try:
if input_filter_functions[fil](data, config['config']):
if input_filter_functions[fil](data, config['config']): # type: ignore[operator]
self.debug(f'Data not passed the input filter {fil}:{config}', metadata)
filter_output.append(config['policy'])
filter_output.append(config['policy']) # type: ignore[index]
except Exception as e: # noqa: BLE001
trace = traceback.format_exc()
self.send_notification(
@@ -145,7 +145,7 @@ class Gates(BaseActivity):
self.info(f'Input gate result: {path_flag}', metadata)
return (
path_flag,
input_filter_functions['path_confidence'][path_flag],
input_filter_functions['path_confidence'][path_flag], # type: ignore[index]
'Input data with bad quality',
)
@@ -205,8 +205,8 @@ class Gates(BaseActivity):
self.error(f'Filter {fil} not found', metadata)
continue
try:
if mlflow_response_filter_functions[fil](data, config):
filter_output.append(config['policy'])
if mlflow_response_filter_functions[fil](data, config): # type: ignore[operator]
filter_output.append(config['policy']) # type: ignore[index]
comments.append(data['content']['message'])
self.send_notification(
metadata=metadata,
@@ -232,7 +232,7 @@ class Gates(BaseActivity):
self.info(f'Mlflow response gate result: {path_flag}', metadata)
return (
path_flag,
mlflow_response_filter_functions['path_confidence'][path_flag],
mlflow_response_filter_functions['path_confidence'][path_flag], # type: ignore[index]
', '.join(comments),
)
@@ -290,8 +290,8 @@ class Gates(BaseActivity):
if fil not in mlflow_content_filter_functions:
continue
try:
if mlflow_content_filter_functions[fil](data, config):
filter_output.append(config['policy'])
if mlflow_content_filter_functions[fil](data, config): # type: ignore[operator]
filter_output.append(config['policy']) # type: ignore[index]
self.send_notification(
metadata=metadata,
notification_id=f'{gate_type.upper()}_GATE_CONTENT_FILTER__{fil}',
@@ -316,7 +316,7 @@ class Gates(BaseActivity):
self.info(f'Mlflow content gate result: {path_flag}', metadata)
return (
path_flag,
mlflow_content_filter_functions['path_confidence'][path_flag],
mlflow_content_filter_functions['path_confidence'][path_flag], # type: ignore[index]
'Transformed data not passed the content filter',
)

View File

@@ -58,7 +58,7 @@ class MLFlowRepository:
raise ValueError(f'{message}') from e
elif index_type == datetime or index_type == pd.Timestamp:
data.index = data.index.strftime(DATETIME_FORMAT_WITH_TZ)
data.index = data.index.strftime(DATETIME_FORMAT_WITH_TZ) # type: ignore[attr-defined]
else:
raise ValueError(f'{message}')