label-studio-sdk 1.0.8__py3-none-any.whl → 1.0.10__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.

Potentially problematic release.


This version of label-studio-sdk might be problematic. Click here for more details.

Files changed (200) hide show
  1. label_studio_sdk/__init__.py +20 -7
  2. label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +16 -4
  3. label_studio_sdk/_extensions/pager_ext.py +8 -0
  4. label_studio_sdk/actions/client.py +91 -40
  5. label_studio_sdk/actions/types/actions_create_request_filters.py +14 -24
  6. label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +16 -26
  7. label_studio_sdk/actions/types/actions_create_request_filters_items_item_value.py +3 -1
  8. label_studio_sdk/actions/types/actions_create_request_selected_items.py +1 -2
  9. label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +15 -25
  10. label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +15 -25
  11. label_studio_sdk/annotations/__init__.py +2 -2
  12. label_studio_sdk/annotations/client.py +278 -104
  13. label_studio_sdk/annotations/types/__init__.py +2 -1
  14. label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +34 -0
  15. label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +11 -21
  16. label_studio_sdk/base_client.py +46 -27
  17. label_studio_sdk/client.py +1 -0
  18. label_studio_sdk/comments/client.py +190 -44
  19. label_studio_sdk/converter/converter.py +56 -13
  20. label_studio_sdk/converter/imports/yolo.py +1 -1
  21. label_studio_sdk/converter/utils.py +3 -2
  22. label_studio_sdk/core/__init__.py +21 -4
  23. label_studio_sdk/core/client_wrapper.py +9 -10
  24. label_studio_sdk/core/file.py +37 -8
  25. label_studio_sdk/core/http_client.py +52 -28
  26. label_studio_sdk/core/jsonable_encoder.py +33 -31
  27. label_studio_sdk/core/pagination.py +5 -4
  28. label_studio_sdk/core/pydantic_utilities.py +272 -4
  29. label_studio_sdk/core/query_encoder.py +38 -13
  30. label_studio_sdk/core/request_options.py +3 -0
  31. label_studio_sdk/core/serialization.py +272 -0
  32. label_studio_sdk/errors/bad_request_error.py +2 -3
  33. label_studio_sdk/export_storage/azure/client.py +228 -58
  34. label_studio_sdk/export_storage/azure/types/azure_create_response.py +19 -29
  35. label_studio_sdk/export_storage/azure/types/azure_update_response.py +19 -29
  36. label_studio_sdk/export_storage/client.py +48 -18
  37. label_studio_sdk/export_storage/gcs/client.py +228 -58
  38. label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +19 -29
  39. label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +19 -29
  40. label_studio_sdk/export_storage/local/client.py +222 -56
  41. label_studio_sdk/export_storage/local/types/local_create_response.py +17 -27
  42. label_studio_sdk/export_storage/local/types/local_update_response.py +17 -27
  43. label_studio_sdk/export_storage/redis/client.py +228 -58
  44. label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -30
  45. label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -30
  46. label_studio_sdk/export_storage/s3/client.py +228 -58
  47. label_studio_sdk/export_storage/s3/types/s3create_response.py +27 -35
  48. label_studio_sdk/export_storage/s3/types/s3update_response.py +27 -35
  49. label_studio_sdk/export_storage/s3s/client.py +187 -43
  50. label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +11 -21
  51. label_studio_sdk/files/client.py +172 -56
  52. label_studio_sdk/import_storage/azure/client.py +223 -53
  53. label_studio_sdk/import_storage/azure/types/azure_create_response.py +22 -32
  54. label_studio_sdk/import_storage/azure/types/azure_update_response.py +22 -32
  55. label_studio_sdk/import_storage/client.py +48 -18
  56. label_studio_sdk/import_storage/gcs/client.py +223 -53
  57. label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +22 -32
  58. label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +22 -32
  59. label_studio_sdk/import_storage/local/client.py +223 -53
  60. label_studio_sdk/import_storage/local/types/local_create_response.py +17 -27
  61. label_studio_sdk/import_storage/local/types/local_update_response.py +17 -27
  62. label_studio_sdk/import_storage/redis/client.py +223 -53
  63. label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -30
  64. label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -30
  65. label_studio_sdk/import_storage/s3/client.py +223 -53
  66. label_studio_sdk/import_storage/s3/types/s3create_response.py +31 -39
  67. label_studio_sdk/import_storage/s3/types/s3update_response.py +31 -39
  68. label_studio_sdk/import_storage/s3s/client.py +222 -52
  69. label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +11 -21
  70. label_studio_sdk/label_interface/control_tags.py +1 -1
  71. label_studio_sdk/ml/client.py +280 -78
  72. label_studio_sdk/ml/types/ml_create_response.py +21 -31
  73. label_studio_sdk/ml/types/ml_update_response.py +21 -31
  74. label_studio_sdk/model_providers/client.py +173 -56
  75. label_studio_sdk/predictions/client.py +247 -101
  76. label_studio_sdk/projects/__init__.py +3 -0
  77. label_studio_sdk/projects/client.py +309 -115
  78. label_studio_sdk/projects/client_ext.py +16 -0
  79. label_studio_sdk/projects/exports/__init__.py +3 -0
  80. label_studio_sdk/projects/exports/client.py +447 -296
  81. label_studio_sdk/projects/exports/client_ext.py +134 -0
  82. label_studio_sdk/projects/exports/types/__init__.py +6 -0
  83. label_studio_sdk/projects/exports/types/exports_convert_response.py +24 -0
  84. label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +44 -0
  85. label_studio_sdk/projects/types/projects_create_response.py +29 -34
  86. label_studio_sdk/projects/types/projects_import_tasks_response.py +19 -29
  87. label_studio_sdk/projects/types/projects_list_response.py +11 -21
  88. label_studio_sdk/projects/types/projects_update_response.py +24 -34
  89. label_studio_sdk/prompts/client.py +309 -92
  90. label_studio_sdk/prompts/indicators/client.py +67 -23
  91. label_studio_sdk/prompts/runs/client.py +95 -40
  92. label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +14 -24
  93. label_studio_sdk/prompts/types/prompts_batch_failed_predictions_response.py +11 -21
  94. label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +26 -29
  95. label_studio_sdk/prompts/types/prompts_batch_predictions_response.py +11 -21
  96. label_studio_sdk/prompts/versions/client.py +277 -88
  97. label_studio_sdk/tasks/client.py +263 -90
  98. label_studio_sdk/tasks/types/tasks_list_response.py +15 -25
  99. label_studio_sdk/types/__init__.py +10 -6
  100. label_studio_sdk/types/annotation.py +29 -38
  101. label_studio_sdk/types/annotation_filter_options.py +14 -24
  102. label_studio_sdk/types/annotations_dm_field.py +30 -39
  103. label_studio_sdk/types/azure_blob_export_storage.py +28 -37
  104. label_studio_sdk/types/azure_blob_import_storage.py +28 -37
  105. label_studio_sdk/types/base_task.py +30 -39
  106. label_studio_sdk/types/base_task_updated_by.py +3 -1
  107. label_studio_sdk/types/base_user.py +14 -21
  108. label_studio_sdk/types/comment.py +12 -21
  109. label_studio_sdk/types/comment_created_by.py +1 -1
  110. label_studio_sdk/types/converted_format.py +12 -22
  111. label_studio_sdk/types/data_manager_task_serializer.py +31 -40
  112. label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +1 -1
  113. label_studio_sdk/types/data_manager_task_serializer_drafts_item.py +13 -22
  114. label_studio_sdk/types/data_manager_task_serializer_predictions_item.py +15 -24
  115. label_studio_sdk/types/export.py +17 -26
  116. label_studio_sdk/types/export_format.py +25 -0
  117. label_studio_sdk/types/export_snapshot.py +45 -0
  118. label_studio_sdk/types/export_snapshot_status.py +5 -0
  119. label_studio_sdk/types/file_upload.py +11 -21
  120. label_studio_sdk/types/filter.py +16 -26
  121. label_studio_sdk/types/filter_group.py +12 -22
  122. label_studio_sdk/types/gcs_export_storage.py +28 -37
  123. label_studio_sdk/types/gcs_import_storage.py +28 -37
  124. label_studio_sdk/types/inference_run.py +14 -23
  125. label_studio_sdk/types/inference_run_cost_estimate.py +17 -27
  126. label_studio_sdk/types/inference_run_created_by.py +1 -1
  127. label_studio_sdk/types/inference_run_organization.py +1 -1
  128. label_studio_sdk/types/key_indicator_value.py +12 -22
  129. label_studio_sdk/types/key_indicators.py +0 -1
  130. label_studio_sdk/types/key_indicators_item.py +15 -25
  131. label_studio_sdk/types/key_indicators_item_additional_kpis_item.py +13 -23
  132. label_studio_sdk/types/key_indicators_item_extra_kpis_item.py +13 -23
  133. label_studio_sdk/types/local_files_export_storage.py +25 -34
  134. label_studio_sdk/types/local_files_import_storage.py +24 -33
  135. label_studio_sdk/types/ml_backend.py +23 -32
  136. label_studio_sdk/types/model_provider_connection.py +22 -31
  137. label_studio_sdk/types/model_provider_connection_created_by.py +1 -1
  138. label_studio_sdk/types/model_provider_connection_organization.py +1 -1
  139. label_studio_sdk/types/model_provider_connection_provider.py +3 -1
  140. label_studio_sdk/types/prediction.py +21 -30
  141. label_studio_sdk/types/project.py +48 -55
  142. label_studio_sdk/types/project_import.py +21 -30
  143. label_studio_sdk/types/project_label_config.py +12 -22
  144. label_studio_sdk/types/prompt.py +24 -32
  145. label_studio_sdk/types/prompt_associated_projects_item.py +6 -0
  146. label_studio_sdk/types/prompt_associated_projects_item_id.py +20 -0
  147. label_studio_sdk/types/prompt_created_by.py +1 -1
  148. label_studio_sdk/types/prompt_organization.py +1 -1
  149. label_studio_sdk/types/prompt_version.py +13 -22
  150. label_studio_sdk/types/prompt_version_created_by.py +1 -1
  151. label_studio_sdk/types/prompt_version_organization.py +1 -1
  152. label_studio_sdk/types/prompt_version_provider.py +3 -1
  153. label_studio_sdk/types/redis_export_storage.py +29 -38
  154. label_studio_sdk/types/redis_import_storage.py +28 -37
  155. label_studio_sdk/types/refined_prompt_response.py +19 -29
  156. label_studio_sdk/types/s3export_storage.py +36 -43
  157. label_studio_sdk/types/s3import_storage.py +37 -44
  158. label_studio_sdk/types/s3s_export_storage.py +26 -33
  159. label_studio_sdk/types/s3s_import_storage.py +35 -42
  160. label_studio_sdk/types/serialization_option.py +12 -22
  161. label_studio_sdk/types/serialization_options.py +18 -28
  162. label_studio_sdk/types/task.py +44 -47
  163. label_studio_sdk/types/task_annotators_item.py +1 -1
  164. label_studio_sdk/types/task_comment_authors_item.py +1 -1
  165. label_studio_sdk/types/task_filter_options.py +15 -25
  166. label_studio_sdk/types/user_simple.py +11 -21
  167. label_studio_sdk/types/view.py +16 -26
  168. label_studio_sdk/types/webhook.py +19 -28
  169. label_studio_sdk/types/webhook_serializer_for_update.py +19 -28
  170. label_studio_sdk/types/workspace.py +22 -31
  171. label_studio_sdk/users/client.py +257 -63
  172. label_studio_sdk/users/types/users_get_token_response.py +12 -22
  173. label_studio_sdk/users/types/users_reset_token_response.py +12 -22
  174. label_studio_sdk/version.py +0 -1
  175. label_studio_sdk/versions/__init__.py +5 -0
  176. label_studio_sdk/versions/client.py +112 -0
  177. label_studio_sdk/versions/types/__init__.py +6 -0
  178. label_studio_sdk/versions/types/versions_get_response.py +73 -0
  179. label_studio_sdk/versions/types/versions_get_response_edition.py +5 -0
  180. label_studio_sdk/views/client.py +219 -52
  181. label_studio_sdk/views/types/views_create_request_data.py +13 -23
  182. label_studio_sdk/views/types/views_create_request_data_filters.py +14 -24
  183. label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +16 -26
  184. label_studio_sdk/views/types/views_create_request_data_filters_items_item_value.py +3 -1
  185. label_studio_sdk/views/types/views_update_request_data.py +13 -23
  186. label_studio_sdk/views/types/views_update_request_data_filters.py +14 -24
  187. label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +16 -26
  188. label_studio_sdk/views/types/views_update_request_data_filters_items_item_value.py +3 -1
  189. label_studio_sdk/webhooks/client.py +191 -61
  190. label_studio_sdk/workspaces/client.py +164 -41
  191. label_studio_sdk/workspaces/members/client.py +109 -31
  192. label_studio_sdk/workspaces/members/types/members_create_response.py +12 -22
  193. label_studio_sdk/workspaces/members/types/members_list_response_item.py +12 -22
  194. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/METADATA +7 -5
  195. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/RECORD +197 -184
  196. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/WHEEL +1 -1
  197. label_studio_sdk/types/export_convert.py +0 -32
  198. label_studio_sdk/types/export_create.py +0 -54
  199. label_studio_sdk/types/export_create_status.py +0 -5
  200. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/LICENSE +0 -0
@@ -1,129 +1,122 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
4
  import typing
5
-
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
5
+ import datetime as dt
6
+ import pydantic
8
7
  from .s3s_import_storage_status import S3SImportStorageStatus
8
+ import typing_extensions
9
+ from ..core.serialization import FieldMetadata
10
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
9
11
 
10
12
 
11
- class S3SImportStorage(pydantic_v1.BaseModel):
13
+ class S3SImportStorage(UniversalBaseModel):
12
14
  id: typing.Optional[int] = None
13
15
  synchronizable: typing.Optional[bool] = None
14
16
  presign: typing.Optional[bool] = None
15
- last_sync: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
17
+ last_sync: typing.Optional[dt.datetime] = pydantic.Field(default=None)
16
18
  """
17
19
  Last sync finished time
18
20
  """
19
21
 
20
- last_sync_count: typing.Optional[int] = pydantic_v1.Field(default=None)
22
+ last_sync_count: typing.Optional[int] = pydantic.Field(default=None)
21
23
  """
22
24
  Count of tasks synced last time
23
25
  """
24
26
 
25
- last_sync_job: typing.Optional[str] = pydantic_v1.Field(default=None)
27
+ last_sync_job: typing.Optional[str] = pydantic.Field(default=None)
26
28
  """
27
29
  Last sync job ID
28
30
  """
29
31
 
30
32
  status: typing.Optional[S3SImportStorageStatus] = None
31
- traceback: typing.Optional[str] = pydantic_v1.Field(default=None)
33
+ traceback: typing.Optional[str] = pydantic.Field(default=None)
32
34
  """
33
35
  Traceback report for the last failed sync
34
36
  """
35
37
 
36
- meta: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None)
38
+ meta: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
37
39
  """
38
40
  Meta and debug information about storage processes
39
41
  """
40
42
 
41
- title: typing.Optional[str] = pydantic_v1.Field(default=None)
43
+ title: typing.Optional[str] = pydantic.Field(default=None)
42
44
  """
43
45
  Cloud storage title
44
46
  """
45
47
 
46
- description: typing.Optional[str] = pydantic_v1.Field(default=None)
48
+ description: typing.Optional[str] = pydantic.Field(default=None)
47
49
  """
48
50
  Cloud storage description
49
51
  """
50
52
 
51
- created_at: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
53
+ created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
52
54
  """
53
55
  Creation time
54
56
  """
55
57
 
56
- bucket: typing.Optional[str] = pydantic_v1.Field(default=None)
58
+ bucket: typing.Optional[str] = pydantic.Field(default=None)
57
59
  """
58
60
  S3 bucket name
59
61
  """
60
62
 
61
- prefix: typing.Optional[str] = pydantic_v1.Field(default=None)
63
+ prefix: typing.Optional[str] = pydantic.Field(default=None)
62
64
  """
63
65
  S3 bucket prefix
64
66
  """
65
67
 
66
- regex_filter: typing.Optional[str] = pydantic_v1.Field(default=None)
68
+ regex_filter: typing.Optional[str] = pydantic.Field(default=None)
67
69
  """
68
70
  Cloud storage regex for filtering objects
69
71
  """
70
72
 
71
- use_blob_urls: typing.Optional[bool] = pydantic_v1.Field(default=None)
73
+ use_blob_urls: typing.Optional[bool] = pydantic.Field(default=None)
72
74
  """
73
75
  Interpret objects as BLOBs and generate URLs
74
76
  """
75
77
 
76
- region_name: typing.Optional[str] = pydantic_v1.Field(default=None)
78
+ region_name: typing.Optional[str] = pydantic.Field(default=None)
77
79
  """
78
80
  AWS Region
79
81
  """
80
82
 
81
- external_id: typing.Optional[str] = pydantic_v1.Field(default=None)
83
+ external_id: typing.Optional[str] = pydantic.Field(default=None)
82
84
  """
83
85
  AWS External ID
84
86
  """
85
87
 
86
- role_arn: typing.Optional[str] = pydantic_v1.Field(default=None)
88
+ role_arn: typing.Optional[str] = pydantic.Field(default=None)
87
89
  """
88
90
  AWS Role ARN
89
91
  """
90
92
 
91
- s3endpoint: typing.Optional[str] = pydantic_v1.Field(alias="s3_endpoint", default=None)
93
+ s3endpoint: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="s3_endpoint")] = pydantic.Field(
94
+ default=None
95
+ )
92
96
  """
93
97
  S3 Endpoint
94
98
  """
95
99
 
96
- presign_ttl: typing.Optional[int] = pydantic_v1.Field(default=None)
100
+ presign_ttl: typing.Optional[int] = pydantic.Field(default=None)
97
101
  """
98
102
  Presigned URLs TTL (in minutes)
99
103
  """
100
104
 
101
- recursive_scan: typing.Optional[bool] = pydantic_v1.Field(default=None)
105
+ recursive_scan: typing.Optional[bool] = pydantic.Field(default=None)
102
106
  """
103
107
  Perform recursive scan over the bucket content
104
108
  """
105
109
 
106
- project: int = pydantic_v1.Field()
110
+ project: int = pydantic.Field()
107
111
  """
108
112
  A unique integer value identifying this project.
109
113
  """
110
114
 
111
- def json(self, **kwargs: typing.Any) -> str:
112
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
113
- return super().json(**kwargs_with_defaults)
114
-
115
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
116
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
117
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
118
-
119
- return deep_union_pydantic_dicts(
120
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
121
- )
115
+ if IS_PYDANTIC_V2:
116
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
117
+ else:
122
118
 
123
- class Config:
124
- frozen = True
125
- smart_union = True
126
- allow_population_by_field_name = True
127
- populate_by_name = True
128
- extra = pydantic_v1.Extra.allow
129
- json_encoders = {dt.datetime: serialize_datetime}
119
+ class Config:
120
+ frozen = True
121
+ smart_union = True
122
+ extra = pydantic.Extra.allow
@@ -1,36 +1,26 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
4
  import typing
5
+ import pydantic
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
5
7
 
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
8
 
9
-
10
- class SerializationOption(pydantic_v1.BaseModel):
9
+ class SerializationOption(UniversalBaseModel):
11
10
  """
12
11
  JSON dict with parameters
13
12
  """
14
13
 
15
- only_id: typing.Optional[bool] = pydantic_v1.Field(default=None)
14
+ only_id: typing.Optional[bool] = pydantic.Field(default=None)
16
15
  """
17
16
  Include a full json body or IDs only
18
17
  """
19
18
 
20
- def json(self, **kwargs: typing.Any) -> str:
21
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
22
- return super().json(**kwargs_with_defaults)
23
-
24
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
25
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
26
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
27
-
28
- return deep_union_pydantic_dicts(
29
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
30
- )
19
+ if IS_PYDANTIC_V2:
20
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
21
+ else:
31
22
 
32
- class Config:
33
- frozen = True
34
- smart_union = True
35
- extra = pydantic_v1.Extra.allow
36
- json_encoders = {dt.datetime: serialize_datetime}
23
+ class Config:
24
+ frozen = True
25
+ smart_union = True
26
+ extra = pydantic.Extra.allow
@@ -1,45 +1,35 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
4
  import typing
5
-
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
5
  from .serialization_option import SerializationOption
6
+ import pydantic
7
+ import typing_extensions
8
+ from ..core.serialization import FieldMetadata
9
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
9
10
 
10
11
 
11
- class SerializationOptions(pydantic_v1.BaseModel):
12
+ class SerializationOptions(UniversalBaseModel):
12
13
  drafts: typing.Optional[SerializationOption] = None
13
14
  predictions: typing.Optional[SerializationOption] = None
14
- include_annotation_history: typing.Optional[bool] = pydantic_v1.Field(default=None)
15
+ include_annotation_history: typing.Optional[bool] = pydantic.Field(default=None)
15
16
  """
16
17
  Include annotation history
17
18
  """
18
19
 
19
- annotations_completed_by: typing.Optional[SerializationOption] = pydantic_v1.Field(
20
- alias="annotations__completed_by", default=None
21
- )
22
- interpolate_key_frames: typing.Optional[bool] = pydantic_v1.Field(default=None)
20
+ annotations_completed_by: typing_extensions.Annotated[
21
+ typing.Optional[SerializationOption], FieldMetadata(alias="annotations__completed_by")
22
+ ] = None
23
+ interpolate_key_frames: typing.Optional[bool] = pydantic.Field(default=None)
23
24
  """
24
25
  Interpolate video key frames
25
26
  """
26
27
 
27
- def json(self, **kwargs: typing.Any) -> str:
28
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
29
- return super().json(**kwargs_with_defaults)
30
-
31
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
32
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
33
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
34
-
35
- return deep_union_pydantic_dicts(
36
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
37
- )
28
+ if IS_PYDANTIC_V2:
29
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
30
+ else:
38
31
 
39
- class Config:
40
- frozen = True
41
- smart_union = True
42
- allow_population_by_field_name = True
43
- populate_by_name = True
44
- extra = pydantic_v1.Extra.allow
45
- json_encoders = {dt.datetime: serialize_datetime}
32
+ class Config:
33
+ frozen = True
34
+ smart_union = True
35
+ extra = pydantic.Extra.allow
@@ -1,159 +1,156 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
4
  import typing
5
-
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
5
+ import pydantic
8
6
  from .task_annotators_item import TaskAnnotatorsItem
7
+ import datetime as dt
9
8
  from .task_comment_authors_item import TaskCommentAuthorsItem
9
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
10
10
 
11
11
 
12
- class Task(pydantic_v1.BaseModel):
13
- id: typing.Optional[int] = pydantic_v1.Field(default=None)
12
+ class Task(UniversalBaseModel):
13
+ id: typing.Optional[int] = pydantic.Field(default=None)
14
14
  """
15
15
  Unique ID of the task
16
16
  """
17
17
 
18
- predictions: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = pydantic_v1.Field(default=None)
18
+ predictions: typing.Optional[typing.List[typing.Dict[str, typing.Optional[typing.Any]]]] = pydantic.Field(
19
+ default=None
20
+ )
19
21
  """
20
22
  Predictions for this task
21
23
  """
22
24
 
23
- annotations: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = pydantic_v1.Field(default=None)
25
+ annotations: typing.Optional[typing.List[typing.Dict[str, typing.Optional[typing.Any]]]] = pydantic.Field(
26
+ default=None
27
+ )
24
28
  """
25
29
  Annotations for this task
26
30
  """
27
31
 
28
- drafts: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = pydantic_v1.Field(default=None)
32
+ drafts: typing.Optional[typing.List[typing.Dict[str, typing.Optional[typing.Any]]]] = pydantic.Field(default=None)
29
33
  """
30
34
  Drafts for this task
31
35
  """
32
36
 
33
- annotators: typing.Optional[typing.List[TaskAnnotatorsItem]] = pydantic_v1.Field(default=None)
37
+ annotators: typing.Optional[typing.List[TaskAnnotatorsItem]] = pydantic.Field(default=None)
34
38
  """
35
39
  List of annotators for this task
36
40
  """
37
41
 
38
- inner_id: typing.Optional[int] = pydantic_v1.Field(default=None)
42
+ inner_id: typing.Optional[int] = pydantic.Field(default=None)
39
43
  """
40
44
  Inner ID of the task
41
45
  """
42
46
 
43
- cancelled_annotations: typing.Optional[int] = pydantic_v1.Field(default=None)
47
+ cancelled_annotations: typing.Optional[int] = pydantic.Field(default=None)
44
48
  """
45
49
  Number of cancelled annotations for this task
46
50
  """
47
51
 
48
- total_annotations: typing.Optional[int] = pydantic_v1.Field(default=None)
52
+ total_annotations: typing.Optional[int] = pydantic.Field(default=None)
49
53
  """
50
54
  Total number of annotations for this task
51
55
  """
52
56
 
53
- total_predictions: typing.Optional[int] = pydantic_v1.Field(default=None)
57
+ total_predictions: typing.Optional[int] = pydantic.Field(default=None)
54
58
  """
55
59
  Total number of predictions for this task
56
60
  """
57
61
 
58
- completed_at: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
62
+ completed_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
59
63
  """
60
64
  Completion time of the task
61
65
  """
62
66
 
63
- file_upload: typing.Optional[str] = pydantic_v1.Field(default=None)
67
+ file_upload: typing.Optional[str] = pydantic.Field(default=None)
64
68
  """
65
69
  File upload ID for this task
66
70
  """
67
71
 
68
- storage_filename: typing.Optional[str] = pydantic_v1.Field(default=None)
72
+ storage_filename: typing.Optional[str] = pydantic.Field(default=None)
69
73
  """
70
74
  Storage filename for this task
71
75
  """
72
76
 
73
- avg_lead_time: typing.Optional[float] = pydantic_v1.Field(default=None)
77
+ avg_lead_time: typing.Optional[float] = pydantic.Field(default=None)
74
78
  """
75
79
  Average lead time for this task
76
80
  """
77
81
 
78
- draft_exists: typing.Optional[bool] = pydantic_v1.Field(default=None)
82
+ draft_exists: typing.Optional[bool] = pydantic.Field(default=None)
79
83
  """
80
84
  Whether a draft exists for this task or not
81
85
  """
82
86
 
83
- updated_by: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = pydantic_v1.Field(default=None)
87
+ updated_by: typing.Optional[typing.List[typing.Dict[str, typing.Optional[typing.Any]]]] = pydantic.Field(
88
+ default=None
89
+ )
84
90
  """
85
91
  List of annotators' info who updated this task
86
92
  """
87
93
 
88
- data: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None)
94
+ data: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
89
95
  """
90
96
  Data of the task
91
97
  """
92
98
 
93
- meta: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None)
99
+ meta: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
94
100
  """
95
101
  Meta information of the task
96
102
  """
97
103
 
98
- created_at: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
104
+ created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
99
105
  """
100
106
  Creation time of the task
101
107
  """
102
108
 
103
- updated_at: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
109
+ updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
104
110
  """
105
111
  Last updated time of the task
106
112
  """
107
113
 
108
- is_labeled: typing.Optional[bool] = pydantic_v1.Field(default=None)
114
+ is_labeled: typing.Optional[bool] = pydantic.Field(default=None)
109
115
  """
110
116
  Whether the task is labeled or not
111
117
  """
112
118
 
113
- overlap: typing.Optional[float] = pydantic_v1.Field(default=None)
119
+ overlap: typing.Optional[float] = pydantic.Field(default=None)
114
120
  """
115
121
  Overlap for the task
116
122
  """
117
123
 
118
- comment_count: typing.Optional[int] = pydantic_v1.Field(default=None)
124
+ comment_count: typing.Optional[int] = pydantic.Field(default=None)
119
125
  """
120
126
  Number of comments for this task
121
127
  """
122
128
 
123
- unresolved_comment_count: typing.Optional[int] = pydantic_v1.Field(default=None)
129
+ unresolved_comment_count: typing.Optional[int] = pydantic.Field(default=None)
124
130
  """
125
131
  Number of unresolved comments for this task
126
132
  """
127
133
 
128
- last_comment_updated_at: typing.Optional[dt.datetime] = pydantic_v1.Field(default=None)
134
+ last_comment_updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
129
135
  """
130
136
  Last updated time of the comments for this task
131
137
  """
132
138
 
133
- project: typing.Optional[int] = pydantic_v1.Field(default=None)
139
+ project: typing.Optional[int] = pydantic.Field(default=None)
134
140
  """
135
141
  Project ID for this task
136
142
  """
137
143
 
138
- comment_authors: typing.Optional[typing.List[TaskCommentAuthorsItem]] = pydantic_v1.Field(default=None)
144
+ comment_authors: typing.Optional[typing.List[TaskCommentAuthorsItem]] = pydantic.Field(default=None)
139
145
  """
140
146
  List of comment authors for this task
141
147
  """
142
148
 
143
- def json(self, **kwargs: typing.Any) -> str:
144
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
145
- return super().json(**kwargs_with_defaults)
146
-
147
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
148
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
149
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
150
-
151
- return deep_union_pydantic_dicts(
152
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
153
- )
149
+ if IS_PYDANTIC_V2:
150
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
151
+ else:
154
152
 
155
- class Config:
156
- frozen = True
157
- smart_union = True
158
- extra = pydantic_v1.Extra.allow
159
- json_encoders = {dt.datetime: serialize_datetime}
153
+ class Config:
154
+ frozen = True
155
+ smart_union = True
156
+ extra = pydantic.Extra.allow
@@ -2,4 +2,4 @@
2
2
 
3
3
  import typing
4
4
 
5
- TaskAnnotatorsItem = typing.Union[int, typing.Dict[str, typing.Any]]
5
+ TaskAnnotatorsItem = typing.Union[int, typing.Dict[str, typing.Optional[typing.Any]]]
@@ -2,4 +2,4 @@
2
2
 
3
3
  import typing
4
4
 
5
- TaskCommentAuthorsItem = typing.Union[int, typing.Dict[str, typing.Any]]
5
+ TaskCommentAuthorsItem = typing.Union[int, typing.Dict[str, typing.Optional[typing.Any]]]
@@ -1,49 +1,39 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
4
  import typing
5
+ import pydantic
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
5
7
 
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
8
 
9
-
10
- class TaskFilterOptions(pydantic_v1.BaseModel):
11
- view: typing.Optional[int] = pydantic_v1.Field(default=None)
9
+ class TaskFilterOptions(UniversalBaseModel):
10
+ view: typing.Optional[int] = pydantic.Field(default=None)
12
11
  """
13
12
  Apply filters from the view ID (a tab from the Data Manager)
14
13
  """
15
14
 
16
- skipped: typing.Optional[str] = pydantic_v1.Field(default=None)
15
+ skipped: typing.Optional[str] = pydantic.Field(default=None)
17
16
  """
18
17
  `only` - include all tasks with skipped annotations<br>`exclude` - exclude all tasks with skipped annotations
19
18
  """
20
19
 
21
- finished: typing.Optional[str] = pydantic_v1.Field(default=None)
20
+ finished: typing.Optional[str] = pydantic.Field(default=None)
22
21
  """
23
22
  `only` - include all finished tasks (is_labeled = true)<br>`exclude` - exclude all finished tasks
24
23
  """
25
24
 
26
- annotated: typing.Optional[str] = pydantic_v1.Field(default=None)
25
+ annotated: typing.Optional[str] = pydantic.Field(default=None)
27
26
  """
28
27
  `only` - include all tasks with at least one not skipped annotation<br>`exclude` - exclude all tasks with at least one not skipped annotation
29
28
  """
30
29
 
31
30
  only_with_annotations: typing.Optional[bool] = None
32
31
 
33
- def json(self, **kwargs: typing.Any) -> str:
34
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
35
- return super().json(**kwargs_with_defaults)
36
-
37
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
38
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
39
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
40
-
41
- return deep_union_pydantic_dicts(
42
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
43
- )
32
+ if IS_PYDANTIC_V2:
33
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
34
+ else:
44
35
 
45
- class Config:
46
- frozen = True
47
- smart_union = True
48
- extra = pydantic_v1.Extra.allow
49
- json_encoders = {dt.datetime: serialize_datetime}
36
+ class Config:
37
+ frozen = True
38
+ smart_union = True
39
+ extra = pydantic.Extra.allow
@@ -1,13 +1,12 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import datetime as dt
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
4
  import typing
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import pydantic
5
7
 
6
- from ..core.datetime_utils import serialize_datetime
7
- from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8
8
 
9
-
10
- class UserSimple(pydantic_v1.BaseModel):
9
+ class UserSimple(UniversalBaseModel):
11
10
  """
12
11
  Project owner
13
12
  """
@@ -18,20 +17,11 @@ class UserSimple(pydantic_v1.BaseModel):
18
17
  email: typing.Optional[str] = None
19
18
  avatar: typing.Optional[str] = None
20
19
 
21
- def json(self, **kwargs: typing.Any) -> str:
22
- kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
23
- return super().json(**kwargs_with_defaults)
24
-
25
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
26
- kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
27
- kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
28
-
29
- return deep_union_pydantic_dicts(
30
- super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
31
- )
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
+ else:
32
23
 
33
- class Config:
34
- frozen = True
35
- smart_union = True
36
- extra = pydantic_v1.Extra.allow
37
- json_encoders = {dt.datetime: serialize_datetime}
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic.Extra.allow