|
| 1 | +""" |
| 2 | +Pinecone Control Plane API |
| 3 | +
|
| 4 | +Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 |
| 5 | +
|
| 6 | +This file is @generated using OpenAPI. |
| 7 | +
|
| 8 | +The version of the OpenAPI document: 2025-04 |
| 9 | + |
| 10 | +""" |
| 11 | + |
| 12 | +from pinecone.openapi_support.model_utils import ( # noqa: F401 |
| 13 | + PineconeApiTypeError, |
| 14 | + ModelComposed, |
| 15 | + ModelNormal, |
| 16 | + ModelSimple, |
| 17 | + OpenApiModel, |
| 18 | + cached_property, |
| 19 | + change_keys_js_to_python, |
| 20 | + convert_js_args_to_python_args, |
| 21 | + date, |
| 22 | + datetime, |
| 23 | + file_type, |
| 24 | + none_type, |
| 25 | + validate_get_composed_info, |
| 26 | +) |
| 27 | +from pinecone.openapi_support.exceptions import PineconeApiAttributeError |
| 28 | + |
| 29 | + |
| 30 | +def lazy_import(): |
| 31 | + from pinecone.core.openapi.db_control.model.backup_model import BackupModel |
| 32 | + from pinecone.core.openapi.db_control.model.pagination_response import PaginationResponse |
| 33 | + |
| 34 | + globals()["BackupModel"] = BackupModel |
| 35 | + globals()["PaginationResponse"] = PaginationResponse |
| 36 | + |
| 37 | + |
| 38 | +from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar |
| 39 | +from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property |
| 40 | + |
| 41 | +T = TypeVar("T", bound="BackupList") |
| 42 | + |
| 43 | + |
| 44 | +class BackupList(ModelNormal): |
| 45 | + """NOTE: This class is @generated using OpenAPI. |
| 46 | +
|
| 47 | + Do not edit the class manually. |
| 48 | +
|
| 49 | + Attributes: |
| 50 | + allowed_values (dict): The key is the tuple path to the attribute |
| 51 | + and the for var_name this is (var_name,). The value is a dict |
| 52 | + with a capitalized key describing the allowed value and an allowed |
| 53 | + value. These dicts store the allowed enum values. |
| 54 | + attribute_map (dict): The key is attribute name |
| 55 | + and the value is json key in definition. |
| 56 | + discriminator_value_class_map (dict): A dict to go from the discriminator |
| 57 | + variable value to the discriminator class name. |
| 58 | + validations (dict): The key is the tuple path to the attribute |
| 59 | + and the for var_name this is (var_name,). The value is a dict |
| 60 | + that stores validations for max_length, min_length, max_items, |
| 61 | + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, |
| 62 | + inclusive_minimum, and regex. |
| 63 | + additional_properties_type (tuple): A tuple of classes accepted |
| 64 | + as additional properties values. |
| 65 | + """ |
| 66 | + |
| 67 | + _data_store: Dict[str, Any] |
| 68 | + _check_type: bool |
| 69 | + |
| 70 | + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = {} |
| 71 | + |
| 72 | + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = {} |
| 73 | + |
| 74 | + @cached_class_property |
| 75 | + def additional_properties_type(cls): |
| 76 | + """ |
| 77 | + This must be a method because a model may have properties that are |
| 78 | + of type self, this must run after the class is loaded |
| 79 | + """ |
| 80 | + lazy_import() |
| 81 | + return (bool, dict, float, int, list, str, none_type) # noqa: E501 |
| 82 | + |
| 83 | + _nullable = False |
| 84 | + |
| 85 | + @cached_class_property |
| 86 | + def openapi_types(cls): |
| 87 | + """ |
| 88 | + This must be a method because a model may have properties that are |
| 89 | + of type self, this must run after the class is loaded |
| 90 | +
|
| 91 | + Returns |
| 92 | + openapi_types (dict): The key is attribute name |
| 93 | + and the value is attribute type. |
| 94 | + """ |
| 95 | + lazy_import() |
| 96 | + return { |
| 97 | + "data": ([BackupModel],), # noqa: E501 |
| 98 | + "pagination": (PaginationResponse,), # noqa: E501 |
| 99 | + } |
| 100 | + |
| 101 | + @cached_class_property |
| 102 | + def discriminator(cls): |
| 103 | + return None |
| 104 | + |
| 105 | + attribute_map: Dict[str, str] = { |
| 106 | + "data": "data", # noqa: E501 |
| 107 | + "pagination": "pagination", # noqa: E501 |
| 108 | + } |
| 109 | + |
| 110 | + read_only_vars: Set[str] = set([]) |
| 111 | + |
| 112 | + _composed_schemas: Dict[Literal["allOf", "oneOf", "anyOf"], Any] = {} |
| 113 | + |
| 114 | + @classmethod |
| 115 | + @convert_js_args_to_python_args |
| 116 | + def _from_openapi_data(cls: Type[T], *args, **kwargs) -> T: # noqa: E501 |
| 117 | + """BackupList - a model defined in OpenAPI |
| 118 | +
|
| 119 | + Keyword Args: |
| 120 | + _check_type (bool): if True, values for parameters in openapi_types |
| 121 | + will be type checked and a TypeError will be |
| 122 | + raised if the wrong type is input. |
| 123 | + Defaults to True |
| 124 | + _path_to_item (tuple/list): This is a list of keys or values to |
| 125 | + drill down to the model in received_data |
| 126 | + when deserializing a response |
| 127 | + _spec_property_naming (bool): True if the variable names in the input data |
| 128 | + are serialized names, as specified in the OpenAPI document. |
| 129 | + False if the variable names in the input data |
| 130 | + are pythonic names, e.g. snake case (default) |
| 131 | + _configuration (Configuration): the instance to use when |
| 132 | + deserializing a file_type parameter. |
| 133 | + If passed, type conversion is attempted |
| 134 | + If omitted no type conversion is done. |
| 135 | + _visited_composed_classes (tuple): This stores a tuple of |
| 136 | + classes that we have traveled through so that |
| 137 | + if we see that class again we will not use its |
| 138 | + discriminator again. |
| 139 | + When traveling through a discriminator, the |
| 140 | + composed schema that is |
| 141 | + is traveled through is added to this set. |
| 142 | + For example if Animal has a discriminator |
| 143 | + petType and we pass in "Dog", and the class Dog |
| 144 | + allOf includes Animal, we move through Animal |
| 145 | + once using the discriminator, and pick Dog. |
| 146 | + Then in Dog, we will make an instance of the |
| 147 | + Animal class but this time we won't travel |
| 148 | + through its discriminator because we passed in |
| 149 | + _visited_composed_classes = (Animal,) |
| 150 | + data ([BackupModel]): [optional] # noqa: E501 |
| 151 | + pagination (PaginationResponse): [optional] # noqa: E501 |
| 152 | + """ |
| 153 | + |
| 154 | + _check_type = kwargs.pop("_check_type", True) |
| 155 | + _spec_property_naming = kwargs.pop("_spec_property_naming", False) |
| 156 | + _path_to_item = kwargs.pop("_path_to_item", ()) |
| 157 | + _configuration = kwargs.pop("_configuration", None) |
| 158 | + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) |
| 159 | + |
| 160 | + self = super(OpenApiModel, cls).__new__(cls) |
| 161 | + |
| 162 | + if args: |
| 163 | + raise PineconeApiTypeError( |
| 164 | + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." |
| 165 | + % (args, self.__class__.__name__), |
| 166 | + path_to_item=_path_to_item, |
| 167 | + valid_classes=(self.__class__,), |
| 168 | + ) |
| 169 | + |
| 170 | + self._data_store = {} |
| 171 | + self._check_type = _check_type |
| 172 | + self._spec_property_naming = _spec_property_naming |
| 173 | + self._path_to_item = _path_to_item |
| 174 | + self._configuration = _configuration |
| 175 | + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) |
| 176 | + |
| 177 | + for var_name, var_value in kwargs.items(): |
| 178 | + if ( |
| 179 | + var_name not in self.attribute_map |
| 180 | + and self._configuration is not None |
| 181 | + and self._configuration.discard_unknown_keys |
| 182 | + and self.additional_properties_type is None |
| 183 | + ): |
| 184 | + # discard variable. |
| 185 | + continue |
| 186 | + setattr(self, var_name, var_value) |
| 187 | + return self |
| 188 | + |
| 189 | + required_properties = set( |
| 190 | + [ |
| 191 | + "_data_store", |
| 192 | + "_check_type", |
| 193 | + "_spec_property_naming", |
| 194 | + "_path_to_item", |
| 195 | + "_configuration", |
| 196 | + "_visited_composed_classes", |
| 197 | + ] |
| 198 | + ) |
| 199 | + |
| 200 | + @convert_js_args_to_python_args |
| 201 | + def __init__(self, *args, **kwargs) -> None: # noqa: E501 |
| 202 | + """BackupList - a model defined in OpenAPI |
| 203 | +
|
| 204 | + Keyword Args: |
| 205 | + _check_type (bool): if True, values for parameters in openapi_types |
| 206 | + will be type checked and a TypeError will be |
| 207 | + raised if the wrong type is input. |
| 208 | + Defaults to True |
| 209 | + _path_to_item (tuple/list): This is a list of keys or values to |
| 210 | + drill down to the model in received_data |
| 211 | + when deserializing a response |
| 212 | + _spec_property_naming (bool): True if the variable names in the input data |
| 213 | + are serialized names, as specified in the OpenAPI document. |
| 214 | + False if the variable names in the input data |
| 215 | + are pythonic names, e.g. snake case (default) |
| 216 | + _configuration (Configuration): the instance to use when |
| 217 | + deserializing a file_type parameter. |
| 218 | + If passed, type conversion is attempted |
| 219 | + If omitted no type conversion is done. |
| 220 | + _visited_composed_classes (tuple): This stores a tuple of |
| 221 | + classes that we have traveled through so that |
| 222 | + if we see that class again we will not use its |
| 223 | + discriminator again. |
| 224 | + When traveling through a discriminator, the |
| 225 | + composed schema that is |
| 226 | + is traveled through is added to this set. |
| 227 | + For example if Animal has a discriminator |
| 228 | + petType and we pass in "Dog", and the class Dog |
| 229 | + allOf includes Animal, we move through Animal |
| 230 | + once using the discriminator, and pick Dog. |
| 231 | + Then in Dog, we will make an instance of the |
| 232 | + Animal class but this time we won't travel |
| 233 | + through its discriminator because we passed in |
| 234 | + _visited_composed_classes = (Animal,) |
| 235 | + data ([BackupModel]): [optional] # noqa: E501 |
| 236 | + pagination (PaginationResponse): [optional] # noqa: E501 |
| 237 | + """ |
| 238 | + |
| 239 | + _check_type = kwargs.pop("_check_type", True) |
| 240 | + _spec_property_naming = kwargs.pop("_spec_property_naming", False) |
| 241 | + _path_to_item = kwargs.pop("_path_to_item", ()) |
| 242 | + _configuration = kwargs.pop("_configuration", None) |
| 243 | + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) |
| 244 | + |
| 245 | + if args: |
| 246 | + raise PineconeApiTypeError( |
| 247 | + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." |
| 248 | + % (args, self.__class__.__name__), |
| 249 | + path_to_item=_path_to_item, |
| 250 | + valid_classes=(self.__class__,), |
| 251 | + ) |
| 252 | + |
| 253 | + self._data_store = {} |
| 254 | + self._check_type = _check_type |
| 255 | + self._spec_property_naming = _spec_property_naming |
| 256 | + self._path_to_item = _path_to_item |
| 257 | + self._configuration = _configuration |
| 258 | + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) |
| 259 | + |
| 260 | + for var_name, var_value in kwargs.items(): |
| 261 | + if ( |
| 262 | + var_name not in self.attribute_map |
| 263 | + and self._configuration is not None |
| 264 | + and self._configuration.discard_unknown_keys |
| 265 | + and self.additional_properties_type is None |
| 266 | + ): |
| 267 | + # discard variable. |
| 268 | + continue |
| 269 | + setattr(self, var_name, var_value) |
| 270 | + if var_name in self.read_only_vars: |
| 271 | + raise PineconeApiAttributeError( |
| 272 | + f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " |
| 273 | + f"class with read only attributes." |
| 274 | + ) |
0 commit comments