From ba9c12c871e685342de3a130d4a8cee33231321a Mon Sep 17 00:00:00 2001 From: Max Marrone Date: Mon, 16 Dec 2024 19:05:22 -0500 Subject: [PATCH] robot-server: copy -> model_copy --- robot-server/robot_server/commands/router.py | 4 +++- .../robot_server/maintenance_runs/router/commands_router.py | 2 +- robot-server/robot_server/runs/router/commands_router.py | 2 +- robot-server/tests/runs/router/test_labware_router.py | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/robot-server/robot_server/commands/router.py b/robot-server/robot_server/commands/router.py index 6f8609a4eeb..ce4db3fd515 100644 --- a/robot-server/robot_server/commands/router.py +++ b/robot-server/robot_server/commands/router.py @@ -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 ) diff --git a/robot-server/robot_server/maintenance_runs/router/commands_router.py b/robot-server/robot_server/maintenance_runs/router/commands_router.py index deafb3776a8..40c9b5d782a 100644 --- a/robot-server/robot_server/maintenance_runs/router/commands_router.py +++ b/robot-server/robot_server/maintenance_runs/router/commands_router.py @@ -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 ) diff --git a/robot-server/robot_server/runs/router/commands_router.py b/robot-server/robot_server/runs/router/commands_router.py index 95d9f082150..99828010750 100644 --- a/robot-server/robot_server/runs/router/commands_router.py +++ b/robot-server/robot_server/runs/router/commands_router.py @@ -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( diff --git a/robot-server/tests/runs/router/test_labware_router.py b/robot-server/tests/runs/router/test_labware_router.py index a81c6726e6d..25f80048df6 100644 --- a/robot-server/tests/runs/router/test_labware_router.py +++ b/robot-server/tests/runs/router/test_labware_router.py @@ -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", @@ -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(