rapidata 0.1.3__py3-none-any.whl → 0.1.6__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.
- openapi/openapi-client/openapi_client/__init__.py +215 -0
- openapi/openapi-client/openapi_client/api/__init__.py +11 -0
- openapi/openapi-client/openapi_client/api/coco_api.py +619 -0
- openapi/openapi-client/openapi_client/api/datapoint_api.py +817 -0
- openapi/openapi-client/openapi_client/api/dataset_api.py +2290 -0
- openapi/openapi-client/openapi_client/api/identity_api.py +3181 -0
- openapi/openapi-client/openapi_client/api/newsletter_api.py +571 -0
- openapi/openapi-client/openapi_client/api/order_api.py +5390 -0
- openapi/openapi-client/openapi_client/api/validation_api.py +1670 -0
- openapi/openapi-client/openapi_client/api_client.py +797 -0
- openapi/openapi-client/openapi_client/api_response.py +21 -0
- openapi/openapi-client/openapi_client/configuration.py +479 -0
- openapi/openapi-client/openapi_client/exceptions.py +199 -0
- openapi/openapi-client/openapi_client/models/__init__.py +192 -0
- openapi/openapi-client/openapi_client/models/add_validation_rapid_model.py +116 -0
- openapi/openapi-client/openapi_client/models/add_validation_rapid_model_payload.py +238 -0
- openapi/openapi-client/openapi_client/models/add_validation_rapid_model_truth.py +238 -0
- openapi/openapi-client/openapi_client/models/admin_order_model.py +103 -0
- openapi/openapi-client/openapi_client/models/admin_order_model_paged_result.py +105 -0
- openapi/openapi-client/openapi_client/models/age_group.py +40 -0
- openapi/openapi-client/openapi_client/models/age_user_filter_model.py +97 -0
- openapi/openapi-client/openapi_client/models/aggregator_type.py +46 -0
- openapi/openapi-client/openapi_client/models/attach_category_rapid_blueprint.py +98 -0
- openapi/openapi-client/openapi_client/models/attach_category_truth.py +96 -0
- openapi/openapi-client/openapi_client/models/base_error.py +90 -0
- openapi/openapi-client/openapi_client/models/bounding_box_payload.py +96 -0
- openapi/openapi-client/openapi_client/models/bounding_box_rapid_blueprint.py +96 -0
- openapi/openapi-client/openapi_client/models/bounding_box_truth.py +102 -0
- openapi/openapi-client/openapi_client/models/box_shape.py +122 -0
- openapi/openapi-client/openapi_client/models/classification_metadata.py +110 -0
- openapi/openapi-client/openapi_client/models/classification_metadata_filter_config.py +96 -0
- openapi/openapi-client/openapi_client/models/classify_payload.py +98 -0
- openapi/openapi-client/openapi_client/models/clone_dataset_model.py +98 -0
- openapi/openapi-client/openapi_client/models/clone_order_model.py +89 -0
- openapi/openapi-client/openapi_client/models/clone_order_result.py +89 -0
- openapi/openapi-client/openapi_client/models/compare_payload.py +96 -0
- openapi/openapi-client/openapi_client/models/compare_rapid_blueprint.py +96 -0
- openapi/openapi-client/openapi_client/models/compare_truth.py +96 -0
- openapi/openapi-client/openapi_client/models/compare_workflow_config.py +143 -0
- openapi/openapi-client/openapi_client/models/compare_workflow_config_rapid_selection_configs_inner.py +210 -0
- openapi/openapi-client/openapi_client/models/compare_workflow_config_referee.py +154 -0
- openapi/openapi-client/openapi_client/models/compare_workflow_model.py +106 -0
- openapi/openapi-client/openapi_client/models/conditional_validation_rapid_selection_config.py +113 -0
- openapi/openapi-client/openapi_client/models/correlated_rapid_selection_config.py +98 -0
- openapi/openapi-client/openapi_client/models/count_classification_metadata_filter_config.py +94 -0
- openapi/openapi-client/openapi_client/models/count_metadata.py +110 -0
- openapi/openapi-client/openapi_client/models/country_user_filter_model.py +96 -0
- openapi/openapi-client/openapi_client/models/create_client_model.py +89 -0
- openapi/openapi-client/openapi_client/models/create_complex_order_model.py +95 -0
- openapi/openapi-client/openapi_client/models/create_complex_order_model_pipeline.py +126 -0
- openapi/openapi-client/openapi_client/models/create_complex_order_result.py +96 -0
- openapi/openapi-client/openapi_client/models/create_dataset_artifact_model.py +102 -0
- openapi/openapi-client/openapi_client/models/create_dataset_artifact_model_dataset.py +126 -0
- openapi/openapi-client/openapi_client/models/create_default_order_model.py +109 -0
- openapi/openapi-client/openapi_client/models/create_default_order_model_workflow_config.py +140 -0
- openapi/openapi-client/openapi_client/models/create_empty_validation_set_result.py +87 -0
- openapi/openapi-client/openapi_client/models/create_legacy_order_result.py +89 -0
- openapi/openapi-client/openapi_client/models/create_order_model.py +163 -0
- openapi/openapi-client/openapi_client/models/create_order_model_referee.py +126 -0
- openapi/openapi-client/openapi_client/models/create_order_model_selections_inner.py +154 -0
- openapi/openapi-client/openapi_client/models/create_order_model_user_filters_inner.py +154 -0
- openapi/openapi-client/openapi_client/models/create_order_model_workflow.py +140 -0
- openapi/openapi-client/openapi_client/models/create_order_result.py +96 -0
- openapi/openapi-client/openapi_client/models/create_simple_pipeline_model.py +116 -0
- openapi/openapi-client/openapi_client/models/create_simple_pipeline_model_artifacts_inner.py +126 -0
- openapi/openapi-client/openapi_client/models/create_simple_pipeline_model_pipeline_steps_inner.py +182 -0
- openapi/openapi-client/openapi_client/models/create_unsupported_order_model.py +91 -0
- openapi/openapi-client/openapi_client/models/customer_order_model.py +101 -0
- openapi/openapi-client/openapi_client/models/customer_order_model_paged_result.py +105 -0
- openapi/openapi-client/openapi_client/models/datapoint.py +121 -0
- openapi/openapi-client/openapi_client/models/datapoint_asset.py +170 -0
- openapi/openapi-client/openapi_client/models/datapoint_get_by_id_get200_response.py +126 -0
- openapi/openapi-client/openapi_client/models/datapoint_metadata_model.py +97 -0
- openapi/openapi-client/openapi_client/models/datapoint_metadata_model_metadata_inner.py +168 -0
- openapi/openapi-client/openapi_client/models/datapoint_model.py +95 -0
- openapi/openapi-client/openapi_client/models/datapoint_model_asset.py +170 -0
- openapi/openapi-client/openapi_client/models/dataset_evaluation_step_model.py +102 -0
- openapi/openapi-client/openapi_client/models/demographic_rapid_selection_config.py +96 -0
- openapi/openapi-client/openapi_client/models/demographic_selection.py +96 -0
- openapi/openapi-client/openapi_client/models/empty_validation_truth.py +94 -0
- openapi/openapi-client/openapi_client/models/error_type.py +40 -0
- openapi/openapi-client/openapi_client/models/feature_flag.py +89 -0
- openapi/openapi-client/openapi_client/models/feature_flag_model.py +89 -0
- openapi/openapi-client/openapi_client/models/feedback_model.py +94 -0
- openapi/openapi-client/openapi_client/models/file_asset.py +108 -0
- openapi/openapi-client/openapi_client/models/file_asset_metadata_inner.py +224 -0
- openapi/openapi-client/openapi_client/models/file_asset_model.py +108 -0
- openapi/openapi-client/openapi_client/models/filter.py +134 -0
- openapi/openapi-client/openapi_client/models/filter_operator.py +44 -0
- openapi/openapi-client/openapi_client/models/free_text_payload.py +96 -0
- openapi/openapi-client/openapi_client/models/free_text_rapid_blueprint.py +96 -0
- openapi/openapi-client/openapi_client/models/gender.py +38 -0
- openapi/openapi-client/openapi_client/models/gender_user_filter_model.py +97 -0
- openapi/openapi-client/openapi_client/models/get_available_validation_sets_result.py +95 -0
- openapi/openapi-client/openapi_client/models/get_datapoints_by_dataset_id_result.py +95 -0
- openapi/openapi-client/openapi_client/models/get_dataset_by_id_result.py +87 -0
- openapi/openapi-client/openapi_client/models/get_order_by_id_result.py +98 -0
- openapi/openapi-client/openapi_client/models/get_order_results_result.py +91 -0
- openapi/openapi-client/openapi_client/models/get_public_orders_result.py +95 -0
- openapi/openapi-client/openapi_client/models/get_workflow_config_result.py +91 -0
- openapi/openapi-client/openapi_client/models/get_workflow_config_result_workflow_config.py +140 -0
- openapi/openapi-client/openapi_client/models/image_dimension_metadata.py +112 -0
- openapi/openapi-client/openapi_client/models/import_from_file_result.py +87 -0
- openapi/openapi-client/openapi_client/models/import_validation_set_from_file_result.py +87 -0
- openapi/openapi-client/openapi_client/models/issue_auth_token_result.py +87 -0
- openapi/openapi-client/openapi_client/models/issue_client_auth_token_result.py +87 -0
- openapi/openapi-client/openapi_client/models/labeling_selection.py +96 -0
- openapi/openapi-client/openapi_client/models/line_payload.py +96 -0
- openapi/openapi-client/openapi_client/models/line_rapid_blueprint.py +96 -0
- openapi/openapi-client/openapi_client/models/line_truth.py +94 -0
- openapi/openapi-client/openapi_client/models/locate_box_truth.py +104 -0
- openapi/openapi-client/openapi_client/models/locate_payload.py +96 -0
- openapi/openapi-client/openapi_client/models/locate_rapid_blueprint.py +96 -0
- openapi/openapi-client/openapi_client/models/location_metadata.py +112 -0
- openapi/openapi-client/openapi_client/models/location_metadata_exists_filter_config.py +94 -0
- openapi/openapi-client/openapi_client/models/logic_operator.py +37 -0
- openapi/openapi-client/openapi_client/models/login_model.py +89 -0
- openapi/openapi-client/openapi_client/models/metadata_visibilities.py +40 -0
- openapi/openapi-client/openapi_client/models/multi_asset.py +116 -0
- openapi/openapi-client/openapi_client/models/multi_asset_model.py +118 -0
- openapi/openapi-client/openapi_client/models/naive_referee_config.py +96 -0
- openapi/openapi-client/openapi_client/models/naive_referee_model.py +96 -0
- openapi/openapi-client/openapi_client/models/named_classification.py +100 -0
- openapi/openapi-client/openapi_client/models/named_entity_payload.py +98 -0
- openapi/openapi-client/openapi_client/models/named_entity_rapid_blueprint.py +98 -0
- openapi/openapi-client/openapi_client/models/named_entity_truth.py +104 -0
- openapi/openapi-client/openapi_client/models/never_ending_referee_config.py +94 -0
- openapi/openapi-client/openapi_client/models/newsletter_model.py +89 -0
- openapi/openapi-client/openapi_client/models/no_validation_workflow_rapid_selection_config.py +101 -0
- openapi/openapi-client/openapi_client/models/null_asset.py +104 -0
- openapi/openapi-client/openapi_client/models/null_asset_model.py +106 -0
- openapi/openapi-client/openapi_client/models/only_validation_workflow_rapid_selection_config.py +96 -0
- openapi/openapi-client/openapi_client/models/order_model.py +91 -0
- openapi/openapi-client/openapi_client/models/order_query_get200_response.py +137 -0
- openapi/openapi-client/openapi_client/models/original_filename_metadata.py +110 -0
- openapi/openapi-client/openapi_client/models/page_info.py +94 -0
- openapi/openapi-client/openapi_client/models/polygon_payload.py +96 -0
- openapi/openapi-client/openapi_client/models/polygon_rapid_blueprint.py +96 -0
- openapi/openapi-client/openapi_client/models/polygon_truth.py +94 -0
- openapi/openapi-client/openapi_client/models/private_text_metadata_input.py +98 -0
- openapi/openapi-client/openapi_client/models/probabilistic_attach_category_referee_config.py +98 -0
- openapi/openapi-client/openapi_client/models/prompt_metadata.py +110 -0
- openapi/openapi-client/openapi_client/models/prompt_metadata_input.py +98 -0
- openapi/openapi-client/openapi_client/models/public_text_metadata_input.py +98 -0
- openapi/openapi-client/openapi_client/models/query_orders_model.py +112 -0
- openapi/openapi-client/openapi_client/models/query_validation_set_model.py +112 -0
- openapi/openapi-client/openapi_client/models/request_password_reset_command.py +98 -0
- openapi/openapi-client/openapi_client/models/root_filter.py +107 -0
- openapi/openapi-client/openapi_client/models/send_completion_mail_step_model.py +98 -0
- openapi/openapi-client/openapi_client/models/signup_customer_model.py +93 -0
- openapi/openapi-client/openapi_client/models/signup_shadow_customer_model.py +87 -0
- openapi/openapi-client/openapi_client/models/simple_workflow_config.py +137 -0
- openapi/openapi-client/openapi_client/models/simple_workflow_config_blueprint.py +238 -0
- openapi/openapi-client/openapi_client/models/simple_workflow_model.py +100 -0
- openapi/openapi-client/openapi_client/models/simple_workflow_model_blueprint.py +238 -0
- openapi/openapi-client/openapi_client/models/sort_criterion.py +96 -0
- openapi/openapi-client/openapi_client/models/sort_direction.py +37 -0
- openapi/openapi-client/openapi_client/models/static_rapid_selection_config.py +96 -0
- openapi/openapi-client/openapi_client/models/submit_coco_model.py +91 -0
- openapi/openapi-client/openapi_client/models/submit_coco_result.py +87 -0
- openapi/openapi-client/openapi_client/models/submit_password_reset_command.py +102 -0
- openapi/openapi-client/openapi_client/models/text_asset.py +106 -0
- openapi/openapi-client/openapi_client/models/text_asset_model.py +108 -0
- openapi/openapi-client/openapi_client/models/text_metadata.py +107 -0
- openapi/openapi-client/openapi_client/models/transcription_metadata.py +107 -0
- openapi/openapi-client/openapi_client/models/transcription_metadata_input.py +98 -0
- openapi/openapi-client/openapi_client/models/transcription_payload.py +106 -0
- openapi/openapi-client/openapi_client/models/transcription_rapid_blueprint.py +96 -0
- openapi/openapi-client/openapi_client/models/transcription_truth.py +106 -0
- openapi/openapi-client/openapi_client/models/transcription_word.py +89 -0
- openapi/openapi-client/openapi_client/models/unlock_order_result.py +87 -0
- openapi/openapi-client/openapi_client/models/update_access_model.py +87 -0
- openapi/openapi-client/openapi_client/models/update_order_model.py +87 -0
- openapi/openapi-client/openapi_client/models/update_workflow_config_model.py +100 -0
- openapi/openapi-client/openapi_client/models/update_workflow_config_model_workflow_config.py +140 -0
- openapi/openapi-client/openapi_client/models/upload_coco_result.py +91 -0
- openapi/openapi-client/openapi_client/models/upload_datapoints_result.py +97 -0
- openapi/openapi-client/openapi_client/models/upload_files_from_s3_bucket_model.py +116 -0
- openapi/openapi-client/openapi_client/models/upload_text_sources_to_dataset_model.py +89 -0
- openapi/openapi-client/openapi_client/models/validation_chance.py +91 -0
- openapi/openapi-client/openapi_client/models/validation_import_post_request_blueprint.py +238 -0
- openapi/openapi-client/openapi_client/models/validation_rapid_selection_config.py +98 -0
- openapi/openapi-client/openapi_client/models/validation_selection.py +98 -0
- openapi/openapi-client/openapi_client/models/validation_set.py +105 -0
- openapi/openapi-client/openapi_client/models/validation_set_overview_model.py +91 -0
- openapi/openapi-client/openapi_client/models/validation_set_paged_result.py +105 -0
- openapi/openapi-client/openapi_client/models/workflow_aggregation_step_model.py +112 -0
- openapi/openapi-client/openapi_client/models/workflow_labeling_step_model.py +96 -0
- openapi/openapi-client/openapi_client/models/workflow_split_model.py +110 -0
- openapi/openapi-client/openapi_client/models/workflow_split_model_filter_configs_inner.py +154 -0
- openapi/openapi-client/openapi_client/rest.py +257 -0
- rapidata/rapidata_client/{workflow/feature_flags → feature_flags}/feature_flags.py +5 -3
- rapidata/rapidata_client/metadata/__init__.py +0 -0
- rapidata/rapidata_client/metadata/base_metadata.py +12 -0
- rapidata/rapidata_client/metadata/transcription_metadata.py +19 -0
- rapidata/rapidata_client/order/dataset/rapidata_dataset.py +42 -16
- rapidata/rapidata_client/order/dataset/validation_set_builder.py +187 -0
- rapidata/rapidata_client/order/rapidata_order.py +49 -23
- rapidata/rapidata_client/order/rapidata_order_builder.py +126 -8
- rapidata/rapidata_client/rapidata_client.py +17 -5
- rapidata/rapidata_client/{workflow/referee → referee}/base_referee.py +8 -2
- rapidata/rapidata_client/{workflow/referee → referee}/classify_early_stopping_referee.py +1 -1
- rapidata/rapidata_client/{workflow/referee → referee}/naive_referee.py +5 -1
- rapidata/rapidata_client/workflow/__init__.py +0 -2
- rapidata/rapidata_client/workflow/base_workflow.py +9 -5
- rapidata/rapidata_client/workflow/classify_workflow.py +18 -3
- rapidata/rapidata_client/workflow/compare_workflow.py +13 -14
- rapidata/rapidata_client/workflow/free_text_workflow.py +14 -0
- rapidata/rapidata_client/workflow/transcription_workflow.py +22 -0
- rapidata/service/__init__.py +0 -1
- rapidata/service/openapi_service.py +43 -0
- {rapidata-0.1.3.dist-info → rapidata-0.1.6.dist-info}/METADATA +2 -2
- rapidata-0.1.6.dist-info/RECORD +227 -0
- rapidata/service/rapidata_api_services/base_service.py +0 -76
- rapidata/service/rapidata_api_services/dataset_service.py +0 -82
- rapidata/service/rapidata_api_services/order_service.py +0 -49
- rapidata/service/rapidata_api_services/rapidata_service.py +0 -18
- rapidata-0.1.3.dist-info/RECORD +0 -34
- /rapidata/service/rapidata_api_services/__init__.py → /openapi/openapi-client/openapi_client/py.typed +0 -0
- /rapidata/rapidata_client/{workflow/country_codes → country_codes}/__init__.py +0 -0
- /rapidata/rapidata_client/{workflow/country_codes → country_codes}/country_codes.py +0 -0
- /rapidata/rapidata_client/{workflow/feature_flags → feature_flags}/__init__.py +0 -0
- /rapidata/rapidata_client/{workflow/referee → referee}/__init__.py +0 -0
- {rapidata-0.1.3.dist-info → rapidata-0.1.6.dist-info}/LICENSE +0 -0
- {rapidata-0.1.3.dist-info → rapidata-0.1.6.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from openapi_client.models.classification_metadata_filter_config import ClassificationMetadataFilterConfig
|
|
21
|
+
from openapi_client.models.count_classification_metadata_filter_config import CountClassificationMetadataFilterConfig
|
|
22
|
+
from openapi_client.models.location_metadata_exists_filter_config import LocationMetadataExistsFilterConfig
|
|
23
|
+
from pydantic import StrictStr, Field
|
|
24
|
+
from typing import Union, List, Set, Optional, Dict
|
|
25
|
+
from typing_extensions import Literal, Self
|
|
26
|
+
|
|
27
|
+
WORKFLOWSPLITMODELFILTERCONFIGSINNER_ONE_OF_SCHEMAS = ["ClassificationMetadataFilterConfig", "CountClassificationMetadataFilterConfig", "LocationMetadataExistsFilterConfig"]
|
|
28
|
+
|
|
29
|
+
class WorkflowSplitModelFilterConfigsInner(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
WorkflowSplitModelFilterConfigsInner
|
|
32
|
+
"""
|
|
33
|
+
# data type: ClassificationMetadataFilterConfig
|
|
34
|
+
oneof_schema_1_validator: Optional[ClassificationMetadataFilterConfig] = None
|
|
35
|
+
# data type: CountClassificationMetadataFilterConfig
|
|
36
|
+
oneof_schema_2_validator: Optional[CountClassificationMetadataFilterConfig] = None
|
|
37
|
+
# data type: LocationMetadataExistsFilterConfig
|
|
38
|
+
oneof_schema_3_validator: Optional[LocationMetadataExistsFilterConfig] = None
|
|
39
|
+
actual_instance: Optional[Union[ClassificationMetadataFilterConfig, CountClassificationMetadataFilterConfig, LocationMetadataExistsFilterConfig]] = None
|
|
40
|
+
one_of_schemas: Set[str] = { "ClassificationMetadataFilterConfig", "CountClassificationMetadataFilterConfig", "LocationMetadataExistsFilterConfig" }
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
52
|
+
if args:
|
|
53
|
+
if len(args) > 1:
|
|
54
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
55
|
+
if kwargs:
|
|
56
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
57
|
+
super().__init__(actual_instance=args[0])
|
|
58
|
+
else:
|
|
59
|
+
super().__init__(**kwargs)
|
|
60
|
+
|
|
61
|
+
@field_validator('actual_instance')
|
|
62
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
63
|
+
instance = WorkflowSplitModelFilterConfigsInner.model_construct()
|
|
64
|
+
error_messages = []
|
|
65
|
+
match = 0
|
|
66
|
+
# validate data type: ClassificationMetadataFilterConfig
|
|
67
|
+
if not isinstance(v, ClassificationMetadataFilterConfig):
|
|
68
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ClassificationMetadataFilterConfig`")
|
|
69
|
+
else:
|
|
70
|
+
match += 1
|
|
71
|
+
# validate data type: CountClassificationMetadataFilterConfig
|
|
72
|
+
if not isinstance(v, CountClassificationMetadataFilterConfig):
|
|
73
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `CountClassificationMetadataFilterConfig`")
|
|
74
|
+
else:
|
|
75
|
+
match += 1
|
|
76
|
+
# validate data type: LocationMetadataExistsFilterConfig
|
|
77
|
+
if not isinstance(v, LocationMetadataExistsFilterConfig):
|
|
78
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LocationMetadataExistsFilterConfig`")
|
|
79
|
+
else:
|
|
80
|
+
match += 1
|
|
81
|
+
if match > 1:
|
|
82
|
+
# more than 1 match
|
|
83
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in WorkflowSplitModelFilterConfigsInner with oneOf schemas: ClassificationMetadataFilterConfig, CountClassificationMetadataFilterConfig, LocationMetadataExistsFilterConfig. Details: " + ", ".join(error_messages))
|
|
84
|
+
elif match == 0:
|
|
85
|
+
# no match
|
|
86
|
+
raise ValueError("No match found when setting `actual_instance` in WorkflowSplitModelFilterConfigsInner with oneOf schemas: ClassificationMetadataFilterConfig, CountClassificationMetadataFilterConfig, LocationMetadataExistsFilterConfig. Details: " + ", ".join(error_messages))
|
|
87
|
+
else:
|
|
88
|
+
return v
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
92
|
+
return cls.from_json(json.dumps(obj))
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_json(cls, json_str: str) -> Self:
|
|
96
|
+
"""Returns the object represented by the json string"""
|
|
97
|
+
instance = cls.model_construct()
|
|
98
|
+
error_messages = []
|
|
99
|
+
match = 0
|
|
100
|
+
|
|
101
|
+
# deserialize data into ClassificationMetadataFilterConfig
|
|
102
|
+
try:
|
|
103
|
+
instance.actual_instance = ClassificationMetadataFilterConfig.from_json(json_str)
|
|
104
|
+
match += 1
|
|
105
|
+
except (ValidationError, ValueError) as e:
|
|
106
|
+
error_messages.append(str(e))
|
|
107
|
+
# deserialize data into CountClassificationMetadataFilterConfig
|
|
108
|
+
try:
|
|
109
|
+
instance.actual_instance = CountClassificationMetadataFilterConfig.from_json(json_str)
|
|
110
|
+
match += 1
|
|
111
|
+
except (ValidationError, ValueError) as e:
|
|
112
|
+
error_messages.append(str(e))
|
|
113
|
+
# deserialize data into LocationMetadataExistsFilterConfig
|
|
114
|
+
try:
|
|
115
|
+
instance.actual_instance = LocationMetadataExistsFilterConfig.from_json(json_str)
|
|
116
|
+
match += 1
|
|
117
|
+
except (ValidationError, ValueError) as e:
|
|
118
|
+
error_messages.append(str(e))
|
|
119
|
+
|
|
120
|
+
if match > 1:
|
|
121
|
+
# more than 1 match
|
|
122
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into WorkflowSplitModelFilterConfigsInner with oneOf schemas: ClassificationMetadataFilterConfig, CountClassificationMetadataFilterConfig, LocationMetadataExistsFilterConfig. Details: " + ", ".join(error_messages))
|
|
123
|
+
elif match == 0:
|
|
124
|
+
# no match
|
|
125
|
+
raise ValueError("No match found when deserializing the JSON string into WorkflowSplitModelFilterConfigsInner with oneOf schemas: ClassificationMetadataFilterConfig, CountClassificationMetadataFilterConfig, LocationMetadataExistsFilterConfig. Details: " + ", ".join(error_messages))
|
|
126
|
+
else:
|
|
127
|
+
return instance
|
|
128
|
+
|
|
129
|
+
def to_json(self) -> str:
|
|
130
|
+
"""Returns the JSON representation of the actual instance"""
|
|
131
|
+
if self.actual_instance is None:
|
|
132
|
+
return "null"
|
|
133
|
+
|
|
134
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
135
|
+
return self.actual_instance.to_json()
|
|
136
|
+
else:
|
|
137
|
+
return json.dumps(self.actual_instance)
|
|
138
|
+
|
|
139
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], ClassificationMetadataFilterConfig, CountClassificationMetadataFilterConfig, LocationMetadataExistsFilterConfig]]:
|
|
140
|
+
"""Returns the dict representation of the actual instance"""
|
|
141
|
+
if self.actual_instance is None:
|
|
142
|
+
return None
|
|
143
|
+
|
|
144
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
145
|
+
return self.actual_instance.to_dict()
|
|
146
|
+
else:
|
|
147
|
+
# primitive type
|
|
148
|
+
return self.actual_instance
|
|
149
|
+
|
|
150
|
+
def to_str(self) -> str:
|
|
151
|
+
"""Returns the string representation of the actual instance"""
|
|
152
|
+
return pprint.pformat(self.model_dump())
|
|
153
|
+
|
|
154
|
+
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
import io
|
|
16
|
+
import json
|
|
17
|
+
import re
|
|
18
|
+
import ssl
|
|
19
|
+
|
|
20
|
+
import urllib3
|
|
21
|
+
|
|
22
|
+
from openapi_client.exceptions import ApiException, ApiValueError
|
|
23
|
+
|
|
24
|
+
SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
|
|
25
|
+
RESTResponseType = urllib3.HTTPResponse
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def is_socks_proxy_url(url):
|
|
29
|
+
if url is None:
|
|
30
|
+
return False
|
|
31
|
+
split_section = url.split("://")
|
|
32
|
+
if len(split_section) < 2:
|
|
33
|
+
return False
|
|
34
|
+
else:
|
|
35
|
+
return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class RESTResponse(io.IOBase):
|
|
39
|
+
|
|
40
|
+
def __init__(self, resp) -> None:
|
|
41
|
+
self.response = resp
|
|
42
|
+
self.status = resp.status
|
|
43
|
+
self.reason = resp.reason
|
|
44
|
+
self.data = None
|
|
45
|
+
|
|
46
|
+
def read(self):
|
|
47
|
+
if self.data is None:
|
|
48
|
+
self.data = self.response.data
|
|
49
|
+
return self.data
|
|
50
|
+
|
|
51
|
+
def getheaders(self):
|
|
52
|
+
"""Returns a dictionary of the response headers."""
|
|
53
|
+
return self.response.headers
|
|
54
|
+
|
|
55
|
+
def getheader(self, name, default=None):
|
|
56
|
+
"""Returns a given response header."""
|
|
57
|
+
return self.response.headers.get(name, default)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class RESTClientObject:
|
|
61
|
+
|
|
62
|
+
def __init__(self, configuration) -> None:
|
|
63
|
+
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
|
64
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
|
65
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
|
66
|
+
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
|
67
|
+
|
|
68
|
+
# cert_reqs
|
|
69
|
+
if configuration.verify_ssl:
|
|
70
|
+
cert_reqs = ssl.CERT_REQUIRED
|
|
71
|
+
else:
|
|
72
|
+
cert_reqs = ssl.CERT_NONE
|
|
73
|
+
|
|
74
|
+
pool_args = {
|
|
75
|
+
"cert_reqs": cert_reqs,
|
|
76
|
+
"ca_certs": configuration.ssl_ca_cert,
|
|
77
|
+
"cert_file": configuration.cert_file,
|
|
78
|
+
"key_file": configuration.key_file,
|
|
79
|
+
}
|
|
80
|
+
if configuration.assert_hostname is not None:
|
|
81
|
+
pool_args['assert_hostname'] = (
|
|
82
|
+
configuration.assert_hostname
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
if configuration.retries is not None:
|
|
86
|
+
pool_args['retries'] = configuration.retries
|
|
87
|
+
|
|
88
|
+
if configuration.tls_server_name:
|
|
89
|
+
pool_args['server_hostname'] = configuration.tls_server_name
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if configuration.socket_options is not None:
|
|
93
|
+
pool_args['socket_options'] = configuration.socket_options
|
|
94
|
+
|
|
95
|
+
if configuration.connection_pool_maxsize is not None:
|
|
96
|
+
pool_args['maxsize'] = configuration.connection_pool_maxsize
|
|
97
|
+
|
|
98
|
+
# https pool manager
|
|
99
|
+
self.pool_manager: urllib3.PoolManager
|
|
100
|
+
|
|
101
|
+
if configuration.proxy:
|
|
102
|
+
if is_socks_proxy_url(configuration.proxy):
|
|
103
|
+
from urllib3.contrib.socks import SOCKSProxyManager
|
|
104
|
+
pool_args["proxy_url"] = configuration.proxy
|
|
105
|
+
pool_args["headers"] = configuration.proxy_headers
|
|
106
|
+
self.pool_manager = SOCKSProxyManager(**pool_args)
|
|
107
|
+
else:
|
|
108
|
+
pool_args["proxy_url"] = configuration.proxy
|
|
109
|
+
pool_args["proxy_headers"] = configuration.proxy_headers
|
|
110
|
+
self.pool_manager = urllib3.ProxyManager(**pool_args)
|
|
111
|
+
else:
|
|
112
|
+
self.pool_manager = urllib3.PoolManager(**pool_args)
|
|
113
|
+
|
|
114
|
+
def request(
|
|
115
|
+
self,
|
|
116
|
+
method,
|
|
117
|
+
url,
|
|
118
|
+
headers=None,
|
|
119
|
+
body=None,
|
|
120
|
+
post_params=None,
|
|
121
|
+
_request_timeout=None
|
|
122
|
+
):
|
|
123
|
+
"""Perform requests.
|
|
124
|
+
|
|
125
|
+
:param method: http request method
|
|
126
|
+
:param url: http request url
|
|
127
|
+
:param headers: http request headers
|
|
128
|
+
:param body: request json body, for `application/json`
|
|
129
|
+
:param post_params: request post parameters,
|
|
130
|
+
`application/x-www-form-urlencoded`
|
|
131
|
+
and `multipart/form-data`
|
|
132
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
133
|
+
number provided, it will be total request
|
|
134
|
+
timeout. It can also be a pair (tuple) of
|
|
135
|
+
(connection, read) timeouts.
|
|
136
|
+
"""
|
|
137
|
+
method = method.upper()
|
|
138
|
+
assert method in [
|
|
139
|
+
'GET',
|
|
140
|
+
'HEAD',
|
|
141
|
+
'DELETE',
|
|
142
|
+
'POST',
|
|
143
|
+
'PUT',
|
|
144
|
+
'PATCH',
|
|
145
|
+
'OPTIONS'
|
|
146
|
+
]
|
|
147
|
+
|
|
148
|
+
if post_params and body:
|
|
149
|
+
raise ApiValueError(
|
|
150
|
+
"body parameter cannot be used with post_params parameter."
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
post_params = post_params or {}
|
|
154
|
+
headers = headers or {}
|
|
155
|
+
|
|
156
|
+
timeout = None
|
|
157
|
+
if _request_timeout:
|
|
158
|
+
if isinstance(_request_timeout, (int, float)):
|
|
159
|
+
timeout = urllib3.Timeout(total=_request_timeout)
|
|
160
|
+
elif (
|
|
161
|
+
isinstance(_request_timeout, tuple)
|
|
162
|
+
and len(_request_timeout) == 2
|
|
163
|
+
):
|
|
164
|
+
timeout = urllib3.Timeout(
|
|
165
|
+
connect=_request_timeout[0],
|
|
166
|
+
read=_request_timeout[1]
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
try:
|
|
170
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
171
|
+
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
|
172
|
+
|
|
173
|
+
# no content type provided or payload is json
|
|
174
|
+
content_type = headers.get('Content-Type')
|
|
175
|
+
if (
|
|
176
|
+
not content_type
|
|
177
|
+
or re.search('json', content_type, re.IGNORECASE)
|
|
178
|
+
):
|
|
179
|
+
request_body = None
|
|
180
|
+
if body is not None:
|
|
181
|
+
request_body = json.dumps(body)
|
|
182
|
+
r = self.pool_manager.request(
|
|
183
|
+
method,
|
|
184
|
+
url,
|
|
185
|
+
body=request_body,
|
|
186
|
+
timeout=timeout,
|
|
187
|
+
headers=headers,
|
|
188
|
+
preload_content=False
|
|
189
|
+
)
|
|
190
|
+
elif content_type == 'application/x-www-form-urlencoded':
|
|
191
|
+
r = self.pool_manager.request(
|
|
192
|
+
method,
|
|
193
|
+
url,
|
|
194
|
+
fields=post_params,
|
|
195
|
+
encode_multipart=False,
|
|
196
|
+
timeout=timeout,
|
|
197
|
+
headers=headers,
|
|
198
|
+
preload_content=False
|
|
199
|
+
)
|
|
200
|
+
elif content_type == 'multipart/form-data':
|
|
201
|
+
# must del headers['Content-Type'], or the correct
|
|
202
|
+
# Content-Type which generated by urllib3 will be
|
|
203
|
+
# overwritten.
|
|
204
|
+
del headers['Content-Type']
|
|
205
|
+
# Ensures that dict objects are serialized
|
|
206
|
+
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
|
|
207
|
+
r = self.pool_manager.request(
|
|
208
|
+
method,
|
|
209
|
+
url,
|
|
210
|
+
fields=post_params,
|
|
211
|
+
encode_multipart=True,
|
|
212
|
+
timeout=timeout,
|
|
213
|
+
headers=headers,
|
|
214
|
+
preload_content=False
|
|
215
|
+
)
|
|
216
|
+
# Pass a `string` parameter directly in the body to support
|
|
217
|
+
# other content types than JSON when `body` argument is
|
|
218
|
+
# provided in serialized form.
|
|
219
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
|
220
|
+
r = self.pool_manager.request(
|
|
221
|
+
method,
|
|
222
|
+
url,
|
|
223
|
+
body=body,
|
|
224
|
+
timeout=timeout,
|
|
225
|
+
headers=headers,
|
|
226
|
+
preload_content=False
|
|
227
|
+
)
|
|
228
|
+
elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool):
|
|
229
|
+
request_body = "true" if body else "false"
|
|
230
|
+
r = self.pool_manager.request(
|
|
231
|
+
method,
|
|
232
|
+
url,
|
|
233
|
+
body=request_body,
|
|
234
|
+
preload_content=False,
|
|
235
|
+
timeout=timeout,
|
|
236
|
+
headers=headers)
|
|
237
|
+
else:
|
|
238
|
+
# Cannot generate the request from given parameters
|
|
239
|
+
msg = """Cannot prepare a request message for provided
|
|
240
|
+
arguments. Please check that your arguments match
|
|
241
|
+
declared content type."""
|
|
242
|
+
raise ApiException(status=0, reason=msg)
|
|
243
|
+
# For `GET`, `HEAD`
|
|
244
|
+
else:
|
|
245
|
+
r = self.pool_manager.request(
|
|
246
|
+
method,
|
|
247
|
+
url,
|
|
248
|
+
fields={},
|
|
249
|
+
timeout=timeout,
|
|
250
|
+
headers=headers,
|
|
251
|
+
preload_content=False
|
|
252
|
+
)
|
|
253
|
+
except urllib3.exceptions.SSLError as e:
|
|
254
|
+
msg = "\n".join([type(e).__name__, str(e)])
|
|
255
|
+
raise ApiException(status=0, reason=msg)
|
|
256
|
+
|
|
257
|
+
return RESTResponse(r)
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
from openapi_client.models.feature_flag_model import FeatureFlagModel
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
class FeatureFlags:
|
|
2
5
|
def __init__(self):
|
|
3
6
|
self._flags: dict[str, str] = {}
|
|
4
7
|
|
|
5
|
-
def to_list(self) -> list[
|
|
6
|
-
|
|
7
|
-
return [{"key": name, "value": value} for name, value in self._flags.items()]
|
|
8
|
+
def to_list(self) -> list[FeatureFlagModel]:
|
|
9
|
+
return [FeatureFlagModel(key=name, value=value) for name, value in self._flags.items()]
|
|
8
10
|
|
|
9
11
|
def alert_on_fast_response(self, value: int):
|
|
10
12
|
self._flags["alertOnFastResponse"] = str(value)
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from openapi_client.models.transcription_metadata_input import (
|
|
2
|
+
TranscriptionMetadataInput,
|
|
3
|
+
)
|
|
4
|
+
from rapidata.rapidata_client.metadata.base_metadata import Metadata
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TranscriptionMetadata(Metadata):
|
|
8
|
+
|
|
9
|
+
def __init__(self, transcription: str, identifier: str = "transcription"):
|
|
10
|
+
super().__init__()
|
|
11
|
+
self.identifier = identifier
|
|
12
|
+
self.transcription = transcription
|
|
13
|
+
|
|
14
|
+
def to_model(self):
|
|
15
|
+
return TranscriptionMetadataInput(
|
|
16
|
+
_t="TranscriptionMetadataInput",
|
|
17
|
+
identifier=self.identifier,
|
|
18
|
+
transcription=self.transcription,
|
|
19
|
+
)
|
|
@@ -1,26 +1,52 @@
|
|
|
1
|
+
from itertools import zip_longest
|
|
1
2
|
import os
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from openapi_client.models.datapoint_metadata_model import DatapointMetadataModel
|
|
6
|
+
from openapi_client.models.datapoint_metadata_model_metadata_inner import (
|
|
7
|
+
DatapointMetadataModelMetadataInner,
|
|
8
|
+
)
|
|
9
|
+
from openapi_client.models.upload_text_sources_to_dataset_model import (
|
|
10
|
+
UploadTextSourcesToDatasetModel,
|
|
11
|
+
)
|
|
12
|
+
from rapidata.rapidata_client.metadata.base_metadata import Metadata
|
|
2
13
|
from rapidata.service import LocalFileService
|
|
3
|
-
from rapidata.service import
|
|
14
|
+
from rapidata.service.openapi_service import OpenAPIService
|
|
4
15
|
|
|
5
16
|
|
|
6
17
|
class RapidataDataset:
|
|
7
18
|
|
|
8
|
-
def __init__(self, dataset_id: str,
|
|
19
|
+
def __init__(self, dataset_id: str, openapi_service: OpenAPIService):
|
|
9
20
|
self.dataset_id = dataset_id
|
|
10
|
-
self.
|
|
21
|
+
self.openapi_service = openapi_service
|
|
11
22
|
self.local_file_service = LocalFileService()
|
|
12
23
|
|
|
13
24
|
def add_texts(self, texts: list[str]):
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
model = UploadTextSourcesToDatasetModel(
|
|
26
|
+
datasetId=self.dataset_id, textSources=texts
|
|
27
|
+
)
|
|
28
|
+
self.openapi_service.dataset_api.dataset_upload_text_sources_to_dataset_post(
|
|
29
|
+
model
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
def add_media_from_paths(
|
|
33
|
+
self,
|
|
34
|
+
image_paths: list[str],
|
|
35
|
+
metadata: List[Metadata] | None = None,
|
|
36
|
+
):
|
|
37
|
+
if metadata is not None and len(metadata) != len(image_paths):
|
|
38
|
+
raise ValueError(
|
|
39
|
+
"metadata must be None or have the same length as image_paths"
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
for image_path, meta in zip_longest(image_paths, metadata or []):
|
|
43
|
+
if not os.path.exists(image_path):
|
|
44
|
+
raise FileNotFoundError(f"File not found: {image_path}")
|
|
45
|
+
|
|
46
|
+
meta_model = meta.to_model() if meta else None
|
|
47
|
+
model = DatapointMetadataModel(
|
|
48
|
+
datasetId=self.dataset_id,
|
|
49
|
+
metadata=[DatapointMetadataModelMetadataInner(meta_model)] if meta_model else [],
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
self.openapi_service.dataset_api.dataset_create_datapoint_post(model=model, files=[image_path]) # type: ignore
|