fix: types for sessions

This commit is contained in:
Mose Mueller 2024-12-17 07:19:57 +01:00
parent 9b2c26dc42
commit bdeb62e595

View File

@ -1,7 +1,14 @@
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .influxdb_session import InfluxDBSession # type: ignore
from .influxdbv1_session import InfluxDBv1Session # type: ignore
from .postgres_session import PostgresDatabaseSession # type: ignore
else:
class OptionalDependencyError(Exception): class OptionalDependencyError(Exception):
"""Exception raised when an optional dependency is not installed.""" """Exception raised when an optional dependency is not installed."""
try: try:
import influxdb_client # type: ignore # noqa import influxdb_client # type: ignore # noqa
@ -15,9 +22,8 @@ except ImportError:
"Please refer to https://gitlab.phys.ethz.ch/tiqi-projects/qchub/icon-services/pydase_service_base." "Please refer to https://gitlab.phys.ethz.ch/tiqi-projects/qchub/icon-services/pydase_service_base."
) )
try: try:
import influxdb # noqa import influxdb # type: ignore # noqa
from .influxdbv1_session import InfluxDBv1Session # type: ignore from .influxdbv1_session import InfluxDBv1Session # type: ignore
except ImportError: except ImportError:
@ -29,7 +35,6 @@ except ImportError:
"Please refer to https://gitlab.phys.ethz.ch/tiqi-projects/qchub/icon-services/pydase_service_base." "Please refer to https://gitlab.phys.ethz.ch/tiqi-projects/qchub/icon-services/pydase_service_base."
) )
try: try:
import sqlmodel # noqa import sqlmodel # noqa