Skip to content

Commit 93ed403

Browse files
author
Andrei Neagu
committed
pylint + mypy
1 parent f54c525 commit 93ed403

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/service-library/src/servicelib/fastapi/app_state.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import logging
1+
from typing import TypeVar
22

33
from fastapi import FastAPI
44

5-
_logger = logging.getLogger(__name__)
5+
T = TypeVar("T", bound="SingletonInAppStateMixin")
66

77

88
class SingletonInAppStateMixin:
@@ -14,7 +14,7 @@ class SingletonInAppStateMixin:
1414
frozen: bool = True # Will raise if set multiple times
1515

1616
@classmethod
17-
def get_from_app_state(cls, app: FastAPI):
17+
def get_from_app_state(cls: type[T], app: FastAPI) -> T:
1818
return getattr(app.state, cls.app_state_name)
1919

2020
def set_to_app_state(self, app: FastAPI):
@@ -26,7 +26,7 @@ def set_to_app_state(self, app: FastAPI):
2626
return self.get_from_app_state(app)
2727

2828
@classmethod
29-
def pop_from_app_state(cls, app: FastAPI):
29+
def pop_from_app_state(cls: type[T], app: FastAPI) -> None:
3030
"""
3131
Raises:
3232
AttributeError: if instance is not in app.state

services/agent/src/simcore_service_agent/services/volumes_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626

2727

2828
@dataclass
29-
class VolumesManager(SingletonInAppStateMixin):
29+
class VolumesManager( # pylint:disable=too-many-instance-attributes
30+
SingletonInAppStateMixin
31+
):
3032
app: FastAPI
3133
book_keeping_interval: timedelta
3234
volume_cleanup_interval: timedelta

0 commit comments

Comments
 (0)