
    i                         d dl mZmZ d dlmZ d dlmZmZ d dlm	Z	m
Z
mZ ddlmZ eefD ]
  Z e	e         G d de
      Zy	)
    )OptionalIterator)NamespaceOperationsApi)ListNamespacesResponseNamespaceDescription)install_json_repr_overridePluginAwarerequire_kwargs   )NamespaceRequestFactoryc                        e Zd Zdeddf fdZededefd       Zedefd       Z	edde
e   dee   fd	       Ze	 dde
e   d
e
e   defd       Z xZS )NamespaceResourcepool_threadsreturnNc                 r    || _         	 || _        	 || _        	 t        |      | _        t
        |           y N)config_openapi_config_pool_threadsr   ,_NamespaceResource__namespace_operations_apisuper__init__)self
api_clientr   openapi_configr   	__class__s        {/var/www/catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/pinecone/db_data/resources/sync/namespace.pyr   zNamespaceResource.__init__   s=     -)*@*L'    	namespacec                 h    t        j                  dd|i|} | j                  j                  di |S )a  
        Args:
            namespace (str): The namespace to describe

        Returns:
            ``NamespaceDescription``: Information about the namespace including vector count

        Describe a namespace within an index, showing the vector count within the namespace.
        r    )r   describe_namespace_argsr   describe_namespacer   r   kwargsargss       r   describezNamespaceResource.describe%   s9     '>>]]V\]At..AAIDIIr   c                 h    t        j                  dd|i|} | j                  j                  di |S )zw
        Args:
            namespace (str): The namespace to delete

        Delete a namespace from an index.
        r   r!   )r   delete_namespace_argsr   delete_namespacer$   s       r   deletezNamespaceResource.delete3   s9     '<<[y[TZ[?t..??G$GGr   limitc              +   N  K   d}|s | j                   dd|i|}|j                  -t        |j                        dkD  r|j                  D ]  }|  |j                  r>|j                  j                  r(|j                  d|j                  j                  i       nd}|syyw)a  
        Args:
            limit (Optional[int]): The maximum number of namespaces to fetch in each network call. If unspecified, the server will use a default value. [optional]
            pagination_token (Optional[str]): When there are multiple pages of results, a pagination token is returned in the response. The token can be used
                to fetch the next page of results. [optional]

        Returns:
            Returns a generator that yields each namespace. It automatically handles pagination tokens on your behalf so you can
            easily iterate over all results. The ``list`` method accepts all of the same arguments as list_paginated

        .. code-block:: python
            for namespace in index.list_namespaces():
                print(namespace)

        You can convert the generator into a list by wrapping the generator in a call to the built-in ``list`` function:

        .. code-block:: python
            namespaces = list(index.list_namespaces())

        You should be cautious with this approach because it will fetch all namespaces at once, which could be a large number
        of network calls and a lot of memory to hold the results.
        Fr,   Nr   pagination_tokenTr!   )list_paginated
namespaceslen
paginationnextupdate)r   r,   r%   doneresultsr   s         r   listzNamespaceResource.list>   s     0 )d))@@@G!!-#g6H6H2IA2M!(!3!3 $I#O$ !!g&8&8&=&=173E3E3J3JKL s   B B%#B%r.   c                 j    t        j                  d||d|} | j                  j                  di |S )a(  
        Args:
            limit (Optional[int]): The maximum number of namespaces to return. If unspecified, the server will use a default value. [optional]
            pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned
                in the response if additional results are available. [optional]

        Returns:
            ``ListNamespacesResponse``: Object containing the list of namespaces and pagination information.

        List all namespaces in an index with pagination support. The response includes pagination information if there are more results available.

        Consider using the ``list`` method to avoid having to handle pagination tokens manually.

        Examples:
            .. code-block:: python
                >>> results = index.list_paginated(limit=5)
                >>> results.pagination.next
                eyJza2lwX3Bhc3QiOiI5OTMiLCJwcmVmaXgiOiI5OSJ9
                >>> next_results = index.list_paginated(limit=5, pagination_token=results.pagination.next)
        )r,   r.   r!   )r   list_namespaces_argsr   list_namespaces_operation)r   r,   r.   r%   r&   s        r   r/   z NamespaceResource.list_paginatedb   s<    0 ';;u%ZjuntuHt..HHP4PPr   r   )NN)__name__
__module____qualname__intr   r
   strr   r'   r+   r   r   r   r7   r/   __classcell__)r   s   @r   r   r      s    
  
& J# J4H J J H H H !(3- !XF\=] ! !F MQQc]Q=Ec]Q	Q Qr   r   N)typingr   r   :pinecone.core.openapi.db_data.api.namespace_operations_apir   $pinecone.core.openapi.db_data.modelsr   r   pinecone.utilsr   r	   r
   namespace_request_factoryr   mr   r!   r   r   <module>rG      sI    % ]
 S R >
 "6	7 "Aq!"jQ jQr   