anyscale 0.24.86__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.
- anyscale/__init__.py +181 -0
- anyscale/_private/anyscale_client/README.md +16 -0
- anyscale/_private/anyscale_client/__init__.py +8 -0
- anyscale/_private/anyscale_client/anyscale_client.py +1847 -0
- anyscale/_private/anyscale_client/common.py +593 -0
- anyscale/_private/anyscale_client/fake_anyscale_client.py +1080 -0
- anyscale/_private/docgen/README.md +15 -0
- anyscale/_private/docgen/__main__.py +700 -0
- anyscale/_private/docgen/api.md +1106 -0
- anyscale/_private/docgen/generator.py +559 -0
- anyscale/_private/docgen/generator_legacy.py +104 -0
- anyscale/_private/docgen/models.md +2261 -0
- anyscale/_private/models/__init__.py +2 -0
- anyscale/_private/models/image_uri.py +116 -0
- anyscale/_private/models/model_base.py +251 -0
- anyscale/_private/sdk/__init__.py +102 -0
- anyscale/_private/sdk/base_sdk.py +35 -0
- anyscale/_private/sdk/timer.py +46 -0
- anyscale/_private/utils/__init__.py +0 -0
- anyscale/_private/utils/progress_util.py +85 -0
- anyscale/_private/workload/__init__.py +2 -0
- anyscale/_private/workload/workload_config.py +195 -0
- anyscale/_private/workload/workload_sdk.py +324 -0
- anyscale/aggregated_instance_usage/__init__.py +36 -0
- anyscale/aggregated_instance_usage/_private/aggregated_instance_usage_sdk.py +30 -0
- anyscale/aggregated_instance_usage/commands.py +42 -0
- anyscale/aggregated_instance_usage/models.py +85 -0
- anyscale/anyscale-cloud-setup-gcp-oa.yaml +88 -0
- anyscale/anyscale-cloud-setup-gcp.yaml +113 -0
- anyscale/anyscale-cloud-setup-oa.yaml +121 -0
- anyscale/anyscale-cloud-setup.yaml +327 -0
- anyscale/anyscale_pydantic/HISTORY.md +1254 -0
- anyscale/anyscale_pydantic/LICENSE +21 -0
- anyscale/anyscale_pydantic/PKG-INFO +1351 -0
- anyscale/anyscale_pydantic/README.md +7 -0
- anyscale/anyscale_pydantic/__init__.py +131 -0
- anyscale/anyscale_pydantic/_hypothesis_plugin.py +391 -0
- anyscale/anyscale_pydantic/annotated_types.py +72 -0
- anyscale/anyscale_pydantic/class_validators.py +361 -0
- anyscale/anyscale_pydantic/color.py +494 -0
- anyscale/anyscale_pydantic/config.py +191 -0
- anyscale/anyscale_pydantic/dataclasses.py +478 -0
- anyscale/anyscale_pydantic/datetime_parse.py +248 -0
- anyscale/anyscale_pydantic/decorator.py +264 -0
- anyscale/anyscale_pydantic/env_settings.py +350 -0
- anyscale/anyscale_pydantic/error_wrappers.py +162 -0
- anyscale/anyscale_pydantic/errors.py +646 -0
- anyscale/anyscale_pydantic/fields.py +1256 -0
- anyscale/anyscale_pydantic/generics.py +400 -0
- anyscale/anyscale_pydantic/json.py +112 -0
- anyscale/anyscale_pydantic/main.py +1109 -0
- anyscale/anyscale_pydantic/mypy.py +943 -0
- anyscale/anyscale_pydantic/networks.py +739 -0
- anyscale/anyscale_pydantic/parse.py +66 -0
- anyscale/anyscale_pydantic/py.typed +0 -0
- anyscale/anyscale_pydantic/schema.py +1164 -0
- anyscale/anyscale_pydantic/tools.py +92 -0
- anyscale/anyscale_pydantic/types.py +1206 -0
- anyscale/anyscale_pydantic/typing.py +603 -0
- anyscale/anyscale_pydantic/utils.py +803 -0
- anyscale/anyscale_pydantic/validators.py +765 -0
- anyscale/anyscale_pydantic/version.py +38 -0
- anyscale/anyscale_schema.json +9 -0
- anyscale/api.py +215 -0
- anyscale/api_utils/README.md +2 -0
- anyscale/api_utils/__init__.py +0 -0
- anyscale/api_utils/common_utils.py +81 -0
- anyscale/api_utils/exceptions/__init__.py +0 -0
- anyscale/api_utils/exceptions/job_errors.py +2 -0
- anyscale/api_utils/job_logs_util.py +116 -0
- anyscale/api_utils/job_util.py +22 -0
- anyscale/api_utils/logs_util.py +61 -0
- anyscale/authenticate.py +298 -0
- anyscale/aws_iam_policies.py +465 -0
- anyscale/background/__init__.py +0 -0
- anyscale/background/job_runner.py +64 -0
- anyscale/cli_logger.py +378 -0
- anyscale/client/.gitignore +66 -0
- anyscale/client/.openapi-generator/VERSION +1 -0
- anyscale/client/.openapi-generator-ignore +23 -0
- anyscale/client/README.md +1070 -0
- anyscale/client/git_push.sh +58 -0
- anyscale/client/openapi_client/__init__.py +667 -0
- anyscale/client/openapi_client/api/__init__.py +6 -0
- anyscale/client/openapi_client/api/default_api.py +40922 -0
- anyscale/client/openapi_client/api_client.py +647 -0
- anyscale/client/openapi_client/configuration.py +373 -0
- anyscale/client/openapi_client/exceptions.py +120 -0
- anyscale/client/openapi_client/models/__init__.py +652 -0
- anyscale/client/openapi_client/models/access_config.py +122 -0
- anyscale/client/openapi_client/models/aggregated_instance_usage_with_cost_model.py +733 -0
- anyscale/client/openapi_client/models/aggregatedinstanceusagewithcostmodel_list_response.py +147 -0
- anyscale/client/openapi_client/models/aica_endpoint.py +527 -0
- anyscale/client/openapi_client/models/aica_endpoint_event.py +433 -0
- anyscale/client/openapi_client/models/aica_endpoint_event_level.py +103 -0
- anyscale/client/openapi_client/models/aica_endpoint_event_type.py +120 -0
- anyscale/client/openapi_client/models/aica_endpoint_scope.py +102 -0
- anyscale/client/openapi_client/models/aica_model.py +398 -0
- anyscale/client/openapi_client/models/aica_model_accelerator_map.py +123 -0
- anyscale/client/openapi_client/models/aica_model_configuration.py +209 -0
- anyscale/client/openapi_client/models/aica_observability_urls.py +178 -0
- anyscale/client/openapi_client/models/aicaendpoint_list_response.py +147 -0
- anyscale/client/openapi_client/models/aicaendpoint_response.py +121 -0
- anyscale/client/openapi_client/models/aicaendpointevent_list_response.py +147 -0
- anyscale/client/openapi_client/models/aicamodel_list_response.py +147 -0
- anyscale/client/openapi_client/models/aicamodel_response.py +121 -0
- anyscale/client/openapi_client/models/aioa_cloud_waitlist_record.py +254 -0
- anyscale/client/openapi_client/models/aioacloudwaitlistrecord_response.py +121 -0
- anyscale/client/openapi_client/models/alert_type.py +103 -0
- anyscale/client/openapi_client/models/anyscale_aws_account.py +121 -0
- anyscale/client/openapi_client/models/anyscale_service_account.py +256 -0
- anyscale/client/openapi_client/models/anyscale_version_response.py +121 -0
- anyscale/client/openapi_client/models/anyscaleawsaccount_response.py +121 -0
- anyscale/client/openapi_client/models/anyscaled_credential_response.py +121 -0
- anyscale/client/openapi_client/models/anyscaledcredentialresponse_response.py +121 -0
- anyscale/client/openapi_client/models/anyscaleserviceaccount_response.py +121 -0
- anyscale/client/openapi_client/models/anyscaleversionresponse_response.py +121 -0
- anyscale/client/openapi_client/models/api_key_parameters.py +147 -0
- anyscale/client/openapi_client/models/app_config.py +436 -0
- anyscale/client/openapi_client/models/app_config_config_schema.py +235 -0
- anyscale/client/openapi_client/models/appconfig_list_response.py +147 -0
- anyscale/client/openapi_client/models/appconfig_response.py +121 -0
- anyscale/client/openapi_client/models/application_type.py +99 -0
- anyscale/client/openapi_client/models/applied_snapshot.py +175 -0
- anyscale/client/openapi_client/models/apply_production_service_v2_model.py +490 -0
- anyscale/client/openapi_client/models/archive_status.py +101 -0
- anyscale/client/openapi_client/models/archived_logs_info.py +164 -0
- anyscale/client/openapi_client/models/archivedlogsinfo_response.py +121 -0
- anyscale/client/openapi_client/models/attach_machine_pool_to_cloud_request.py +152 -0
- anyscale/client/openapi_client/models/attachmachinepooltocloudresponse_response.py +121 -0
- anyscale/client/openapi_client/models/aviary_model_config_v2.py +358 -0
- anyscale/client/openapi_client/models/aws_credentials.py +181 -0
- anyscale/client/openapi_client/models/aws_memory_db_cluster_config.py +148 -0
- anyscale/client/openapi_client/models/aws_region_and_zones.py +123 -0
- anyscale/client/openapi_client/models/aws_region_info.py +152 -0
- anyscale/client/openapi_client/models/awsregionandzones_response.py +121 -0
- anyscale/client/openapi_client/models/bank_account_information.py +239 -0
- anyscale/client/openapi_client/models/base_job_status.py +105 -0
- anyscale/client/openapi_client/models/baseimagesenum.py +2130 -0
- anyscale/client/openapi_client/models/batch_response_batched_result_organization_invitation_base.py +121 -0
- anyscale/client/openapi_client/models/batched_result_organization_invitation_base.py +173 -0
- anyscale/client/openapi_client/models/billing_information.py +181 -0
- anyscale/client/openapi_client/models/billing_version_code.py +100 -0
- anyscale/client/openapi_client/models/body_aws_marketplace_registration_api_v2_organization_billing_aws_marketplace_registration_post.py +121 -0
- anyscale/client/openapi_client/models/buffer_registration.py +285 -0
- anyscale/client/openapi_client/models/build.py +607 -0
- anyscale/client/openapi_client/models/build_log_response.py +123 -0
- anyscale/client/openapi_client/models/build_registration.py +285 -0
- anyscale/client/openapi_client/models/build_response.py +121 -0
- anyscale/client/openapi_client/models/build_status.py +104 -0
- anyscale/client/openapi_client/models/buildlogresponse_response.py +121 -0
- anyscale/client/openapi_client/models/card.py +181 -0
- anyscale/client/openapi_client/models/card_id.py +108 -0
- anyscale/client/openapi_client/models/card_list_response.py +147 -0
- anyscale/client/openapi_client/models/change_password_params.py +148 -0
- anyscale/client/openapi_client/models/cleanup_leaked_grafana_dashboard_response.py +208 -0
- anyscale/client/openapi_client/models/cleanupleakedgrafanadashboardresponse_response.py +121 -0
- anyscale/client/openapi_client/models/clone_experimental_workspace.py +151 -0
- anyscale/client/openapi_client/models/cloud.py +802 -0
- anyscale/client/openapi_client/models/cloud_analytics_event.py +351 -0
- anyscale/client/openapi_client/models/cloud_analytics_event_cloud_provider_error.py +152 -0
- anyscale/client/openapi_client/models/cloud_analytics_event_cloud_resource.py +117 -0
- anyscale/client/openapi_client/models/cloud_analytics_event_command_name.py +103 -0
- anyscale/client/openapi_client/models/cloud_analytics_event_error.py +150 -0
- anyscale/client/openapi_client/models/cloud_analytics_event_name.py +109 -0
- anyscale/client/openapi_client/models/cloud_collaborator.py +175 -0
- anyscale/client/openapi_client/models/cloud_collaborator_value.py +177 -0
- anyscale/client/openapi_client/models/cloud_collaborators_query.py +122 -0
- anyscale/client/openapi_client/models/cloud_config.py +206 -0
- anyscale/client/openapi_client/models/cloud_data_bucket_access_mode.py +100 -0
- anyscale/client/openapi_client/models/cloud_data_bucket_file_type.py +102 -0
- anyscale/client/openapi_client/models/cloud_data_bucket_presigned_upload_info.py +268 -0
- anyscale/client/openapi_client/models/cloud_data_bucket_presigned_upload_request.py +152 -0
- anyscale/client/openapi_client/models/cloud_data_bucket_presigned_upload_scheme.py +100 -0
- anyscale/client/openapi_client/models/cloud_data_bucket_presigned_url_request.py +209 -0
- anyscale/client/openapi_client/models/cloud_data_bucket_presigned_url_response.py +296 -0
- anyscale/client/openapi_client/models/cloud_data_bucket_presigned_url_scheme.py +100 -0
- anyscale/client/openapi_client/models/cloud_data_bucket_request_scope.py +100 -0
- anyscale/client/openapi_client/models/cloud_hosting_type.py +100 -0
- anyscale/client/openapi_client/models/cloud_list_response.py +147 -0
- anyscale/client/openapi_client/models/cloud_name_options.py +121 -0
- anyscale/client/openapi_client/models/cloud_overview_dashboard.py +175 -0
- anyscale/client/openapi_client/models/cloud_project_collaborator.py +175 -0
- anyscale/client/openapi_client/models/cloud_project_collaborator_value.py +121 -0
- anyscale/client/openapi_client/models/cloud_provider.py +102 -0
- anyscale/client/openapi_client/models/cloud_providers.py +103 -0
- anyscale/client/openapi_client/models/cloud_region_and_zones.py +123 -0
- anyscale/client/openapi_client/models/cloud_region_info.py +152 -0
- anyscale/client/openapi_client/models/cloud_resource.py +740 -0
- anyscale/client/openapi_client/models/cloud_resource_gcp.py +691 -0
- anyscale/client/openapi_client/models/cloud_response.py +121 -0
- anyscale/client/openapi_client/models/cloud_state.py +104 -0
- anyscale/client/openapi_client/models/cloud_status.py +100 -0
- anyscale/client/openapi_client/models/cloud_type.py +100 -0
- anyscale/client/openapi_client/models/cloud_types.py +100 -0
- anyscale/client/openapi_client/models/cloud_version.py +100 -0
- anyscale/client/openapi_client/models/cloud_waitlist_status.py +102 -0
- anyscale/client/openapi_client/models/cloud_with_cloud_resource.py +830 -0
- anyscale/client/openapi_client/models/cloud_with_cloud_resource_gcp.py +830 -0
- anyscale/client/openapi_client/models/cloudcollaborator_list_response.py +147 -0
- anyscale/client/openapi_client/models/clouddatabucketpresigneduploadinfo_response.py +121 -0
- anyscale/client/openapi_client/models/clouddatabucketpresignedurlresponse_response.py +121 -0
- anyscale/client/openapi_client/models/cloudoverviewdashboard_response.py +121 -0
- anyscale/client/openapi_client/models/cloudregionandzones_response.py +121 -0
- anyscale/client/openapi_client/models/cloudresource_response.py +121 -0
- anyscale/client/openapi_client/models/cloudresourcegcp_response.py +121 -0
- anyscale/client/openapi_client/models/cloudwithcloudresource_response.py +121 -0
- anyscale/client/openapi_client/models/cloudwithcloudresourcegcp_response.py +121 -0
- anyscale/client/openapi_client/models/cluster_auth_response.py +148 -0
- anyscale/client/openapi_client/models/cluster_config.py +178 -0
- anyscale/client/openapi_client/models/cluster_config_with_session_idle_timeout.py +204 -0
- anyscale/client/openapi_client/models/cluster_environments_query.py +290 -0
- anyscale/client/openapi_client/models/cluster_event.py +174 -0
- anyscale/client/openapi_client/models/cluster_events_output.py +175 -0
- anyscale/client/openapi_client/models/cluster_features.py +152 -0
- anyscale/client/openapi_client/models/cluster_management_stack_versions.py +100 -0
- anyscale/client/openapi_client/models/cluster_startup.py +208 -0
- anyscale/client/openapi_client/models/cluster_status.py +104 -0
- anyscale/client/openapi_client/models/cluster_status_details.py +100 -0
- anyscale/client/openapi_client/models/clusterauthresponse_response.py +121 -0
- anyscale/client/openapi_client/models/clusterconfig_response.py +121 -0
- anyscale/client/openapi_client/models/clusterconfigwithsessionidletimeout_response.py +121 -0
- anyscale/client/openapi_client/models/clustereventsoutput_response.py +121 -0
- anyscale/client/openapi_client/models/clusterfeatures_response.py +121 -0
- anyscale/client/openapi_client/models/company_size.py +103 -0
- anyscale/client/openapi_client/models/compute_node_type.py +292 -0
- anyscale/client/openapi_client/models/compute_stack.py +100 -0
- anyscale/client/openapi_client/models/compute_template.py +415 -0
- anyscale/client/openapi_client/models/compute_template_config.py +461 -0
- anyscale/client/openapi_client/models/compute_template_query.py +316 -0
- anyscale/client/openapi_client/models/computetemplate_response.py +121 -0
- anyscale/client/openapi_client/models/computetemplateconfig_response.py +121 -0
- anyscale/client/openapi_client/models/create_aica_endpoint.py +210 -0
- anyscale/client/openapi_client/models/create_aioa_cloud_waitlist.py +173 -0
- anyscale/client/openapi_client/models/create_analytics_event.py +122 -0
- anyscale/client/openapi_client/models/create_app_config.py +235 -0
- anyscale/client/openapi_client/models/create_app_config_configuration_schema.py +235 -0
- anyscale/client/openapi_client/models/create_billing_version.py +181 -0
- anyscale/client/openapi_client/models/create_bug_report_response.py +152 -0
- anyscale/client/openapi_client/models/create_build.py +263 -0
- anyscale/client/openapi_client/models/create_byod_app_config.py +180 -0
- anyscale/client/openapi_client/models/create_byod_app_config_configuration_schema.py +206 -0
- anyscale/client/openapi_client/models/create_byod_build.py +152 -0
- anyscale/client/openapi_client/models/create_cloud_collaborator.py +148 -0
- anyscale/client/openapi_client/models/create_cloud_resource.py +682 -0
- anyscale/client/openapi_client/models/create_cloud_resource_gcp.py +633 -0
- anyscale/client/openapi_client/models/create_cloud_with_cloud_resource.py +546 -0
- anyscale/client/openapi_client/models/create_cluster_compute_config.py +463 -0
- anyscale/client/openapi_client/models/create_compute_template.py +229 -0
- anyscale/client/openapi_client/models/create_compute_template_config.py +464 -0
- anyscale/client/openapi_client/models/create_dataset.py +200 -0
- anyscale/client/openapi_client/models/create_experimental_workspace.py +435 -0
- anyscale/client/openapi_client/models/create_experimental_workspace_from_job.py +123 -0
- anyscale/client/openapi_client/models/create_fine_tuning_hyperparameters.py +156 -0
- anyscale/client/openapi_client/models/create_fine_tuning_job_product_request.py +353 -0
- anyscale/client/openapi_client/models/create_instance_usage_budget.py +253 -0
- anyscale/client/openapi_client/models/create_internal_production_job.py +262 -0
- anyscale/client/openapi_client/models/create_job_queue_config.py +206 -0
- anyscale/client/openapi_client/models/create_job_queue_requests.py +323 -0
- anyscale/client/openapi_client/models/create_machine_pool_request.py +151 -0
- anyscale/client/openapi_client/models/create_machine_pool_response.py +123 -0
- anyscale/client/openapi_client/models/create_machine_request.py +151 -0
- anyscale/client/openapi_client/models/create_machine_response.py +123 -0
- anyscale/client/openapi_client/models/create_metronome_webhook_notification.py +175 -0
- anyscale/client/openapi_client/models/create_notification_channel_record.py +146 -0
- anyscale/client/openapi_client/models/create_organization_configuration.py +199 -0
- anyscale/client/openapi_client/models/create_organization_invitation.py +121 -0
- anyscale/client/openapi_client/models/create_otp_return_api_model.py +148 -0
- anyscale/client/openapi_client/models/create_production_job_config.py +347 -0
- anyscale/client/openapi_client/models/create_resource_quota.py +293 -0
- anyscale/client/openapi_client/models/create_schedule.py +263 -0
- anyscale/client/openapi_client/models/create_session_from_snapshot_options.py +565 -0
- anyscale/client/openapi_client/models/create_session_in_db.py +434 -0
- anyscale/client/openapi_client/models/create_session_response.py +174 -0
- anyscale/client/openapi_client/models/create_user.py +439 -0
- anyscale/client/openapi_client/models/create_user_project_collaborator.py +148 -0
- anyscale/client/openapi_client/models/create_user_project_collaborator_value.py +121 -0
- anyscale/client/openapi_client/models/create_workspace_from_template.py +263 -0
- anyscale/client/openapi_client/models/createbugreportresponse_response.py +121 -0
- anyscale/client/openapi_client/models/createcomputetemplateconfig_response.py +121 -0
- anyscale/client/openapi_client/models/createmachinepoolresponse_response.py +121 -0
- anyscale/client/openapi_client/models/createmachineresponse_response.py +121 -0
- anyscale/client/openapi_client/models/createotpreturnapimodel_response.py +121 -0
- anyscale/client/openapi_client/models/createsessionresponse_response.py +121 -0
- anyscale/client/openapi_client/models/credit_card_information.py +268 -0
- anyscale/client/openapi_client/models/customer_alert_status.py +101 -0
- anyscale/client/openapi_client/models/customer_billing_type.py +101 -0
- anyscale/client/openapi_client/models/dataplane_services.py +102 -0
- anyscale/client/openapi_client/models/dataset.py +416 -0
- anyscale/client/openapi_client/models/dataset_list_response.py +150 -0
- anyscale/client/openapi_client/models/dataset_response.py +121 -0
- anyscale/client/openapi_client/models/dataset_upload.py +148 -0
- anyscale/client/openapi_client/models/datasetupload_response.py +121 -0
- anyscale/client/openapi_client/models/decorated_application_template.py +493 -0
- anyscale/client/openapi_client/models/decorated_build.py +664 -0
- anyscale/client/openapi_client/models/decorated_compute_template.py +446 -0
- anyscale/client/openapi_client/models/decorated_compute_template_config.py +490 -0
- anyscale/client/openapi_client/models/decorated_interactive_session.py +793 -0
- anyscale/client/openapi_client/models/decorated_job.py +793 -0
- anyscale/client/openapi_client/models/decorated_job_queue.py +639 -0
- anyscale/client/openapi_client/models/decorated_job_submission.py +575 -0
- anyscale/client/openapi_client/models/decorated_list_service_api_model.py +670 -0
- anyscale/client/openapi_client/models/decorated_production_job.py +805 -0
- anyscale/client/openapi_client/models/decorated_production_job_state_transition.py +319 -0
- anyscale/client/openapi_client/models/decorated_production_service_v2_api_model.py +641 -0
- anyscale/client/openapi_client/models/decorated_production_service_v2_version_api_model.py +437 -0
- anyscale/client/openapi_client/models/decorated_runtime_env.py +488 -0
- anyscale/client/openapi_client/models/decorated_schedule.py +552 -0
- anyscale/client/openapi_client/models/decorated_serve_deployment.py +711 -0
- anyscale/client/openapi_client/models/decorated_service_event_api_model.py +513 -0
- anyscale/client/openapi_client/models/decorated_session.py +1789 -0
- anyscale/client/openapi_client/models/decorated_support_request.py +283 -0
- anyscale/client/openapi_client/models/decorated_unified_job.py +466 -0
- anyscale/client/openapi_client/models/decoratedapplicationtemplate_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedapplicationtemplate_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedbuild_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedbuild_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedcomputetemplate_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedcomputetemplate_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedinteractivesession_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedinteractivesession_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedjob_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedjob_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedjobqueue_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedjobqueue_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedjobsubmission_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedjobsubmission_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedlistserviceapimodel_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedproductionjob_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedproductionjob_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedproductionjobstatetransition_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedproductionservicev2_apimodel_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedproductionservicev2_versionapimodel_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedruntimeenv_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedruntimeenv_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedschedule_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedschedule_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedservedeployment_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedservedeployment_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedserviceeventapimodel_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedsession_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedsession_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedsupportrequest_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedsupportrequest_response.py +121 -0
- anyscale/client/openapi_client/models/decoratedunifiedjob_list_response.py +147 -0
- anyscale/client/openapi_client/models/decoratedunifiedjob_response.py +121 -0
- anyscale/client/openapi_client/models/delete_machine_pool_request.py +123 -0
- anyscale/client/openapi_client/models/delete_machine_request.py +206 -0
- anyscale/client/openapi_client/models/deleted_platform_fine_tuned_model.py +148 -0
- anyscale/client/openapi_client/models/deletedplatformfinetunedmodel_response.py +121 -0
- anyscale/client/openapi_client/models/deletemachinepoolresponse_response.py +121 -0
- anyscale/client/openapi_client/models/detach_machine_pool_from_cloud_request.py +152 -0
- anyscale/client/openapi_client/models/detachmachinepoolfromcloudresponse_response.py +121 -0
- anyscale/client/openapi_client/models/dismissal_type.py +100 -0
- anyscale/client/openapi_client/models/editable_cloud_resource.py +206 -0
- anyscale/client/openapi_client/models/editable_cloud_resource_gcp.py +178 -0
- anyscale/client/openapi_client/models/error.py +174 -0
- anyscale/client/openapi_client/models/event_level.py +104 -0
- anyscale/client/openapi_client/models/execute_command_response.py +175 -0
- anyscale/client/openapi_client/models/execute_interactive_command_options.py +147 -0
- anyscale/client/openapi_client/models/execute_shell_command_options.py +121 -0
- anyscale/client/openapi_client/models/executecommandresponse_response.py +121 -0
- anyscale/client/openapi_client/models/experimental_workspace.py +748 -0
- anyscale/client/openapi_client/models/experimental_workspaces_sort_field.py +100 -0
- anyscale/client/openapi_client/models/experimentalworkspace_list_response.py +147 -0
- anyscale/client/openapi_client/models/experimentalworkspace_response.py +121 -0
- anyscale/client/openapi_client/models/external_service_status.py +147 -0
- anyscale/client/openapi_client/models/external_service_status_response.py +250 -0
- anyscale/client/openapi_client/models/external_terminal_command.py +280 -0
- anyscale/client/openapi_client/models/externalservicestatusresponse_response.py +121 -0
- anyscale/client/openapi_client/models/feature_compatibility.py +152 -0
- anyscale/client/openapi_client/models/feature_flag_response.py +121 -0
- anyscale/client/openapi_client/models/featureflagresponse_response.py +121 -0
- anyscale/client/openapi_client/models/fine_tune_type.py +100 -0
- anyscale/client/openapi_client/models/fine_tuned_model.py +412 -0
- anyscale/client/openapi_client/models/fine_tuning_job_status.py +103 -0
- anyscale/client/openapi_client/models/finetunedmodel_list_response.py +147 -0
- anyscale/client/openapi_client/models/finetunedmodel_response.py +121 -0
- anyscale/client/openapi_client/models/finish_ft_job_request.py +204 -0
- anyscale/client/openapi_client/models/finish_ft_job_request_v2.py +183 -0
- anyscale/client/openapi_client/models/gcp_file_store_config.py +175 -0
- anyscale/client/openapi_client/models/gcp_memorystore_instance_config.py +148 -0
- anyscale/client/openapi_client/models/grafana_dashboard.py +201 -0
- anyscale/client/openapi_client/models/grpc_protocol_config.py +178 -0
- anyscale/client/openapi_client/models/ha_job_error_types.py +103 -0
- anyscale/client/openapi_client/models/ha_job_event_level.py +101 -0
- anyscale/client/openapi_client/models/ha_job_event_origin.py +100 -0
- anyscale/client/openapi_client/models/ha_job_goal_states.py +102 -0
- anyscale/client/openapi_client/models/ha_job_states.py +109 -0
- anyscale/client/openapi_client/models/ha_job_type.py +100 -0
- anyscale/client/openapi_client/models/ha_jobs_sort_field.py +105 -0
- anyscale/client/openapi_client/models/head_ip.py +121 -0
- anyscale/client/openapi_client/models/headip_response.py +121 -0
- anyscale/client/openapi_client/models/http_protocol_config.py +150 -0
- anyscale/client/openapi_client/models/http_validation_error.py +120 -0
- anyscale/client/openapi_client/models/idle_termination_status.py +104 -0
- anyscale/client/openapi_client/models/import_aica_model.py +241 -0
- anyscale/client/openapi_client/models/instance_usage_budget.py +572 -0
- anyscale/client/openapi_client/models/instance_usage_budget_evaluation_period.py +100 -0
- anyscale/client/openapi_client/models/instanceusagebudget_list_response.py +147 -0
- anyscale/client/openapi_client/models/instanceusagebudget_response.py +121 -0
- anyscale/client/openapi_client/models/integration_details.py +120 -0
- anyscale/client/openapi_client/models/interactive_session_logs.py +152 -0
- anyscale/client/openapi_client/models/interactivesessionlogs_response.py +121 -0
- anyscale/client/openapi_client/models/internal_production_job.py +663 -0
- anyscale/client/openapi_client/models/internalproductionjob_response.py +121 -0
- anyscale/client/openapi_client/models/invoice.py +413 -0
- anyscale/client/openapi_client/models/invoice_list_response.py +147 -0
- anyscale/client/openapi_client/models/invoice_status.py +102 -0
- anyscale/client/openapi_client/models/invoices_query.py +150 -0
- anyscale/client/openapi_client/models/job_access.py +102 -0
- anyscale/client/openapi_client/models/job_queue.py +467 -0
- anyscale/client/openapi_client/models/job_queue_config.py +122 -0
- anyscale/client/openapi_client/models/job_queue_execution_mode.py +101 -0
- anyscale/client/openapi_client/models/job_queue_spec.py +263 -0
- anyscale/client/openapi_client/models/job_queue_state.py +100 -0
- anyscale/client/openapi_client/models/job_queues_query.py +262 -0
- anyscale/client/openapi_client/models/job_run_type.py +101 -0
- anyscale/client/openapi_client/models/job_state_log_level_types.py +100 -0
- anyscale/client/openapi_client/models/job_status.py +105 -0
- anyscale/client/openapi_client/models/job_submissions_sort_field.py +101 -0
- anyscale/client/openapi_client/models/jobqueue_response.py +121 -0
- anyscale/client/openapi_client/models/jobs_logs.py +152 -0
- anyscale/client/openapi_client/models/jobs_logs_query_info.py +181 -0
- anyscale/client/openapi_client/models/jobs_sort_field.py +104 -0
- anyscale/client/openapi_client/models/jobslogs_response.py +121 -0
- anyscale/client/openapi_client/models/jobslogsqueryinfo_response.py +121 -0
- anyscale/client/openapi_client/models/json_patch_operation.py +200 -0
- anyscale/client/openapi_client/models/kubernetes_manager_registration_request.py +123 -0
- anyscale/client/openapi_client/models/kubernetes_manager_registration_response.py +123 -0
- anyscale/client/openapi_client/models/kubernetesmanagerregistrationresponse_response.py +121 -0
- anyscale/client/openapi_client/models/lb_resource.py +123 -0
- anyscale/client/openapi_client/models/lbresource_response.py +121 -0
- anyscale/client/openapi_client/models/list_machine_pools_response.py +123 -0
- anyscale/client/openapi_client/models/list_machines_response.py +121 -0
- anyscale/client/openapi_client/models/list_resource_quotas_query.py +234 -0
- anyscale/client/openapi_client/models/list_response_metadata.py +146 -0
- anyscale/client/openapi_client/models/listmachinepoolsresponse_response.py +121 -0
- anyscale/client/openapi_client/models/listmachinesresponse_response.py +121 -0
- anyscale/client/openapi_client/models/log_detail.py +187 -0
- anyscale/client/openapi_client/models/log_details.py +151 -0
- anyscale/client/openapi_client/models/log_download_config.py +206 -0
- anyscale/client/openapi_client/models/log_download_request.py +150 -0
- anyscale/client/openapi_client/models/log_download_result.py +207 -0
- anyscale/client/openapi_client/models/log_file_chunk.py +439 -0
- anyscale/client/openapi_client/models/log_filter.py +430 -0
- anyscale/client/openapi_client/models/log_item.py +181 -0
- anyscale/client/openapi_client/models/log_item_batch.py +151 -0
- anyscale/client/openapi_client/models/log_level_types.py +100 -0
- anyscale/client/openapi_client/models/log_stream.py +151 -0
- anyscale/client/openapi_client/models/logdetails_response.py +121 -0
- anyscale/client/openapi_client/models/logdownloadresult_response.py +121 -0
- anyscale/client/openapi_client/models/login_user_params.py +205 -0
- anyscale/client/openapi_client/models/logitembatch_response.py +121 -0
- anyscale/client/openapi_client/models/logs_output.py +202 -0
- anyscale/client/openapi_client/models/logsoutput_response.py +121 -0
- anyscale/client/openapi_client/models/logstream_response.py +121 -0
- anyscale/client/openapi_client/models/long_running_workload.py +256 -0
- anyscale/client/openapi_client/models/longrunningworkload_list_response.py +147 -0
- anyscale/client/openapi_client/models/machine_allocation_state.py +100 -0
- anyscale/client/openapi_client/models/machine_connection_state.py +100 -0
- anyscale/client/openapi_client/models/machine_info.py +466 -0
- anyscale/client/openapi_client/models/machine_pool.py +266 -0
- anyscale/client/openapi_client/models/metronome_customer_info_model.py +148 -0
- anyscale/client/openapi_client/models/metronome_dashboard_type.py +101 -0
- anyscale/client/openapi_client/models/metronomecustomerinfomodel_list_response.py +147 -0
- anyscale/client/openapi_client/models/metronomecustomerinfomodel_response.py +121 -0
- anyscale/client/openapi_client/models/mini_build.py +267 -0
- anyscale/client/openapi_client/models/mini_cloud.py +321 -0
- anyscale/client/openapi_client/models/mini_cluster.py +148 -0
- anyscale/client/openapi_client/models/mini_compute_template.py +228 -0
- anyscale/client/openapi_client/models/mini_compute_template_config.py +121 -0
- anyscale/client/openapi_client/models/mini_job_run.py +599 -0
- anyscale/client/openapi_client/models/mini_namespace.py +148 -0
- anyscale/client/openapi_client/models/mini_organization.py +148 -0
- anyscale/client/openapi_client/models/mini_production_job.py +202 -0
- anyscale/client/openapi_client/models/mini_project.py +205 -0
- anyscale/client/openapi_client/models/mini_runtime_environment.py +147 -0
- anyscale/client/openapi_client/models/mini_schedule.py +180 -0
- anyscale/client/openapi_client/models/mini_user.py +266 -0
- anyscale/client/openapi_client/models/minibuild_list_response.py +147 -0
- anyscale/client/openapi_client/models/minicomputetemplate_list_response.py +147 -0
- anyscale/client/openapi_client/models/miniproject_list_response.py +147 -0
- anyscale/client/openapi_client/models/monitor_logs_extension.py +100 -0
- anyscale/client/openapi_client/models/named_entity.py +148 -0
- anyscale/client/openapi_client/models/nfs_mount_target.py +151 -0
- anyscale/client/openapi_client/models/node_registration_aws.py +152 -0
- anyscale/client/openapi_client/models/node_registration_gcp.py +123 -0
- anyscale/client/openapi_client/models/node_registration_k8_s.py +178 -0
- anyscale/client/openapi_client/models/node_registration_provisioned.py +150 -0
- anyscale/client/openapi_client/models/node_registration_v2.py +279 -0
- anyscale/client/openapi_client/models/node_type.py +100 -0
- anyscale/client/openapi_client/models/notification_channel_email_config.py +121 -0
- anyscale/client/openapi_client/models/notification_channel_webhook_config.py +121 -0
- anyscale/client/openapi_client/models/onboarding_user_cards_query.py +122 -0
- anyscale/client/openapi_client/models/organization.py +490 -0
- anyscale/client/openapi_client/models/organization_availability.py +148 -0
- anyscale/client/openapi_client/models/organization_collaborator.py +259 -0
- anyscale/client/openapi_client/models/organization_configuration.py +280 -0
- anyscale/client/openapi_client/models/organization_configuration_response.py +227 -0
- anyscale/client/openapi_client/models/organization_invitation.py +255 -0
- anyscale/client/openapi_client/models/organization_invitation_base.py +121 -0
- anyscale/client/openapi_client/models/organization_marketing_questions.py +198 -0
- anyscale/client/openapi_client/models/organization_permission_level.py +100 -0
- anyscale/client/openapi_client/models/organization_project_collaborator.py +175 -0
- anyscale/client/openapi_client/models/organization_project_collaborator_value.py +148 -0
- anyscale/client/openapi_client/models/organization_public_identifier.py +121 -0
- anyscale/client/openapi_client/models/organization_response.py +121 -0
- anyscale/client/openapi_client/models/organization_summary.py +229 -0
- anyscale/client/openapi_client/models/organization_usage_alert.py +210 -0
- anyscale/client/openapi_client/models/organization_usage_alert_severity.py +100 -0
- anyscale/client/openapi_client/models/organizationavailability_response.py +121 -0
- anyscale/client/openapi_client/models/organizationcollaborator_list_response.py +147 -0
- anyscale/client/openapi_client/models/organizationconfiguration_list_response.py +147 -0
- anyscale/client/openapi_client/models/organizationconfigurationresponse_response.py +121 -0
- anyscale/client/openapi_client/models/organizationinvitation_list_response.py +147 -0
- anyscale/client/openapi_client/models/organizationinvitation_response.py +121 -0
- anyscale/client/openapi_client/models/organizationinvitationbase_response.py +121 -0
- anyscale/client/openapi_client/models/organizationprojectcollaborator_list_response.py +147 -0
- anyscale/client/openapi_client/models/organizationpublicidentifier_response.py +121 -0
- anyscale/client/openapi_client/models/organizationusagealert_list_response.py +147 -0
- anyscale/client/openapi_client/models/page_query.py +153 -0
- anyscale/client/openapi_client/models/pause_schedule.py +123 -0
- anyscale/client/openapi_client/models/permission_level.py +101 -0
- anyscale/client/openapi_client/models/platform_fine_tuning_job.py +577 -0
- anyscale/client/openapi_client/models/platformfinetuningjob_list_response.py +147 -0
- anyscale/client/openapi_client/models/platformfinetuningjob_response.py +121 -0
- anyscale/client/openapi_client/models/product_autoscaler_flag.py +122 -0
- anyscale/client/openapi_client/models/product_type.py +100 -0
- anyscale/client/openapi_client/models/productautoscalerflag_response.py +121 -0
- anyscale/client/openapi_client/models/production_job.py +437 -0
- anyscale/client/openapi_client/models/production_job_config.py +348 -0
- anyscale/client/openapi_client/models/production_job_event.py +378 -0
- anyscale/client/openapi_client/models/production_job_event_scope_filter.py +101 -0
- anyscale/client/openapi_client/models/production_job_state_transition.py +293 -0
- anyscale/client/openapi_client/models/productionjob_response.py +121 -0
- anyscale/client/openapi_client/models/productionjobevent_list_response.py +147 -0
- anyscale/client/openapi_client/models/project.py +554 -0
- anyscale/client/openapi_client/models/project_base.py +121 -0
- anyscale/client/openapi_client/models/project_collaborator.py +175 -0
- anyscale/client/openapi_client/models/project_collaborator_value.py +175 -0
- anyscale/client/openapi_client/models/project_collaborators_put_message.py +121 -0
- anyscale/client/openapi_client/models/project_create_message.py +148 -0
- anyscale/client/openapi_client/models/project_default_session_name.py +121 -0
- anyscale/client/openapi_client/models/project_delete_message.py +121 -0
- anyscale/client/openapi_client/models/project_list_response.py +147 -0
- anyscale/client/openapi_client/models/project_patch_message.py +121 -0
- anyscale/client/openapi_client/models/project_response.py +121 -0
- anyscale/client/openapi_client/models/projectbase_response.py +121 -0
- anyscale/client/openapi_client/models/projectcollaborator_list_response.py +147 -0
- anyscale/client/openapi_client/models/projectdefaultsessionname_response.py +121 -0
- anyscale/client/openapi_client/models/projects_sort_field.py +101 -0
- anyscale/client/openapi_client/models/projects_violating_tree_hierarchy_response.py +121 -0
- anyscale/client/openapi_client/models/projectsviolatingtreehierarchyresponse_response.py +121 -0
- anyscale/client/openapi_client/models/protocols.py +150 -0
- anyscale/client/openapi_client/models/provider_metadata.py +205 -0
- anyscale/client/openapi_client/models/providermetadata_response.py +121 -0
- anyscale/client/openapi_client/models/python_modules.py +150 -0
- anyscale/client/openapi_client/models/quota.py +198 -0
- anyscale/client/openapi_client/models/ray_gcs_external_storage_config.py +178 -0
- anyscale/client/openapi_client/models/ray_runtime_env_config.py +262 -0
- anyscale/client/openapi_client/models/read_billing_version.py +210 -0
- anyscale/client/openapi_client/models/readbillingversion_list_response.py +147 -0
- anyscale/client/openapi_client/models/replica_details.py +152 -0
- anyscale/client/openapi_client/models/replica_state.py +104 -0
- anyscale/client/openapi_client/models/request_email_magic_link_response.py +147 -0
- anyscale/client/openapi_client/models/request_otp_return_api_model.py +148 -0
- anyscale/client/openapi_client/models/request_password_reset_params.py +147 -0
- anyscale/client/openapi_client/models/requestemailmagiclinkresponse_response.py +121 -0
- anyscale/client/openapi_client/models/requestotpreturnapimodel_response.py +121 -0
- anyscale/client/openapi_client/models/reset_password_params.py +148 -0
- anyscale/client/openapi_client/models/resource_quota.py +465 -0
- anyscale/client/openapi_client/models/resource_quota_status.py +123 -0
- anyscale/client/openapi_client/models/resourcequota_list_response.py +147 -0
- anyscale/client/openapi_client/models/resourcequota_response.py +121 -0
- anyscale/client/openapi_client/models/resources.py +234 -0
- anyscale/client/openapi_client/models/resubmit_ft_job_request.py +121 -0
- anyscale/client/openapi_client/models/rollback_service_model.py +122 -0
- anyscale/client/openapi_client/models/rollout_strategy.py +100 -0
- anyscale/client/openapi_client/models/s3_download_location.py +148 -0
- anyscale/client/openapi_client/models/schedule_config.py +151 -0
- anyscale/client/openapi_client/models/serve_deployment_grafana_dashboard_status.py +101 -0
- anyscale/client/openapi_client/models/serve_deployment_logs.py +152 -0
- anyscale/client/openapi_client/models/serve_deployment_state.py +104 -0
- anyscale/client/openapi_client/models/servedeploymentlogs_response.py +121 -0
- anyscale/client/openapi_client/models/server_session_token.py +121 -0
- anyscale/client/openapi_client/models/serversessiontoken_response.py +121 -0
- anyscale/client/openapi_client/models/service_config.py +178 -0
- anyscale/client/openapi_client/models/service_event_current_state.py +108 -0
- anyscale/client/openapi_client/models/service_event_level.py +102 -0
- anyscale/client/openapi_client/models/service_event_origin.py +103 -0
- anyscale/client/openapi_client/models/service_event_scope.py +103 -0
- anyscale/client/openapi_client/models/service_event_scope_filter.py +104 -0
- anyscale/client/openapi_client/models/service_event_type.py +125 -0
- anyscale/client/openapi_client/models/service_event_verbose_message_model.py +180 -0
- anyscale/client/openapi_client/models/service_goal_states.py +100 -0
- anyscale/client/openapi_client/models/service_observability_urls.py +206 -0
- anyscale/client/openapi_client/models/service_sort_field.py +101 -0
- anyscale/client/openapi_client/models/service_type.py +100 -0
- anyscale/client/openapi_client/models/service_usage.py +353 -0
- anyscale/client/openapi_client/models/service_version_state.py +106 -0
- anyscale/client/openapi_client/models/serviceeventverbosemessagemodel_list_response.py +147 -0
- anyscale/client/openapi_client/models/session.py +834 -0
- anyscale/client/openapi_client/models/session_access.py +102 -0
- anyscale/client/openapi_client/models/session_autosync_sessions_update_message.py +121 -0
- anyscale/client/openapi_client/models/session_command.py +413 -0
- anyscale/client/openapi_client/models/session_command_finish_options.py +226 -0
- anyscale/client/openapi_client/models/session_command_id.py +121 -0
- anyscale/client/openapi_client/models/session_command_types.py +100 -0
- anyscale/client/openapi_client/models/session_create_message.py +148 -0
- anyscale/client/openapi_client/models/session_delete_message.py +121 -0
- anyscale/client/openapi_client/models/session_describe.py +175 -0
- anyscale/client/openapi_client/models/session_details.py +148 -0
- anyscale/client/openapi_client/models/session_event.py +267 -0
- anyscale/client/openapi_client/models/session_event_cause.py +150 -0
- anyscale/client/openapi_client/models/session_event_types.py +111 -0
- anyscale/client/openapi_client/models/session_execute_message.py +121 -0
- anyscale/client/openapi_client/models/session_finish_command_message.py +175 -0
- anyscale/client/openapi_client/models/session_history_item.py +146 -0
- anyscale/client/openapi_client/models/session_kill_command_message.py +121 -0
- anyscale/client/openapi_client/models/session_list_response.py +147 -0
- anyscale/client/openapi_client/models/session_patch_message.py +121 -0
- anyscale/client/openapi_client/models/session_response.py +121 -0
- anyscale/client/openapi_client/models/session_ssh_key.py +148 -0
- anyscale/client/openapi_client/models/session_starting_up_data.py +146 -0
- anyscale/client/openapi_client/models/session_state.py +111 -0
- anyscale/client/openapi_client/models/session_state_change_message.py +121 -0
- anyscale/client/openapi_client/models/session_state_data.py +146 -0
- anyscale/client/openapi_client/models/session_stopping_data.py +146 -0
- anyscale/client/openapi_client/models/sessioncommand_list_response.py +147 -0
- anyscale/client/openapi_client/models/sessioncommandid_response.py +121 -0
- anyscale/client/openapi_client/models/sessiondescribe_response.py +121 -0
- anyscale/client/openapi_client/models/sessiondetails_response.py +121 -0
- anyscale/client/openapi_client/models/sessionevent_list_response.py +147 -0
- anyscale/client/openapi_client/models/sessionhistoryitem_list_response.py +147 -0
- anyscale/client/openapi_client/models/sessions_sort_field.py +104 -0
- anyscale/client/openapi_client/models/sessionsshkey_response.py +121 -0
- anyscale/client/openapi_client/models/setup_initialize_session_options.py +225 -0
- anyscale/client/openapi_client/models/show_otp_source_return_api_model.py +121 -0
- anyscale/client/openapi_client/models/showotpsourcereturnapimodel_response.py +121 -0
- anyscale/client/openapi_client/models/snapshot_create_message.py +148 -0
- anyscale/client/openapi_client/models/snapshot_delete_message.py +148 -0
- anyscale/client/openapi_client/models/snapshot_patch_message.py +148 -0
- anyscale/client/openapi_client/models/socket_message_schemas.py +499 -0
- anyscale/client/openapi_client/models/socket_message_types.py +113 -0
- anyscale/client/openapi_client/models/socketmessageschemas_response.py +121 -0
- anyscale/client/openapi_client/models/socketmessagetypes_response.py +121 -0
- anyscale/client/openapi_client/models/sort_order.py +100 -0
- anyscale/client/openapi_client/models/sso_login_info.py +151 -0
- anyscale/client/openapi_client/models/ssologininfo_response.py +121 -0
- anyscale/client/openapi_client/models/start_session_options.py +146 -0
- anyscale/client/openapi_client/models/stop_session_options.py +227 -0
- anyscale/client/openapi_client/models/stream_publish_request.py +239 -0
- anyscale/client/openapi_client/models/subnet_id_with_availability_zone_aws.py +148 -0
- anyscale/client/openapi_client/models/support_requests_query.py +178 -0
- anyscale/client/openapi_client/models/supportedbaseimagesenum.py +1570 -0
- anyscale/client/openapi_client/models/templatized_compute_configs.py +202 -0
- anyscale/client/openapi_client/models/templatized_decorated_application_templates.py +202 -0
- anyscale/client/openapi_client/models/templatizedcomputeconfigs_response.py +121 -0
- anyscale/client/openapi_client/models/templatizeddecoratedapplicationtemplates_response.py +121 -0
- anyscale/client/openapi_client/models/text_query.py +178 -0
- anyscale/client/openapi_client/models/timestamped_logs_output.py +148 -0
- anyscale/client/openapi_client/models/timestampedlogsoutput_response.py +121 -0
- anyscale/client/openapi_client/models/tool.py +100 -0
- anyscale/client/openapi_client/models/tracing_config.py +178 -0
- anyscale/client/openapi_client/models/try_login_email_response.py +208 -0
- anyscale/client/openapi_client/models/tryloginemailresponse_response.py +121 -0
- anyscale/client/openapi_client/models/unified_job_sort_field.py +103 -0
- anyscale/client/openapi_client/models/unified_job_status.py +114 -0
- anyscale/client/openapi_client/models/unified_job_type.py +100 -0
- anyscale/client/openapi_client/models/update_cloud_with_cloud_resource.py +178 -0
- anyscale/client/openapi_client/models/update_cloud_with_cloud_resource_gcp.py +178 -0
- anyscale/client/openapi_client/models/update_cluster_dns.py +152 -0
- anyscale/client/openapi_client/models/update_compute_template.py +146 -0
- anyscale/client/openapi_client/models/update_compute_template_config.py +464 -0
- anyscale/client/openapi_client/models/update_endpoint.py +152 -0
- anyscale/client/openapi_client/models/update_machine_pool_request.py +151 -0
- anyscale/client/openapi_client/models/update_model_deployment.py +152 -0
- anyscale/client/openapi_client/models/update_organization_collaborator.py +121 -0
- anyscale/client/openapi_client/models/update_project_collaborator.py +121 -0
- anyscale/client/openapi_client/models/update_resource_quota.py +122 -0
- anyscale/client/openapi_client/models/updatemachinepoolresponse_response.py +121 -0
- anyscale/client/openapi_client/models/upload_session_command_logs_locations.py +148 -0
- anyscale/client/openapi_client/models/uploadsessioncommandlogslocations_response.py +121 -0
- anyscale/client/openapi_client/models/user_info.py +569 -0
- anyscale/client/openapi_client/models/user_resend_email_options.py +147 -0
- anyscale/client/openapi_client/models/user_service_access_types.py +100 -0
- anyscale/client/openapi_client/models/userinfo_response.py +121 -0
- anyscale/client/openapi_client/models/utm_fields.py +224 -0
- anyscale/client/openapi_client/models/ux_instance.py +468 -0
- anyscale/client/openapi_client/models/validate_otp_params_api_model.py +121 -0
- anyscale/client/openapi_client/models/validation_error.py +175 -0
- anyscale/client/openapi_client/models/verify_response.py +147 -0
- anyscale/client/openapi_client/models/verifyresponse_response.py +121 -0
- anyscale/client/openapi_client/models/visibility.py +100 -0
- anyscale/client/openapi_client/models/waitlist_status_response.py +121 -0
- anyscale/client/openapi_client/models/waitlist_status_type.py +100 -0
- anyscale/client/openapi_client/models/waitliststatusresponse_response.py +121 -0
- anyscale/client/openapi_client/models/wand_b_run_details.py +147 -0
- anyscale/client/openapi_client/models/web_terminal.py +121 -0
- anyscale/client/openapi_client/models/webterminal_list_response.py +147 -0
- anyscale/client/openapi_client/models/webterminal_response.py +121 -0
- anyscale/client/openapi_client/models/worker_node_type.py +404 -0
- anyscale/client/openapi_client/models/workload_type.py +102 -0
- anyscale/client/openapi_client/models/workspace_dataplane_artifact.py +181 -0
- anyscale/client/openapi_client/models/workspace_dataplane_artifacts.py +123 -0
- anyscale/client/openapi_client/models/workspace_dataplane_proxied_artifacts.py +178 -0
- anyscale/client/openapi_client/models/workspace_event.py +325 -0
- anyscale/client/openapi_client/models/workspace_event_source.py +100 -0
- anyscale/client/openapi_client/models/workspace_event_source_filter.py +101 -0
- anyscale/client/openapi_client/models/workspace_readme.py +123 -0
- anyscale/client/openapi_client/models/workspace_snapshot_states.py +108 -0
- anyscale/client/openapi_client/models/workspace_template.py +353 -0
- anyscale/client/openapi_client/models/workspace_template_cluster_environment_metadata.py +178 -0
- anyscale/client/openapi_client/models/workspacedataplaneartifacts_response.py +121 -0
- anyscale/client/openapi_client/models/workspacedataplaneproxiedartifacts_response.py +121 -0
- anyscale/client/openapi_client/models/workspaceevent_list_response.py +147 -0
- anyscale/client/openapi_client/models/workspacereadme_response.py +121 -0
- anyscale/client/openapi_client/models/workspacetemplate_list_response.py +147 -0
- anyscale/client/openapi_client/models/workspacetemplateclusterenvironmentmetadata_response.py +121 -0
- anyscale/client/openapi_client/models/write_cloud.py +546 -0
- anyscale/client/openapi_client/models/write_cluster_config.py +123 -0
- anyscale/client/openapi_client/models/write_project.py +226 -0
- anyscale/client/openapi_client/models/write_session.py +147 -0
- anyscale/client/openapi_client/models/write_support_request.py +121 -0
- anyscale/client/openapi_client/rest.py +296 -0
- anyscale/client/requirements.txt +6 -0
- anyscale/client/setup.cfg +2 -0
- anyscale/client/setup.py +40 -0
- anyscale/client/test-requirements.txt +3 -0
- anyscale/client/tox.ini +9 -0
- anyscale/cloud.py +216 -0
- anyscale/cloud_resource.py +1032 -0
- anyscale/cluster.py +138 -0
- anyscale/cluster_compute.py +167 -0
- anyscale/cluster_env.py +173 -0
- anyscale/commands/__init__.py +0 -0
- anyscale/commands/aggregated_instance_usage_commands.py +86 -0
- anyscale/commands/anyscale_api/__init__.py +0 -0
- anyscale/commands/anyscale_api/api_commands.py +23 -0
- anyscale/commands/anyscale_api/session_commands_commands.py +80 -0
- anyscale/commands/anyscale_api/session_operations_commands.py +28 -0
- anyscale/commands/anyscale_api/sessions_commands.py +152 -0
- anyscale/commands/auth_commands.py +41 -0
- anyscale/commands/cloud_commands.py +1011 -0
- anyscale/commands/cloud_commands_util.py +10 -0
- anyscale/commands/cluster_commands.py +476 -0
- anyscale/commands/cluster_env_commands.py +139 -0
- anyscale/commands/command_examples.py +495 -0
- anyscale/commands/compute_config_commands.py +252 -0
- anyscale/commands/config_commands.py +213 -0
- anyscale/commands/exec_commands.py +14 -0
- anyscale/commands/experimental_integrations_commands.py +70 -0
- anyscale/commands/image_commands.py +125 -0
- anyscale/commands/job_commands.py +745 -0
- anyscale/commands/list_commands.py +85 -0
- anyscale/commands/llm/dataset_commands.py +269 -0
- anyscale/commands/llm/group.py +15 -0
- anyscale/commands/llm/models_commands.py +123 -0
- anyscale/commands/login_commands.py +79 -0
- anyscale/commands/logs_commands.py +312 -0
- anyscale/commands/machine_commands.py +116 -0
- anyscale/commands/machine_pool_commands.py +163 -0
- anyscale/commands/migrate_commands.py +84 -0
- anyscale/commands/project_commands.py +203 -0
- anyscale/commands/resource_quota_commands.py +214 -0
- anyscale/commands/schedule_commands.py +436 -0
- anyscale/commands/service_account_commands.py +72 -0
- anyscale/commands/service_commands.py +738 -0
- anyscale/commands/session_commands_hidden.py +179 -0
- anyscale/commands/util.py +152 -0
- anyscale/commands/workspace_commands.py +511 -0
- anyscale/commands/workspace_commands_v2.py +874 -0
- anyscale/component_activity_util.py +83 -0
- anyscale/compute_config/__init__.py +84 -0
- anyscale/compute_config/_private/compute_config_sdk.py +433 -0
- anyscale/compute_config/commands.py +122 -0
- anyscale/compute_config/models.py +630 -0
- anyscale/conf.py +23 -0
- anyscale/connect.py +1323 -0
- anyscale/connect_utils/__init__.py +0 -0
- anyscale/connect_utils/prepare_cluster.py +962 -0
- anyscale/connect_utils/project.py +298 -0
- anyscale/connect_utils/start_interactive_session.py +437 -0
- anyscale/controllers/__init__.py +0 -0
- anyscale/controllers/auth_controller.py +134 -0
- anyscale/controllers/base_controller.py +52 -0
- anyscale/controllers/cloud_controller.py +3609 -0
- anyscale/controllers/cloud_functional_verification_controller.py +858 -0
- anyscale/controllers/cluster_controller.py +720 -0
- anyscale/controllers/cluster_env_controller.py +219 -0
- anyscale/controllers/compute_config_controller.py +351 -0
- anyscale/controllers/config_controller.py +422 -0
- anyscale/controllers/experimental_integrations_controller.py +80 -0
- anyscale/controllers/job_controller.py +647 -0
- anyscale/controllers/jobs_bg_controller.py +0 -0
- anyscale/controllers/list_controller.py +290 -0
- anyscale/controllers/llm/__init__.py +0 -0
- anyscale/controllers/llm/models_controller.py +144 -0
- anyscale/controllers/logs_controller.py +449 -0
- anyscale/controllers/machine_controller.py +37 -0
- anyscale/controllers/machine_pool_controller.py +86 -0
- anyscale/controllers/project_controller.py +281 -0
- anyscale/controllers/resource_quota_controller.py +183 -0
- anyscale/controllers/schedule_controller.py +333 -0
- anyscale/controllers/service_account_controller.py +168 -0
- anyscale/controllers/service_controller.py +453 -0
- anyscale/controllers/workspace_controller.py +253 -0
- anyscale/feature_flags.py +4 -0
- anyscale/fingerprint.py +62 -0
- anyscale/formatters/__init__.py +0 -0
- anyscale/formatters/clouds_formatter.py +65 -0
- anyscale/formatters/common_formatter.py +22 -0
- anyscale/gcp_verification.py +792 -0
- anyscale/image/__init__.py +73 -0
- anyscale/image/_private/image_sdk.py +202 -0
- anyscale/image/commands.py +117 -0
- anyscale/image/models.py +57 -0
- anyscale/integrations.py +329 -0
- anyscale/job/__init__.py +166 -0
- anyscale/job/_private/job_sdk.py +497 -0
- anyscale/job/commands.py +267 -0
- anyscale/job/models.py +500 -0
- anyscale/links.py +4 -0
- anyscale/llm/__init__.py +2 -0
- anyscale/llm/dataset/__init__.py +2 -0
- anyscale/llm/dataset/_private/__init__.py +0 -0
- anyscale/llm/dataset/_private/docs.py +63 -0
- anyscale/llm/dataset/_private/models.py +71 -0
- anyscale/llm/dataset/_private/sdk.py +147 -0
- anyscale/llm/model/__init__.py +2 -0
- anyscale/llm/model/_private/models_sdk.py +62 -0
- anyscale/llm/model/commands.py +93 -0
- anyscale/llm/model/models.py +171 -0
- anyscale/llm/model/sdk.py +62 -0
- anyscale/llm/sdk.py +27 -0
- anyscale/memorydb_supported_zones.json +22 -0
- anyscale/models/job_model.py +457 -0
- anyscale/models/service_model.py +125 -0
- anyscale/project.py +501 -0
- anyscale/schedule/__init__.py +91 -0
- anyscale/schedule/_private/schedule_sdk.py +165 -0
- anyscale/schedule/commands.py +149 -0
- anyscale/schedule/models.py +145 -0
- anyscale/scripts.py +164 -0
- anyscale/sdk/anyscale_client/__init__.py +235 -0
- anyscale/sdk/anyscale_client/api/__init__.py +6 -0
- anyscale/sdk/anyscale_client/api/default_api.py +11625 -0
- anyscale/sdk/anyscale_client/api_client.py +647 -0
- anyscale/sdk/anyscale_client/configuration.py +373 -0
- anyscale/sdk/anyscale_client/exceptions.py +120 -0
- anyscale/sdk/anyscale_client/models/__init__.py +220 -0
- anyscale/sdk/anyscale_client/models/access_config.py +122 -0
- anyscale/sdk/anyscale_client/models/app_config.py +436 -0
- anyscale/sdk/anyscale_client/models/app_config_config_schema.py +235 -0
- anyscale/sdk/anyscale_client/models/appconfig_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/appconfig_response.py +121 -0
- anyscale/sdk/anyscale_client/models/apply_production_service_v2_model.py +490 -0
- anyscale/sdk/anyscale_client/models/apply_service_model.py +490 -0
- anyscale/sdk/anyscale_client/models/archive_status.py +101 -0
- anyscale/sdk/anyscale_client/models/base_job_status.py +105 -0
- anyscale/sdk/anyscale_client/models/baseimagesenum.py +2130 -0
- anyscale/sdk/anyscale_client/models/build.py +607 -0
- anyscale/sdk/anyscale_client/models/build_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/build_log_response.py +123 -0
- anyscale/sdk/anyscale_client/models/build_response.py +121 -0
- anyscale/sdk/anyscale_client/models/build_status.py +104 -0
- anyscale/sdk/anyscale_client/models/buildlogresponse_response.py +121 -0
- anyscale/sdk/anyscale_client/models/cloud.py +802 -0
- anyscale/sdk/anyscale_client/models/cloud_config.py +206 -0
- anyscale/sdk/anyscale_client/models/cloud_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/cloud_providers.py +103 -0
- anyscale/sdk/anyscale_client/models/cloud_response.py +121 -0
- anyscale/sdk/anyscale_client/models/cloud_state.py +104 -0
- anyscale/sdk/anyscale_client/models/cloud_status.py +100 -0
- anyscale/sdk/anyscale_client/models/cloud_type.py +100 -0
- anyscale/sdk/anyscale_client/models/cloud_types.py +100 -0
- anyscale/sdk/anyscale_client/models/cloud_version.py +100 -0
- anyscale/sdk/anyscale_client/models/clouds_query.py +150 -0
- anyscale/sdk/anyscale_client/models/cluster.py +721 -0
- anyscale/sdk/anyscale_client/models/cluster_compute.py +415 -0
- anyscale/sdk/anyscale_client/models/cluster_compute_config.py +461 -0
- anyscale/sdk/anyscale_client/models/cluster_computes_query.py +293 -0
- anyscale/sdk/anyscale_client/models/cluster_environment.py +380 -0
- anyscale/sdk/anyscale_client/models/cluster_environment_build.py +578 -0
- anyscale/sdk/anyscale_client/models/cluster_environment_build_log_response.py +123 -0
- anyscale/sdk/anyscale_client/models/cluster_environment_build_operation.py +237 -0
- anyscale/sdk/anyscale_client/models/cluster_environment_build_status.py +104 -0
- anyscale/sdk/anyscale_client/models/cluster_environments_query.py +290 -0
- anyscale/sdk/anyscale_client/models/cluster_head_node_info.py +152 -0
- anyscale/sdk/anyscale_client/models/cluster_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/cluster_management_stack_versions.py +100 -0
- anyscale/sdk/anyscale_client/models/cluster_operation.py +266 -0
- anyscale/sdk/anyscale_client/models/cluster_operation_type.py +101 -0
- anyscale/sdk/anyscale_client/models/cluster_response.py +121 -0
- anyscale/sdk/anyscale_client/models/cluster_services_urls.py +430 -0
- anyscale/sdk/anyscale_client/models/cluster_state.py +108 -0
- anyscale/sdk/anyscale_client/models/cluster_status.py +104 -0
- anyscale/sdk/anyscale_client/models/cluster_status_details.py +100 -0
- anyscale/sdk/anyscale_client/models/clustercompute_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/clustercompute_response.py +121 -0
- anyscale/sdk/anyscale_client/models/clusterenvironment_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/clusterenvironment_response.py +121 -0
- anyscale/sdk/anyscale_client/models/clusterenvironmentbuild_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/clusterenvironmentbuild_response.py +121 -0
- anyscale/sdk/anyscale_client/models/clusterenvironmentbuildlogresponse_response.py +121 -0
- anyscale/sdk/anyscale_client/models/clusterenvironmentbuildoperation_response.py +121 -0
- anyscale/sdk/anyscale_client/models/clusteroperation_response.py +121 -0
- anyscale/sdk/anyscale_client/models/clusters_query.py +234 -0
- anyscale/sdk/anyscale_client/models/compute_node_type.py +292 -0
- anyscale/sdk/anyscale_client/models/compute_stack.py +100 -0
- anyscale/sdk/anyscale_client/models/compute_template.py +415 -0
- anyscale/sdk/anyscale_client/models/compute_template_config.py +461 -0
- anyscale/sdk/anyscale_client/models/compute_template_query.py +316 -0
- anyscale/sdk/anyscale_client/models/computetemplate_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/computetemplate_response.py +121 -0
- anyscale/sdk/anyscale_client/models/computetemplateconfig_response.py +121 -0
- anyscale/sdk/anyscale_client/models/create_app_config.py +235 -0
- anyscale/sdk/anyscale_client/models/create_app_config_configuration_schema.py +235 -0
- anyscale/sdk/anyscale_client/models/create_build.py +263 -0
- anyscale/sdk/anyscale_client/models/create_byod_app_config_configuration_schema.py +206 -0
- anyscale/sdk/anyscale_client/models/create_byod_cluster_environment.py +180 -0
- anyscale/sdk/anyscale_client/models/create_byod_cluster_environment_build.py +152 -0
- anyscale/sdk/anyscale_client/models/create_byod_cluster_environment_configuration_schema.py +208 -0
- anyscale/sdk/anyscale_client/models/create_cloud.py +518 -0
- anyscale/sdk/anyscale_client/models/create_cluster.py +376 -0
- anyscale/sdk/anyscale_client/models/create_cluster_compute.py +229 -0
- anyscale/sdk/anyscale_client/models/create_cluster_compute_config.py +463 -0
- anyscale/sdk/anyscale_client/models/create_cluster_environment.py +235 -0
- anyscale/sdk/anyscale_client/models/create_cluster_environment_build.py +263 -0
- anyscale/sdk/anyscale_client/models/create_cluster_environment_configuration_schema.py +235 -0
- anyscale/sdk/anyscale_client/models/create_compute_template.py +229 -0
- anyscale/sdk/anyscale_client/models/create_compute_template_config.py +464 -0
- anyscale/sdk/anyscale_client/models/create_job_queue_config.py +206 -0
- anyscale/sdk/anyscale_client/models/create_production_job.py +234 -0
- anyscale/sdk/anyscale_client/models/create_production_job_config.py +347 -0
- anyscale/sdk/anyscale_client/models/create_project.py +207 -0
- anyscale/sdk/anyscale_client/models/create_schedule.py +263 -0
- anyscale/sdk/anyscale_client/models/create_session.py +432 -0
- anyscale/sdk/anyscale_client/models/create_session_command.py +152 -0
- anyscale/sdk/anyscale_client/models/create_sso_config.py +150 -0
- anyscale/sdk/anyscale_client/models/grpc_protocol_config.py +178 -0
- anyscale/sdk/anyscale_client/models/ha_job_goal_states.py +102 -0
- anyscale/sdk/anyscale_client/models/ha_job_states.py +109 -0
- anyscale/sdk/anyscale_client/models/http_protocol_config.py +150 -0
- anyscale/sdk/anyscale_client/models/http_validation_error.py +120 -0
- anyscale/sdk/anyscale_client/models/idle_termination_status.py +104 -0
- anyscale/sdk/anyscale_client/models/job.py +466 -0
- anyscale/sdk/anyscale_client/models/job_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/job_queue_config.py +122 -0
- anyscale/sdk/anyscale_client/models/job_queue_execution_mode.py +101 -0
- anyscale/sdk/anyscale_client/models/job_queue_spec.py +263 -0
- anyscale/sdk/anyscale_client/models/job_run_type.py +101 -0
- anyscale/sdk/anyscale_client/models/job_status.py +105 -0
- anyscale/sdk/anyscale_client/models/jobs_query.py +458 -0
- anyscale/sdk/anyscale_client/models/jobs_sort_field.py +104 -0
- anyscale/sdk/anyscale_client/models/list_response_metadata.py +146 -0
- anyscale/sdk/anyscale_client/models/list_service_model.py +347 -0
- anyscale/sdk/anyscale_client/models/listservicemodel_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/log_download_result.py +207 -0
- anyscale/sdk/anyscale_client/models/log_file_chunk.py +439 -0
- anyscale/sdk/anyscale_client/models/log_level_types.py +100 -0
- anyscale/sdk/anyscale_client/models/log_stream.py +151 -0
- anyscale/sdk/anyscale_client/models/logdownloadresult_response.py +121 -0
- anyscale/sdk/anyscale_client/models/logstream_response.py +121 -0
- anyscale/sdk/anyscale_client/models/node_type.py +100 -0
- anyscale/sdk/anyscale_client/models/object_storage_config.py +122 -0
- anyscale/sdk/anyscale_client/models/object_storage_config_s3.py +256 -0
- anyscale/sdk/anyscale_client/models/objectstorageconfig_response.py +121 -0
- anyscale/sdk/anyscale_client/models/operation_error.py +123 -0
- anyscale/sdk/anyscale_client/models/operation_progress.py +123 -0
- anyscale/sdk/anyscale_client/models/operation_result.py +150 -0
- anyscale/sdk/anyscale_client/models/organization.py +209 -0
- anyscale/sdk/anyscale_client/models/organization_response.py +121 -0
- anyscale/sdk/anyscale_client/models/page_query.py +153 -0
- anyscale/sdk/anyscale_client/models/pause_schedule.py +123 -0
- anyscale/sdk/anyscale_client/models/production_job.py +437 -0
- anyscale/sdk/anyscale_client/models/production_job_config.py +348 -0
- anyscale/sdk/anyscale_client/models/production_job_state_transition.py +293 -0
- anyscale/sdk/anyscale_client/models/production_service_v2_model.py +612 -0
- anyscale/sdk/anyscale_client/models/production_service_v2_version_model.py +437 -0
- anyscale/sdk/anyscale_client/models/productionjob_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/productionjob_response.py +121 -0
- anyscale/sdk/anyscale_client/models/productionservicev2_model_response.py +121 -0
- anyscale/sdk/anyscale_client/models/project.py +467 -0
- anyscale/sdk/anyscale_client/models/project_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/project_response.py +121 -0
- anyscale/sdk/anyscale_client/models/projects_query.py +234 -0
- anyscale/sdk/anyscale_client/models/protocols.py +150 -0
- anyscale/sdk/anyscale_client/models/python_modules.py +150 -0
- anyscale/sdk/anyscale_client/models/python_version.py +105 -0
- anyscale/sdk/anyscale_client/models/ray_gcs_external_storage_config.py +178 -0
- anyscale/sdk/anyscale_client/models/ray_runtime_env_config.py +262 -0
- anyscale/sdk/anyscale_client/models/resources.py +234 -0
- anyscale/sdk/anyscale_client/models/rollback_service_model.py +122 -0
- anyscale/sdk/anyscale_client/models/rollout_strategy.py +100 -0
- anyscale/sdk/anyscale_client/models/runtime_environment.py +406 -0
- anyscale/sdk/anyscale_client/models/runtimeenvironment_response.py +121 -0
- anyscale/sdk/anyscale_client/models/schedule_api_model.py +467 -0
- anyscale/sdk/anyscale_client/models/schedule_config.py +151 -0
- anyscale/sdk/anyscale_client/models/scheduleapimodel_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/scheduleapimodel_response.py +121 -0
- anyscale/sdk/anyscale_client/models/service_config.py +178 -0
- anyscale/sdk/anyscale_client/models/service_event_current_state.py +108 -0
- anyscale/sdk/anyscale_client/models/service_goal_states.py +100 -0
- anyscale/sdk/anyscale_client/models/service_model.py +612 -0
- anyscale/sdk/anyscale_client/models/service_observability_urls.py +206 -0
- anyscale/sdk/anyscale_client/models/service_sort_field.py +101 -0
- anyscale/sdk/anyscale_client/models/service_type.py +100 -0
- anyscale/sdk/anyscale_client/models/service_version_state.py +106 -0
- anyscale/sdk/anyscale_client/models/servicemodel_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/servicemodel_response.py +121 -0
- anyscale/sdk/anyscale_client/models/session.py +1535 -0
- anyscale/sdk/anyscale_client/models/session_command.py +350 -0
- anyscale/sdk/anyscale_client/models/session_command_types.py +100 -0
- anyscale/sdk/anyscale_client/models/session_event.py +267 -0
- anyscale/sdk/anyscale_client/models/session_event_cause.py +150 -0
- anyscale/sdk/anyscale_client/models/session_event_types.py +111 -0
- anyscale/sdk/anyscale_client/models/session_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/session_operation.py +266 -0
- anyscale/sdk/anyscale_client/models/session_operation_type.py +101 -0
- anyscale/sdk/anyscale_client/models/session_response.py +121 -0
- anyscale/sdk/anyscale_client/models/session_starting_up_data.py +146 -0
- anyscale/sdk/anyscale_client/models/session_state.py +111 -0
- anyscale/sdk/anyscale_client/models/session_state_data.py +146 -0
- anyscale/sdk/anyscale_client/models/session_stopping_data.py +146 -0
- anyscale/sdk/anyscale_client/models/sessioncommand_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/sessioncommand_response.py +121 -0
- anyscale/sdk/anyscale_client/models/sessionevent_list_response.py +147 -0
- anyscale/sdk/anyscale_client/models/sessionoperation_response.py +121 -0
- anyscale/sdk/anyscale_client/models/sessions_query.py +206 -0
- anyscale/sdk/anyscale_client/models/sort_by_clause_jobs_sort_field.py +148 -0
- anyscale/sdk/anyscale_client/models/sort_order.py +100 -0
- anyscale/sdk/anyscale_client/models/sso_config.py +237 -0
- anyscale/sdk/anyscale_client/models/sso_mode.py +101 -0
- anyscale/sdk/anyscale_client/models/ssoconfig_response.py +121 -0
- anyscale/sdk/anyscale_client/models/start_cluster_options.py +178 -0
- anyscale/sdk/anyscale_client/models/start_session_options.py +206 -0
- anyscale/sdk/anyscale_client/models/static_sso_config.py +210 -0
- anyscale/sdk/anyscale_client/models/supportedbaseimagesenum.py +1570 -0
- anyscale/sdk/anyscale_client/models/terminate_cluster_options.py +122 -0
- anyscale/sdk/anyscale_client/models/terminate_session_options.py +206 -0
- anyscale/sdk/anyscale_client/models/text_query.py +178 -0
- anyscale/sdk/anyscale_client/models/tracing_config.py +178 -0
- anyscale/sdk/anyscale_client/models/update_app_config.py +122 -0
- anyscale/sdk/anyscale_client/models/update_cloud.py +150 -0
- anyscale/sdk/anyscale_client/models/update_cluster.py +206 -0
- anyscale/sdk/anyscale_client/models/update_compute_template.py +146 -0
- anyscale/sdk/anyscale_client/models/update_compute_template_config.py +464 -0
- anyscale/sdk/anyscale_client/models/update_organization.py +123 -0
- anyscale/sdk/anyscale_client/models/update_project.py +150 -0
- anyscale/sdk/anyscale_client/models/update_session.py +150 -0
- anyscale/sdk/anyscale_client/models/user_service_access_types.py +100 -0
- anyscale/sdk/anyscale_client/models/ux_instance.py +468 -0
- anyscale/sdk/anyscale_client/models/validation_error.py +175 -0
- anyscale/sdk/anyscale_client/models/worker_node_type.py +404 -0
- anyscale/sdk/anyscale_client/rest.py +296 -0
- anyscale/sdk/anyscale_client/sdk.py +634 -0
- anyscale/service/__init__.py +168 -0
- anyscale/service/_private/service_sdk.py +702 -0
- anyscale/service/commands.py +261 -0
- anyscale/service/models.py +671 -0
- anyscale/shared_anyscale_utils/__init__.py +1 -0
- anyscale/shared_anyscale_utils/aws.py +153 -0
- anyscale/shared_anyscale_utils/bytes_util.py +10 -0
- anyscale/shared_anyscale_utils/conf.py +47 -0
- anyscale/shared_anyscale_utils/default_anyscale_aws.yaml +74 -0
- anyscale/shared_anyscale_utils/default_anyscale_gcp.yaml +80 -0
- anyscale/shared_anyscale_utils/headers.py +38 -0
- anyscale/shared_anyscale_utils/latest_ray_version.py +2 -0
- anyscale/shared_anyscale_utils/project.py +15 -0
- anyscale/shared_anyscale_utils/test_util.py +22 -0
- anyscale/shared_anyscale_utils/tests/__init__.py +1 -0
- anyscale/shared_anyscale_utils/tests/test_asyncio.py +41 -0
- anyscale/shared_anyscale_utils/tests/test_ray_semver.py +63 -0
- anyscale/shared_anyscale_utils/util.py +50 -0
- anyscale/shared_anyscale_utils/utils/__init__.py +2 -0
- anyscale/shared_anyscale_utils/utils/asyncio.py +120 -0
- anyscale/shared_anyscale_utils/utils/byod.py +40 -0
- anyscale/shared_anyscale_utils/utils/collections.py +33 -0
- anyscale/shared_anyscale_utils/utils/id_gen.py +147 -0
- anyscale/shared_anyscale_utils/utils/protected_string.py +89 -0
- anyscale/shared_anyscale_utils/utils/ray_semver.py +81 -0
- anyscale/snapshot.py +46 -0
- anyscale/tables.py +82 -0
- anyscale/util.py +1155 -0
- anyscale/utils/__init__.py +0 -0
- anyscale/utils/cli_version_check_util.py +63 -0
- anyscale/utils/cloud_update_utils.py +862 -0
- anyscale/utils/cloud_utils.py +317 -0
- anyscale/utils/cluster_debug.py +191 -0
- anyscale/utils/connect_helpers.py +155 -0
- anyscale/utils/deprecation_util.py +32 -0
- anyscale/utils/entity_arg_utils.py +43 -0
- anyscale/utils/env_utils.py +17 -0
- anyscale/utils/gcp_managed_setup_utils.py +888 -0
- anyscale/utils/gcp_utils.py +312 -0
- anyscale/utils/imports/__init__.py +0 -0
- anyscale/utils/imports/all.py +13 -0
- anyscale/utils/imports/azure.py +14 -0
- anyscale/utils/imports/gcp.py +59 -0
- anyscale/utils/logs_utils.py +141 -0
- anyscale/utils/name_utils.py +33 -0
- anyscale/utils/network_verification.py +153 -0
- anyscale/utils/ray_utils.py +128 -0
- anyscale/utils/ray_version_checker.py +48 -0
- anyscale/utils/ray_version_utils.py +53 -0
- anyscale/utils/runtime_env.py +487 -0
- anyscale/utils/s3.py +92 -0
- anyscale/utils/user_utils.py +17 -0
- anyscale/utils/workload_types.py +7 -0
- anyscale/utils/workspace_notification.py +39 -0
- anyscale/utils/workspace_utils.py +65 -0
- anyscale/version.py +1 -0
- anyscale/webterminal/__init__.py +0 -0
- anyscale/webterminal/bash-preexec.sh +370 -0
- anyscale/webterminal/command_persister.py +164 -0
- anyscale/webterminal/utils.py +176 -0
- anyscale/webterminal/webterminal.py +311 -0
- anyscale/workspace/__init__.py +270 -0
- anyscale/workspace/_private/workspace_sdk.py +737 -0
- anyscale/workspace/commands.py +472 -0
- anyscale/workspace/models.py +296 -0
- anyscale/workspace_utils.py +35 -0
- anyscale-0.24.86.dist-info/LICENSE +68 -0
- anyscale-0.24.86.dist-info/METADATA +82 -0
- anyscale-0.24.86.dist-info/NOTICE +6 -0
- anyscale-0.24.86.dist-info/RECORD +1131 -0
- anyscale-0.24.86.dist-info/WHEEL +5 -0
- anyscale-0.24.86.dist-info/entry_points.txt +2 -0
- anyscale-0.24.86.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1256 @@
|
|
|
1
|
+
import copy
|
|
2
|
+
import re
|
|
3
|
+
from collections import Counter as CollectionCounter, defaultdict, deque
|
|
4
|
+
from collections.abc import Callable, Hashable as CollectionsHashable, Iterable as CollectionsIterable
|
|
5
|
+
from typing import (
|
|
6
|
+
TYPE_CHECKING,
|
|
7
|
+
Any,
|
|
8
|
+
Counter,
|
|
9
|
+
DefaultDict,
|
|
10
|
+
Deque,
|
|
11
|
+
Dict,
|
|
12
|
+
ForwardRef,
|
|
13
|
+
FrozenSet,
|
|
14
|
+
Generator,
|
|
15
|
+
Iterable,
|
|
16
|
+
Iterator,
|
|
17
|
+
List,
|
|
18
|
+
Mapping,
|
|
19
|
+
Optional,
|
|
20
|
+
Pattern,
|
|
21
|
+
Sequence,
|
|
22
|
+
Set,
|
|
23
|
+
Tuple,
|
|
24
|
+
Type,
|
|
25
|
+
TypeVar,
|
|
26
|
+
Union,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
from typing_extensions import Annotated, Final
|
|
30
|
+
|
|
31
|
+
from . import errors as errors_
|
|
32
|
+
from .class_validators import Validator, make_generic_validator, prep_validators
|
|
33
|
+
from .error_wrappers import ErrorWrapper
|
|
34
|
+
from .errors import ConfigError, InvalidDiscriminator, MissingDiscriminator, NoneIsNotAllowedError
|
|
35
|
+
from .types import Json, JsonWrapper
|
|
36
|
+
from .typing import (
|
|
37
|
+
NoArgAnyCallable,
|
|
38
|
+
convert_generics,
|
|
39
|
+
display_as_type,
|
|
40
|
+
get_args,
|
|
41
|
+
get_origin,
|
|
42
|
+
is_finalvar,
|
|
43
|
+
is_literal_type,
|
|
44
|
+
is_new_type,
|
|
45
|
+
is_none_type,
|
|
46
|
+
is_typeddict,
|
|
47
|
+
is_typeddict_special,
|
|
48
|
+
is_union,
|
|
49
|
+
new_type_supertype,
|
|
50
|
+
)
|
|
51
|
+
from .utils import (
|
|
52
|
+
PyObjectStr,
|
|
53
|
+
Representation,
|
|
54
|
+
ValueItems,
|
|
55
|
+
get_discriminator_alias_and_values,
|
|
56
|
+
get_unique_discriminator_alias,
|
|
57
|
+
lenient_isinstance,
|
|
58
|
+
lenient_issubclass,
|
|
59
|
+
sequence_like,
|
|
60
|
+
smart_deepcopy,
|
|
61
|
+
)
|
|
62
|
+
from .validators import constant_validator, dict_validator, find_validators, validate_json
|
|
63
|
+
|
|
64
|
+
Required: Any = Ellipsis
|
|
65
|
+
|
|
66
|
+
T = TypeVar('T')
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class UndefinedType:
|
|
70
|
+
def __repr__(self) -> str:
|
|
71
|
+
return 'PydanticUndefined'
|
|
72
|
+
|
|
73
|
+
def __copy__(self: T) -> T:
|
|
74
|
+
return self
|
|
75
|
+
|
|
76
|
+
def __reduce__(self) -> str:
|
|
77
|
+
return 'Undefined'
|
|
78
|
+
|
|
79
|
+
def __deepcopy__(self: T, _: Any) -> T:
|
|
80
|
+
return self
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
Undefined = UndefinedType()
|
|
84
|
+
|
|
85
|
+
if TYPE_CHECKING:
|
|
86
|
+
from .class_validators import ValidatorsList
|
|
87
|
+
from .config import BaseConfig
|
|
88
|
+
from .error_wrappers import ErrorList
|
|
89
|
+
from .types import ModelOrDc
|
|
90
|
+
from .typing import AbstractSetIntStr, MappingIntStrAny, ReprArgs
|
|
91
|
+
|
|
92
|
+
ValidateReturn = Tuple[Optional[Any], Optional[ErrorList]]
|
|
93
|
+
LocStr = Union[Tuple[Union[int, str], ...], str]
|
|
94
|
+
BoolUndefined = Union[bool, UndefinedType]
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class FieldInfo(Representation):
|
|
98
|
+
"""
|
|
99
|
+
Captures extra information about a field.
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
__slots__ = (
|
|
103
|
+
'default',
|
|
104
|
+
'default_factory',
|
|
105
|
+
'alias',
|
|
106
|
+
'alias_priority',
|
|
107
|
+
'title',
|
|
108
|
+
'description',
|
|
109
|
+
'exclude',
|
|
110
|
+
'include',
|
|
111
|
+
'const',
|
|
112
|
+
'gt',
|
|
113
|
+
'ge',
|
|
114
|
+
'lt',
|
|
115
|
+
'le',
|
|
116
|
+
'multiple_of',
|
|
117
|
+
'allow_inf_nan',
|
|
118
|
+
'max_digits',
|
|
119
|
+
'decimal_places',
|
|
120
|
+
'min_items',
|
|
121
|
+
'max_items',
|
|
122
|
+
'unique_items',
|
|
123
|
+
'min_length',
|
|
124
|
+
'max_length',
|
|
125
|
+
'allow_mutation',
|
|
126
|
+
'repr',
|
|
127
|
+
'regex',
|
|
128
|
+
'discriminator',
|
|
129
|
+
'extra',
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
# field constraints with the default value, it's also used in update_from_config below
|
|
133
|
+
__field_constraints__ = {
|
|
134
|
+
'min_length': None,
|
|
135
|
+
'max_length': None,
|
|
136
|
+
'regex': None,
|
|
137
|
+
'gt': None,
|
|
138
|
+
'lt': None,
|
|
139
|
+
'ge': None,
|
|
140
|
+
'le': None,
|
|
141
|
+
'multiple_of': None,
|
|
142
|
+
'allow_inf_nan': None,
|
|
143
|
+
'max_digits': None,
|
|
144
|
+
'decimal_places': None,
|
|
145
|
+
'min_items': None,
|
|
146
|
+
'max_items': None,
|
|
147
|
+
'unique_items': None,
|
|
148
|
+
'allow_mutation': True,
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
def __init__(self, default: Any = Undefined, **kwargs: Any) -> None:
|
|
152
|
+
self.default = default
|
|
153
|
+
self.default_factory = kwargs.pop('default_factory', None)
|
|
154
|
+
self.alias = kwargs.pop('alias', None)
|
|
155
|
+
self.alias_priority = kwargs.pop('alias_priority', 2 if self.alias is not None else None)
|
|
156
|
+
self.title = kwargs.pop('title', None)
|
|
157
|
+
self.description = kwargs.pop('description', None)
|
|
158
|
+
self.exclude = kwargs.pop('exclude', None)
|
|
159
|
+
self.include = kwargs.pop('include', None)
|
|
160
|
+
self.const = kwargs.pop('const', None)
|
|
161
|
+
self.gt = kwargs.pop('gt', None)
|
|
162
|
+
self.ge = kwargs.pop('ge', None)
|
|
163
|
+
self.lt = kwargs.pop('lt', None)
|
|
164
|
+
self.le = kwargs.pop('le', None)
|
|
165
|
+
self.multiple_of = kwargs.pop('multiple_of', None)
|
|
166
|
+
self.allow_inf_nan = kwargs.pop('allow_inf_nan', None)
|
|
167
|
+
self.max_digits = kwargs.pop('max_digits', None)
|
|
168
|
+
self.decimal_places = kwargs.pop('decimal_places', None)
|
|
169
|
+
self.min_items = kwargs.pop('min_items', None)
|
|
170
|
+
self.max_items = kwargs.pop('max_items', None)
|
|
171
|
+
self.unique_items = kwargs.pop('unique_items', None)
|
|
172
|
+
self.min_length = kwargs.pop('min_length', None)
|
|
173
|
+
self.max_length = kwargs.pop('max_length', None)
|
|
174
|
+
self.allow_mutation = kwargs.pop('allow_mutation', True)
|
|
175
|
+
self.regex = kwargs.pop('regex', None)
|
|
176
|
+
self.discriminator = kwargs.pop('discriminator', None)
|
|
177
|
+
self.repr = kwargs.pop('repr', True)
|
|
178
|
+
self.extra = kwargs
|
|
179
|
+
|
|
180
|
+
def __repr_args__(self) -> 'ReprArgs':
|
|
181
|
+
|
|
182
|
+
field_defaults_to_hide: Dict[str, Any] = {
|
|
183
|
+
'repr': True,
|
|
184
|
+
**self.__field_constraints__,
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
attrs = ((s, getattr(self, s)) for s in self.__slots__)
|
|
188
|
+
return [(a, v) for a, v in attrs if v != field_defaults_to_hide.get(a, None)]
|
|
189
|
+
|
|
190
|
+
def get_constraints(self) -> Set[str]:
|
|
191
|
+
"""
|
|
192
|
+
Gets the constraints set on the field by comparing the constraint value with its default value
|
|
193
|
+
|
|
194
|
+
:return: the constraints set on field_info
|
|
195
|
+
"""
|
|
196
|
+
return {attr for attr, default in self.__field_constraints__.items() if getattr(self, attr) != default}
|
|
197
|
+
|
|
198
|
+
def update_from_config(self, from_config: Dict[str, Any]) -> None:
|
|
199
|
+
"""
|
|
200
|
+
Update this FieldInfo based on a dict from get_field_info, only fields which have not been set are dated.
|
|
201
|
+
"""
|
|
202
|
+
for attr_name, value in from_config.items():
|
|
203
|
+
try:
|
|
204
|
+
current_value = getattr(self, attr_name)
|
|
205
|
+
except AttributeError:
|
|
206
|
+
# attr_name is not an attribute of FieldInfo, it should therefore be added to extra
|
|
207
|
+
# (except if extra already has this value!)
|
|
208
|
+
self.extra.setdefault(attr_name, value)
|
|
209
|
+
else:
|
|
210
|
+
if current_value is self.__field_constraints__.get(attr_name, None):
|
|
211
|
+
setattr(self, attr_name, value)
|
|
212
|
+
elif attr_name == 'exclude':
|
|
213
|
+
self.exclude = ValueItems.merge(value, current_value)
|
|
214
|
+
elif attr_name == 'include':
|
|
215
|
+
self.include = ValueItems.merge(value, current_value, intersect=True)
|
|
216
|
+
|
|
217
|
+
def _validate(self) -> None:
|
|
218
|
+
if self.default is not Undefined and self.default_factory is not None:
|
|
219
|
+
raise ValueError('cannot specify both default and default_factory')
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def Field(
|
|
223
|
+
default: Any = Undefined,
|
|
224
|
+
*,
|
|
225
|
+
default_factory: Optional[NoArgAnyCallable] = None,
|
|
226
|
+
alias: Optional[str] = None,
|
|
227
|
+
title: Optional[str] = None,
|
|
228
|
+
description: Optional[str] = None,
|
|
229
|
+
exclude: Optional[Union['AbstractSetIntStr', 'MappingIntStrAny', Any]] = None,
|
|
230
|
+
include: Optional[Union['AbstractSetIntStr', 'MappingIntStrAny', Any]] = None,
|
|
231
|
+
const: Optional[bool] = None,
|
|
232
|
+
gt: Optional[float] = None,
|
|
233
|
+
ge: Optional[float] = None,
|
|
234
|
+
lt: Optional[float] = None,
|
|
235
|
+
le: Optional[float] = None,
|
|
236
|
+
multiple_of: Optional[float] = None,
|
|
237
|
+
allow_inf_nan: Optional[bool] = None,
|
|
238
|
+
max_digits: Optional[int] = None,
|
|
239
|
+
decimal_places: Optional[int] = None,
|
|
240
|
+
min_items: Optional[int] = None,
|
|
241
|
+
max_items: Optional[int] = None,
|
|
242
|
+
unique_items: Optional[bool] = None,
|
|
243
|
+
min_length: Optional[int] = None,
|
|
244
|
+
max_length: Optional[int] = None,
|
|
245
|
+
allow_mutation: bool = True,
|
|
246
|
+
regex: Optional[str] = None,
|
|
247
|
+
discriminator: Optional[str] = None,
|
|
248
|
+
repr: bool = True,
|
|
249
|
+
**extra: Any,
|
|
250
|
+
) -> Any:
|
|
251
|
+
"""
|
|
252
|
+
Used to provide extra information about a field, either for the model schema or complex validation. Some arguments
|
|
253
|
+
apply only to number fields (``int``, ``float``, ``Decimal``) and some apply only to ``str``.
|
|
254
|
+
|
|
255
|
+
:param default: since this is replacing the field’s default, its first argument is used
|
|
256
|
+
to set the default, use ellipsis (``...``) to indicate the field is required
|
|
257
|
+
:param default_factory: callable that will be called when a default value is needed for this field
|
|
258
|
+
If both `default` and `default_factory` are set, an error is raised.
|
|
259
|
+
:param alias: the public name of the field
|
|
260
|
+
:param title: can be any string, used in the schema
|
|
261
|
+
:param description: can be any string, used in the schema
|
|
262
|
+
:param exclude: exclude this field while dumping.
|
|
263
|
+
Takes same values as the ``include`` and ``exclude`` arguments on the ``.dict`` method.
|
|
264
|
+
:param include: include this field while dumping.
|
|
265
|
+
Takes same values as the ``include`` and ``exclude`` arguments on the ``.dict`` method.
|
|
266
|
+
:param const: this field is required and *must* take it's default value
|
|
267
|
+
:param gt: only applies to numbers, requires the field to be "greater than". The schema
|
|
268
|
+
will have an ``exclusiveMinimum`` validation keyword
|
|
269
|
+
:param ge: only applies to numbers, requires the field to be "greater than or equal to". The
|
|
270
|
+
schema will have a ``minimum`` validation keyword
|
|
271
|
+
:param lt: only applies to numbers, requires the field to be "less than". The schema
|
|
272
|
+
will have an ``exclusiveMaximum`` validation keyword
|
|
273
|
+
:param le: only applies to numbers, requires the field to be "less than or equal to". The
|
|
274
|
+
schema will have a ``maximum`` validation keyword
|
|
275
|
+
:param multiple_of: only applies to numbers, requires the field to be "a multiple of". The
|
|
276
|
+
schema will have a ``multipleOf`` validation keyword
|
|
277
|
+
:param allow_inf_nan: only applies to numbers, allows the field to be NaN or infinity (+inf or -inf),
|
|
278
|
+
which is a valid Python float. Default True, set to False for compatibility with JSON.
|
|
279
|
+
:param max_digits: only applies to Decimals, requires the field to have a maximum number
|
|
280
|
+
of digits within the decimal. It does not include a zero before the decimal point or trailing decimal zeroes.
|
|
281
|
+
:param decimal_places: only applies to Decimals, requires the field to have at most a number of decimal places
|
|
282
|
+
allowed. It does not include trailing decimal zeroes.
|
|
283
|
+
:param min_items: only applies to lists, requires the field to have a minimum number of
|
|
284
|
+
elements. The schema will have a ``minItems`` validation keyword
|
|
285
|
+
:param max_items: only applies to lists, requires the field to have a maximum number of
|
|
286
|
+
elements. The schema will have a ``maxItems`` validation keyword
|
|
287
|
+
:param unique_items: only applies to lists, requires the field not to have duplicated
|
|
288
|
+
elements. The schema will have a ``uniqueItems`` validation keyword
|
|
289
|
+
:param min_length: only applies to strings, requires the field to have a minimum length. The
|
|
290
|
+
schema will have a ``minLength`` validation keyword
|
|
291
|
+
:param max_length: only applies to strings, requires the field to have a maximum length. The
|
|
292
|
+
schema will have a ``maxLength`` validation keyword
|
|
293
|
+
:param allow_mutation: a boolean which defaults to True. When False, the field raises a TypeError if the field is
|
|
294
|
+
assigned on an instance. The BaseModel Config must set validate_assignment to True
|
|
295
|
+
:param regex: only applies to strings, requires the field match against a regular expression
|
|
296
|
+
pattern string. The schema will have a ``pattern`` validation keyword
|
|
297
|
+
:param discriminator: only useful with a (discriminated a.k.a. tagged) `Union` of sub models with a common field.
|
|
298
|
+
The `discriminator` is the name of this common field to shorten validation and improve generated schema
|
|
299
|
+
:param repr: show this field in the representation
|
|
300
|
+
:param **extra: any additional keyword arguments will be added as is to the schema
|
|
301
|
+
"""
|
|
302
|
+
field_info = FieldInfo(
|
|
303
|
+
default,
|
|
304
|
+
default_factory=default_factory,
|
|
305
|
+
alias=alias,
|
|
306
|
+
title=title,
|
|
307
|
+
description=description,
|
|
308
|
+
exclude=exclude,
|
|
309
|
+
include=include,
|
|
310
|
+
const=const,
|
|
311
|
+
gt=gt,
|
|
312
|
+
ge=ge,
|
|
313
|
+
lt=lt,
|
|
314
|
+
le=le,
|
|
315
|
+
multiple_of=multiple_of,
|
|
316
|
+
allow_inf_nan=allow_inf_nan,
|
|
317
|
+
max_digits=max_digits,
|
|
318
|
+
decimal_places=decimal_places,
|
|
319
|
+
min_items=min_items,
|
|
320
|
+
max_items=max_items,
|
|
321
|
+
unique_items=unique_items,
|
|
322
|
+
min_length=min_length,
|
|
323
|
+
max_length=max_length,
|
|
324
|
+
allow_mutation=allow_mutation,
|
|
325
|
+
regex=regex,
|
|
326
|
+
discriminator=discriminator,
|
|
327
|
+
repr=repr,
|
|
328
|
+
**extra,
|
|
329
|
+
)
|
|
330
|
+
field_info._validate()
|
|
331
|
+
return field_info
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
# used to be an enum but changed to int's for small performance improvement as less access overhead
|
|
335
|
+
SHAPE_SINGLETON = 1
|
|
336
|
+
SHAPE_LIST = 2
|
|
337
|
+
SHAPE_SET = 3
|
|
338
|
+
SHAPE_MAPPING = 4
|
|
339
|
+
SHAPE_TUPLE = 5
|
|
340
|
+
SHAPE_TUPLE_ELLIPSIS = 6
|
|
341
|
+
SHAPE_SEQUENCE = 7
|
|
342
|
+
SHAPE_FROZENSET = 8
|
|
343
|
+
SHAPE_ITERABLE = 9
|
|
344
|
+
SHAPE_GENERIC = 10
|
|
345
|
+
SHAPE_DEQUE = 11
|
|
346
|
+
SHAPE_DICT = 12
|
|
347
|
+
SHAPE_DEFAULTDICT = 13
|
|
348
|
+
SHAPE_COUNTER = 14
|
|
349
|
+
SHAPE_NAME_LOOKUP = {
|
|
350
|
+
SHAPE_LIST: 'List[{}]',
|
|
351
|
+
SHAPE_SET: 'Set[{}]',
|
|
352
|
+
SHAPE_TUPLE_ELLIPSIS: 'Tuple[{}, ...]',
|
|
353
|
+
SHAPE_SEQUENCE: 'Sequence[{}]',
|
|
354
|
+
SHAPE_FROZENSET: 'FrozenSet[{}]',
|
|
355
|
+
SHAPE_ITERABLE: 'Iterable[{}]',
|
|
356
|
+
SHAPE_DEQUE: 'Deque[{}]',
|
|
357
|
+
SHAPE_DICT: 'Dict[{}]',
|
|
358
|
+
SHAPE_DEFAULTDICT: 'DefaultDict[{}]',
|
|
359
|
+
SHAPE_COUNTER: 'Counter[{}]',
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
MAPPING_LIKE_SHAPES: Set[int] = {SHAPE_DEFAULTDICT, SHAPE_DICT, SHAPE_MAPPING, SHAPE_COUNTER}
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
class ModelField(Representation):
|
|
366
|
+
__slots__ = (
|
|
367
|
+
'type_',
|
|
368
|
+
'outer_type_',
|
|
369
|
+
'annotation',
|
|
370
|
+
'sub_fields',
|
|
371
|
+
'sub_fields_mapping',
|
|
372
|
+
'key_field',
|
|
373
|
+
'validators',
|
|
374
|
+
'pre_validators',
|
|
375
|
+
'post_validators',
|
|
376
|
+
'default',
|
|
377
|
+
'default_factory',
|
|
378
|
+
'required',
|
|
379
|
+
'final',
|
|
380
|
+
'model_config',
|
|
381
|
+
'name',
|
|
382
|
+
'alias',
|
|
383
|
+
'has_alias',
|
|
384
|
+
'field_info',
|
|
385
|
+
'discriminator_key',
|
|
386
|
+
'discriminator_alias',
|
|
387
|
+
'validate_always',
|
|
388
|
+
'allow_none',
|
|
389
|
+
'shape',
|
|
390
|
+
'class_validators',
|
|
391
|
+
'parse_json',
|
|
392
|
+
)
|
|
393
|
+
|
|
394
|
+
def __init__(
|
|
395
|
+
self,
|
|
396
|
+
*,
|
|
397
|
+
name: str,
|
|
398
|
+
type_: Type[Any],
|
|
399
|
+
class_validators: Optional[Dict[str, Validator]],
|
|
400
|
+
model_config: Type['BaseConfig'],
|
|
401
|
+
default: Any = None,
|
|
402
|
+
default_factory: Optional[NoArgAnyCallable] = None,
|
|
403
|
+
required: 'BoolUndefined' = Undefined,
|
|
404
|
+
final: bool = False,
|
|
405
|
+
alias: Optional[str] = None,
|
|
406
|
+
field_info: Optional[FieldInfo] = None,
|
|
407
|
+
) -> None:
|
|
408
|
+
|
|
409
|
+
self.name: str = name
|
|
410
|
+
self.has_alias: bool = alias is not None
|
|
411
|
+
self.alias: str = alias if alias is not None else name
|
|
412
|
+
self.annotation = type_
|
|
413
|
+
self.type_: Any = convert_generics(type_)
|
|
414
|
+
self.outer_type_: Any = type_
|
|
415
|
+
self.class_validators = class_validators or {}
|
|
416
|
+
self.default: Any = default
|
|
417
|
+
self.default_factory: Optional[NoArgAnyCallable] = default_factory
|
|
418
|
+
self.required: 'BoolUndefined' = required
|
|
419
|
+
self.final: bool = final
|
|
420
|
+
self.model_config = model_config
|
|
421
|
+
self.field_info: FieldInfo = field_info or FieldInfo(default)
|
|
422
|
+
self.discriminator_key: Optional[str] = self.field_info.discriminator
|
|
423
|
+
self.discriminator_alias: Optional[str] = self.discriminator_key
|
|
424
|
+
|
|
425
|
+
self.allow_none: bool = False
|
|
426
|
+
self.validate_always: bool = False
|
|
427
|
+
self.sub_fields: Optional[List[ModelField]] = None
|
|
428
|
+
self.sub_fields_mapping: Optional[Dict[str, 'ModelField']] = None # used for discriminated union
|
|
429
|
+
self.key_field: Optional[ModelField] = None
|
|
430
|
+
self.validators: 'ValidatorsList' = []
|
|
431
|
+
self.pre_validators: Optional['ValidatorsList'] = None
|
|
432
|
+
self.post_validators: Optional['ValidatorsList'] = None
|
|
433
|
+
self.parse_json: bool = False
|
|
434
|
+
self.shape: int = SHAPE_SINGLETON
|
|
435
|
+
self.model_config.prepare_field(self)
|
|
436
|
+
self.prepare()
|
|
437
|
+
|
|
438
|
+
def get_default(self) -> Any:
|
|
439
|
+
return smart_deepcopy(self.default) if self.default_factory is None else self.default_factory()
|
|
440
|
+
|
|
441
|
+
@staticmethod
|
|
442
|
+
def _get_field_info(
|
|
443
|
+
field_name: str, annotation: Any, value: Any, config: Type['BaseConfig']
|
|
444
|
+
) -> Tuple[FieldInfo, Any]:
|
|
445
|
+
"""
|
|
446
|
+
Get a FieldInfo from a root typing.Annotated annotation, value, or config default.
|
|
447
|
+
|
|
448
|
+
The FieldInfo may be set in typing.Annotated or the value, but not both. If neither contain
|
|
449
|
+
a FieldInfo, a new one will be created using the config.
|
|
450
|
+
|
|
451
|
+
:param field_name: name of the field for use in error messages
|
|
452
|
+
:param annotation: a type hint such as `str` or `Annotated[str, Field(..., min_length=5)]`
|
|
453
|
+
:param value: the field's assigned value
|
|
454
|
+
:param config: the model's config object
|
|
455
|
+
:return: the FieldInfo contained in the `annotation`, the value, or a new one from the config.
|
|
456
|
+
"""
|
|
457
|
+
field_info_from_config = config.get_field_info(field_name)
|
|
458
|
+
|
|
459
|
+
field_info = None
|
|
460
|
+
if get_origin(annotation) is Annotated:
|
|
461
|
+
field_infos = [arg for arg in get_args(annotation)[1:] if isinstance(arg, FieldInfo)]
|
|
462
|
+
if len(field_infos) > 1:
|
|
463
|
+
raise ValueError(f'cannot specify multiple `Annotated` `Field`s for {field_name!r}')
|
|
464
|
+
field_info = next(iter(field_infos), None)
|
|
465
|
+
if field_info is not None:
|
|
466
|
+
field_info = copy.copy(field_info)
|
|
467
|
+
field_info.update_from_config(field_info_from_config)
|
|
468
|
+
if field_info.default not in (Undefined, Required):
|
|
469
|
+
raise ValueError(f'`Field` default cannot be set in `Annotated` for {field_name!r}')
|
|
470
|
+
if value is not Undefined and value is not Required:
|
|
471
|
+
# check also `Required` because of `validate_arguments` that sets `...` as default value
|
|
472
|
+
field_info.default = value
|
|
473
|
+
|
|
474
|
+
if isinstance(value, FieldInfo):
|
|
475
|
+
if field_info is not None:
|
|
476
|
+
raise ValueError(f'cannot specify `Annotated` and value `Field`s together for {field_name!r}')
|
|
477
|
+
field_info = value
|
|
478
|
+
field_info.update_from_config(field_info_from_config)
|
|
479
|
+
elif field_info is None:
|
|
480
|
+
field_info = FieldInfo(value, **field_info_from_config)
|
|
481
|
+
value = None if field_info.default_factory is not None else field_info.default
|
|
482
|
+
field_info._validate()
|
|
483
|
+
return field_info, value
|
|
484
|
+
|
|
485
|
+
@classmethod
|
|
486
|
+
def infer(
|
|
487
|
+
cls,
|
|
488
|
+
*,
|
|
489
|
+
name: str,
|
|
490
|
+
value: Any,
|
|
491
|
+
annotation: Any,
|
|
492
|
+
class_validators: Optional[Dict[str, Validator]],
|
|
493
|
+
config: Type['BaseConfig'],
|
|
494
|
+
) -> 'ModelField':
|
|
495
|
+
from .schema import get_annotation_from_field_info
|
|
496
|
+
|
|
497
|
+
field_info, value = cls._get_field_info(name, annotation, value, config)
|
|
498
|
+
required: 'BoolUndefined' = Undefined
|
|
499
|
+
if value is Required:
|
|
500
|
+
required = True
|
|
501
|
+
value = None
|
|
502
|
+
elif value is not Undefined:
|
|
503
|
+
required = False
|
|
504
|
+
annotation = get_annotation_from_field_info(annotation, field_info, name, config.validate_assignment)
|
|
505
|
+
|
|
506
|
+
return cls(
|
|
507
|
+
name=name,
|
|
508
|
+
type_=annotation,
|
|
509
|
+
alias=field_info.alias,
|
|
510
|
+
class_validators=class_validators,
|
|
511
|
+
default=value,
|
|
512
|
+
default_factory=field_info.default_factory,
|
|
513
|
+
required=required,
|
|
514
|
+
model_config=config,
|
|
515
|
+
field_info=field_info,
|
|
516
|
+
)
|
|
517
|
+
|
|
518
|
+
def set_config(self, config: Type['BaseConfig']) -> None:
|
|
519
|
+
self.model_config = config
|
|
520
|
+
info_from_config = config.get_field_info(self.name)
|
|
521
|
+
config.prepare_field(self)
|
|
522
|
+
new_alias = info_from_config.get('alias')
|
|
523
|
+
new_alias_priority = info_from_config.get('alias_priority') or 0
|
|
524
|
+
if new_alias and new_alias_priority >= (self.field_info.alias_priority or 0):
|
|
525
|
+
self.field_info.alias = new_alias
|
|
526
|
+
self.field_info.alias_priority = new_alias_priority
|
|
527
|
+
self.alias = new_alias
|
|
528
|
+
new_exclude = info_from_config.get('exclude')
|
|
529
|
+
if new_exclude is not None:
|
|
530
|
+
self.field_info.exclude = ValueItems.merge(self.field_info.exclude, new_exclude)
|
|
531
|
+
new_include = info_from_config.get('include')
|
|
532
|
+
if new_include is not None:
|
|
533
|
+
self.field_info.include = ValueItems.merge(self.field_info.include, new_include, intersect=True)
|
|
534
|
+
|
|
535
|
+
@property
|
|
536
|
+
def alt_alias(self) -> bool:
|
|
537
|
+
return self.name != self.alias
|
|
538
|
+
|
|
539
|
+
def prepare(self) -> None:
|
|
540
|
+
"""
|
|
541
|
+
Prepare the field but inspecting self.default, self.type_ etc.
|
|
542
|
+
|
|
543
|
+
Note: this method is **not** idempotent (because _type_analysis is not idempotent),
|
|
544
|
+
e.g. calling it it multiple times may modify the field and configure it incorrectly.
|
|
545
|
+
"""
|
|
546
|
+
self._set_default_and_type()
|
|
547
|
+
if self.type_.__class__ is ForwardRef or self.type_.__class__ is DeferredType:
|
|
548
|
+
# self.type_ is currently a ForwardRef and there's nothing we can do now,
|
|
549
|
+
# user will need to call model.update_forward_refs()
|
|
550
|
+
return
|
|
551
|
+
|
|
552
|
+
self._type_analysis()
|
|
553
|
+
if self.required is Undefined:
|
|
554
|
+
self.required = True
|
|
555
|
+
if self.default is Undefined and self.default_factory is None:
|
|
556
|
+
self.default = None
|
|
557
|
+
self.populate_validators()
|
|
558
|
+
|
|
559
|
+
def _set_default_and_type(self) -> None:
|
|
560
|
+
"""
|
|
561
|
+
Set the default value, infer the type if needed and check if `None` value is valid.
|
|
562
|
+
"""
|
|
563
|
+
if self.default_factory is not None:
|
|
564
|
+
if self.type_ is Undefined:
|
|
565
|
+
raise errors_.ConfigError(
|
|
566
|
+
f'you need to set the type of field {self.name!r} when using `default_factory`'
|
|
567
|
+
)
|
|
568
|
+
return
|
|
569
|
+
|
|
570
|
+
default_value = self.get_default()
|
|
571
|
+
|
|
572
|
+
if default_value is not None and self.type_ is Undefined:
|
|
573
|
+
self.type_ = default_value.__class__
|
|
574
|
+
self.outer_type_ = self.type_
|
|
575
|
+
self.annotation = self.type_
|
|
576
|
+
|
|
577
|
+
if self.type_ is Undefined:
|
|
578
|
+
raise errors_.ConfigError(f'unable to infer type for attribute "{self.name}"')
|
|
579
|
+
|
|
580
|
+
if self.required is False and default_value is None:
|
|
581
|
+
self.allow_none = True
|
|
582
|
+
|
|
583
|
+
def _type_analysis(self) -> None: # noqa: C901 (ignore complexity)
|
|
584
|
+
# typing interface is horrible, we have to do some ugly checks
|
|
585
|
+
if lenient_issubclass(self.type_, JsonWrapper):
|
|
586
|
+
self.type_ = self.type_.inner_type
|
|
587
|
+
self.parse_json = True
|
|
588
|
+
elif lenient_issubclass(self.type_, Json):
|
|
589
|
+
self.type_ = Any
|
|
590
|
+
self.parse_json = True
|
|
591
|
+
elif isinstance(self.type_, TypeVar):
|
|
592
|
+
if self.type_.__bound__:
|
|
593
|
+
self.type_ = self.type_.__bound__
|
|
594
|
+
elif self.type_.__constraints__:
|
|
595
|
+
self.type_ = Union[self.type_.__constraints__]
|
|
596
|
+
else:
|
|
597
|
+
self.type_ = Any
|
|
598
|
+
elif is_new_type(self.type_):
|
|
599
|
+
self.type_ = new_type_supertype(self.type_)
|
|
600
|
+
|
|
601
|
+
if self.type_ is Any or self.type_ is object:
|
|
602
|
+
if self.required is Undefined:
|
|
603
|
+
self.required = False
|
|
604
|
+
self.allow_none = True
|
|
605
|
+
return
|
|
606
|
+
elif self.type_ is Pattern or self.type_ is re.Pattern:
|
|
607
|
+
# python 3.7 only, Pattern is a typing object but without sub fields
|
|
608
|
+
return
|
|
609
|
+
elif is_literal_type(self.type_):
|
|
610
|
+
return
|
|
611
|
+
elif is_typeddict(self.type_):
|
|
612
|
+
return
|
|
613
|
+
|
|
614
|
+
if is_finalvar(self.type_):
|
|
615
|
+
self.final = True
|
|
616
|
+
|
|
617
|
+
if self.type_ is Final:
|
|
618
|
+
self.type_ = Any
|
|
619
|
+
else:
|
|
620
|
+
self.type_ = get_args(self.type_)[0]
|
|
621
|
+
|
|
622
|
+
self._type_analysis()
|
|
623
|
+
return
|
|
624
|
+
|
|
625
|
+
origin = get_origin(self.type_)
|
|
626
|
+
|
|
627
|
+
if origin is Annotated or is_typeddict_special(origin):
|
|
628
|
+
self.type_ = get_args(self.type_)[0]
|
|
629
|
+
self._type_analysis()
|
|
630
|
+
return
|
|
631
|
+
|
|
632
|
+
if self.discriminator_key is not None and not is_union(origin):
|
|
633
|
+
raise TypeError('`discriminator` can only be used with `Union` type with more than one variant')
|
|
634
|
+
|
|
635
|
+
# add extra check for `collections.abc.Hashable` for python 3.10+ where origin is not `None`
|
|
636
|
+
if origin is None or origin is CollectionsHashable:
|
|
637
|
+
# field is not "typing" object eg. Union, Dict, List etc.
|
|
638
|
+
# allow None for virtual superclasses of NoneType, e.g. Hashable
|
|
639
|
+
if isinstance(self.type_, type) and isinstance(None, self.type_):
|
|
640
|
+
self.allow_none = True
|
|
641
|
+
return
|
|
642
|
+
elif origin is Callable:
|
|
643
|
+
return
|
|
644
|
+
elif is_union(origin):
|
|
645
|
+
types_ = []
|
|
646
|
+
for type_ in get_args(self.type_):
|
|
647
|
+
if is_none_type(type_) or type_ is Any or type_ is object:
|
|
648
|
+
if self.required is Undefined:
|
|
649
|
+
self.required = False
|
|
650
|
+
self.allow_none = True
|
|
651
|
+
if is_none_type(type_):
|
|
652
|
+
continue
|
|
653
|
+
types_.append(type_)
|
|
654
|
+
|
|
655
|
+
if len(types_) == 1:
|
|
656
|
+
# Optional[]
|
|
657
|
+
self.type_ = types_[0]
|
|
658
|
+
# this is the one case where the "outer type" isn't just the original type
|
|
659
|
+
self.outer_type_ = self.type_
|
|
660
|
+
# re-run to correctly interpret the new self.type_
|
|
661
|
+
self._type_analysis()
|
|
662
|
+
else:
|
|
663
|
+
self.sub_fields = [self._create_sub_type(t, f'{self.name}_{display_as_type(t)}') for t in types_]
|
|
664
|
+
|
|
665
|
+
if self.discriminator_key is not None:
|
|
666
|
+
self.prepare_discriminated_union_sub_fields()
|
|
667
|
+
return
|
|
668
|
+
elif issubclass(origin, Tuple): # type: ignore
|
|
669
|
+
# origin == Tuple without item type
|
|
670
|
+
args = get_args(self.type_)
|
|
671
|
+
if not args: # plain tuple
|
|
672
|
+
self.type_ = Any
|
|
673
|
+
self.shape = SHAPE_TUPLE_ELLIPSIS
|
|
674
|
+
elif len(args) == 2 and args[1] is Ellipsis: # e.g. Tuple[int, ...]
|
|
675
|
+
self.type_ = args[0]
|
|
676
|
+
self.shape = SHAPE_TUPLE_ELLIPSIS
|
|
677
|
+
self.sub_fields = [self._create_sub_type(args[0], f'{self.name}_0')]
|
|
678
|
+
elif args == ((),): # Tuple[()] means empty tuple
|
|
679
|
+
self.shape = SHAPE_TUPLE
|
|
680
|
+
self.type_ = Any
|
|
681
|
+
self.sub_fields = []
|
|
682
|
+
else:
|
|
683
|
+
self.shape = SHAPE_TUPLE
|
|
684
|
+
self.sub_fields = [self._create_sub_type(t, f'{self.name}_{i}') for i, t in enumerate(args)]
|
|
685
|
+
return
|
|
686
|
+
elif issubclass(origin, List):
|
|
687
|
+
# Create self validators
|
|
688
|
+
get_validators = getattr(self.type_, '__get_validators__', None)
|
|
689
|
+
if get_validators:
|
|
690
|
+
self.class_validators.update(
|
|
691
|
+
{f'list_{i}': Validator(validator, pre=True) for i, validator in enumerate(get_validators())}
|
|
692
|
+
)
|
|
693
|
+
|
|
694
|
+
self.type_ = get_args(self.type_)[0]
|
|
695
|
+
self.shape = SHAPE_LIST
|
|
696
|
+
elif issubclass(origin, Set):
|
|
697
|
+
# Create self validators
|
|
698
|
+
get_validators = getattr(self.type_, '__get_validators__', None)
|
|
699
|
+
if get_validators:
|
|
700
|
+
self.class_validators.update(
|
|
701
|
+
{f'set_{i}': Validator(validator, pre=True) for i, validator in enumerate(get_validators())}
|
|
702
|
+
)
|
|
703
|
+
|
|
704
|
+
self.type_ = get_args(self.type_)[0]
|
|
705
|
+
self.shape = SHAPE_SET
|
|
706
|
+
elif issubclass(origin, FrozenSet):
|
|
707
|
+
# Create self validators
|
|
708
|
+
get_validators = getattr(self.type_, '__get_validators__', None)
|
|
709
|
+
if get_validators:
|
|
710
|
+
self.class_validators.update(
|
|
711
|
+
{f'frozenset_{i}': Validator(validator, pre=True) for i, validator in enumerate(get_validators())}
|
|
712
|
+
)
|
|
713
|
+
|
|
714
|
+
self.type_ = get_args(self.type_)[0]
|
|
715
|
+
self.shape = SHAPE_FROZENSET
|
|
716
|
+
elif issubclass(origin, Deque):
|
|
717
|
+
self.type_ = get_args(self.type_)[0]
|
|
718
|
+
self.shape = SHAPE_DEQUE
|
|
719
|
+
elif issubclass(origin, Sequence):
|
|
720
|
+
self.type_ = get_args(self.type_)[0]
|
|
721
|
+
self.shape = SHAPE_SEQUENCE
|
|
722
|
+
# priority to most common mapping: dict
|
|
723
|
+
elif origin is dict or origin is Dict:
|
|
724
|
+
self.key_field = self._create_sub_type(get_args(self.type_)[0], 'key_' + self.name, for_keys=True)
|
|
725
|
+
self.type_ = get_args(self.type_)[1]
|
|
726
|
+
self.shape = SHAPE_DICT
|
|
727
|
+
elif issubclass(origin, DefaultDict):
|
|
728
|
+
self.key_field = self._create_sub_type(get_args(self.type_)[0], 'key_' + self.name, for_keys=True)
|
|
729
|
+
self.type_ = get_args(self.type_)[1]
|
|
730
|
+
self.shape = SHAPE_DEFAULTDICT
|
|
731
|
+
elif issubclass(origin, Counter):
|
|
732
|
+
self.key_field = self._create_sub_type(get_args(self.type_)[0], 'key_' + self.name, for_keys=True)
|
|
733
|
+
self.type_ = int
|
|
734
|
+
self.shape = SHAPE_COUNTER
|
|
735
|
+
elif issubclass(origin, Mapping):
|
|
736
|
+
self.key_field = self._create_sub_type(get_args(self.type_)[0], 'key_' + self.name, for_keys=True)
|
|
737
|
+
self.type_ = get_args(self.type_)[1]
|
|
738
|
+
self.shape = SHAPE_MAPPING
|
|
739
|
+
# Equality check as almost everything inherits form Iterable, including str
|
|
740
|
+
# check for Iterable and CollectionsIterable, as it could receive one even when declared with the other
|
|
741
|
+
elif origin in {Iterable, CollectionsIterable}:
|
|
742
|
+
self.type_ = get_args(self.type_)[0]
|
|
743
|
+
self.shape = SHAPE_ITERABLE
|
|
744
|
+
self.sub_fields = [self._create_sub_type(self.type_, f'{self.name}_type')]
|
|
745
|
+
elif issubclass(origin, Type): # type: ignore
|
|
746
|
+
return
|
|
747
|
+
elif hasattr(origin, '__get_validators__') or self.model_config.arbitrary_types_allowed:
|
|
748
|
+
# Is a Pydantic-compatible generic that handles itself
|
|
749
|
+
# or we have arbitrary_types_allowed = True
|
|
750
|
+
self.shape = SHAPE_GENERIC
|
|
751
|
+
self.sub_fields = [self._create_sub_type(t, f'{self.name}_{i}') for i, t in enumerate(get_args(self.type_))]
|
|
752
|
+
self.type_ = origin
|
|
753
|
+
return
|
|
754
|
+
else:
|
|
755
|
+
raise TypeError(f'Fields of type "{origin}" are not supported.')
|
|
756
|
+
|
|
757
|
+
# type_ has been refined eg. as the type of a List and sub_fields needs to be populated
|
|
758
|
+
self.sub_fields = [self._create_sub_type(self.type_, '_' + self.name)]
|
|
759
|
+
|
|
760
|
+
def prepare_discriminated_union_sub_fields(self) -> None:
|
|
761
|
+
"""
|
|
762
|
+
Prepare the mapping <discriminator key> -> <ModelField> and update `sub_fields`
|
|
763
|
+
Note that this process can be aborted if a `ForwardRef` is encountered
|
|
764
|
+
"""
|
|
765
|
+
assert self.discriminator_key is not None
|
|
766
|
+
|
|
767
|
+
if self.type_.__class__ is DeferredType:
|
|
768
|
+
return
|
|
769
|
+
|
|
770
|
+
assert self.sub_fields is not None
|
|
771
|
+
sub_fields_mapping: Dict[str, 'ModelField'] = {}
|
|
772
|
+
all_aliases: Set[str] = set()
|
|
773
|
+
|
|
774
|
+
for sub_field in self.sub_fields:
|
|
775
|
+
t = sub_field.type_
|
|
776
|
+
if t.__class__ is ForwardRef:
|
|
777
|
+
# Stopping everything...will need to call `update_forward_refs`
|
|
778
|
+
return
|
|
779
|
+
|
|
780
|
+
alias, discriminator_values = get_discriminator_alias_and_values(t, self.discriminator_key)
|
|
781
|
+
all_aliases.add(alias)
|
|
782
|
+
for discriminator_value in discriminator_values:
|
|
783
|
+
sub_fields_mapping[discriminator_value] = sub_field
|
|
784
|
+
|
|
785
|
+
self.sub_fields_mapping = sub_fields_mapping
|
|
786
|
+
self.discriminator_alias = get_unique_discriminator_alias(all_aliases, self.discriminator_key)
|
|
787
|
+
|
|
788
|
+
def _create_sub_type(self, type_: Type[Any], name: str, *, for_keys: bool = False) -> 'ModelField':
|
|
789
|
+
if for_keys:
|
|
790
|
+
class_validators = None
|
|
791
|
+
else:
|
|
792
|
+
# validators for sub items should not have `each_item` as we want to check only the first sublevel
|
|
793
|
+
class_validators = {
|
|
794
|
+
k: Validator(
|
|
795
|
+
func=v.func,
|
|
796
|
+
pre=v.pre,
|
|
797
|
+
each_item=False,
|
|
798
|
+
always=v.always,
|
|
799
|
+
check_fields=v.check_fields,
|
|
800
|
+
skip_on_failure=v.skip_on_failure,
|
|
801
|
+
)
|
|
802
|
+
for k, v in self.class_validators.items()
|
|
803
|
+
if v.each_item
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
field_info, _ = self._get_field_info(name, type_, None, self.model_config)
|
|
807
|
+
|
|
808
|
+
return self.__class__(
|
|
809
|
+
type_=type_,
|
|
810
|
+
name=name,
|
|
811
|
+
class_validators=class_validators,
|
|
812
|
+
model_config=self.model_config,
|
|
813
|
+
field_info=field_info,
|
|
814
|
+
)
|
|
815
|
+
|
|
816
|
+
def populate_validators(self) -> None:
|
|
817
|
+
"""
|
|
818
|
+
Prepare self.pre_validators, self.validators, and self.post_validators based on self.type_'s __get_validators__
|
|
819
|
+
and class validators. This method should be idempotent, e.g. it should be safe to call multiple times
|
|
820
|
+
without mis-configuring the field.
|
|
821
|
+
"""
|
|
822
|
+
self.validate_always = getattr(self.type_, 'validate_always', False) or any(
|
|
823
|
+
v.always for v in self.class_validators.values()
|
|
824
|
+
)
|
|
825
|
+
|
|
826
|
+
class_validators_ = self.class_validators.values()
|
|
827
|
+
if not self.sub_fields or self.shape == SHAPE_GENERIC:
|
|
828
|
+
get_validators = getattr(self.type_, '__get_validators__', None)
|
|
829
|
+
v_funcs = (
|
|
830
|
+
*[v.func for v in class_validators_ if v.each_item and v.pre],
|
|
831
|
+
*(get_validators() if get_validators else list(find_validators(self.type_, self.model_config))),
|
|
832
|
+
*[v.func for v in class_validators_ if v.each_item and not v.pre],
|
|
833
|
+
)
|
|
834
|
+
self.validators = prep_validators(v_funcs)
|
|
835
|
+
|
|
836
|
+
self.pre_validators = []
|
|
837
|
+
self.post_validators = []
|
|
838
|
+
|
|
839
|
+
if self.field_info and self.field_info.const:
|
|
840
|
+
self.post_validators.append(make_generic_validator(constant_validator))
|
|
841
|
+
|
|
842
|
+
if class_validators_:
|
|
843
|
+
self.pre_validators += prep_validators(v.func for v in class_validators_ if not v.each_item and v.pre)
|
|
844
|
+
self.post_validators += prep_validators(v.func for v in class_validators_ if not v.each_item and not v.pre)
|
|
845
|
+
|
|
846
|
+
if self.parse_json:
|
|
847
|
+
self.pre_validators.append(make_generic_validator(validate_json))
|
|
848
|
+
|
|
849
|
+
self.pre_validators = self.pre_validators or None
|
|
850
|
+
self.post_validators = self.post_validators or None
|
|
851
|
+
|
|
852
|
+
def validate(
|
|
853
|
+
self, v: Any, values: Dict[str, Any], *, loc: 'LocStr', cls: Optional['ModelOrDc'] = None
|
|
854
|
+
) -> 'ValidateReturn':
|
|
855
|
+
|
|
856
|
+
assert self.type_.__class__ is not DeferredType
|
|
857
|
+
|
|
858
|
+
if self.type_.__class__ is ForwardRef:
|
|
859
|
+
assert cls is not None
|
|
860
|
+
raise ConfigError(
|
|
861
|
+
f'field "{self.name}" not yet prepared so type is still a ForwardRef, '
|
|
862
|
+
f'you might need to call {cls.__name__}.update_forward_refs().'
|
|
863
|
+
)
|
|
864
|
+
|
|
865
|
+
errors: Optional['ErrorList']
|
|
866
|
+
if self.pre_validators:
|
|
867
|
+
v, errors = self._apply_validators(v, values, loc, cls, self.pre_validators)
|
|
868
|
+
if errors:
|
|
869
|
+
return v, errors
|
|
870
|
+
|
|
871
|
+
if v is None:
|
|
872
|
+
if is_none_type(self.type_):
|
|
873
|
+
# keep validating
|
|
874
|
+
pass
|
|
875
|
+
elif self.allow_none:
|
|
876
|
+
if self.post_validators:
|
|
877
|
+
return self._apply_validators(v, values, loc, cls, self.post_validators)
|
|
878
|
+
else:
|
|
879
|
+
return None, None
|
|
880
|
+
else:
|
|
881
|
+
return v, ErrorWrapper(NoneIsNotAllowedError(), loc)
|
|
882
|
+
|
|
883
|
+
if self.shape == SHAPE_SINGLETON:
|
|
884
|
+
v, errors = self._validate_singleton(v, values, loc, cls)
|
|
885
|
+
elif self.shape in MAPPING_LIKE_SHAPES:
|
|
886
|
+
v, errors = self._validate_mapping_like(v, values, loc, cls)
|
|
887
|
+
elif self.shape == SHAPE_TUPLE:
|
|
888
|
+
v, errors = self._validate_tuple(v, values, loc, cls)
|
|
889
|
+
elif self.shape == SHAPE_ITERABLE:
|
|
890
|
+
v, errors = self._validate_iterable(v, values, loc, cls)
|
|
891
|
+
elif self.shape == SHAPE_GENERIC:
|
|
892
|
+
v, errors = self._apply_validators(v, values, loc, cls, self.validators)
|
|
893
|
+
else:
|
|
894
|
+
# sequence, list, set, generator, tuple with ellipsis, frozen set
|
|
895
|
+
v, errors = self._validate_sequence_like(v, values, loc, cls)
|
|
896
|
+
|
|
897
|
+
if not errors and self.post_validators:
|
|
898
|
+
v, errors = self._apply_validators(v, values, loc, cls, self.post_validators)
|
|
899
|
+
return v, errors
|
|
900
|
+
|
|
901
|
+
def _validate_sequence_like( # noqa: C901 (ignore complexity)
|
|
902
|
+
self, v: Any, values: Dict[str, Any], loc: 'LocStr', cls: Optional['ModelOrDc']
|
|
903
|
+
) -> 'ValidateReturn':
|
|
904
|
+
"""
|
|
905
|
+
Validate sequence-like containers: lists, tuples, sets and generators
|
|
906
|
+
Note that large if-else blocks are necessary to enable Cython
|
|
907
|
+
optimization, which is why we disable the complexity check above.
|
|
908
|
+
"""
|
|
909
|
+
if not sequence_like(v):
|
|
910
|
+
e: errors_.PydanticTypeError
|
|
911
|
+
if self.shape == SHAPE_LIST:
|
|
912
|
+
e = errors_.ListError()
|
|
913
|
+
elif self.shape in (SHAPE_TUPLE, SHAPE_TUPLE_ELLIPSIS):
|
|
914
|
+
e = errors_.TupleError()
|
|
915
|
+
elif self.shape == SHAPE_SET:
|
|
916
|
+
e = errors_.SetError()
|
|
917
|
+
elif self.shape == SHAPE_FROZENSET:
|
|
918
|
+
e = errors_.FrozenSetError()
|
|
919
|
+
else:
|
|
920
|
+
e = errors_.SequenceError()
|
|
921
|
+
return v, ErrorWrapper(e, loc)
|
|
922
|
+
|
|
923
|
+
loc = loc if isinstance(loc, tuple) else (loc,)
|
|
924
|
+
result = []
|
|
925
|
+
errors: List[ErrorList] = []
|
|
926
|
+
for i, v_ in enumerate(v):
|
|
927
|
+
v_loc = *loc, i
|
|
928
|
+
r, ee = self._validate_singleton(v_, values, v_loc, cls)
|
|
929
|
+
if ee:
|
|
930
|
+
errors.append(ee)
|
|
931
|
+
else:
|
|
932
|
+
result.append(r)
|
|
933
|
+
|
|
934
|
+
if errors:
|
|
935
|
+
return v, errors
|
|
936
|
+
|
|
937
|
+
converted: Union[List[Any], Set[Any], FrozenSet[Any], Tuple[Any, ...], Iterator[Any], Deque[Any]] = result
|
|
938
|
+
|
|
939
|
+
if self.shape == SHAPE_SET:
|
|
940
|
+
converted = set(result)
|
|
941
|
+
elif self.shape == SHAPE_FROZENSET:
|
|
942
|
+
converted = frozenset(result)
|
|
943
|
+
elif self.shape == SHAPE_TUPLE_ELLIPSIS:
|
|
944
|
+
converted = tuple(result)
|
|
945
|
+
elif self.shape == SHAPE_DEQUE:
|
|
946
|
+
converted = deque(result, maxlen=getattr(v, 'maxlen', None))
|
|
947
|
+
elif self.shape == SHAPE_SEQUENCE:
|
|
948
|
+
if isinstance(v, tuple):
|
|
949
|
+
converted = tuple(result)
|
|
950
|
+
elif isinstance(v, set):
|
|
951
|
+
converted = set(result)
|
|
952
|
+
elif isinstance(v, Generator):
|
|
953
|
+
converted = iter(result)
|
|
954
|
+
elif isinstance(v, deque):
|
|
955
|
+
converted = deque(result, maxlen=getattr(v, 'maxlen', None))
|
|
956
|
+
return converted, None
|
|
957
|
+
|
|
958
|
+
def _validate_iterable(
|
|
959
|
+
self, v: Any, values: Dict[str, Any], loc: 'LocStr', cls: Optional['ModelOrDc']
|
|
960
|
+
) -> 'ValidateReturn':
|
|
961
|
+
"""
|
|
962
|
+
Validate Iterables.
|
|
963
|
+
|
|
964
|
+
This intentionally doesn't validate values to allow infinite generators.
|
|
965
|
+
"""
|
|
966
|
+
|
|
967
|
+
try:
|
|
968
|
+
iterable = iter(v)
|
|
969
|
+
except TypeError:
|
|
970
|
+
return v, ErrorWrapper(errors_.IterableError(), loc)
|
|
971
|
+
return iterable, None
|
|
972
|
+
|
|
973
|
+
def _validate_tuple(
|
|
974
|
+
self, v: Any, values: Dict[str, Any], loc: 'LocStr', cls: Optional['ModelOrDc']
|
|
975
|
+
) -> 'ValidateReturn':
|
|
976
|
+
e: Optional[Exception] = None
|
|
977
|
+
if not sequence_like(v):
|
|
978
|
+
e = errors_.TupleError()
|
|
979
|
+
else:
|
|
980
|
+
actual_length, expected_length = len(v), len(self.sub_fields) # type: ignore
|
|
981
|
+
if actual_length != expected_length:
|
|
982
|
+
e = errors_.TupleLengthError(actual_length=actual_length, expected_length=expected_length)
|
|
983
|
+
|
|
984
|
+
if e:
|
|
985
|
+
return v, ErrorWrapper(e, loc)
|
|
986
|
+
|
|
987
|
+
loc = loc if isinstance(loc, tuple) else (loc,)
|
|
988
|
+
result = []
|
|
989
|
+
errors: List[ErrorList] = []
|
|
990
|
+
for i, (v_, field) in enumerate(zip(v, self.sub_fields)): # type: ignore
|
|
991
|
+
v_loc = *loc, i
|
|
992
|
+
r, ee = field.validate(v_, values, loc=v_loc, cls=cls)
|
|
993
|
+
if ee:
|
|
994
|
+
errors.append(ee)
|
|
995
|
+
else:
|
|
996
|
+
result.append(r)
|
|
997
|
+
|
|
998
|
+
if errors:
|
|
999
|
+
return v, errors
|
|
1000
|
+
else:
|
|
1001
|
+
return tuple(result), None
|
|
1002
|
+
|
|
1003
|
+
def _validate_mapping_like(
|
|
1004
|
+
self, v: Any, values: Dict[str, Any], loc: 'LocStr', cls: Optional['ModelOrDc']
|
|
1005
|
+
) -> 'ValidateReturn':
|
|
1006
|
+
try:
|
|
1007
|
+
v_iter = dict_validator(v)
|
|
1008
|
+
except TypeError as exc:
|
|
1009
|
+
return v, ErrorWrapper(exc, loc)
|
|
1010
|
+
|
|
1011
|
+
loc = loc if isinstance(loc, tuple) else (loc,)
|
|
1012
|
+
result, errors = {}, []
|
|
1013
|
+
for k, v_ in v_iter.items():
|
|
1014
|
+
v_loc = *loc, '__key__'
|
|
1015
|
+
key_result, key_errors = self.key_field.validate(k, values, loc=v_loc, cls=cls) # type: ignore
|
|
1016
|
+
if key_errors:
|
|
1017
|
+
errors.append(key_errors)
|
|
1018
|
+
continue
|
|
1019
|
+
|
|
1020
|
+
v_loc = *loc, k
|
|
1021
|
+
value_result, value_errors = self._validate_singleton(v_, values, v_loc, cls)
|
|
1022
|
+
if value_errors:
|
|
1023
|
+
errors.append(value_errors)
|
|
1024
|
+
continue
|
|
1025
|
+
|
|
1026
|
+
result[key_result] = value_result
|
|
1027
|
+
if errors:
|
|
1028
|
+
return v, errors
|
|
1029
|
+
elif self.shape == SHAPE_DICT:
|
|
1030
|
+
return result, None
|
|
1031
|
+
elif self.shape == SHAPE_DEFAULTDICT:
|
|
1032
|
+
return defaultdict(self.type_, result), None
|
|
1033
|
+
elif self.shape == SHAPE_COUNTER:
|
|
1034
|
+
return CollectionCounter(result), None
|
|
1035
|
+
else:
|
|
1036
|
+
return self._get_mapping_value(v, result), None
|
|
1037
|
+
|
|
1038
|
+
def _get_mapping_value(self, original: T, converted: Dict[Any, Any]) -> Union[T, Dict[Any, Any]]:
|
|
1039
|
+
"""
|
|
1040
|
+
When type is `Mapping[KT, KV]` (or another unsupported mapping), we try to avoid
|
|
1041
|
+
coercing to `dict` unwillingly.
|
|
1042
|
+
"""
|
|
1043
|
+
original_cls = original.__class__
|
|
1044
|
+
|
|
1045
|
+
if original_cls == dict or original_cls == Dict:
|
|
1046
|
+
return converted
|
|
1047
|
+
elif original_cls in {defaultdict, DefaultDict}:
|
|
1048
|
+
return defaultdict(self.type_, converted)
|
|
1049
|
+
else:
|
|
1050
|
+
try:
|
|
1051
|
+
# Counter, OrderedDict, UserDict, ...
|
|
1052
|
+
return original_cls(converted) # type: ignore
|
|
1053
|
+
except TypeError:
|
|
1054
|
+
raise RuntimeError(f'Could not convert dictionary to {original_cls.__name__!r}') from None
|
|
1055
|
+
|
|
1056
|
+
def _validate_singleton(
|
|
1057
|
+
self, v: Any, values: Dict[str, Any], loc: 'LocStr', cls: Optional['ModelOrDc']
|
|
1058
|
+
) -> 'ValidateReturn':
|
|
1059
|
+
if self.sub_fields:
|
|
1060
|
+
if self.discriminator_key is not None:
|
|
1061
|
+
return self._validate_discriminated_union(v, values, loc, cls)
|
|
1062
|
+
|
|
1063
|
+
errors = []
|
|
1064
|
+
|
|
1065
|
+
if self.model_config.smart_union and is_union(get_origin(self.type_)):
|
|
1066
|
+
# 1st pass: check if the value is an exact instance of one of the Union types
|
|
1067
|
+
# (e.g. to avoid coercing a bool into an int)
|
|
1068
|
+
for field in self.sub_fields:
|
|
1069
|
+
if v.__class__ is field.outer_type_:
|
|
1070
|
+
return v, None
|
|
1071
|
+
|
|
1072
|
+
# 2nd pass: check if the value is an instance of any subclass of the Union types
|
|
1073
|
+
for field in self.sub_fields:
|
|
1074
|
+
# This whole logic will be improved later on to support more complex `isinstance` checks
|
|
1075
|
+
# It will probably be done once a strict mode is added and be something like:
|
|
1076
|
+
# ```
|
|
1077
|
+
# value, error = field.validate(v, values, strict=True)
|
|
1078
|
+
# if error is None:
|
|
1079
|
+
# return value, None
|
|
1080
|
+
# ```
|
|
1081
|
+
try:
|
|
1082
|
+
if isinstance(v, field.outer_type_):
|
|
1083
|
+
return v, None
|
|
1084
|
+
except TypeError:
|
|
1085
|
+
# compound type
|
|
1086
|
+
if lenient_isinstance(v, get_origin(field.outer_type_)):
|
|
1087
|
+
value, error = field.validate(v, values, loc=loc, cls=cls)
|
|
1088
|
+
if not error:
|
|
1089
|
+
return value, None
|
|
1090
|
+
|
|
1091
|
+
# 1st pass by default or 3rd pass with `smart_union` enabled:
|
|
1092
|
+
# check if the value can be coerced into one of the Union types
|
|
1093
|
+
for field in self.sub_fields:
|
|
1094
|
+
value, error = field.validate(v, values, loc=loc, cls=cls)
|
|
1095
|
+
if error:
|
|
1096
|
+
errors.append(error)
|
|
1097
|
+
else:
|
|
1098
|
+
return value, None
|
|
1099
|
+
return v, errors
|
|
1100
|
+
else:
|
|
1101
|
+
return self._apply_validators(v, values, loc, cls, self.validators)
|
|
1102
|
+
|
|
1103
|
+
def _validate_discriminated_union(
|
|
1104
|
+
self, v: Any, values: Dict[str, Any], loc: 'LocStr', cls: Optional['ModelOrDc']
|
|
1105
|
+
) -> 'ValidateReturn':
|
|
1106
|
+
assert self.discriminator_key is not None
|
|
1107
|
+
assert self.discriminator_alias is not None
|
|
1108
|
+
|
|
1109
|
+
try:
|
|
1110
|
+
try:
|
|
1111
|
+
discriminator_value = v[self.discriminator_alias]
|
|
1112
|
+
except KeyError:
|
|
1113
|
+
if self.model_config.allow_population_by_field_name:
|
|
1114
|
+
discriminator_value = v[self.discriminator_key]
|
|
1115
|
+
else:
|
|
1116
|
+
raise
|
|
1117
|
+
except KeyError:
|
|
1118
|
+
return v, ErrorWrapper(MissingDiscriminator(discriminator_key=self.discriminator_key), loc)
|
|
1119
|
+
except TypeError:
|
|
1120
|
+
try:
|
|
1121
|
+
# BaseModel or dataclass
|
|
1122
|
+
discriminator_value = getattr(v, self.discriminator_key)
|
|
1123
|
+
except (AttributeError, TypeError):
|
|
1124
|
+
return v, ErrorWrapper(MissingDiscriminator(discriminator_key=self.discriminator_key), loc)
|
|
1125
|
+
|
|
1126
|
+
if self.sub_fields_mapping is None:
|
|
1127
|
+
assert cls is not None
|
|
1128
|
+
raise ConfigError(
|
|
1129
|
+
f'field "{self.name}" not yet prepared so type is still a ForwardRef, '
|
|
1130
|
+
f'you might need to call {cls.__name__}.update_forward_refs().'
|
|
1131
|
+
)
|
|
1132
|
+
|
|
1133
|
+
try:
|
|
1134
|
+
sub_field = self.sub_fields_mapping[discriminator_value]
|
|
1135
|
+
except (KeyError, TypeError):
|
|
1136
|
+
# KeyError: `discriminator_value` is not in the dictionary.
|
|
1137
|
+
# TypeError: `discriminator_value` is unhashable.
|
|
1138
|
+
assert self.sub_fields_mapping is not None
|
|
1139
|
+
return v, ErrorWrapper(
|
|
1140
|
+
InvalidDiscriminator(
|
|
1141
|
+
discriminator_key=self.discriminator_key,
|
|
1142
|
+
discriminator_value=discriminator_value,
|
|
1143
|
+
allowed_values=list(self.sub_fields_mapping),
|
|
1144
|
+
),
|
|
1145
|
+
loc,
|
|
1146
|
+
)
|
|
1147
|
+
else:
|
|
1148
|
+
if not isinstance(loc, tuple):
|
|
1149
|
+
loc = (loc,)
|
|
1150
|
+
return sub_field.validate(v, values, loc=(*loc, display_as_type(sub_field.type_)), cls=cls)
|
|
1151
|
+
|
|
1152
|
+
def _apply_validators(
|
|
1153
|
+
self, v: Any, values: Dict[str, Any], loc: 'LocStr', cls: Optional['ModelOrDc'], validators: 'ValidatorsList'
|
|
1154
|
+
) -> 'ValidateReturn':
|
|
1155
|
+
for validator in validators:
|
|
1156
|
+
try:
|
|
1157
|
+
v = validator(cls, v, values, self, self.model_config)
|
|
1158
|
+
except (ValueError, TypeError, AssertionError) as exc:
|
|
1159
|
+
return v, ErrorWrapper(exc, loc)
|
|
1160
|
+
return v, None
|
|
1161
|
+
|
|
1162
|
+
def is_complex(self) -> bool:
|
|
1163
|
+
"""
|
|
1164
|
+
Whether the field is "complex" eg. env variables should be parsed as JSON.
|
|
1165
|
+
"""
|
|
1166
|
+
from .main import BaseModel
|
|
1167
|
+
|
|
1168
|
+
return (
|
|
1169
|
+
self.shape != SHAPE_SINGLETON
|
|
1170
|
+
or hasattr(self.type_, '__pydantic_model__')
|
|
1171
|
+
or lenient_issubclass(self.type_, (BaseModel, list, set, frozenset, dict))
|
|
1172
|
+
)
|
|
1173
|
+
|
|
1174
|
+
def _type_display(self) -> PyObjectStr:
|
|
1175
|
+
t = display_as_type(self.type_)
|
|
1176
|
+
|
|
1177
|
+
if self.shape in MAPPING_LIKE_SHAPES:
|
|
1178
|
+
t = f'Mapping[{display_as_type(self.key_field.type_)}, {t}]' # type: ignore
|
|
1179
|
+
elif self.shape == SHAPE_TUPLE:
|
|
1180
|
+
t = 'Tuple[{}]'.format(', '.join(display_as_type(f.type_) for f in self.sub_fields)) # type: ignore
|
|
1181
|
+
elif self.shape == SHAPE_GENERIC:
|
|
1182
|
+
assert self.sub_fields
|
|
1183
|
+
t = '{}[{}]'.format(
|
|
1184
|
+
display_as_type(self.type_), ', '.join(display_as_type(f.type_) for f in self.sub_fields)
|
|
1185
|
+
)
|
|
1186
|
+
elif self.shape != SHAPE_SINGLETON:
|
|
1187
|
+
t = SHAPE_NAME_LOOKUP[self.shape].format(t)
|
|
1188
|
+
|
|
1189
|
+
if self.allow_none and (self.shape != SHAPE_SINGLETON or not self.sub_fields):
|
|
1190
|
+
t = f'Optional[{t}]'
|
|
1191
|
+
return PyObjectStr(t)
|
|
1192
|
+
|
|
1193
|
+
def __repr_args__(self) -> 'ReprArgs':
|
|
1194
|
+
args = [('name', self.name), ('type', self._type_display()), ('required', self.required)]
|
|
1195
|
+
|
|
1196
|
+
if not self.required:
|
|
1197
|
+
if self.default_factory is not None:
|
|
1198
|
+
args.append(('default_factory', f'<function {self.default_factory.__name__}>'))
|
|
1199
|
+
else:
|
|
1200
|
+
args.append(('default', self.default))
|
|
1201
|
+
|
|
1202
|
+
if self.alt_alias:
|
|
1203
|
+
args.append(('alias', self.alias))
|
|
1204
|
+
return args
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
class ModelPrivateAttr(Representation):
|
|
1208
|
+
__slots__ = ('default', 'default_factory')
|
|
1209
|
+
|
|
1210
|
+
def __init__(self, default: Any = Undefined, *, default_factory: Optional[NoArgAnyCallable] = None) -> None:
|
|
1211
|
+
self.default = default
|
|
1212
|
+
self.default_factory = default_factory
|
|
1213
|
+
|
|
1214
|
+
def get_default(self) -> Any:
|
|
1215
|
+
return smart_deepcopy(self.default) if self.default_factory is None else self.default_factory()
|
|
1216
|
+
|
|
1217
|
+
def __eq__(self, other: Any) -> bool:
|
|
1218
|
+
return isinstance(other, self.__class__) and (self.default, self.default_factory) == (
|
|
1219
|
+
other.default,
|
|
1220
|
+
other.default_factory,
|
|
1221
|
+
)
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
def PrivateAttr(
|
|
1225
|
+
default: Any = Undefined,
|
|
1226
|
+
*,
|
|
1227
|
+
default_factory: Optional[NoArgAnyCallable] = None,
|
|
1228
|
+
) -> Any:
|
|
1229
|
+
"""
|
|
1230
|
+
Indicates that attribute is only used internally and never mixed with regular fields.
|
|
1231
|
+
|
|
1232
|
+
Types or values of private attrs are not checked by pydantic and it's up to you to keep them relevant.
|
|
1233
|
+
|
|
1234
|
+
Private attrs are stored in model __slots__.
|
|
1235
|
+
|
|
1236
|
+
:param default: the attribute’s default value
|
|
1237
|
+
:param default_factory: callable that will be called when a default value is needed for this attribute
|
|
1238
|
+
If both `default` and `default_factory` are set, an error is raised.
|
|
1239
|
+
"""
|
|
1240
|
+
if default is not Undefined and default_factory is not None:
|
|
1241
|
+
raise ValueError('cannot specify both default and default_factory')
|
|
1242
|
+
|
|
1243
|
+
return ModelPrivateAttr(
|
|
1244
|
+
default,
|
|
1245
|
+
default_factory=default_factory,
|
|
1246
|
+
)
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
class DeferredType:
|
|
1250
|
+
"""
|
|
1251
|
+
Used to postpone field preparation, while creating recursive generic models.
|
|
1252
|
+
"""
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
def is_finalvar_with_default_val(type_: Type[Any], val: Any) -> bool:
|
|
1256
|
+
return is_finalvar(type_) and val is not Undefined and not isinstance(val, FieldInfo)
|