From ae067ffeb0db8777c4a804f55012a409f902d6a7 Mon Sep 17 00:00:00 2001
From: Simon Mazenoux <simon.mazenoux@cern.ch>
Date: Mon, 11 Nov 2024 15:04:22 +0100
Subject: [PATCH] fix mypy

---
 .gitlab-ci.yml                  | 6 +++---
 lhcsmqh/analyses/commons.py     | 8 ++++----
 pyproject.toml                  | 1 -
 test/integration/test_qh_ccc.py | 2 +-
 test/notebook/test_notebooks.py | 2 +-
 5 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 696ba2e..6a03d74 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -92,12 +92,12 @@ integration_tests:
     - pytest test/integration --cov=lhcsmapi.api.analysis.qh --junitxml=report.xml --cov-report xml:cov.xml --cov-report term
 
 
-type_checking:
+mypy:
   stage: test
   script:
-    - pip install mypy
+    - pip install .
+    - pip install mypy pandas-stubs
     - mypy lhcsmqh
-  allow_failure: true
 
 build_wheel:
   stage: build
diff --git a/lhcsmqh/analyses/commons.py b/lhcsmqh/analyses/commons.py
index 5647143..f1ca719 100644
--- a/lhcsmqh/analyses/commons.py
+++ b/lhcsmqh/analyses/commons.py
@@ -10,13 +10,13 @@ from typing import Any
 import numpy as np
 import pandas as pd
 from lhcsmapi import reference
-from lhcsmapi.analysis import comparison
+from lhcsmapi.analysis import comparison  # type: ignore
 from lhcsmapi.analysis import features_helper as utility_features
 from lhcsmapi.api import processing, query, resolver
 from lhcsmapi.metadata import signal_metadata
 from lhcsmapi.metadata.signal_metadata import CircuitType, GenericCircuitType
-from lhcsmapi.pyedsl.dbsignal.SignalIndexConversion import SignalIndexConversion
-from lhcsmapi.signal_analysis import features as signal_analysis
+from lhcsmapi.pyedsl.dbsignal.SignalIndexConversion import SignalIndexConversion  # type: ignore
+from lhcsmapi.signal_analysis import features as signal_analysis  # type: ignore
 from lhcsmapi.signal_analysis import functions as signal_analysis_functions
 from lhcsmapi.Time import Time
 
@@ -39,7 +39,7 @@ class Event:
 
     source: str
     timestamp: int
-    circuit_type: CircuitType
+    circuit_type: str
     circuit_name: str
     u_hds: list[pd.DataFrame]
     u_hds_ref: list[pd.DataFrame]
diff --git a/pyproject.toml b/pyproject.toml
index 7fa5a21..1083a66 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -60,7 +60,6 @@ select = [
 "*.ipynb" = ["E501"] # disable line-too-long in notebooks
 
 [tool.mypy]
-# ignore_missing_imports = true
 warn_unused_configs = true
 warn_redundant_casts = true
 warn_no_return = true
diff --git a/test/integration/test_qh_ccc.py b/test/integration/test_qh_ccc.py
index 8083c7c..e3d4ed0 100644
--- a/test/integration/test_qh_ccc.py
+++ b/test/integration/test_qh_ccc.py
@@ -1,7 +1,7 @@
 import pandas as pd
 import pytest
 from numpy import nan
-from nxcals.spark_session_builder import get_or_create
+from nxcals.spark_session_builder import get_or_create  # type: ignore
 
 from lhcsmqh.analyses import VoltageCurrentResult, VoltageResult, quench_heater_ccc
 
diff --git a/test/notebook/test_notebooks.py b/test/notebook/test_notebooks.py
index 2072618..f2426dd 100644
--- a/test/notebook/test_notebooks.py
+++ b/test/notebook/test_notebooks.py
@@ -1,6 +1,6 @@
 import pathlib
 
-import papermill
+import papermill  # type: ignore
 import pytest
 
 
-- 
GitLab