Skip to content

Commit

Permalink
removed occurences of construct()
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg committed Nov 1, 2024
1 parent 233da09 commit ef80d78
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/models-library/src/models_library/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def to_simcore_runtime_docker_label_key(key: str) -> DockerLabelKey:
class StandardSimcoreDockerLabels(BaseModel):
"""
Represents the standard label on oSparc created containers (not yet services)
In order to create this object in code, please use construct() method!
In order to create this object in code, please use model_construct() method!
"""

user_id: UserID = Field(..., alias=f"{_SIMCORE_RUNTIME_DOCKER_LABEL_PREFIX}user-id") # type: ignore[literal-required]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def post_log_message(
app: FastAPI, log: LogMessageStr, *, log_level: LogLevelInt
) -> None:
app_settings: ApplicationSettings = app.state.settings
message = LoggerRabbitMessage.construct(
message = LoggerRabbitMessage.model_construct(
node_id=app_settings.DY_SIDECAR_NODE_ID,
user_id=app_settings.DY_SIDECAR_USER_ID,
project_id=app_settings.DY_SIDECAR_PROJECT_ID,
Expand All @@ -61,7 +61,7 @@ async def post_progress_message(
app: FastAPI, progress_type: ProgressType, report: ProgressReport
) -> None:
app_settings: ApplicationSettings = app.state.settings
message = ProgressRabbitMessageNode.construct(
message = ProgressRabbitMessageNode.model_construct(
node_id=app_settings.DY_SIDECAR_NODE_ID,
user_id=app_settings.DY_SIDECAR_USER_ID,
project_id=app_settings.DY_SIDECAR_PROJECT_ID,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncio
import logging
from datetime import datetime, timezone
from datetime import UTC, datetime
from decimal import Decimal

from models_library.api_schemas_resource_usage_tracker.credit_transactions import (
Expand Down Expand Up @@ -41,9 +41,9 @@ async def sum_credit_transactions_and_publish_to_rabbitmq(
wallet_id,
)
)
publish_message = WalletCreditsMessage.construct(
publish_message = WalletCreditsMessage.model_construct(
wallet_id=wallet_id,
created_at=datetime.now(tz=timezone.utc),
created_at=datetime.now(tz=UTC),
credits=wallet_total_credits.available_osparc_credits,
product_name=product_name,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async def list_service_runs(
service_runs_api_model: list[ServiceRunGet] = []
for service in service_runs_db_model:
service_runs_api_model.append(
ServiceRunGet.construct(
ServiceRunGet.model_construct(
service_run_id=service.service_run_id,
wallet_id=service.wallet_id,
wallet_name=service.wallet_name,
Expand Down Expand Up @@ -218,7 +218,7 @@ async def get_osparc_credits_aggregated_usages_page(
output_api_model: list[OsparcCreditsAggregatedByServiceGet] = []
for item in output_list_db:
output_api_model.append(
OsparcCreditsAggregatedByServiceGet.construct(
OsparcCreditsAggregatedByServiceGet.model_construct(
osparc_credits=item.osparc_credits,
service_key=item.service_key,
running_time_in_hours=item.running_time_in_hours,
Expand Down

0 comments on commit ef80d78

Please sign in to comment.