Skip to content

Commit 2d8c2a7

Browse files
continue mypy
1 parent 8786b9a commit 2d8c2a7

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

services/web/server/src/simcore_service_webserver/meta_modeling/_function_nodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def create_param_node_from_iterator_with_outputs(iterator_node: Node) -> Node:
3737
label=iterator_node.label,
3838
inputs={},
3939
inputNodes=[],
40-
thumbnail="", # type: ignore[arg-type] # NOTE: hack due to issue in projects json-schema
40+
thumbnail="", # NOTE: hack due to issue in projects json-schema
4141
outputs=deepcopy(iterator_node.outputs),
4242
)
4343

services/web/server/src/simcore_service_webserver/products/_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async def load_products_on_startup(app: web.Application):
9090
app_products[name] = Product(
9191
**dict(row.items()),
9292
is_payment_enabled=payments.enabled,
93-
credits_per_usd=payments.credits_per_usd, # type: ignore[arg-type]
93+
credits_per_usd=payments.credits_per_usd,
9494
)
9595

9696
assert name in FRONTEND_APPS_AVAILABLE # nosec

services/web/server/src/simcore_service_webserver/products/_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async def _get_current_product_price(request: web.Request):
4141

4242
credit_price = GetCreditPrice(
4343
product_name=req_ctx.product_name,
44-
usd_per_credit=price_info.usd_per_credit if price_info else None, # type: ignore[arg-type]
44+
usd_per_credit=price_info.usd_per_credit if price_info else None,
4545
min_payment_amount_usd=price_info.min_payment_amount_usd # type: ignore[arg-type]
4646
if price_info
4747
else None,

services/web/server/src/simcore_service_webserver/projects/_projects_nodes_pricing_unit_handlers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
import logging
77

88
from aiohttp import web
9+
from common_library.errors_classes import OsparcErrorMixin
910
from models_library.api_schemas_webserver.resource_usage import PricingUnitGet
1011
from models_library.projects import ProjectID
1112
from models_library.projects_nodes_io import NodeID, NodeIDStr
1213
from models_library.resource_tracker import PricingPlanId, PricingUnitId
1314
from pydantic import BaseModel, ConfigDict
14-
from pydantic.errors import PydanticErrorMixin
1515
from servicelib.aiohttp.requests_validation import parse_request_path_parameters_as
1616
from servicelib.aiohttp.typing_extension import Handler
1717

@@ -29,7 +29,7 @@
2929
_logger = logging.getLogger(__name__)
3030

3131

32-
class PricingUnitError(PydanticErrorMixin, ValueError):
32+
class PricingUnitError(OsparcErrorMixin, ValueError):
3333
...
3434

3535

@@ -132,7 +132,7 @@ async def connect_pricing_unit_to_project_node(request: web.Request):
132132
path_params.pricing_unit_id,
133133
)
134134
if rut_pricing_unit.pricing_unit_id != path_params.pricing_unit_id:
135-
raise PricingUnitNotFoundError
135+
raise PricingUnitNotFoundError()
136136

137137
await db.connect_pricing_unit_to_project_node(
138138
path_params.project_id,

services/web/server/src/simcore_service_webserver/socketio/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class WebSocketMessageBase(BaseModel):
2020

2121
@classmethod
2222
def get_event_type(cls) -> str:
23-
_event_type: str = cls.__fields__["event_type"].default
23+
_event_type: str = cls.model_fields["event_type"].default
2424
return _event_type
2525

2626
@abstractmethod

services/web/server/src/simcore_service_webserver/tags/schemas.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import re
22
from datetime import datetime
3+
from typing import Annotated, TypeAlias
34

45
from models_library.api_schemas_webserver._base import InputSchema, OutputSchema
56
from models_library.users import GroupID, UserID
6-
from pydantic import ConstrainedStr, Field, PositiveInt
7+
from pydantic import Field, PositiveInt, StringConstraints
78
from servicelib.aiohttp.requests_validation import RequestParams, StrictRequestParams
89
from servicelib.request_keys import RQT_USERID_KEY
910
from simcore_postgres_database.utils_tags import TagDict
@@ -17,8 +18,9 @@ class TagPathParams(StrictRequestParams):
1718
tag_id: PositiveInt
1819

1920

20-
class ColorStr(ConstrainedStr):
21-
regex = re.compile(r"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$")
21+
ColorStr: TypeAlias = Annotated[
22+
str, StringConstraints(pattern=re.compile(r"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"))
23+
]
2224

2325

2426
class TagUpdate(InputSchema):

0 commit comments

Comments
 (0)