Skip to content

Commit 2c06e84

Browse files
authored
minor updates & read-only fixes (#866)
* update generated client * bump recommended poetry version * minor read-only changes * add changelog entries * minor fix to ensure correct usage of suffixes
1 parent 5c01f80 commit 2c06e84

File tree

132 files changed

+3486
-931
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+3486
-931
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
dunamai==1.6.0
2-
poetry==1.1.14
2+
poetry==1.3.2

webknossos/Changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ For upgrade instructions, please check the respective *Breaking Changes* section
1515
### Breaking Changes
1616

1717
### Added
18+
- Added `read_only` parameter for `annotation.temporary_volume_layer_copy`. [#866](https://github.com/scalableminds/webknossos-libs/pull/866)
1819

1920
### Changed
2021

2122
### Fixed
22-
2323
- Fixed a bug where some czi, dm3, dm4 images could not be converted to wkw due to a too-strict check. [#865](https://github.com/scalableminds/webknossos-libs/pull/865)
24+
- Enforce `read_only` property of datasets also for down- and upsampling. [#866](https://github.com/scalableminds/webknossos-libs/pull/866)
2425

2526

2627
## [0.12.0](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.12.0) - 2023-02-10

webknossos/webknossos/annotation/annotation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,7 @@ def temporary_volume_layer_copy(
784784
self,
785785
volume_layer_name: Optional[str] = None,
786786
volume_layer_id: Optional[int] = None,
787+
read_only: bool = True,
787788
) -> Iterator[SegmentationLayer]:
788789

789790
"""
@@ -809,7 +810,7 @@ def temporary_volume_layer_copy(
809810
volume_layer_id=volume_layer_id,
810811
)
811812

812-
input_annotation_dataset._read_only = True
813+
input_annotation_dataset._read_only = read_only
813814

814815
yield input_annotation_layer
815816

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
""" A client library for accessing webknossos """
22
from .client import AuthenticatedClient, Client
3+
4+
__all__ = (
5+
"AuthenticatedClient",
6+
"Client",
7+
)

webknossos/webknossos/client/_generated/api/datastore/dataset_cancel_upload.py

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from http import HTTPStatus
12
from typing import Any, Dict, Union
23

34
import httpx
@@ -15,17 +16,18 @@ def _get_kwargs(
1516
) -> Dict[str, Any]:
1617
url = "{}/data/datasets/cancelUpload".format(client.base_url)
1718

18-
headers: Dict[str, Any] = client.get_headers()
19+
headers: Dict[str, str] = client.get_headers()
1920
cookies: Dict[str, Any] = client.get_cookies()
2021

21-
params: Dict[str, Any] = {
22-
"token": token,
23-
}
22+
params: Dict[str, Any] = {}
23+
params["token"] = token
24+
2425
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
2526

2627
json_json_body = json_body.to_dict()
2728

2829
return {
30+
"method": "post",
2931
"url": url,
3032
"headers": headers,
3133
"cookies": cookies,
@@ -37,7 +39,7 @@ def _get_kwargs(
3739

3840
def _build_response(*, response: httpx.Response) -> Response[Any]:
3941
return Response(
40-
status_code=response.status_code,
42+
status_code=HTTPStatus(response.status_code),
4143
content=response.content,
4244
headers=response.headers,
4345
parsed=None,
@@ -50,13 +52,29 @@ def sync_detailed(
5052
json_body: DatasetCancelUploadJsonBody,
5153
token: Union[Unset, None, str] = UNSET,
5254
) -> Response[Any]:
55+
"""Cancel a running dataset upload
56+
Expects:
57+
- As JSON object body with keys:
58+
- uploadId (string): upload id that was also used in chunk upload (this time without file paths)
59+
- As GET parameter:
60+
- token (string): datastore token identifying the uploading user
61+
62+
Args:
63+
token (Union[Unset, None, str]):
64+
json_body (DatasetCancelUploadJsonBody):
65+
66+
Returns:
67+
Response[Any]
68+
"""
69+
5370
kwargs = _get_kwargs(
5471
client=client,
5572
json_body=json_body,
5673
token=token,
5774
)
5875

59-
response = httpx.post(
76+
response = httpx.request(
77+
verify=client.verify_ssl,
6078
**kwargs,
6179
)
6280

@@ -69,13 +87,28 @@ async def asyncio_detailed(
6987
json_body: DatasetCancelUploadJsonBody,
7088
token: Union[Unset, None, str] = UNSET,
7189
) -> Response[Any]:
90+
"""Cancel a running dataset upload
91+
Expects:
92+
- As JSON object body with keys:
93+
- uploadId (string): upload id that was also used in chunk upload (this time without file paths)
94+
- As GET parameter:
95+
- token (string): datastore token identifying the uploading user
96+
97+
Args:
98+
token (Union[Unset, None, str]):
99+
json_body (DatasetCancelUploadJsonBody):
100+
101+
Returns:
102+
Response[Any]
103+
"""
104+
72105
kwargs = _get_kwargs(
73106
client=client,
74107
json_body=json_body,
75108
token=token,
76109
)
77110

78-
async with httpx.AsyncClient() as _client:
79-
response = await _client.post(**kwargs)
111+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
112+
response = await _client.request(**kwargs)
80113

81114
return _build_response(response=response)

webknossos/webknossos/client/_generated/api/datastore/dataset_download.py

Lines changed: 71 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from http import HTTPStatus
12
from typing import Any, Dict, Union
23

34
import httpx
@@ -30,24 +31,34 @@ def _get_kwargs(
3031
dataLayerName=data_layer_name,
3132
)
3233

33-
headers: Dict[str, Any] = client.get_headers()
34+
headers: Dict[str, str] = client.get_headers()
3435
cookies: Dict[str, Any] = client.get_cookies()
3536

36-
params: Dict[str, Any] = {
37-
"token": token,
38-
"x": x,
39-
"y": y,
40-
"z": z,
41-
"width": width,
42-
"height": height,
43-
"depth": depth,
44-
"mag": mag,
45-
"halfByte": half_byte,
46-
"mappingName": mapping_name,
47-
}
37+
params: Dict[str, Any] = {}
38+
params["token"] = token
39+
40+
params["x"] = x
41+
42+
params["y"] = y
43+
44+
params["z"] = z
45+
46+
params["width"] = width
47+
48+
params["height"] = height
49+
50+
params["depth"] = depth
51+
52+
params["mag"] = mag
53+
54+
params["halfByte"] = half_byte
55+
56+
params["mappingName"] = mapping_name
57+
4858
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
4959

5060
return {
61+
"method": "get",
5162
"url": url,
5263
"headers": headers,
5364
"cookies": cookies,
@@ -58,7 +69,7 @@ def _get_kwargs(
5869

5970
def _build_response(*, response: httpx.Response) -> Response[Any]:
6071
return Response(
61-
status_code=response.status_code,
72+
status_code=HTTPStatus(response.status_code),
6273
content=response.content,
6374
headers=response.headers,
6475
parsed=None,
@@ -82,6 +93,27 @@ def sync_detailed(
8293
half_byte: Union[Unset, None, bool] = False,
8394
mapping_name: Union[Unset, None, str] = UNSET,
8495
) -> Response[Any]:
96+
"""Get raw binary data from a bounding box in a dataset layer
97+
98+
Args:
99+
organization_name (str):
100+
data_set_name (str):
101+
data_layer_name (str):
102+
token (Union[Unset, None, str]):
103+
x (int):
104+
y (int):
105+
z (int):
106+
width (int):
107+
height (int):
108+
depth (int):
109+
mag (str):
110+
half_byte (Union[Unset, None, bool]):
111+
mapping_name (Union[Unset, None, str]):
112+
113+
Returns:
114+
Response[Any]
115+
"""
116+
85117
kwargs = _get_kwargs(
86118
organization_name=organization_name,
87119
data_set_name=data_set_name,
@@ -99,7 +131,8 @@ def sync_detailed(
99131
mapping_name=mapping_name,
100132
)
101133

102-
response = httpx.get(
134+
response = httpx.request(
135+
verify=client.verify_ssl,
103136
**kwargs,
104137
)
105138

@@ -123,6 +156,27 @@ async def asyncio_detailed(
123156
half_byte: Union[Unset, None, bool] = False,
124157
mapping_name: Union[Unset, None, str] = UNSET,
125158
) -> Response[Any]:
159+
"""Get raw binary data from a bounding box in a dataset layer
160+
161+
Args:
162+
organization_name (str):
163+
data_set_name (str):
164+
data_layer_name (str):
165+
token (Union[Unset, None, str]):
166+
x (int):
167+
y (int):
168+
z (int):
169+
width (int):
170+
height (int):
171+
depth (int):
172+
mag (str):
173+
half_byte (Union[Unset, None, bool]):
174+
mapping_name (Union[Unset, None, str]):
175+
176+
Returns:
177+
Response[Any]
178+
"""
179+
126180
kwargs = _get_kwargs(
127181
organization_name=organization_name,
128182
data_set_name=data_set_name,
@@ -140,7 +194,7 @@ async def asyncio_detailed(
140194
mapping_name=mapping_name,
141195
)
142196

143-
async with httpx.AsyncClient() as _client:
144-
response = await _client.get(**kwargs)
197+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
198+
response = await _client.request(**kwargs)
145199

146200
return _build_response(response=response)

webknossos/webknossos/client/_generated/api/datastore/dataset_finish_upload.py

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from http import HTTPStatus
12
from typing import Any, Dict, Union
23

34
import httpx
@@ -15,17 +16,18 @@ def _get_kwargs(
1516
) -> Dict[str, Any]:
1617
url = "{}/data/datasets/finishUpload".format(client.base_url)
1718

18-
headers: Dict[str, Any] = client.get_headers()
19+
headers: Dict[str, str] = client.get_headers()
1920
cookies: Dict[str, Any] = client.get_cookies()
2021

21-
params: Dict[str, Any] = {
22-
"token": token,
23-
}
22+
params: Dict[str, Any] = {}
23+
params["token"] = token
24+
2425
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
2526

2627
json_json_body = json_body.to_dict()
2728

2829
return {
30+
"method": "post",
2931
"url": url,
3032
"headers": headers,
3133
"cookies": cookies,
@@ -37,7 +39,7 @@ def _get_kwargs(
3739

3840
def _build_response(*, response: httpx.Response) -> Response[Any]:
3941
return Response(
40-
status_code=response.status_code,
42+
status_code=HTTPStatus(response.status_code),
4143
content=response.content,
4244
headers=response.headers,
4345
parsed=None,
@@ -50,13 +52,33 @@ def sync_detailed(
5052
json_body: DatasetFinishUploadJsonBody,
5153
token: Union[Unset, None, str] = UNSET,
5254
) -> Response[Any]:
55+
"""Finish dataset upload, call after all chunks have been uploaded via uploadChunk
56+
Expects:
57+
- As JSON object body with keys:
58+
- uploadId (string): upload id that was also used in chunk upload (this time without file paths)
59+
- organization (string): owning organization name
60+
- name (string): dataset name
61+
- needsConversion (boolean): mark as true for non-wkw datasets. They are stored differently and a
62+
conversion job can later be run.
63+
- As GET parameter:
64+
- token (string): datastore token identifying the uploading user
65+
66+
Args:
67+
token (Union[Unset, None, str]):
68+
json_body (DatasetFinishUploadJsonBody):
69+
70+
Returns:
71+
Response[Any]
72+
"""
73+
5374
kwargs = _get_kwargs(
5475
client=client,
5576
json_body=json_body,
5677
token=token,
5778
)
5879

59-
response = httpx.post(
80+
response = httpx.request(
81+
verify=client.verify_ssl,
6082
**kwargs,
6183
)
6284

@@ -69,13 +91,32 @@ async def asyncio_detailed(
6991
json_body: DatasetFinishUploadJsonBody,
7092
token: Union[Unset, None, str] = UNSET,
7193
) -> Response[Any]:
94+
"""Finish dataset upload, call after all chunks have been uploaded via uploadChunk
95+
Expects:
96+
- As JSON object body with keys:
97+
- uploadId (string): upload id that was also used in chunk upload (this time without file paths)
98+
- organization (string): owning organization name
99+
- name (string): dataset name
100+
- needsConversion (boolean): mark as true for non-wkw datasets. They are stored differently and a
101+
conversion job can later be run.
102+
- As GET parameter:
103+
- token (string): datastore token identifying the uploading user
104+
105+
Args:
106+
token (Union[Unset, None, str]):
107+
json_body (DatasetFinishUploadJsonBody):
108+
109+
Returns:
110+
Response[Any]
111+
"""
112+
72113
kwargs = _get_kwargs(
73114
client=client,
74115
json_body=json_body,
75116
token=token,
76117
)
77118

78-
async with httpx.AsyncClient() as _client:
79-
response = await _client.post(**kwargs)
119+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
120+
response = await _client.request(**kwargs)
80121

81122
return _build_response(response=response)

0 commit comments

Comments
 (0)