cognite-toolkit 0.7.71__py3-none-any.whl → 0.7.73__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cognite_toolkit/_cdf_tk/builders/_raw.py +2 -2
- cognite_toolkit/_cdf_tk/client/_toolkit_client.py +0 -2
- cognite_toolkit/_cdf_tk/client/api/raw.py +47 -27
- cognite_toolkit/_cdf_tk/client/api/robotics_capabilities.py +9 -3
- cognite_toolkit/_cdf_tk/client/api/robotics_data_postprocessing.py +12 -3
- cognite_toolkit/_cdf_tk/client/api/robotics_frames.py +10 -3
- cognite_toolkit/_cdf_tk/client/api/robotics_locations.py +10 -3
- cognite_toolkit/_cdf_tk/client/api/robotics_maps.py +10 -3
- cognite_toolkit/_cdf_tk/client/api/robotics_robots.py +10 -3
- cognite_toolkit/_cdf_tk/client/http_client/_client.py +1 -1
- cognite_toolkit/_cdf_tk/client/http_client/_data_classes.py +1 -0
- cognite_toolkit/_cdf_tk/client/http_client/_exception.py +6 -1
- cognite_toolkit/_cdf_tk/client/resource_classes/identifiers.py +26 -1
- cognite_toolkit/_cdf_tk/client/resource_classes/raw.py +70 -16
- cognite_toolkit/_cdf_tk/client/testing.py +23 -19
- cognite_toolkit/_cdf_tk/commands/build_cmd.py +2 -2
- cognite_toolkit/_cdf_tk/cruds/_data_cruds.py +3 -3
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/auth.py +4 -5
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/extraction_pipeline.py +3 -3
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/raw.py +99 -91
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/robotics.py +154 -160
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/transformation.py +3 -3
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml +1 -1
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml +1 -1
- cognite_toolkit/_resources/cdf.toml +1 -1
- cognite_toolkit/_version.py +1 -1
- {cognite_toolkit-0.7.71.dist-info → cognite_toolkit-0.7.73.dist-info}/METADATA +1 -1
- {cognite_toolkit-0.7.71.dist-info → cognite_toolkit-0.7.73.dist-info}/RECORD +30 -40
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/__init__.py +0 -8
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/api.py +0 -20
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/capabilities.py +0 -142
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/data_postprocessing.py +0 -144
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/frames.py +0 -136
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/locations.py +0 -136
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/maps.py +0 -136
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/robots.py +0 -132
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/utlis.py +0 -13
- cognite_toolkit/_cdf_tk/client/resource_classes/legacy/robotics.py +0 -970
- {cognite_toolkit-0.7.71.dist-info → cognite_toolkit-0.7.73.dist-info}/WHEEL +0 -0
- {cognite_toolkit-0.7.71.dist-info → cognite_toolkit-0.7.73.dist-info}/entry_points.txt +0 -0
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
from collections.abc import Iterator, Sequence
|
|
2
|
-
from typing import overload
|
|
3
|
-
|
|
4
|
-
from cognite.client._api_client import APIClient
|
|
5
|
-
from cognite.client.utils._identifier import IdentifierSequence
|
|
6
|
-
from cognite.client.utils.useful_types import SequenceNotStr
|
|
7
|
-
|
|
8
|
-
from cognite_toolkit._cdf_tk.client.resource_classes.legacy.robotics import (
|
|
9
|
-
Location,
|
|
10
|
-
LocationList,
|
|
11
|
-
LocationWrite,
|
|
12
|
-
_LocationUpdate,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
from .utlis import tmp_disable_gzip
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class LocationsAPI(APIClient):
|
|
19
|
-
_RESOURCE_PATH = "/robotics/locations"
|
|
20
|
-
|
|
21
|
-
@overload
|
|
22
|
-
def __call__(self) -> Iterator[Location]: ...
|
|
23
|
-
|
|
24
|
-
@overload
|
|
25
|
-
def __call__(self, chunk_size: int) -> Iterator[LocationList]: ...
|
|
26
|
-
|
|
27
|
-
def __call__(self, chunk_size: int | None = None) -> Iterator[Location] | Iterator[LocationList]:
|
|
28
|
-
"""Iterate over robot locations.
|
|
29
|
-
|
|
30
|
-
Args:
|
|
31
|
-
chunk_size: The number of robot locations to return in each chunk. None will return all robot locations.
|
|
32
|
-
|
|
33
|
-
Yields:
|
|
34
|
-
Location or LocationList
|
|
35
|
-
|
|
36
|
-
"""
|
|
37
|
-
return self._list_generator(method="GET", resource_cls=Location, list_cls=LocationList, chunk_size=chunk_size)
|
|
38
|
-
|
|
39
|
-
def __iter__(self) -> Iterator[Location]:
|
|
40
|
-
return self.__call__()
|
|
41
|
-
|
|
42
|
-
@overload
|
|
43
|
-
def create(self, location: LocationWrite) -> Location: ...
|
|
44
|
-
|
|
45
|
-
@overload
|
|
46
|
-
def create(self, location: Sequence[LocationWrite]) -> LocationList: ...
|
|
47
|
-
|
|
48
|
-
def create(self, location: LocationWrite | Sequence[LocationWrite]) -> Location | LocationList:
|
|
49
|
-
"""Create a new robot location.
|
|
50
|
-
|
|
51
|
-
Args:
|
|
52
|
-
location: LocationWrite or list of LocationWrite.
|
|
53
|
-
|
|
54
|
-
Returns:
|
|
55
|
-
Location object.
|
|
56
|
-
|
|
57
|
-
"""
|
|
58
|
-
with tmp_disable_gzip():
|
|
59
|
-
return self._create_multiple(
|
|
60
|
-
list_cls=LocationList,
|
|
61
|
-
resource_cls=Location,
|
|
62
|
-
items=location,
|
|
63
|
-
input_resource_cls=LocationWrite,
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
@overload
|
|
67
|
-
def retrieve(self, external_id: str) -> Location | None: ...
|
|
68
|
-
|
|
69
|
-
@overload
|
|
70
|
-
def retrieve(self, external_id: SequenceNotStr[str]) -> LocationList: ...
|
|
71
|
-
|
|
72
|
-
def retrieve(self, external_id: str | SequenceNotStr[str]) -> Location | None | LocationList:
|
|
73
|
-
"""Retrieve a robot location.
|
|
74
|
-
|
|
75
|
-
Args:
|
|
76
|
-
external_id: External id of the robot location.
|
|
77
|
-
|
|
78
|
-
Returns:
|
|
79
|
-
Location object.
|
|
80
|
-
|
|
81
|
-
"""
|
|
82
|
-
identifiers = IdentifierSequence.load(external_ids=external_id)
|
|
83
|
-
with tmp_disable_gzip():
|
|
84
|
-
return self._retrieve_multiple(
|
|
85
|
-
identifiers=identifiers,
|
|
86
|
-
resource_cls=Location,
|
|
87
|
-
list_cls=LocationList,
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
@overload
|
|
91
|
-
def update(self, location: LocationWrite) -> Location: ...
|
|
92
|
-
|
|
93
|
-
@overload
|
|
94
|
-
def update(self, location: Sequence[LocationWrite]) -> LocationList: ...
|
|
95
|
-
|
|
96
|
-
def update(self, location: LocationWrite | Sequence[LocationWrite]) -> Location | LocationList:
|
|
97
|
-
"""Update a robot location.
|
|
98
|
-
|
|
99
|
-
Args:
|
|
100
|
-
location: LocationWrite or list of LocationWrite.
|
|
101
|
-
|
|
102
|
-
Returns:
|
|
103
|
-
Location object.
|
|
104
|
-
|
|
105
|
-
"""
|
|
106
|
-
with tmp_disable_gzip():
|
|
107
|
-
return self._update_multiple(
|
|
108
|
-
items=location,
|
|
109
|
-
resource_cls=Location,
|
|
110
|
-
list_cls=LocationList,
|
|
111
|
-
update_cls=_LocationUpdate,
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
def delete(self, external_id: str | SequenceNotStr[str]) -> None:
|
|
115
|
-
"""Delete a robot location.
|
|
116
|
-
|
|
117
|
-
Args:
|
|
118
|
-
external_id: External id of the robot location.
|
|
119
|
-
|
|
120
|
-
Returns:
|
|
121
|
-
None
|
|
122
|
-
|
|
123
|
-
"""
|
|
124
|
-
identifiers = IdentifierSequence.load(external_ids=external_id)
|
|
125
|
-
with tmp_disable_gzip():
|
|
126
|
-
self._delete_multiple(identifiers=identifiers, wrap_ids=True)
|
|
127
|
-
|
|
128
|
-
def list(self) -> LocationList:
|
|
129
|
-
"""List robot locations.
|
|
130
|
-
|
|
131
|
-
Returns:
|
|
132
|
-
LocationList
|
|
133
|
-
|
|
134
|
-
"""
|
|
135
|
-
with tmp_disable_gzip():
|
|
136
|
-
return self._list(method="GET", resource_cls=Location, list_cls=LocationList)
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
from collections.abc import Iterator, Sequence
|
|
2
|
-
from typing import overload
|
|
3
|
-
|
|
4
|
-
from cognite.client._api_client import APIClient
|
|
5
|
-
from cognite.client.utils._identifier import IdentifierSequence
|
|
6
|
-
from cognite.client.utils.useful_types import SequenceNotStr
|
|
7
|
-
|
|
8
|
-
from cognite_toolkit._cdf_tk.client.resource_classes.legacy.robotics import (
|
|
9
|
-
Map,
|
|
10
|
-
MapList,
|
|
11
|
-
MapWrite,
|
|
12
|
-
_MapUpdate,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
from .utlis import tmp_disable_gzip
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class MapsAPI(APIClient):
|
|
19
|
-
_RESOURCE_PATH = "/robotics/maps"
|
|
20
|
-
|
|
21
|
-
@overload
|
|
22
|
-
def __call__(self) -> Iterator[Map]: ...
|
|
23
|
-
|
|
24
|
-
@overload
|
|
25
|
-
def __call__(self, chunk_size: int) -> Iterator[MapList]: ...
|
|
26
|
-
|
|
27
|
-
def __call__(self, chunk_size: int | None = None) -> Iterator[Map] | Iterator[MapList]:
|
|
28
|
-
"""Iterate over robot maps.
|
|
29
|
-
|
|
30
|
-
Args:
|
|
31
|
-
chunk_size: The number of robot maps to return in each chunk. None will return all robot maps.
|
|
32
|
-
|
|
33
|
-
Yields:
|
|
34
|
-
Map or MapList
|
|
35
|
-
|
|
36
|
-
"""
|
|
37
|
-
return self._list_generator(method="GET", resource_cls=Map, list_cls=MapList, chunk_size=chunk_size)
|
|
38
|
-
|
|
39
|
-
def __iter__(self) -> Iterator[Map]:
|
|
40
|
-
return self.__call__()
|
|
41
|
-
|
|
42
|
-
@overload
|
|
43
|
-
def create(self, map: MapWrite) -> Map: ...
|
|
44
|
-
|
|
45
|
-
@overload
|
|
46
|
-
def create(self, map: Sequence[MapWrite]) -> MapList: ...
|
|
47
|
-
|
|
48
|
-
def create(self, map: MapWrite | Sequence[MapWrite]) -> Map | MapList:
|
|
49
|
-
"""Create a new robot map.
|
|
50
|
-
|
|
51
|
-
Args:
|
|
52
|
-
map: MapWrite or list of MapWrite.
|
|
53
|
-
|
|
54
|
-
Returns:
|
|
55
|
-
Map object.
|
|
56
|
-
|
|
57
|
-
"""
|
|
58
|
-
with tmp_disable_gzip():
|
|
59
|
-
return self._create_multiple(
|
|
60
|
-
list_cls=MapList,
|
|
61
|
-
resource_cls=Map,
|
|
62
|
-
items=map,
|
|
63
|
-
input_resource_cls=MapWrite,
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
@overload
|
|
67
|
-
def retrieve(self, external_id: str) -> Map | None: ...
|
|
68
|
-
|
|
69
|
-
@overload
|
|
70
|
-
def retrieve(self, external_id: SequenceNotStr[str]) -> MapList: ...
|
|
71
|
-
|
|
72
|
-
def retrieve(self, external_id: str | SequenceNotStr[str]) -> Map | None | MapList:
|
|
73
|
-
"""Retrieve a robot map.
|
|
74
|
-
|
|
75
|
-
Args:
|
|
76
|
-
external_id: External id of the robot map.
|
|
77
|
-
|
|
78
|
-
Returns:
|
|
79
|
-
Map object.
|
|
80
|
-
|
|
81
|
-
"""
|
|
82
|
-
identifiers = IdentifierSequence.load(external_ids=external_id)
|
|
83
|
-
with tmp_disable_gzip():
|
|
84
|
-
return self._retrieve_multiple(
|
|
85
|
-
identifiers=identifiers,
|
|
86
|
-
resource_cls=Map,
|
|
87
|
-
list_cls=MapList,
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
@overload
|
|
91
|
-
def update(self, map: MapWrite) -> Map: ...
|
|
92
|
-
|
|
93
|
-
@overload
|
|
94
|
-
def update(self, map: Sequence[MapWrite]) -> MapList: ...
|
|
95
|
-
|
|
96
|
-
def update(self, map: MapWrite | Sequence[MapWrite]) -> Map | MapList:
|
|
97
|
-
"""Update a robot map.
|
|
98
|
-
|
|
99
|
-
Args:
|
|
100
|
-
map: MapWrite or list of MapWrite.
|
|
101
|
-
|
|
102
|
-
Returns:
|
|
103
|
-
Map object.
|
|
104
|
-
|
|
105
|
-
"""
|
|
106
|
-
with tmp_disable_gzip():
|
|
107
|
-
return self._update_multiple(
|
|
108
|
-
items=map,
|
|
109
|
-
resource_cls=Map,
|
|
110
|
-
list_cls=MapList,
|
|
111
|
-
update_cls=_MapUpdate,
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
def delete(self, external_id: str | SequenceNotStr[str]) -> None:
|
|
115
|
-
"""Delete a robot map.
|
|
116
|
-
|
|
117
|
-
Args:
|
|
118
|
-
external_id: External id of the robot map.
|
|
119
|
-
|
|
120
|
-
Returns:
|
|
121
|
-
None
|
|
122
|
-
|
|
123
|
-
"""
|
|
124
|
-
identifiers = IdentifierSequence.load(external_ids=external_id)
|
|
125
|
-
with tmp_disable_gzip():
|
|
126
|
-
self._delete_multiple(identifiers=identifiers, wrap_ids=True)
|
|
127
|
-
|
|
128
|
-
def list(self) -> MapList:
|
|
129
|
-
"""List robot maps.
|
|
130
|
-
|
|
131
|
-
Returns:
|
|
132
|
-
MapList
|
|
133
|
-
|
|
134
|
-
"""
|
|
135
|
-
with tmp_disable_gzip():
|
|
136
|
-
return self._list(method="GET", resource_cls=Map, list_cls=MapList)
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
from collections.abc import Iterator, Sequence
|
|
2
|
-
from typing import overload
|
|
3
|
-
|
|
4
|
-
from cognite.client._api_client import APIClient
|
|
5
|
-
|
|
6
|
-
from cognite_toolkit._cdf_tk.client.api.legacy.robotics.utlis import tmp_disable_gzip
|
|
7
|
-
from cognite_toolkit._cdf_tk.client.resource_classes.legacy.robotics import Robot, RobotList, RobotWrite, _RobotUpdate
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class RobotsAPI(APIClient):
|
|
11
|
-
_RESOURCE_PATH = "/robotics/robots"
|
|
12
|
-
|
|
13
|
-
@overload
|
|
14
|
-
def __call__(self) -> Iterator[Robot]: ...
|
|
15
|
-
|
|
16
|
-
@overload
|
|
17
|
-
def __call__(self, chunk_size: int) -> Iterator[RobotList]: ...
|
|
18
|
-
|
|
19
|
-
def __call__(self, chunk_size: int | None = None) -> Iterator[Robot] | Iterator[RobotList]:
|
|
20
|
-
"""Iterate over robots.
|
|
21
|
-
|
|
22
|
-
Args:
|
|
23
|
-
chunk_size: The number of robots to return in each chunk. None will return all robots.
|
|
24
|
-
|
|
25
|
-
Yields:
|
|
26
|
-
Robot or RobotList
|
|
27
|
-
|
|
28
|
-
"""
|
|
29
|
-
return self._list_generator(method="GET", resource_cls=Robot, list_cls=RobotList, chunk_size=chunk_size)
|
|
30
|
-
|
|
31
|
-
def __iter__(self) -> Iterator[Robot]:
|
|
32
|
-
return self.__call__()
|
|
33
|
-
|
|
34
|
-
@overload
|
|
35
|
-
def create(self, robot: RobotWrite) -> Robot: ...
|
|
36
|
-
|
|
37
|
-
@overload
|
|
38
|
-
def create(self, robot: Sequence[RobotWrite]) -> RobotList: ...
|
|
39
|
-
|
|
40
|
-
def create(self, robot: RobotWrite | Sequence[RobotWrite]) -> Robot | RobotList:
|
|
41
|
-
"""Create a new robot.
|
|
42
|
-
|
|
43
|
-
Args:
|
|
44
|
-
robot: RobotWrite or list of RobotWrite.
|
|
45
|
-
|
|
46
|
-
Returns:
|
|
47
|
-
Robot object.
|
|
48
|
-
|
|
49
|
-
"""
|
|
50
|
-
with tmp_disable_gzip():
|
|
51
|
-
return self._create_multiple(
|
|
52
|
-
list_cls=RobotList,
|
|
53
|
-
resource_cls=Robot,
|
|
54
|
-
items=robot,
|
|
55
|
-
input_resource_cls=RobotWrite,
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
def retrieve(self, data_set_id: int | Sequence[int]) -> RobotList:
|
|
59
|
-
"""Retrieve a robot.
|
|
60
|
-
|
|
61
|
-
Args:
|
|
62
|
-
data_set_id: Data set id of the robot.
|
|
63
|
-
|
|
64
|
-
Returns:
|
|
65
|
-
Robot object.
|
|
66
|
-
|
|
67
|
-
"""
|
|
68
|
-
body = self._create_body(data_set_id)
|
|
69
|
-
res = self._post(url_path=self._RESOURCE_PATH + "/byids", json=body)
|
|
70
|
-
return RobotList._load(res.json()["items"], cognite_client=self._cognite_client)
|
|
71
|
-
|
|
72
|
-
@staticmethod
|
|
73
|
-
def _create_body(data_set_id: int | Sequence[int]) -> dict:
|
|
74
|
-
ids = [data_set_id] if isinstance(data_set_id, int) else data_set_id
|
|
75
|
-
body = {"items": [{"dataSetId": external_id} for external_id in ids]}
|
|
76
|
-
return body
|
|
77
|
-
|
|
78
|
-
@overload
|
|
79
|
-
def update(self, robot: RobotWrite) -> Robot: ...
|
|
80
|
-
|
|
81
|
-
@overload
|
|
82
|
-
def update(self, robot: Sequence[RobotWrite]) -> RobotList: ...
|
|
83
|
-
|
|
84
|
-
def update(self, robot: RobotWrite | Sequence[RobotWrite]) -> Robot | RobotList:
|
|
85
|
-
"""Update a robot.
|
|
86
|
-
|
|
87
|
-
Args:
|
|
88
|
-
robot: RobotWrite or list of RobotWrite.
|
|
89
|
-
|
|
90
|
-
Returns:
|
|
91
|
-
Robot object.
|
|
92
|
-
|
|
93
|
-
"""
|
|
94
|
-
is_single = False
|
|
95
|
-
if isinstance(robot, RobotWrite):
|
|
96
|
-
robots = [robot]
|
|
97
|
-
is_single = True
|
|
98
|
-
elif isinstance(robot, Sequence):
|
|
99
|
-
robots = list(robot)
|
|
100
|
-
else:
|
|
101
|
-
raise ValueError("robot must be a RobotWrite or a list of RobotWrite")
|
|
102
|
-
|
|
103
|
-
property_spec = _RobotUpdate._get_update_properties()
|
|
104
|
-
update = [
|
|
105
|
-
{"dataSetId": r.data_set_id, **self._convert_resource_to_patch_object(r, property_spec)} for r in robots
|
|
106
|
-
]
|
|
107
|
-
res = self._post(url_path=self._RESOURCE_PATH + "/update", json={"items": update})
|
|
108
|
-
loaded = RobotList._load(res.json()["items"], cognite_client=self._cognite_client)
|
|
109
|
-
return loaded[0] if is_single else loaded
|
|
110
|
-
|
|
111
|
-
def delete(self, data_set_id: int | Sequence[int]) -> None:
|
|
112
|
-
"""Delete a robot.
|
|
113
|
-
|
|
114
|
-
Args:
|
|
115
|
-
data_set_id: Data set id of the robot.
|
|
116
|
-
|
|
117
|
-
Returns:
|
|
118
|
-
None
|
|
119
|
-
|
|
120
|
-
"""
|
|
121
|
-
body = self._create_body(data_set_id)
|
|
122
|
-
self._post(url_path=self._RESOURCE_PATH + "/delete", json=body)
|
|
123
|
-
|
|
124
|
-
def list(self) -> RobotList:
|
|
125
|
-
"""List robots.
|
|
126
|
-
|
|
127
|
-
Returns:
|
|
128
|
-
RobotList
|
|
129
|
-
|
|
130
|
-
"""
|
|
131
|
-
with tmp_disable_gzip():
|
|
132
|
-
return self._list(method="GET", resource_cls=Robot, list_cls=RobotList)
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import contextlib
|
|
2
|
-
from collections.abc import Iterator
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
@contextlib.contextmanager
|
|
6
|
-
def tmp_disable_gzip() -> Iterator[None]:
|
|
7
|
-
from cognite.client.config import global_config
|
|
8
|
-
|
|
9
|
-
_current_value = global_config.disable_gzip
|
|
10
|
-
|
|
11
|
-
global_config.disable_gzip = True
|
|
12
|
-
yield None
|
|
13
|
-
global_config.disable_gzip = _current_value
|