Skip to content

Commit

Permalink
robot-server: copy -> model_copy
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring committed Dec 17, 2024
1 parent c19f505 commit ba9c12c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion robot-server/robot_server/commands/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ async def create_command(
Comes from a query parameter in the URL.
orchestrator: The `RunOrchestrator` handling engine for command to be enqueued.
"""
command_create = request_body.data.copy(update={"intent": CommandIntent.SETUP})
command_create = request_body.data.model_copy(
update={"intent": CommandIntent.SETUP}
)
command = await orchestrator.add_command_and_wait_for_interval(
command=command_create, wait_until_complete=waitUntilComplete, timeout=timeout
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ async def create_run_command(
# TODO(mc, 2022-05-26): increment the HTTP API version so that default
# behavior is to pass through `command_intent` without overriding it
command_intent = pe_commands.CommandIntent.SETUP
command_create = request_body.data.copy(update={"intent": command_intent})
command_create = request_body.data.model_copy(update={"intent": command_intent})
command = await run_orchestrator_store.add_command_and_wait_for_interval(
request=command_create, wait_until_complete=waitUntilComplete, timeout=timeout
)
Expand Down
2 changes: 1 addition & 1 deletion robot-server/robot_server/runs/router/commands_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ async def create_run_command(
# TODO(mc, 2022-05-26): increment the HTTP API version so that default
# behavior is to pass through `command_intent` without overriding it
command_intent = request_body.data.intent or pe_commands.CommandIntent.SETUP
command_create = request_body.data.copy(update={"intent": command_intent})
command_create = request_body.data.model_copy(update={"intent": command_intent})

try:
command = await run_orchestrator_store.add_command_and_wait_for_interval(
Expand Down
4 changes: 2 additions & 2 deletions robot-server/tests/runs/router/test_labware_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async def test_add_labware_offset_not_current(
run: Run,
) -> None:
"""It should 409 if the run is not current."""
not_current_run = run.copy(update={"current": False})
not_current_run = run.model_copy(update={"current": False})

labware_offset_request = pe_types.LabwareOffsetCreate(
definitionUri="namespace_1/load_name_1/123",
Expand Down Expand Up @@ -142,7 +142,7 @@ async def test_add_labware_definition_not_current(
labware_definition: LabwareDefinition,
) -> None:
"""It should 409 if the run is not current."""
not_current_run = run.copy(update={"current": False})
not_current_run = run.model_copy(update={"current": False})

with pytest.raises(ApiError) as exc_info:
await add_labware_definition(
Expand Down

0 comments on commit ba9c12c

Please sign in to comment.