Skip to content

Commit 0475f11

Browse files
author
Andrei Neagu
committed
fixed mypy
1 parent 9cb432f commit 0475f11

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class SingletonInAppStateMixin:
1515

1616
@classmethod
1717
def get_from_app_state(cls: type[T], app: FastAPI) -> T:
18-
return getattr(app.state, cls.app_state_name)
18+
return getattr(app.state, cls.app_state_name) # type:ignore[no-any-return]
1919

2020
def set_to_app_state(self, app: FastAPI):
2121
if (exists := getattr(app.state, self.app_state_name, None)) and self.frozen:
@@ -26,11 +26,11 @@ 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: type[T], app: FastAPI) -> None:
29+
def pop_from_app_state(cls: type[T], app: FastAPI) -> T:
3030
"""
3131
Raises:
3232
AttributeError: if instance is not in app.state
3333
"""
34-
old = getattr(app.state, cls.app_state_name)
34+
old = cls.get_from_app_state(app)
3535
delattr(app.state, cls.app_state_name)
3636
return old

0 commit comments

Comments
 (0)