mirror of
https://github.com/tiqi-group/pydase_service_base.git
synced 2025-06-06 12:40:41 +02:00
fix: types for sessions
This commit is contained in:
parent
9b2c26dc42
commit
bdeb62e595
@ -1,47 +1,52 @@
|
||||
class OptionalDependencyError(Exception):
|
||||
"""Exception raised when an optional dependency is not installed."""
|
||||
|
||||
|
||||
try:
|
||||
import influxdb_client # type: ignore # noqa
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .influxdb_session import InfluxDBSession # type: ignore
|
||||
except ImportError:
|
||||
|
||||
class InfluxDBSession: # type: ignore
|
||||
def __init__(self) -> None:
|
||||
raise OptionalDependencyError(
|
||||
"InfluxDBSession requires the 'influxdbv2' extra. "
|
||||
"Please refer to https://gitlab.phys.ethz.ch/tiqi-projects/qchub/icon-services/pydase_service_base."
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
import influxdb # noqa
|
||||
|
||||
from .influxdbv1_session import InfluxDBv1Session # type: ignore
|
||||
except ImportError:
|
||||
|
||||
class InfluxDBv1Session: # type: ignore
|
||||
def __init__(self) -> None:
|
||||
raise OptionalDependencyError(
|
||||
"InfluxDBv1Session requires the 'influxdbv1' extra. "
|
||||
"Please refer to https://gitlab.phys.ethz.ch/tiqi-projects/qchub/icon-services/pydase_service_base."
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
import sqlmodel # noqa
|
||||
|
||||
from .postgres_session import PostgresDatabaseSession # type: ignore
|
||||
except ImportError:
|
||||
else:
|
||||
|
||||
class PostgresDatabaseSession: # type: ignore
|
||||
def __init__(self) -> None:
|
||||
raise OptionalDependencyError(
|
||||
"PostgresDatabaseSession requires the 'postgresql' extra. "
|
||||
"Please refer to https://gitlab.phys.ethz.ch/tiqi-projects/qchub/icon-services/pydase_service_base."
|
||||
)
|
||||
class OptionalDependencyError(Exception):
|
||||
"""Exception raised when an optional dependency is not installed."""
|
||||
|
||||
try:
|
||||
import influxdb_client # type: ignore # noqa
|
||||
|
||||
from .influxdb_session import InfluxDBSession # type: ignore
|
||||
except ImportError:
|
||||
|
||||
class InfluxDBSession: # type: ignore
|
||||
def __init__(self) -> None:
|
||||
raise OptionalDependencyError(
|
||||
"InfluxDBSession requires the 'influxdbv2' extra. "
|
||||
"Please refer to https://gitlab.phys.ethz.ch/tiqi-projects/qchub/icon-services/pydase_service_base."
|
||||
)
|
||||
|
||||
try:
|
||||
import influxdb # type: ignore # noqa
|
||||
|
||||
from .influxdbv1_session import InfluxDBv1Session # type: ignore
|
||||
except ImportError:
|
||||
|
||||
class InfluxDBv1Session: # type: ignore
|
||||
def __init__(self) -> None:
|
||||
raise OptionalDependencyError(
|
||||
"InfluxDBv1Session requires the 'influxdbv1' extra. "
|
||||
"Please refer to https://gitlab.phys.ethz.ch/tiqi-projects/qchub/icon-services/pydase_service_base."
|
||||
)
|
||||
|
||||
try:
|
||||
import sqlmodel # noqa
|
||||
|
||||
from .postgres_session import PostgresDatabaseSession # type: ignore
|
||||
except ImportError:
|
||||
|
||||
class PostgresDatabaseSession: # type: ignore
|
||||
def __init__(self) -> None:
|
||||
raise OptionalDependencyError(
|
||||
"PostgresDatabaseSession requires the 'postgresql' extra. "
|
||||
"Please refer to https://gitlab.phys.ethz.ch/tiqi-projects/qchub/icon-services/pydase_service_base."
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["InfluxDBSession", "InfluxDBv1Session", "PostgresDatabaseSession"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user