From 744920232e3bae3127c7a3264de2b895fbadf8a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Sus=C3=A6g?= <41901890+msusag@users.noreply.github.com> Date: Mon, 10 Jun 2024 19:32:49 +0000 Subject: [PATCH 1/4] Fix reset dataset for 3d model update --- cognite/client/data_classes/three_d.py | 4 ++-- renovate.json | 4 ++++ tests/tests_unit/test_api/test_3d.py | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/cognite/client/data_classes/three_d.py b/cognite/client/data_classes/three_d.py index 1db3904af0..1ee6f4c27f 100644 --- a/cognite/client/data_classes/three_d.py +++ b/cognite/client/data_classes/three_d.py @@ -204,8 +204,8 @@ def metadata(self) -> _ObjectThreeDModelUpdate: return ThreeDModelUpdate._ObjectThreeDModelUpdate(self, "metadata") @property - def data_set_id(self) -> _ObjectThreeDModelUpdate: - return ThreeDModelUpdate._ObjectThreeDModelUpdate(self, "dataSetId") + def data_set_id(self) -> _PrimitiveThreeDModelUpdate: + return ThreeDModelUpdate._PrimitiveThreeDModelUpdate(self, "dataSetId") @classmethod def _get_update_properties(cls) -> list[PropertySpec]: diff --git a/renovate.json b/renovate.json index 9dc8b364db..ddb3153e9b 100644 --- a/renovate.json +++ b/renovate.json @@ -9,6 +9,10 @@ "enabled": false, "matchManagers": ["poetry"], "matchPackagePatterns": ["*"] + }, + { + "enabled": false, + "matchPackageNames": ["mcr.microsoft.com/devcontainers/python"] } ], "vulnerabilityAlerts": { diff --git a/tests/tests_unit/test_api/test_3d.py b/tests/tests_unit/test_api/test_3d.py index b368228542..73442536f6 100644 --- a/tests/tests_unit/test_api/test_3d.py +++ b/tests/tests_unit/test_api/test_3d.py @@ -58,6 +58,22 @@ def test_update_with_update_object(self, cognite_client, mock_3d_model_response) ][0] assert mock_3d_model_response.calls[0].response.json()["items"][0] == res.dump(camel_case=True) + def test_update_dataset(self, cognite_client, mock_3d_model_response): + update = ThreeDModelUpdate(id=1).data_set_id.set(2) + res = cognite_client.three_d.models.update(update) + assert {"id": 1, "update": {"dataSetId": {"set": 2}}} == jsgz_load( + mock_3d_model_response.calls[0].request.body + )["items"][0] + assert mock_3d_model_response.calls[0].response.json()["items"][0] == res.dump(camel_case=True) + + def test_reset_dataset(self, cognite_client, mock_3d_model_response): + update = ThreeDModelUpdate(id=1).data_set_id.set(None) + res = cognite_client.three_d.models.update(update) + assert {"id": 1, "update": {"dataSetId": {"setNull": True}}} == jsgz_load( + mock_3d_model_response.calls[0].request.body + )["items"][0] + assert mock_3d_model_response.calls[0].response.json()["items"][0] == res.dump(camel_case=True) + def test_update_with_resource_object(self, cognite_client, mock_3d_model_response): res = cognite_client.three_d.models.update(ThreeDModel(id=1, name="bla", created_time=123)) assert {"id": 1, "update": {"name": {"set": "bla"}}} == jsgz_load(mock_3d_model_response.calls[0].request.body)[ From ec7a6bd3090b9e565d2b566d8eaca6e35c7f8d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Sus=C3=A6g?= <41901890+msusag@users.noreply.github.com> Date: Mon, 10 Jun 2024 20:40:18 +0000 Subject: [PATCH 2/4] Revert change in renovate.json for this PR --- renovate.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/renovate.json b/renovate.json index ddb3153e9b..9dc8b364db 100644 --- a/renovate.json +++ b/renovate.json @@ -9,10 +9,6 @@ "enabled": false, "matchManagers": ["poetry"], "matchPackagePatterns": ["*"] - }, - { - "enabled": false, - "matchPackageNames": ["mcr.microsoft.com/devcontainers/python"] } ], "vulnerabilityAlerts": { From 011a4a09e80a76ab937d5a23fbf5728d7ddbf9f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Sus=C3=A6g?= <41901890+msusag@users.noreply.github.com> Date: Tue, 11 Jun 2024 06:16:47 +0000 Subject: [PATCH 3/4] Added changelog entry --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d02abbe14..bc070be153 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ Changes are grouped as follows - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## [7.50.0] - 2024-06-11 + +### Fixed +- Fixes resetting dataSetId to None in a ThreeDModelUpdate. + ## [7.49.0] - 2024-06-05 ### Added - `WorkfowExecutionAPI.list` now allows filtering by execution status. From 161c5138930fc8420d17ec79de71fd8de6aa6fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Sus=C3=A6g?= <41901890+msusag@users.noreply.github.com> Date: Tue, 11 Jun 2024 06:23:55 +0000 Subject: [PATCH 4/4] Set version 7.49.1 --- CHANGELOG.md | 2 +- cognite/client/_version.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc070be153..b469721037 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ Changes are grouped as follows - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. -## [7.50.0] - 2024-06-11 +## [7.49.1] - 2024-06-11 ### Fixed - Fixes resetting dataSetId to None in a ThreeDModelUpdate. diff --git a/cognite/client/_version.py b/cognite/client/_version.py index 77306f4221..7f490d3c4a 100644 --- a/cognite/client/_version.py +++ b/cognite/client/_version.py @@ -1,4 +1,4 @@ from __future__ import annotations -__version__ = "7.49.0" +__version__ = "7.49.1" __api_subversion__ = "20230101" diff --git a/pyproject.toml b/pyproject.toml index 9d2d6dd4d8..be7fbcb05e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "cognite-sdk" -version = "7.49.0" +version = "7.49.1" description = "Cognite Python SDK" readme = "README.md" documentation = "https://cognite-sdk-python.readthedocs-hosted.com"