
    +dW                         d dl mZ d dlmZ ddlmZ ddlmZ ddlm	Z	 ee	eeedZ
 ee
          Zg dZdd
Zd Zd ZdS )   )RemoteCatalog)ContainerRegistryView   )RemoteDataFrame)RemoteArray)RemoteSequenceSource)	dataframepythonndarraynumpycatalog)container_mapregister_containerunregister_containerFc           	          | t           v r9|s7t           |          }||u rdS t          d| d|  dt           |           d          |t           | <   dS )a]  
    Add to the container registry, ``intake.container.container_map``.

    Parameters
    ----------
    name: string
    container: DataSource
    overwrite: bool, optional
        False by default.

    Raises
    ------
    ValueError
        If name collides with an existing name in the container registry and
        overwrite is False.
    NzThe container z& could not be registered for the name z	 because zE is already registered for that name. Use overwrite=True to force it.)_container_map
ValueError)name	container	overwriteoriginals       9lib/python3.11/site-packages/intake/container/__init__.pyr   r      s    " ~ 	
i 	
!$'y  	FIY I II I#1$#7I I I
 
 	

 %N4    c                 8    t                               | d          S )a  
    Ensure that a given name in the container registry is cleared.

    This function is idempotent: if the name does not exist in
    ``intake.container.container_map``, nothing is done, and the function
    returns None

    Parameters
    ----------
    name: string

    Returns
    -------
    container: DataSource or None
        Whatever was registered for ``name``, or ``None``
    N)r   pop)r   s    r   r   r   4   s    " dD)))r   c                     t                                           D ](}	  |j        | |fi |}||c S # t          $ r Y %w xY wt	          d          )a  Given a concrete data object, store it at given location return Source

    Use this function to publicly share data which you have created in your
    python session. Intake will try each of the container types, to see if
    one of them can handle the input data, and write the data to the path
    given, in the format most appropriate for the data type, e.g., parquet for
    pandas or dask data-frames.

    With the DataSource instance you get back, you can add this to a catalog,
    or just get the YAML representation for editing (``.yaml()``) and
    sharing.

    Parameters
    ----------
    data : instance
        The object to upload and store. In many cases, the dask or in-memory
        variant are handled equivalently.
    path : str
        Location of the output files; can be, for instance, a network drive
        for sharing over a VPC, or a bucket on a cloud storage service
    kwargs : passed to the writer for fine control

    Returns
    -------
    DataSource instance
    Nz#No class found to handle given data)r   values_data_to_sourceNotImplementedError	TypeError)datapathkwargsclsss        r   uploadr&   H   s    6 ##%%  	##D$99&99A " 	 	 	D	
9
:
::s   3
A A N)F)catalog.remoter   utilsr   r	   r   r   r   semistructuredr   r   r   __all__r   r   r&    r   r   <module>r,      s    + * * * * * ) ) ) ) ) ) & & & & & &             0 0 0 0 0 0  /:N[fq|  JW  X  X%%n55
I
I
I% % % %<* * *("; "; "; "; ";r   