mirror of
https://github.com/tiqi-group/pydase_service_base.git
synced 2025-04-20 08:20:03 +02:00
fixing type hints
This commit is contained in:
parent
d14805ee7f
commit
f708b6d159
@ -3,6 +3,12 @@ from __future__ import annotations
|
|||||||
import logging
|
import logging
|
||||||
from typing import TYPE_CHECKING, Any, NamedTuple
|
from typing import TYPE_CHECKING, Any, NamedTuple
|
||||||
|
|
||||||
|
try:
|
||||||
|
from typing import Self # type: ignore
|
||||||
|
except ImportError:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
|
||||||
from confz import FileSource
|
from confz import FileSource
|
||||||
from influxdb_client import (
|
from influxdb_client import (
|
||||||
Bucket,
|
Bucket,
|
||||||
@ -77,7 +83,7 @@ class InfluxDBSession:
|
|||||||
self._write_api: WriteApi
|
self._write_api: WriteApi
|
||||||
self._buckets_api: BucketsApi
|
self._buckets_api: BucketsApi
|
||||||
|
|
||||||
def __enter__(self) -> InfluxDBSession:
|
def __enter__(self) -> Self:
|
||||||
self._client = InfluxDBClient(url=self.url, token=self.token, org=self.org)
|
self._client = InfluxDBClient(url=self.url, token=self.token, org=self.org)
|
||||||
self._write_api = self._client.write_api(write_options=SYNCHRONOUS) # type: ignore
|
self._write_api = self._client.write_api(write_options=SYNCHRONOUS) # type: ignore
|
||||||
return self
|
return self
|
||||||
|
@ -6,6 +6,11 @@ import logging
|
|||||||
import re
|
import re
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
try:
|
||||||
|
from typing import Self # type: ignore
|
||||||
|
except ImportError:
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from confz import FileSource
|
from confz import FileSource
|
||||||
from dateutil.parser import ParserError, parse # type: ignore
|
from dateutil.parser import ParserError, parse # type: ignore
|
||||||
from sqlmodel import Session, SQLModel, create_engine
|
from sqlmodel import Session, SQLModel, create_engine
|
||||||
@ -155,7 +160,7 @@ class PostgresDatabaseSession(Session):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def __enter__(self) -> PostgresDatabaseSession:
|
def __enter__(self) -> Self:
|
||||||
"""Begins the runtime context related to the database session."""
|
"""Begins the runtime context related to the database session."""
|
||||||
|
|
||||||
super().__enter__()
|
super().__enter__()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user