66
77from pinecone .config import PineconeConfig , Config , ConfigBuilder
88
9- from pinecone .core .openapi .control .api .manage_indexes_api import (
10- ManageIndexesApi ,
11- )
9+ from pinecone .core .openapi .control .api .manage_indexes_api import ManageIndexesApi
1210from pinecone .core .openapi .shared .api_client import ApiClient
1311
14- from pinecone .utils import (
15- normalize_host ,
16- setup_openapi_client ,
17- build_plugin_setup_client ,
18- )
12+
13+ from pinecone .utils import normalize_host , setup_openapi_client , build_plugin_setup_client
1914from pinecone .core .openapi .control .models import (
2015 CreateCollectionRequest ,
2116 CreateIndexRequest ,
@@ -214,7 +209,7 @@ def __init__(
214209
215210 if kwargs .get ("openapi_config" , None ):
216211 raise Exception (
217- "Passing openapi_config is no longer supported. Please pass settings such as proxy_url, proxy_headers, ssl_ca_certs, and ssl_verify directly to the Pinecone constructor as keyword arguments. See the README at https://github.com/pinecone-io/pinecone-python-client for examples." ,
212+ "Passing openapi_config is no longer supported. Please pass settings such as proxy_url, proxy_headers, ssl_ca_certs, and ssl_verify directly to the Pinecone constructor as keyword arguments. See the README at https://github.com/pinecone-io/pinecone-python-client for examples."
218213 )
219214
220215 self .openapi_config = ConfigBuilder .build_openapi_config (self .config , ** kwargs )
@@ -353,10 +348,7 @@ def _parse_non_empty_args(args: List[Tuple[str, Any]]) -> Dict[str, Any]:
353348 raise ValueError ("spec must contain either 'serverless' or 'pod' key" )
354349 elif isinstance (spec , ServerlessSpec ):
355350 index_spec = IndexSpec (
356- serverless = ServerlessSpecModel (
357- cloud = spec .cloud ,
358- region = spec .region ,
359- )
351+ serverless = ServerlessSpecModel (cloud = spec .cloud , region = spec .region )
360352 )
361353 elif isinstance (spec , PodSpec ):
362354 args_dict = _parse_non_empty_args (
@@ -368,14 +360,12 @@ def _parse_non_empty_args(args: List[Tuple[str, Any]]) -> Dict[str, Any]:
368360 ]
369361 )
370362 if spec .metadata_config :
371- args_dict ["metadata_config" ] = PodSpecMetadataConfig (indexed = spec .metadata_config .get ("indexed" , None ))
363+ args_dict ["metadata_config" ] = PodSpecMetadataConfig (
364+ indexed = spec .metadata_config .get ("indexed" , None )
365+ )
372366
373367 index_spec = IndexSpec (
374- pod = PodSpecModel (
375- environment = spec .environment ,
376- pod_type = spec .pod_type ,
377- ** args_dict ,
378- )
368+ pod = PodSpecModel (environment = spec .environment , pod_type = spec .pod_type , ** args_dict )
379369 )
380370 else :
381371 raise TypeError ("spec must be of type dict, ServerlessSpec, or PodSpec" )
@@ -387,7 +377,7 @@ def _parse_non_empty_args(args: List[Tuple[str, Any]]) -> Dict[str, Any]:
387377 metric = metric ,
388378 spec = index_spec ,
389379 deletion_protection = dp ,
390- ),
380+ )
391381 )
392382
393383 def is_ready ():
@@ -630,7 +620,9 @@ def create_collection(self, name: str, source: str):
630620 :param source: Name of the source index
631621 """
632622 api_instance = self .index_api
633- api_instance .create_collection (create_collection_request = CreateCollectionRequest (name = name , source = source ))
623+ api_instance .create_collection (
624+ create_collection_request = CreateCollectionRequest (name = name , source = source )
625+ )
634626
635627 def list_collections (self ) -> CollectionList :
636628 """List all collections
0 commit comments