mirror of
https://github.com/tiqi-group/pydase_service_base.git
synced 2025-06-08 21:40:41 +02:00
fix: types for sessions
This commit is contained in:
parent
9b2c26dc42
commit
bdeb62e595
@ -1,12 +1,19 @@
|
|||||||
class OptionalDependencyError(Exception):
|
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):
|
||||||
"""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
|
||||||
|
|
||||||
from .influxdb_session import InfluxDBSession # type: ignore
|
from .influxdb_session import InfluxDBSession # type: ignore
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
||||||
class InfluxDBSession: # type: ignore
|
class InfluxDBSession: # type: ignore
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
@ -15,12 +22,11 @@ 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 # type: ignore # noqa
|
||||||
import influxdb # noqa
|
|
||||||
|
|
||||||
from .influxdbv1_session import InfluxDBv1Session # type: ignore
|
from .influxdbv1_session import InfluxDBv1Session # type: ignore
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
||||||
class InfluxDBv1Session: # type: ignore
|
class InfluxDBv1Session: # type: ignore
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
@ -29,12 +35,11 @@ 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
|
||||||
|
|
||||||
from .postgres_session import PostgresDatabaseSession # type: ignore
|
from .postgres_session import PostgresDatabaseSession # type: ignore
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
||||||
class PostgresDatabaseSession: # type: ignore
|
class PostgresDatabaseSession: # type: ignore
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user