Skip to content

Commit 1433bb1

Browse files
committed
rename
1 parent 472cc7d commit 1433bb1

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
_logger = logging.getLogger(__name__)
66

77

8-
class AppStateMixin:
8+
class SingletonInAppStateMixin:
99
"""
1010
Mixin to get, set and delete an instance of 'self' from/to app.state
1111
"""

packages/service-library/tests/fastapi/test_http_client.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
from asgi_lifespan import LifespanManager
1414
from fastapi import FastAPI, status
1515
from models_library.healthchecks import IsResponsive
16-
from servicelib.fastapi.app_state import AppStateMixin
16+
from servicelib.fastapi.app_state import SingletonInAppStateMixin
1717
from servicelib.fastapi.http_client import BaseHttpApi
1818

1919

2020
def test_using_app_state_mixin():
21-
class SomeData(AppStateMixin):
21+
class SomeData(SingletonInAppStateMixin):
2222
app_state_name: str = "my_data"
2323
frozen: bool = True
2424

@@ -71,7 +71,7 @@ def mock_server_api(base_url: str) -> Iterator[respx.MockRouter]:
7171

7272

7373
async def test_base_http_api(mock_server_api: respx.MockRouter, base_url: str):
74-
class MyClientApi(BaseHttpApi, AppStateMixin):
74+
class MyClientApi(BaseHttpApi, SingletonInAppStateMixin):
7575
app_state_name: str = "my_client_api"
7676

7777
new_app = FastAPI()

services/payments/src/simcore_service_payments/api/rest/_dependencies.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from fastapi import Depends, FastAPI, Request
66
from fastapi.security import OAuth2PasswordBearer
7-
from servicelib.fastapi.app_state import AppStateMixin
7+
from servicelib.fastapi.app_state import SingletonInAppStateMixin
88
from servicelib.fastapi.dependencies import get_app, get_reverse_url_mapper
99
from sqlalchemy.ext.asyncio import AsyncEngine
1010

@@ -44,7 +44,9 @@ def get_rut_api(request: Request) -> ResourceUsageTrackerApi:
4444
)
4545

4646

47-
def get_from_app_state(app_state_mixin_subclass: type[AppStateMixin]) -> Callable:
47+
def get_from_app_state(
48+
app_state_mixin_subclass: type[SingletonInAppStateMixin],
49+
) -> Callable:
4850
"""Generic getter of app.state objects"""
4951

5052
def _(app: Annotated[FastAPI, Depends(get_app)]):

services/payments/src/simcore_service_payments/services/notifier.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
PaymentTransaction,
1414
)
1515
from models_library.users import UserID
16-
from servicelib.fastapi.app_state import AppStateMixin
16+
from servicelib.fastapi.app_state import SingletonInAppStateMixin
1717

1818
from ..db.payment_users_repo import PaymentsUsersRepo
1919
from .postgres import get_engine
2020

2121
_logger = logging.getLogger(__name__)
2222

2323

24-
class Notifier(AppStateMixin):
24+
class Notifier(SingletonInAppStateMixin):
2525
app_state_name: str = "notifier"
2626

2727
def __init__(

services/payments/src/simcore_service_payments/services/payments_gateway.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
from models_library.api_schemas_webserver.wallets import PaymentID, PaymentMethodID
1919
from pydantic import ValidationError, parse_raw_as
2020
from pydantic.errors import PydanticErrorMixin
21-
from servicelib.fastapi.http_client import AppStateMixin, BaseHttpApi, to_curl_command
21+
from servicelib.fastapi.app_state import SingletonInAppStateMixin
22+
from servicelib.fastapi.http_client import BaseHttpApi
23+
from servicelib.fastapi.httpx_utils import to_curl_command
2224
from simcore_service_payments.models.schemas.acknowledgements import (
2325
AckPaymentWithPaymentMethod,
2426
)
@@ -105,7 +107,7 @@ def auth_flow(self, request):
105107
yield request
106108

107109

108-
class PaymentsGatewayApi(BaseHttpApi, AppStateMixin):
110+
class PaymentsGatewayApi(BaseHttpApi, SingletonInAppStateMixin):
109111
app_state_name: str = "payment_gateway_api"
110112

111113
#

services/payments/src/simcore_service_payments/services/resource_usage_tracker.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
from models_library.resource_tracker import CreditTransactionId
2020
from models_library.users import UserID
2121
from models_library.wallets import WalletID
22-
from servicelib.fastapi.app_state import AppStateMixin
22+
from servicelib.fastapi.app_state import SingletonInAppStateMixin
2323
from servicelib.fastapi.http_client import BaseHttpApi
2424

2525
from ..core.settings import ApplicationSettings
2626

2727
_logger = logging.getLogger(__name__)
2828

2929

30-
class ResourceUsageTrackerApi(BaseHttpApi, AppStateMixin):
30+
class ResourceUsageTrackerApi(BaseHttpApi, SingletonInAppStateMixin):
3131
app_state_name: str = "source_usage_tracker_api"
3232

3333
async def create_credit_transaction(

0 commit comments

Comments
 (0)