From dab1ba7d447f663c263960c8f2365fe577bbe96d Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Mon, 27 Nov 2023 21:19:33 -0500 Subject: [PATCH 1/6] Rename exception classes --- pinecone/core/client/__init__.py | 12 +-- pinecone/core/client/api_client.py | 22 ++--- pinecone/core/client/configuration.py | 4 +- pinecone/core/client/exceptions.py | 30 +++---- pinecone/core/client/model/aws_regions.py | 16 ++-- pinecone/core/client/model/collection_list.py | 10 +-- .../core/client/model/collection_model.py | 10 +-- .../client/model/configure_index_request.py | 10 +-- .../model/configure_index_request_spec.py | 10 +-- .../model/configure_index_request_spec_pod.py | 10 +-- .../client/model/create_collection_request.py | 10 +-- .../core/client/model/create_index_request.py | 10 +-- pinecone/core/client/model/delete_request.py | 10 +-- .../model/describe_index_stats_request.py | 10 +-- .../model/describe_index_stats_response.py | 10 +-- pinecone/core/client/model/error_response.py | 10 +-- .../core/client/model/error_response_error.py | 10 +-- pinecone/core/client/model/fetch_response.py | 10 +-- pinecone/core/client/model/gcp_regions.py | 16 ++-- pinecone/core/client/model/index_list.py | 10 +-- pinecone/core/client/model/index_model.py | 10 +-- .../core/client/model/index_model_spec.py | 10 +-- .../core/client/model/index_model_status.py | 10 +-- .../core/client/model/namespace_summary.py | 10 +-- pinecone/core/client/model/pod_spec.py | 10 +-- .../client/model/pod_spec_metadata_config.py | 10 +-- pinecone/core/client/model/protobuf_any.py | 10 +-- .../core/client/model/protobuf_null_value.py | 12 +-- pinecone/core/client/model/query_request.py | 10 +-- pinecone/core/client/model/query_response.py | 10 +-- pinecone/core/client/model/query_vector.py | 10 +-- pinecone/core/client/model/rpc_status.py | 10 +-- pinecone/core/client/model/scored_vector.py | 10 +-- pinecone/core/client/model/serverless_spec.py | 10 +-- .../core/client/model/single_query_results.py | 10 +-- pinecone/core/client/model/sparse_values.py | 10 +-- pinecone/core/client/model/update_request.py | 10 +-- pinecone/core/client/model/upsert_request.py | 10 +-- pinecone/core/client/model/upsert_response.py | 10 +-- pinecone/core/client/model/vector.py | 10 +-- pinecone/core/client/model_utils.py | 84 +++++++++---------- pinecone/core/client/rest.py | 10 +-- 42 files changed, 268 insertions(+), 268 deletions(-) diff --git a/pinecone/core/client/__init__.py b/pinecone/core/client/__init__.py index 486f91455..0746e0651 100644 --- a/pinecone/core/client/__init__.py +++ b/pinecone/core/client/__init__.py @@ -19,9 +19,9 @@ from pinecone.core.client.configuration import Configuration # import exceptions -from pinecone.core.client.exceptions import OpenApiException -from pinecone.core.client.exceptions import ApiAttributeError -from pinecone.core.client.exceptions import ApiTypeError -from pinecone.core.client.exceptions import ApiValueError -from pinecone.core.client.exceptions import ApiKeyError -from pinecone.core.client.exceptions import ApiException +from pinecone.core.client.exceptions import PineconeException +from pinecone.core.client.exceptions import PineconeApiAttributeError +from pinecone.core.client.exceptions import PineconeApiTypeError +from pinecone.core.client.exceptions import PineconeApiValueError +from pinecone.core.client.exceptions import PineconeApiKeyError +from pinecone.core.client.exceptions import PineconeApiException diff --git a/pinecone/core/client/api_client.py b/pinecone/core/client/api_client.py index 88cb5182d..e7e2feae5 100644 --- a/pinecone/core/client/api_client.py +++ b/pinecone/core/client/api_client.py @@ -22,7 +22,7 @@ from pinecone.core.client import rest from pinecone.core.client.configuration import Configuration -from pinecone.core.client.exceptions import ApiTypeError, ApiValueError, ApiException +from pinecone.core.client.exceptions import PineconeApiTypeError, PineconeApiValueError, PineconeApiException from pinecone.core.client.model_utils import ( ModelNormal, ModelSimple, @@ -197,7 +197,7 @@ def __call_api( post_params=post_params, body=body, _preload_content=_preload_content, _request_timeout=_request_timeout) - except ApiException as e: + except PineconeApiException as e: e.body = e.body.decode('utf-8') raise e @@ -284,7 +284,7 @@ def sanitize_for_serialization(cls, obj): return [cls.sanitize_for_serialization(item) for item in obj] if isinstance(obj, dict): return {key: cls.sanitize_for_serialization(val) for key, val in obj.items()} - raise ApiValueError('Unable to prepare type {} for serialization'.format(obj.__class__.__name__)) + raise PineconeApiValueError('Unable to prepare type {} for serialization'.format(obj.__class__.__name__)) def deserialize(self, response, response_type, _check_type): """Deserializes response into an object. @@ -482,7 +482,7 @@ def request(self, method, url, query_params=None, headers=None, _request_timeout=_request_timeout, body=body) else: - raise ApiValueError( + raise PineconeApiValueError( "http method must be `GET`, `HEAD`, `OPTIONS`," " `POST`, `PATCH`, `PUT` or `DELETE`." ) @@ -543,7 +543,7 @@ def files_parameters(self, files: typing.Optional[typing.Dict[str, typing.List[i # if the file field is nullable, skip None values continue if file_instance.closed is True: - raise ApiValueError( + raise PineconeApiValueError( "Cannot read a closed file. The passed in file_type " "for %s must be open." % param_name ) @@ -614,7 +614,7 @@ def update_params_for_auth(self, headers, querys, auth_settings, elif auth_setting['in'] == 'query': querys.append((auth_setting['key'], auth_setting['value'])) else: - raise ApiValueError( + raise PineconeApiValueError( 'Authentication token must be in `query` or `header`' ) @@ -784,7 +784,7 @@ def call_with_http_info(self, **kwargs): ) except IndexError: if self.settings['servers']: - raise ApiValueError( + raise PineconeApiValueError( "Invalid host index. Must be 0 <= index < %s" % len(self.settings['servers']) ) @@ -792,17 +792,17 @@ def call_with_http_info(self, **kwargs): for key, value in kwargs.items(): if key not in self.params_map['all']: - raise ApiTypeError( + raise PineconeApiTypeError( "Got an unexpected parameter '%s'" " to method `%s`" % (key, self.settings['operation_id']) ) - # only throw this nullable ApiValueError if _check_input_type + # only throw this nullable PineconeApiValueError if _check_input_type # is False, if _check_input_type==True we catch this case # in self.__validate_inputs if (key not in self.params_map['nullable'] and value is None and kwargs['_check_input_type'] is False): - raise ApiValueError( + raise PineconeApiValueError( "Value may not be None for non-nullable parameter `%s`" " when calling `%s`" % (key, self.settings['operation_id']) @@ -810,7 +810,7 @@ def call_with_http_info(self, **kwargs): for key in self.params_map['required']: if key not in kwargs.keys(): - raise ApiValueError( + raise PineconeApiValueError( "Missing the required parameter `%s` when calling " "`%s`" % (key, self.settings['operation_id']) ) diff --git a/pinecone/core/client/configuration.py b/pinecone/core/client/configuration.py index 99447c9f2..a7ab0cd4c 100644 --- a/pinecone/core/client/configuration.py +++ b/pinecone/core/client/configuration.py @@ -15,7 +15,7 @@ import urllib3 from http import client as http_client -from pinecone.core.client.exceptions import ApiValueError +from pinecone.core.client.exceptions import PineconeApiValueError JSON_SCHEMA_VALIDATION_KEYWORDS = { @@ -234,7 +234,7 @@ def __setattr__(self, name, value): s = set(filter(None, value.split(','))) for v in s: if v not in JSON_SCHEMA_VALIDATION_KEYWORDS: - raise ApiValueError( + raise PineconeApiValueError( "Invalid keyword: '{0}''".format(v)) self._disabled_client_side_validations = s diff --git a/pinecone/core/client/exceptions.py b/pinecone/core/client/exceptions.py index 3d1ff935a..665dada66 100644 --- a/pinecone/core/client/exceptions.py +++ b/pinecone/core/client/exceptions.py @@ -9,11 +9,11 @@ -class OpenApiException(Exception): - """The base exception class for all OpenAPIExceptions""" +class PineconeException(Exception): + """The base exception class for all exceptions in the Pinecone Python SDK""" -class ApiTypeError(OpenApiException, TypeError): +class PineconeApiTypeError(PineconeException, TypeError): def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): """ Raises an exception for TypeErrors @@ -39,10 +39,10 @@ def __init__(self, msg, path_to_item=None, valid_classes=None, full_msg = msg if path_to_item: full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiTypeError, self).__init__(full_msg) + super(PineconeApiTypeError, self).__init__(full_msg) -class ApiValueError(OpenApiException, ValueError): +class PineconeApiValueError(PineconeException, ValueError): def __init__(self, msg, path_to_item=None): """ Args: @@ -57,10 +57,10 @@ def __init__(self, msg, path_to_item=None): full_msg = msg if path_to_item: full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiValueError, self).__init__(full_msg) + super(PineconeApiValueError, self).__init__(full_msg) -class ApiAttributeError(OpenApiException, AttributeError): +class PineconeApiAttributeError(PineconeException, AttributeError): def __init__(self, msg, path_to_item=None): """ Raised when an attribute reference or assignment fails. @@ -76,10 +76,10 @@ def __init__(self, msg, path_to_item=None): full_msg = msg if path_to_item: full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiAttributeError, self).__init__(full_msg) + super(PineconeApiAttributeError, self).__init__(full_msg) -class ApiKeyError(OpenApiException, KeyError): +class PineconeApiKeyError(PineconeException, KeyError): def __init__(self, msg, path_to_item=None): """ Args: @@ -93,10 +93,10 @@ def __init__(self, msg, path_to_item=None): full_msg = msg if path_to_item: full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiKeyError, self).__init__(full_msg) + super(PineconeApiKeyError, self).__init__(full_msg) -class ApiException(OpenApiException): +class PineconeApiException(PineconeException): def __init__(self, status=None, reason=None, http_resp=None): if http_resp: @@ -124,25 +124,25 @@ def __str__(self): return error_message -class NotFoundException(ApiException): +class NotFoundException(PineconeApiException): def __init__(self, status=None, reason=None, http_resp=None): super(NotFoundException, self).__init__(status, reason, http_resp) -class UnauthorizedException(ApiException): +class UnauthorizedException(PineconeApiException): def __init__(self, status=None, reason=None, http_resp=None): super(UnauthorizedException, self).__init__(status, reason, http_resp) -class ForbiddenException(ApiException): +class ForbiddenException(PineconeApiException): def __init__(self, status=None, reason=None, http_resp=None): super(ForbiddenException, self).__init__(status, reason, http_resp) -class ServiceException(ApiException): +class ServiceException(PineconeApiException): def __init__(self, status=None, reason=None, http_resp=None): super(ServiceException, self).__init__(status, reason, http_resp) diff --git a/pinecone/core/client/model/aws_regions.py b/pinecone/core/client/model/aws_regions.py index 04848cb3f..09739bfea 100644 --- a/pinecone/core/client/model/aws_regions.py +++ b/pinecone/core/client/model/aws_regions.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -156,7 +156,7 @@ def __init__(self, *args, **kwargs): args = list(args) value = args.pop(0) else: - raise ApiTypeError( + raise PineconeApiTypeError( "value is required, but not passed in args or kwargs and doesn't have default", path_to_item=_path_to_item, valid_classes=(self.__class__,), @@ -168,7 +168,7 @@ def __init__(self, *args, **kwargs): _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -185,7 +185,7 @@ def __init__(self, *args, **kwargs): self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, @@ -248,7 +248,7 @@ def _from_openapi_data(cls, *args, **kwargs): args = list(args) value = args.pop(0) else: - raise ApiTypeError( + raise PineconeApiTypeError( "value is required, but not passed in args or kwargs and doesn't have default", path_to_item=_path_to_item, valid_classes=(self.__class__,), @@ -260,7 +260,7 @@ def _from_openapi_data(cls, *args, **kwargs): _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -277,7 +277,7 @@ def _from_openapi_data(cls, *args, **kwargs): self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, diff --git a/pinecone/core/client/model/collection_list.py b/pinecone/core/client/model/collection_list.py index 2cac53b57..1317d964c 100644 --- a/pinecone/core/client/model/collection_list.py +++ b/pinecone/core/client/model/collection_list.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -152,7 +152,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -232,7 +232,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -257,5 +257,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/collection_model.py b/pinecone/core/client/model/collection_model.py index acbcaf952..4e9d54280 100644 --- a/pinecone/core/client/model/collection_model.py +++ b/pinecone/core/client/model/collection_model.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -172,7 +172,7 @@ def _from_openapi_data(cls, name, size, status, dimension, record_count, *args, self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -264,7 +264,7 @@ def __init__(self, name, size, status, dimension, record_count, *args, **kwargs) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -294,5 +294,5 @@ def __init__(self, name, size, status, dimension, record_count, *args, **kwargs) continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/configure_index_request.py b/pinecone/core/client/model/configure_index_request.py index 864c1427b..0cf62d638 100644 --- a/pinecone/core/client/model/configure_index_request.py +++ b/pinecone/core/client/model/configure_index_request.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -154,7 +154,7 @@ def _from_openapi_data(cls, spec, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -237,7 +237,7 @@ def __init__(self, spec, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -263,5 +263,5 @@ def __init__(self, spec, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/configure_index_request_spec.py b/pinecone/core/client/model/configure_index_request_spec.py index e673d077f..151a9955d 100644 --- a/pinecone/core/client/model/configure_index_request_spec.py +++ b/pinecone/core/client/model/configure_index_request_spec.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -154,7 +154,7 @@ def _from_openapi_data(cls, pod, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -237,7 +237,7 @@ def __init__(self, pod, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -263,5 +263,5 @@ def __init__(self, pod, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/configure_index_request_spec_pod.py b/pinecone/core/client/model/configure_index_request_spec_pod.py index a11a43757..8a8adab60 100644 --- a/pinecone/core/client/model/configure_index_request_spec_pod.py +++ b/pinecone/core/client/model/configure_index_request_spec_pod.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -152,7 +152,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -233,7 +233,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -258,5 +258,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/create_collection_request.py b/pinecone/core/client/model/create_collection_request.py index c80103ae1..30f9041f2 100644 --- a/pinecone/core/client/model/create_collection_request.py +++ b/pinecone/core/client/model/create_collection_request.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -151,7 +151,7 @@ def _from_openapi_data(cls, name, source, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -236,7 +236,7 @@ def __init__(self, name, source, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -263,5 +263,5 @@ def __init__(self, name, source, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/create_index_request.py b/pinecone/core/client/model/create_index_request.py index 1bd0b2a83..e362ad43d 100644 --- a/pinecone/core/client/model/create_index_request.py +++ b/pinecone/core/client/model/create_index_request.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -166,7 +166,7 @@ def _from_openapi_data(cls, name, dimension, metric, spec, *args, **kwargs): # self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -255,7 +255,7 @@ def __init__(self, name, dimension, metric, spec, *args, **kwargs): # noqa: E50 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -284,5 +284,5 @@ def __init__(self, name, dimension, metric, spec, *args, **kwargs): # noqa: E50 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/delete_request.py b/pinecone/core/client/model/delete_request.py index 10e0832b3..260871be3 100644 --- a/pinecone/core/client/model/delete_request.py +++ b/pinecone/core/client/model/delete_request.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -157,7 +157,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -240,7 +240,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -265,5 +265,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/describe_index_stats_request.py b/pinecone/core/client/model/describe_index_stats_request.py index a6f8de18d..388f9c026 100644 --- a/pinecone/core/client/model/describe_index_stats_request.py +++ b/pinecone/core/client/model/describe_index_stats_request.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -146,7 +146,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -226,7 +226,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -251,5 +251,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/describe_index_stats_response.py b/pinecone/core/client/model/describe_index_stats_response.py index e56c1ab87..e04ef7e69 100644 --- a/pinecone/core/client/model/describe_index_stats_response.py +++ b/pinecone/core/client/model/describe_index_stats_response.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -161,7 +161,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -244,7 +244,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -269,5 +269,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/error_response.py b/pinecone/core/client/model/error_response.py index 543305804..967176dbf 100644 --- a/pinecone/core/client/model/error_response.py +++ b/pinecone/core/client/model/error_response.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -157,7 +157,7 @@ def _from_openapi_data(cls, status, error, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -242,7 +242,7 @@ def __init__(self, status, error, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -269,5 +269,5 @@ def __init__(self, status, error, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/error_response_error.py b/pinecone/core/client/model/error_response_error.py index 4edd409ff..444fa2afe 100644 --- a/pinecone/core/client/model/error_response_error.py +++ b/pinecone/core/client/model/error_response_error.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -174,7 +174,7 @@ def _from_openapi_data(cls, code, message, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -260,7 +260,7 @@ def __init__(self, code, message, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -287,5 +287,5 @@ def __init__(self, code, message, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/fetch_response.py b/pinecone/core/client/model/fetch_response.py index 64d0f1ab6..a142ed42c 100644 --- a/pinecone/core/client/model/fetch_response.py +++ b/pinecone/core/client/model/fetch_response.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -155,7 +155,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -236,7 +236,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -261,5 +261,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/gcp_regions.py b/pinecone/core/client/model/gcp_regions.py index 8ed733971..e7713bd81 100644 --- a/pinecone/core/client/model/gcp_regions.py +++ b/pinecone/core/client/model/gcp_regions.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -159,7 +159,7 @@ def __init__(self, *args, **kwargs): args = list(args) value = args.pop(0) else: - raise ApiTypeError( + raise PineconeApiTypeError( "value is required, but not passed in args or kwargs and doesn't have default", path_to_item=_path_to_item, valid_classes=(self.__class__,), @@ -171,7 +171,7 @@ def __init__(self, *args, **kwargs): _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -188,7 +188,7 @@ def __init__(self, *args, **kwargs): self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, @@ -251,7 +251,7 @@ def _from_openapi_data(cls, *args, **kwargs): args = list(args) value = args.pop(0) else: - raise ApiTypeError( + raise PineconeApiTypeError( "value is required, but not passed in args or kwargs and doesn't have default", path_to_item=_path_to_item, valid_classes=(self.__class__,), @@ -263,7 +263,7 @@ def _from_openapi_data(cls, *args, **kwargs): _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -280,7 +280,7 @@ def _from_openapi_data(cls, *args, **kwargs): self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, diff --git a/pinecone/core/client/model/index_list.py b/pinecone/core/client/model/index_list.py index a75628d53..fef0fb381 100644 --- a/pinecone/core/client/model/index_list.py +++ b/pinecone/core/client/model/index_list.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -152,7 +152,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -232,7 +232,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -257,5 +257,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/index_model.py b/pinecone/core/client/model/index_model.py index d7f46e91c..1910c7d31 100644 --- a/pinecone/core/client/model/index_model.py +++ b/pinecone/core/client/model/index_model.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -180,7 +180,7 @@ def _from_openapi_data(cls, name, dimension, metric, host, spec, status, *args, self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -273,7 +273,7 @@ def __init__(self, name, dimension, metric, host, spec, status, *args, **kwargs) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -304,5 +304,5 @@ def __init__(self, name, dimension, metric, host, spec, status, *args, **kwargs) continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/index_model_spec.py b/pinecone/core/client/model/index_model_spec.py index 1a15d873f..959de0066 100644 --- a/pinecone/core/client/model/index_model_spec.py +++ b/pinecone/core/client/model/index_model_spec.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -157,7 +157,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -238,7 +238,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -263,5 +263,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/index_model_status.py b/pinecone/core/client/model/index_model_status.py index 7ec7ca4ee..58b2e3e85 100644 --- a/pinecone/core/client/model/index_model_status.py +++ b/pinecone/core/client/model/index_model_status.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -161,7 +161,7 @@ def _from_openapi_data(cls, ready, state, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -246,7 +246,7 @@ def __init__(self, ready, state, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -273,5 +273,5 @@ def __init__(self, ready, state, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/namespace_summary.py b/pinecone/core/client/model/namespace_summary.py index c42d8b5a7..0ea3fd96b 100644 --- a/pinecone/core/client/model/namespace_summary.py +++ b/pinecone/core/client/model/namespace_summary.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -146,7 +146,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -226,7 +226,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -251,5 +251,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/pod_spec.py b/pinecone/core/client/model/pod_spec.py index 62d897214..8e63cbc8b 100644 --- a/pinecone/core/client/model/pod_spec.py +++ b/pinecone/core/client/model/pod_spec.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -185,7 +185,7 @@ def _from_openapi_data(cls, environment, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -282,7 +282,7 @@ def __init__(self, environment, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -312,5 +312,5 @@ def __init__(self, environment, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/pod_spec_metadata_config.py b/pinecone/core/client/model/pod_spec_metadata_config.py index b41a51f3f..8fe593d5d 100644 --- a/pinecone/core/client/model/pod_spec_metadata_config.py +++ b/pinecone/core/client/model/pod_spec_metadata_config.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -146,7 +146,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -226,7 +226,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -251,5 +251,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/protobuf_any.py b/pinecone/core/client/model/protobuf_any.py index fb46af753..c1bbf8c64 100644 --- a/pinecone/core/client/model/protobuf_any.py +++ b/pinecone/core/client/model/protobuf_any.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -149,7 +149,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -230,7 +230,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -255,5 +255,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/protobuf_null_value.py b/pinecone/core/client/model/protobuf_null_value.py index 83e635111..f38ae2ca8 100644 --- a/pinecone/core/client/model/protobuf_null_value.py +++ b/pinecone/core/client/model/protobuf_null_value.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -162,7 +162,7 @@ def __init__(self, *args, **kwargs): _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -179,7 +179,7 @@ def __init__(self, *args, **kwargs): self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, @@ -250,7 +250,7 @@ def _from_openapi_data(cls, *args, **kwargs): _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -267,7 +267,7 @@ def _from_openapi_data(cls, *args, **kwargs): self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, diff --git a/pinecone/core/client/model/query_request.py b/pinecone/core/client/model/query_request.py index e5a209480..0fe0779aa 100644 --- a/pinecone/core/client/model/query_request.py +++ b/pinecone/core/client/model/query_request.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -191,7 +191,7 @@ def _from_openapi_data(cls, top_k, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -282,7 +282,7 @@ def __init__(self, top_k, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -308,5 +308,5 @@ def __init__(self, top_k, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/query_response.py b/pinecone/core/client/model/query_response.py index 49e28d999..5f932cc43 100644 --- a/pinecone/core/client/model/query_response.py +++ b/pinecone/core/client/model/query_response.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -160,7 +160,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -242,7 +242,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -267,5 +267,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/query_vector.py b/pinecone/core/client/model/query_vector.py index 62c5bb713..68784ec14 100644 --- a/pinecone/core/client/model/query_vector.py +++ b/pinecone/core/client/model/query_vector.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -172,7 +172,7 @@ def _from_openapi_data(cls, values, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -259,7 +259,7 @@ def __init__(self, values, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -285,5 +285,5 @@ def __init__(self, values, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/rpc_status.py b/pinecone/core/client/model/rpc_status.py index aa3f851e9..ebcfb2c28 100644 --- a/pinecone/core/client/model/rpc_status.py +++ b/pinecone/core/client/model/rpc_status.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -158,7 +158,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -240,7 +240,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -265,5 +265,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/scored_vector.py b/pinecone/core/client/model/scored_vector.py index 69828a242..b8681f645 100644 --- a/pinecone/core/client/model/scored_vector.py +++ b/pinecone/core/client/model/scored_vector.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -170,7 +170,7 @@ def _from_openapi_data(cls, id, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -257,7 +257,7 @@ def __init__(self, id, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -283,5 +283,5 @@ def __init__(self, id, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/serverless_spec.py b/pinecone/core/client/model/serverless_spec.py index 1fd00c6d0..7f967c6e0 100644 --- a/pinecone/core/client/model/serverless_spec.py +++ b/pinecone/core/client/model/serverless_spec.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -156,7 +156,7 @@ def _from_openapi_data(cls, cloud, region, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -241,7 +241,7 @@ def __init__(self, cloud, region, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -268,5 +268,5 @@ def __init__(self, cloud, region, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/single_query_results.py b/pinecone/core/client/model/single_query_results.py index 9fe8c4313..389af078c 100644 --- a/pinecone/core/client/model/single_query_results.py +++ b/pinecone/core/client/model/single_query_results.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -155,7 +155,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -236,7 +236,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -261,5 +261,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/sparse_values.py b/pinecone/core/client/model/sparse_values.py index 62374846e..95bc4e945 100644 --- a/pinecone/core/client/model/sparse_values.py +++ b/pinecone/core/client/model/sparse_values.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -155,7 +155,7 @@ def _from_openapi_data(cls, indices, values, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -240,7 +240,7 @@ def __init__(self, indices, values, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -267,5 +267,5 @@ def __init__(self, indices, values, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/update_request.py b/pinecone/core/client/model/update_request.py index 3fb151e8c..aebfd0c4b 100644 --- a/pinecone/core/client/model/update_request.py +++ b/pinecone/core/client/model/update_request.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -172,7 +172,7 @@ def _from_openapi_data(cls, id, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -259,7 +259,7 @@ def __init__(self, id, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -285,5 +285,5 @@ def __init__(self, id, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/upsert_request.py b/pinecone/core/client/model/upsert_request.py index 5e20e01ee..20d79830b 100644 --- a/pinecone/core/client/model/upsert_request.py +++ b/pinecone/core/client/model/upsert_request.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -159,7 +159,7 @@ def _from_openapi_data(cls, vectors, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -243,7 +243,7 @@ def __init__(self, vectors, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -269,5 +269,5 @@ def __init__(self, vectors, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/upsert_response.py b/pinecone/core/client/model/upsert_response.py index 3a0c766cc..22b30a822 100644 --- a/pinecone/core/client/model/upsert_response.py +++ b/pinecone/core/client/model/upsert_response.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError @@ -146,7 +146,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -226,7 +226,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -251,5 +251,5 @@ def __init__(self, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model/vector.py b/pinecone/core/client/model/vector.py index 7c94ea867..031506e5b 100644 --- a/pinecone/core/client/model/vector.py +++ b/pinecone/core/client/model/vector.py @@ -12,7 +12,7 @@ import sys # noqa: F401 from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, + PineconeApiTypeError, ModelComposed, ModelNormal, ModelSimple, @@ -26,7 +26,7 @@ validate_get_composed_info, ) from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError +from pinecone.core.client.exceptions import PineconeApiAttributeError def lazy_import(): @@ -169,7 +169,7 @@ def _from_openapi_data(cls, id, values, *args, **kwargs): # noqa: E501 self = super(OpenApiModel, cls).__new__(cls) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -256,7 +256,7 @@ def __init__(self, id, values, *args, **kwargs): # noqa: E501 _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: - raise ApiTypeError( + raise PineconeApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, @@ -283,5 +283,5 @@ def __init__(self, id, values, *args, **kwargs): # noqa: E501 continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.") diff --git a/pinecone/core/client/model_utils.py b/pinecone/core/client/model_utils.py index f07308a93..530b7c819 100644 --- a/pinecone/core/client/model_utils.py +++ b/pinecone/core/client/model_utils.py @@ -19,10 +19,10 @@ from dateutil.parser import parse from pinecone.core.client.exceptions import ( - ApiKeyError, - ApiAttributeError, - ApiTypeError, - ApiValueError, + PineconeApiKeyError, + PineconeApiAttributeError, + PineconeApiTypeError, + PineconeApiValueError, ) none_type = type(None) @@ -129,7 +129,7 @@ def set_attribute(self, name, value): if name in self.openapi_types: required_types_mixed = self.openapi_types[name] elif self.additional_properties_type is None: - raise ApiAttributeError( + raise PineconeApiAttributeError( "{0} has no attribute '{1}'".format( type(self).__name__, name), path_to_item @@ -144,7 +144,7 @@ def set_attribute(self, name, value): valid_classes=(str,), key_type=True ) - raise ApiTypeError( + raise PineconeApiTypeError( error_msg, path_to_item=path_to_item, valid_classes=(str,), @@ -238,7 +238,7 @@ def __new__(cls, *args, **kwargs): else: # The input data does not contain the discriminator property. path_to_item = kwargs.get('_path_to_item', ()) - raise ApiValueError( + raise PineconeApiValueError( "Cannot deserialize input data due to missing discriminator. " "The discriminator property '%s' is missing at path: %s" % (discr_propertyname_js, path_to_item) @@ -254,7 +254,7 @@ def __new__(cls, *args, **kwargs): path_to_item = kwargs.get('_path_to_item', ()) disc_prop_value = kwargs.get( discr_propertyname_js, kwargs.get(discr_propertyname_py)) - raise ApiValueError( + raise PineconeApiValueError( "Cannot deserialize input data due to invalid discriminator " "value. The OpenAPI document has no mapping for discriminator " "property '%s'='%s' at path: %s" % @@ -354,7 +354,7 @@ def _new_from_openapi_data(cls, *args, **kwargs): else: # The input data does not contain the discriminator property. path_to_item = kwargs.get('_path_to_item', ()) - raise ApiValueError( + raise PineconeApiValueError( "Cannot deserialize input data due to missing discriminator. " "The discriminator property '%s' is missing at path: %s" % (discr_propertyname_js, path_to_item) @@ -370,7 +370,7 @@ def _new_from_openapi_data(cls, *args, **kwargs): path_to_item = kwargs.get('_path_to_item', ()) disc_prop_value = kwargs.get( discr_propertyname_js, kwargs.get(discr_propertyname_py)) - raise ApiValueError( + raise PineconeApiValueError( "Cannot deserialize input data due to invalid discriminator " "value. The OpenAPI document has no mapping for discriminator " "property '%s'='%s' at path: %s" % @@ -439,7 +439,7 @@ def __getitem__(self, name): if name in self: return self.get(name) - raise ApiAttributeError( + raise PineconeApiAttributeError( "{0} has no attribute '{1}'".format( type(self).__name__, name), [e for e in [self._path_to_item, name] if e] @@ -494,7 +494,7 @@ def __getitem__(self, name): if name in self: return self.get(name) - raise ApiAttributeError( + raise PineconeApiAttributeError( "{0} has no attribute '{1}'".format( type(self).__name__, name), [e for e in [self._path_to_item, name] if e] @@ -589,7 +589,7 @@ def __setitem__(self, name, value): - have additionalProperties set """ if name not in self.openapi_types: - raise ApiAttributeError( + raise PineconeApiAttributeError( "{0} has no attribute '{1}'".format( type(self).__name__, name), [e for e in [self._path_to_item, name] if e] @@ -629,7 +629,7 @@ def get(self, name, default=None): elif len_values == 1: return values[0] elif len_values > 1: - raise ApiValueError( + raise PineconeApiValueError( "Values stored for property {0} in {1} differ when looking " "at self and self's composed instances. All values must be " "the same".format(name, type(self).__name__), @@ -640,7 +640,7 @@ def __getitem__(self, name): """get the value of an attribute using square-bracket notation: `instance[attr]`""" value = self.get(name, self.__unset_attribute_value__) if value is self.__unset_attribute_value__: - raise ApiAttributeError( + raise PineconeApiAttributeError( "{0} has no attribute '{1}'".format( type(self).__name__, name), [e for e in [self._path_to_item, name] if e] @@ -820,7 +820,7 @@ def check_allowed_values(allowed_values, input_variable_path, input_values): set(these_allowed_values))): invalid_values = ", ".join( map(str, set(input_values) - set(these_allowed_values))), - raise ApiValueError( + raise PineconeApiValueError( "Invalid values for `%s` [%s], must be a subset of [%s]" % ( input_variable_path[0], @@ -833,7 +833,7 @@ def check_allowed_values(allowed_values, input_variable_path, input_values): input_values.keys()).issubset(set(these_allowed_values))): invalid_values = ", ".join( map(str, set(input_values.keys()) - set(these_allowed_values))) - raise ApiValueError( + raise PineconeApiValueError( "Invalid keys in `%s` [%s], must be a subset of [%s]" % ( input_variable_path[0], @@ -843,7 +843,7 @@ def check_allowed_values(allowed_values, input_variable_path, input_values): ) elif (not isinstance(input_values, (list, dict)) and input_values not in these_allowed_values): - raise ApiValueError( + raise PineconeApiValueError( "Invalid value for `%s` (%s), must be one of %s" % ( input_variable_path[0], @@ -890,7 +890,7 @@ def check_validations( isinstance(input_values, (int, float)) and not (float(input_values) / current_validations['multiple_of']).is_integer()): # Note 'multipleOf' will be as good as the floating point arithmetic. - raise ApiValueError( + raise PineconeApiValueError( "Invalid value for `%s`, value must be a multiple of " "`%s`" % ( input_variable_path[0], @@ -901,7 +901,7 @@ def check_validations( if (is_json_validation_enabled('maxLength', configuration) and 'max_length' in current_validations and len(input_values) > current_validations['max_length']): - raise ApiValueError( + raise PineconeApiValueError( "Invalid value for `%s`, length must be less than or equal to " "`%s`" % ( input_variable_path[0], @@ -912,7 +912,7 @@ def check_validations( if (is_json_validation_enabled('minLength', configuration) and 'min_length' in current_validations and len(input_values) < current_validations['min_length']): - raise ApiValueError( + raise PineconeApiValueError( "Invalid value for `%s`, length must be greater than or equal to " "`%s`" % ( input_variable_path[0], @@ -923,7 +923,7 @@ def check_validations( if (is_json_validation_enabled('maxItems', configuration) and 'max_items' in current_validations and len(input_values) > current_validations['max_items']): - raise ApiValueError( + raise PineconeApiValueError( "Invalid value for `%s`, number of items must be less than or " "equal to `%s`" % ( input_variable_path[0], @@ -958,7 +958,7 @@ def check_validations( if (is_json_validation_enabled('exclusiveMaximum', configuration) and 'exclusive_maximum' in current_validations and max_val >= current_validations['exclusive_maximum']): - raise ApiValueError( + raise PineconeApiValueError( "Invalid value for `%s`, must be a value less than `%s`" % ( input_variable_path[0], current_validations['exclusive_maximum'] @@ -968,7 +968,7 @@ def check_validations( if (is_json_validation_enabled('maximum', configuration) and 'inclusive_maximum' in current_validations and max_val > current_validations['inclusive_maximum']): - raise ApiValueError( + raise PineconeApiValueError( "Invalid value for `%s`, must be a value less than or equal to " "`%s`" % ( input_variable_path[0], @@ -979,7 +979,7 @@ def check_validations( if (is_json_validation_enabled('exclusiveMinimum', configuration) and 'exclusive_minimum' in current_validations and min_val <= current_validations['exclusive_minimum']): - raise ApiValueError( + raise PineconeApiValueError( "Invalid value for `%s`, must be a value greater than `%s`" % ( input_variable_path[0], @@ -990,7 +990,7 @@ def check_validations( if (is_json_validation_enabled('minimum', configuration) and 'inclusive_minimum' in current_validations and min_val < current_validations['inclusive_minimum']): - raise ApiValueError( + raise PineconeApiValueError( "Invalid value for `%s`, must be a value greater than or equal " "to `%s`" % ( input_variable_path[0], @@ -1010,7 +1010,7 @@ def check_validations( # Don't print the regex flags if the flags are not # specified in the OAS document. err_msg = r"%s with flags=`%s`" % (err_msg, flags) - raise ApiValueError(err_msg) + raise PineconeApiValueError(err_msg) def order_response_types(required_types): @@ -1041,7 +1041,7 @@ def index_getter(class_or_instance): return COERCION_INDEX_BY_TYPE[ModelSimple] elif class_or_instance in COERCION_INDEX_BY_TYPE: return COERCION_INDEX_BY_TYPE[class_or_instance] - raise ApiValueError("Unsupported type: %s" % class_or_instance) + raise PineconeApiValueError("Unsupported type: %s" % class_or_instance) sorted_types = sorted( required_types, @@ -1196,7 +1196,7 @@ def get_type_error(var_value, path_to_item, valid_classes, key_type=False): valid_classes=valid_classes, key_type=key_type ) - return ApiTypeError( + return PineconeApiTypeError( error_msg, path_to_item=path_to_item, valid_classes=valid_classes, @@ -1248,7 +1248,7 @@ def deserialize_primitive(data, klass, path_to_item): return converted_value except (OverflowError, ValueError) as ex: # parse can raise OverflowError - raise ApiValueError( + raise PineconeApiValueError( "{0}Failed to parse {1} as {2}".format( additional_message, repr(data), klass.__name__ ), @@ -1328,9 +1328,9 @@ def deserialize_model(model_data, model_class, path_to_item, check_type, model instance Raise: - ApiTypeError - ApiValueError - ApiKeyError + PineconeApiTypeError + PineconeApiValueError + PineconeApiKeyError """ kw_args = dict(_check_type=check_type, @@ -1408,9 +1408,9 @@ def attempt_convert_item(input_value, valid_classes, path_to_item, instance (any) the fixed item Raises: - ApiTypeError - ApiValueError - ApiKeyError + PineconeApiTypeError + PineconeApiValueError + PineconeApiKeyError """ valid_classes_ordered = order_response_types(valid_classes) valid_classes_coercible = remove_uncoercible( @@ -1431,7 +1431,7 @@ def attempt_convert_item(input_value, valid_classes, path_to_item, return deserialize_file(input_value, configuration) return deserialize_primitive(input_value, valid_class, path_to_item) - except (ApiTypeError, ApiValueError, ApiKeyError) as conversion_exc: + except (PineconeApiTypeError, PineconeApiValueError, PineconeApiKeyError) as conversion_exc: if must_convert: raise conversion_exc # if we have conversion errors when must_convert == False @@ -1527,7 +1527,7 @@ def validate_and_convert_types(input_value, required_types_mixed, path_to_item, the correctly typed value Raises: - ApiTypeError + PineconeApiTypeError """ results = get_required_type_classes(required_types_mixed, spec_property_naming) valid_classes, child_req_types_by_current_type = results @@ -1750,7 +1750,7 @@ def get_allof_instances(self, model_args, constant_args): allof_instance = allof_class(**model_args, **constant_args) composed_instances.append(allof_instance) except Exception as ex: - raise ApiValueError( + raise PineconeApiValueError( "Invalid inputs given to generate an instance of '%s'. The " "input data was invalid for the allOf schema '%s' in the composed " "schema '%s'. Error=%s" % ( @@ -1826,13 +1826,13 @@ def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None): except Exception: pass if len(oneof_instances) == 0: - raise ApiValueError( + raise PineconeApiValueError( "Invalid inputs given to generate an instance of %s. None " "of the oneOf schemas matched the input data." % cls.__name__ ) elif len(oneof_instances) > 1: - raise ApiValueError( + raise PineconeApiValueError( "Invalid inputs given to generate an instance of %s. Multiple " "oneOf schemas matched the inputs, but a max of one is allowed." % cls.__name__ @@ -1872,7 +1872,7 @@ def get_anyof_instances(self, model_args, constant_args): except Exception: pass if len(anyof_instances) == 0: - raise ApiValueError( + raise PineconeApiValueError( "Invalid inputs given to generate an instance of %s. None of the " "anyOf schemas matched the inputs." % self.__class__.__name__ diff --git a/pinecone/core/client/rest.py b/pinecone/core/client/rest.py index 9a51bb9b4..a7b8d432e 100644 --- a/pinecone/core/client/rest.py +++ b/pinecone/core/client/rest.py @@ -18,7 +18,7 @@ import urllib3 -from pinecone.core.client.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError +from pinecone.core.client.exceptions import PineconeApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, PineconeApiValueError class bcolors: @@ -147,7 +147,7 @@ def request(self, method, url, query_params=None, headers=None, print(bcolors.OKBLUE + "curl -X {method} '{url}' {formatted_headers} -d '{data}'".format(method=method, url=formatted_url, formatted_headers=formatted_headers, data=formatted_body) + bcolors.ENDC) if post_params and body: - raise ApiValueError( + raise PineconeApiValueError( "body parameter cannot be used with post_params parameter." ) @@ -217,7 +217,7 @@ def request(self, method, url, query_params=None, headers=None, msg = """Cannot prepare a request message for provided arguments. Please check that your arguments match declared content type.""" - raise ApiException(status=0, reason=msg) + raise PineconeApiException(status=0, reason=msg) # For `GET`, `HEAD` else: r = self.pool_manager.request(method, url, @@ -227,7 +227,7 @@ def request(self, method, url, query_params=None, headers=None, headers=headers) except urllib3.exceptions.SSLError as e: msg = "{0}\n{1}".format(type(e).__name__, str(e)) - raise ApiException(status=0, reason=msg) + raise PineconeApiException(status=0, reason=msg) if os.environ.get('PINECONE_DEBUG_CURL'): o = RESTResponse(r) @@ -257,7 +257,7 @@ def request(self, method, url, query_params=None, headers=None, if 500 <= r.status <= 599: raise ServiceException(http_resp=r) - raise ApiException(http_resp=r) + raise PineconeApiException(http_resp=r) return r From 5239ace68b82156de7f5c068ffa739d8d0609620 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Mon, 27 Nov 2023 21:32:59 -0500 Subject: [PATCH 2/6] Rename imports --- pinecone/control/index_host_store.py | 3 +- pinecone/exceptions.py | 28 ++++++++----------- tests/integ/test_index.py | 6 ++-- tests/integration/conftest.py | 4 +-- .../test_create_index_api_errors.py | 12 ++++---- 5 files changed, 25 insertions(+), 28 deletions(-) diff --git a/pinecone/control/index_host_store.py b/pinecone/control/index_host_store.py index d27bf12af..69e98bf91 100644 --- a/pinecone/control/index_host_store.py +++ b/pinecone/control/index_host_store.py @@ -1,6 +1,7 @@ from typing import Dict from pinecone.config import Config from pinecone.core.client.api.manage_pod_indexes_api import ManagePodIndexesApi as IndexOperationsApi +from pinecone.core.client.exceptions import PineconeException class SingletonMeta(type): _instances: Dict[str, str] = {} @@ -40,5 +41,5 @@ def get_host(self, api: IndexOperationsApi, config: Config, index_name: str) -> description = api.describe_index(index_name) self.set_host(config, index_name, description.host) if not self.key_exists(key): - raise Exception(f"Could not get host for index: {index_name}. Call describe_index('{index_name}') to check the current status.") + raise PineconeException(f"Could not get host for index: {index_name}. Call describe_index('{index_name}') to check the current status.") return self._indexHosts[key] diff --git a/pinecone/exceptions.py b/pinecone/exceptions.py index 98610be39..cda2bee11 100644 --- a/pinecone/exceptions.py +++ b/pinecone/exceptions.py @@ -1,19 +1,16 @@ from .core.client.exceptions import ( - OpenApiException, - ApiAttributeError, - ApiTypeError, - ApiValueError, - ApiKeyError, - ApiException, + PineconeException, + PineconeApiAttributeError, + PineconeApiTypeError, + PineconeApiValueError, + PineconeApiKeyError, + PineconeApiException, NotFoundException, UnauthorizedException, ForbiddenException, ServiceException, ) -class PineconeException(Exception): - """The base exception class for all Pinecone client exceptions.""" - class PineconeProtocolError(PineconeException): """Raised when something unexpected happens mid-request/response.""" @@ -22,14 +19,13 @@ class PineconeConfigurationError(PineconeException): __all__ = [ "PineconeConfigurationError", + "PineconeProtocolError" "PineconeException", - "PineconeProtocolError", - "OpenApiException", - "ApiAttributeError", - "ApiTypeError", - "ApiValueError", - "ApiKeyError", - "ApiException", + "PineconeApiAttributeError", + "PineconeApiTypeError", + "PineconeApiValueError", + "PineconeApiKeyError", + "PineconeApiException", "NotFoundException", "UnauthorizedException", "ForbiddenException", diff --git a/tests/integ/test_index.py b/tests/integ/test_index.py index cb52b6c56..2df35b986 100644 --- a/tests/integ/test_index.py +++ b/tests/integ/test_index.py @@ -5,7 +5,7 @@ import responses as req_responses import pinecone -from pinecone import ApiTypeError, ApiException +from pinecone import PineconeApiTypeError, PineconeApiException responses_req = Responses() responses = Responses("requests.packages.urllib3") @@ -38,7 +38,7 @@ def test_invalid_upsert_request_vector_value_type(): ) pinecone.init("example-api-key", environment="example-environment") - with pytest.raises(ApiException) as exc_info: + with pytest.raises(PineconeApiException) as exc_info: index = pinecone.Index("example-index") resp = index.upsert(vectors=[("vec1", [0.1] * 8), ("vec2", [0.2] * 8)]) @@ -133,6 +133,6 @@ def _test_invalid_delete_response_wrong_type(): index = pinecone.Index("example-index") - with pytest.raises(ApiTypeError) as exc_info: + with pytest.raises(PineconeApiTypeError) as exc_info: resp = index.delete(ids=["vec1", "vec2"]) assert resp.deleted_count == 2 diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 79b78419b..d8d333e20 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -1,7 +1,7 @@ import pytest import random import time -from pinecone import Pinecone, NotFoundException, ApiException +from pinecone import Pinecone, NotFoundException, PineconeApiException from .helpers.helpers import generate_index_name, get_environment_var @pytest.fixture() @@ -66,7 +66,7 @@ def delete_with_retry(client, index_name, retries=0, sleep_interval=5): client.delete_index(index_name, -1) except NotFoundException: pass - except ApiException as e: + except PineconeApiException as e: if e.error.code == 'PRECONDITON_FAILED': if retries > 5: raise 'Unable to delete index ' + index_name diff --git a/tests/integration/test_create_index_api_errors.py b/tests/integration/test_create_index_api_errors.py index 8eeb3f3db..89ae97946 100644 --- a/tests/integration/test_create_index_api_errors.py +++ b/tests/integration/test_create_index_api_errors.py @@ -1,25 +1,25 @@ import pytest -from pinecone import ApiException, ApiValueError +from pinecone import PineconeApiException, PineconeApiValueError class TestCreateIndexApiErrorCases: def test_create_index_with_invalid_name(self, client, create_sl_index_params): create_sl_index_params['name'] = '-invalid-name' - with pytest.raises(ApiException): + with pytest.raises(PineconeApiException): client.create_index(**create_sl_index_params) def test_create_index_invalid_metric(self, client, create_sl_index_params): create_sl_index_params['metric'] = 'invalid' - with pytest.raises(ApiValueError): + with pytest.raises(PineconeApiValueError): client.create_index(**create_sl_index_params) def test_create_index_with_invalid_neg_dimension(self, client, create_sl_index_params): create_sl_index_params['dimension'] = -1 - with pytest.raises(ApiValueError): + with pytest.raises(PineconeApiValueError): client.create_index(**create_sl_index_params) def test_create_index_that_already_exists(self, client, create_sl_index_params): client.create_index(**create_sl_index_params) - with pytest.raises(ApiException): + with pytest.raises(PineconeApiException): client.create_index(**create_sl_index_params) @pytest.mark.skip(reason='Bug filed https://app.asana.com/0/1205078872348810/1205917627868143') @@ -27,5 +27,5 @@ def test_create_index_w_incompatible_options(self, client, create_sl_index_param create_sl_index_params['pod_type'] = 'p1.x2' create_sl_index_params['environment'] = 'us-east1-gcp' create_sl_index_params['replicas'] = 2 - with pytest.raises(ApiException): + with pytest.raises(PineconeApiException): client.create_index(**create_sl_index_params) \ No newline at end of file From 52848c388e34736a9e1c75c3388c17a27006a100 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Wed, 29 Nov 2023 16:45:33 -0500 Subject: [PATCH 3/6] Update test imports --- pinecone/config/config.py | 2 +- tests/unit/test_config.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pinecone/config/config.py b/pinecone/config/config.py index 2bd851419..42c7f6d3e 100644 --- a/pinecone/config/config.py +++ b/pinecone/config/config.py @@ -2,7 +2,7 @@ import os from pinecone.exceptions import PineconeConfigurationError -from pinecone.core.client.exceptions import ApiKeyError +from pinecone.core.client.exceptions import PineconeApiKeyError from pinecone.config.openapi import OpenApiConfigFactory from pinecone.core.client.configuration import Configuration as OpenApiConfiguration diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py index aebd002c6..cc08dd2b9 100644 --- a/tests/unit/test_config.py +++ b/tests/unit/test_config.py @@ -1,5 +1,5 @@ import pinecone -from pinecone.exceptions import ApiKeyError, PineconeConfigurationError +from pinecone.exceptions import PineconeApiKeyError, PineconeConfigurationError from pinecone.config import PineconeConfig from pinecone.core.client.configuration import Configuration as OpenApiConfiguration From a8ec9bc2c96ae1a30c1137917ba80726b4241f2d Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Wed, 29 Nov 2023 16:53:36 -0500 Subject: [PATCH 4/6] Fix syntax error --- pinecone/exceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pinecone/exceptions.py b/pinecone/exceptions.py index cda2bee11..24319f657 100644 --- a/pinecone/exceptions.py +++ b/pinecone/exceptions.py @@ -19,7 +19,7 @@ class PineconeConfigurationError(PineconeException): __all__ = [ "PineconeConfigurationError", - "PineconeProtocolError" + "PineconeProtocolError", "PineconeException", "PineconeApiAttributeError", "PineconeApiTypeError", From 0c7ae30fbf8245992a0771e442062878d0f936ff Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Wed, 29 Nov 2023 17:56:50 -0500 Subject: [PATCH 5/6] Fix syntax error --- tests/integration/test_create_index_type_errors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_create_index_type_errors.py b/tests/integration/test_create_index_type_errors.py index b4f649c07..252b6840b 100644 --- a/tests/integration/test_create_index_type_errors.py +++ b/tests/integration/test_create_index_type_errors.py @@ -1,10 +1,10 @@ import pytest -from pinecone import ApiTypeError +from pinecone import PineconeApiTypeError class TestCreateIndexTypeErrorCases: def test_create_index_with_invalid_str_dimension(self, client, create_sl_index_params): create_sl_index_params['dimension'] = '10' - with pytest.raises(ApiTypeError): + with pytest.raises(PineconeApiTypeError): client.create_index(**create_sl_index_params) def test_create_index_with_missing_dimension(self, client, create_sl_index_params): From a8acbd3ae7c48f55fc168c736172ee5910277e62 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Wed, 29 Nov 2023 22:49:28 -0500 Subject: [PATCH 6/6] Remove unused --- pinecone/config/config.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pinecone/config/config.py b/pinecone/config/config.py index 42c7f6d3e..92d7a7767 100644 --- a/pinecone/config/config.py +++ b/pinecone/config/config.py @@ -2,7 +2,6 @@ import os from pinecone.exceptions import PineconeConfigurationError -from pinecone.core.client.exceptions import PineconeApiKeyError from pinecone.config.openapi import OpenApiConfigFactory from pinecone.core.client.configuration import Configuration as OpenApiConfiguration