Skip to content

Commit 2ccaf5f

Browse files
authored
update generated client, rm unneeded type check (#767)
1 parent 0a3ee04 commit 2ccaf5f

File tree

5 files changed

+34
-70
lines changed

5 files changed

+34
-70
lines changed

webknossos/webknossos/administration/task.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
annotation_infos_by_task_id,
1212
task_info,
1313
)
14-
from webknossos.client._generated.types import Unset
1514
from webknossos.client.context import _get_generated_client
1615
from webknossos.dataset.dataset import RemoteDataset
1716
from webknossos.geometry import BoundingBox, Vec3Int
@@ -171,7 +170,6 @@ def _from_generated_response(
171170
cls,
172171
response: Union["TaskInfoResponse200", "TaskInfosByProjectIdResponse200Item"],
173172
) -> "Task":
174-
assert not isinstance(response.status, Unset)
175173
return cls(
176174
response.id,
177175
response.project_name,

webknossos/webknossos/client/_generated/models/annotation_info_response_200_task.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Optional, Type, TypeVar, Union, cast
1+
from typing import Any, Dict, List, Optional, Type, TypeVar, cast
22

33
import attr
44

@@ -11,7 +11,6 @@
1111
from ..models.annotation_info_response_200_task_type import (
1212
AnnotationInfoResponse200TaskType,
1313
)
14-
from ..types import UNSET, Unset
1514

1615
T = TypeVar("T", bound="AnnotationInfoResponse200Task")
1716

@@ -29,13 +28,13 @@ class AnnotationInfoResponse200Task:
2928
data_set: str
3029
needed_experience: AnnotationInfoResponse200TaskNeededExperience
3130
created: int
31+
status: AnnotationInfoResponse200TaskStatus
3232
script: str
3333
creation_info: str
3434
bounding_box: str
3535
edit_position: List[int]
3636
edit_rotation: List[int]
3737
tracing_time: Optional[int]
38-
status: Union[Unset, AnnotationInfoResponse200TaskStatus] = UNSET
3938
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
4039

4140
def to_dict(self) -> Dict[str, Any]:
@@ -50,17 +49,15 @@ def to_dict(self) -> Dict[str, Any]:
5049
needed_experience = self.needed_experience.to_dict()
5150

5251
created = self.created
52+
status = self.status.to_dict()
53+
5354
script = self.script
5455
creation_info = self.creation_info
5556
bounding_box = self.bounding_box
5657
edit_position = self.edit_position
5758

5859
edit_rotation = self.edit_rotation
5960

60-
status: Union[Unset, Dict[str, Any]] = UNSET
61-
if not isinstance(self.status, Unset):
62-
status = self.status.to_dict()
63-
6461
tracing_time = self.tracing_time
6562

6663
field_dict: Dict[str, Any] = {}
@@ -76,6 +73,7 @@ def to_dict(self) -> Dict[str, Any]:
7673
"dataSet": data_set,
7774
"neededExperience": needed_experience,
7875
"created": created,
76+
"status": status,
7977
"script": script,
8078
"creationInfo": creation_info,
8179
"boundingBox": bounding_box,
@@ -84,8 +82,6 @@ def to_dict(self) -> Dict[str, Any]:
8482
"tracingTime": tracing_time,
8583
}
8684
)
87-
if status is not UNSET:
88-
field_dict["status"] = status
8985

9086
return field_dict
9187

@@ -112,6 +108,8 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
112108

113109
created = d.pop("created")
114110

111+
status = AnnotationInfoResponse200TaskStatus.from_dict(d.pop("status"))
112+
115113
script = d.pop("script")
116114

117115
creation_info = d.pop("creationInfo")
@@ -122,13 +120,6 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
122120

123121
edit_rotation = cast(List[int], d.pop("editRotation"))
124122

125-
_status = d.pop("status", UNSET)
126-
status: Union[Unset, AnnotationInfoResponse200TaskStatus]
127-
if isinstance(_status, Unset):
128-
status = UNSET
129-
else:
130-
status = AnnotationInfoResponse200TaskStatus.from_dict(_status)
131-
132123
tracing_time = d.pop("tracingTime")
133124

134125
annotation_info_response_200_task = cls(
@@ -141,12 +132,12 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
141132
data_set=data_set,
142133
needed_experience=needed_experience,
143134
created=created,
135+
status=status,
144136
script=script,
145137
creation_info=creation_info,
146138
bounding_box=bounding_box,
147139
edit_position=edit_position,
148140
edit_rotation=edit_rotation,
149-
status=status,
150141
tracing_time=tracing_time,
151142
)
152143

webknossos/webknossos/client/_generated/models/annotation_infos_by_task_id_response_200_item_task.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Optional, Type, TypeVar, Union, cast
1+
from typing import Any, Dict, List, Optional, Type, TypeVar, cast
22

33
import attr
44

@@ -11,7 +11,6 @@
1111
from ..models.annotation_infos_by_task_id_response_200_item_task_type import (
1212
AnnotationInfosByTaskIdResponse200ItemTaskType,
1313
)
14-
from ..types import UNSET, Unset
1514

1615
T = TypeVar("T", bound="AnnotationInfosByTaskIdResponse200ItemTask")
1716

@@ -29,13 +28,13 @@ class AnnotationInfosByTaskIdResponse200ItemTask:
2928
data_set: str
3029
needed_experience: AnnotationInfosByTaskIdResponse200ItemTaskNeededExperience
3130
created: int
31+
status: AnnotationInfosByTaskIdResponse200ItemTaskStatus
3232
script: str
3333
creation_info: str
3434
bounding_box: str
3535
edit_position: List[int]
3636
edit_rotation: List[int]
3737
tracing_time: Optional[int]
38-
status: Union[Unset, AnnotationInfosByTaskIdResponse200ItemTaskStatus] = UNSET
3938
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
4039

4140
def to_dict(self) -> Dict[str, Any]:
@@ -50,17 +49,15 @@ def to_dict(self) -> Dict[str, Any]:
5049
needed_experience = self.needed_experience.to_dict()
5150

5251
created = self.created
52+
status = self.status.to_dict()
53+
5354
script = self.script
5455
creation_info = self.creation_info
5556
bounding_box = self.bounding_box
5657
edit_position = self.edit_position
5758

5859
edit_rotation = self.edit_rotation
5960

60-
status: Union[Unset, Dict[str, Any]] = UNSET
61-
if not isinstance(self.status, Unset):
62-
status = self.status.to_dict()
63-
6461
tracing_time = self.tracing_time
6562

6663
field_dict: Dict[str, Any] = {}
@@ -76,6 +73,7 @@ def to_dict(self) -> Dict[str, Any]:
7673
"dataSet": data_set,
7774
"neededExperience": needed_experience,
7875
"created": created,
76+
"status": status,
7977
"script": script,
8078
"creationInfo": creation_info,
8179
"boundingBox": bounding_box,
@@ -84,8 +82,6 @@ def to_dict(self) -> Dict[str, Any]:
8482
"tracingTime": tracing_time,
8583
}
8684
)
87-
if status is not UNSET:
88-
field_dict["status"] = status
8985

9086
return field_dict
9187

@@ -114,6 +110,10 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
114110

115111
created = d.pop("created")
116112

113+
status = AnnotationInfosByTaskIdResponse200ItemTaskStatus.from_dict(
114+
d.pop("status")
115+
)
116+
117117
script = d.pop("script")
118118

119119
creation_info = d.pop("creationInfo")
@@ -124,13 +124,6 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
124124

125125
edit_rotation = cast(List[int], d.pop("editRotation"))
126126

127-
_status = d.pop("status", UNSET)
128-
status: Union[Unset, AnnotationInfosByTaskIdResponse200ItemTaskStatus]
129-
if isinstance(_status, Unset):
130-
status = UNSET
131-
else:
132-
status = AnnotationInfosByTaskIdResponse200ItemTaskStatus.from_dict(_status)
133-
134127
tracing_time = d.pop("tracingTime")
135128

136129
annotation_infos_by_task_id_response_200_item_task = cls(
@@ -143,12 +136,12 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
143136
data_set=data_set,
144137
needed_experience=needed_experience,
145138
created=created,
139+
status=status,
146140
script=script,
147141
creation_info=creation_info,
148142
bounding_box=bounding_box,
149143
edit_position=edit_position,
150144
edit_rotation=edit_rotation,
151-
status=status,
152145
tracing_time=tracing_time,
153146
)
154147

webknossos/webknossos/client/_generated/models/task_info_response_200.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Optional, Type, TypeVar, Union, cast
1+
from typing import Any, Dict, List, Optional, Type, TypeVar, cast
22

33
import attr
44

@@ -7,7 +7,6 @@
77
)
88
from ..models.task_info_response_200_status import TaskInfoResponse200Status
99
from ..models.task_info_response_200_type import TaskInfoResponse200Type
10-
from ..types import UNSET, Unset
1110

1211
T = TypeVar("T", bound="TaskInfoResponse200")
1312

@@ -25,13 +24,13 @@ class TaskInfoResponse200:
2524
data_set: str
2625
needed_experience: TaskInfoResponse200NeededExperience
2726
created: int
27+
status: TaskInfoResponse200Status
2828
script: str
2929
creation_info: str
3030
bounding_box: str
3131
edit_position: List[int]
3232
edit_rotation: List[int]
3333
tracing_time: Optional[int]
34-
status: Union[Unset, TaskInfoResponse200Status] = UNSET
3534
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
3635

3736
def to_dict(self) -> Dict[str, Any]:
@@ -46,17 +45,15 @@ def to_dict(self) -> Dict[str, Any]:
4645
needed_experience = self.needed_experience.to_dict()
4746

4847
created = self.created
48+
status = self.status.to_dict()
49+
4950
script = self.script
5051
creation_info = self.creation_info
5152
bounding_box = self.bounding_box
5253
edit_position = self.edit_position
5354

5455
edit_rotation = self.edit_rotation
5556

56-
status: Union[Unset, Dict[str, Any]] = UNSET
57-
if not isinstance(self.status, Unset):
58-
status = self.status.to_dict()
59-
6057
tracing_time = self.tracing_time
6158

6259
field_dict: Dict[str, Any] = {}
@@ -72,6 +69,7 @@ def to_dict(self) -> Dict[str, Any]:
7269
"dataSet": data_set,
7370
"neededExperience": needed_experience,
7471
"created": created,
72+
"status": status,
7573
"script": script,
7674
"creationInfo": creation_info,
7775
"boundingBox": bounding_box,
@@ -80,8 +78,6 @@ def to_dict(self) -> Dict[str, Any]:
8078
"tracingTime": tracing_time,
8179
}
8280
)
83-
if status is not UNSET:
84-
field_dict["status"] = status
8581

8682
return field_dict
8783

@@ -108,6 +104,8 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
108104

109105
created = d.pop("created")
110106

107+
status = TaskInfoResponse200Status.from_dict(d.pop("status"))
108+
111109
script = d.pop("script")
112110

113111
creation_info = d.pop("creationInfo")
@@ -118,13 +116,6 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
118116

119117
edit_rotation = cast(List[int], d.pop("editRotation"))
120118

121-
_status = d.pop("status", UNSET)
122-
status: Union[Unset, TaskInfoResponse200Status]
123-
if isinstance(_status, Unset):
124-
status = UNSET
125-
else:
126-
status = TaskInfoResponse200Status.from_dict(_status)
127-
128119
tracing_time = d.pop("tracingTime")
129120

130121
task_info_response_200 = cls(
@@ -137,12 +128,12 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
137128
data_set=data_set,
138129
needed_experience=needed_experience,
139130
created=created,
131+
status=status,
140132
script=script,
141133
creation_info=creation_info,
142134
bounding_box=bounding_box,
143135
edit_position=edit_position,
144136
edit_rotation=edit_rotation,
145-
status=status,
146137
tracing_time=tracing_time,
147138
)
148139

0 commit comments

Comments
 (0)