o
    ‹¨Êh5  ã                   @   s<   d Z ddlmZ G dd„ deƒZG dd„ deƒZdd„ ZdS )	z¨
    pyexcel.source
    ~~~~~~~~~~~~~~~~~~~~~~~~

    Generic data source definition

    :copyright: (c) 2015-2017 by Onni Software Ltd.
    :license: New BSD License
é    Nc                   @   sV   e Zd ZdZejgZg Zg Zg Z	ejZ
dd„ Zdd„ Zedd„ ƒZdd	„ Zd
d„ ZdS )ÚAbstractSourcezÕ
    Define a data source for use with the signature functions

    This can be used to extend the function parameters once the custom
    class inherit this and register it with corresponding source registry
    c                 K   s
   || _ d S ©N)Ú	_keywords)ÚselfÚkeywords© r   ú@/var/www/html/env/lib/python3.10/site-packages/pyexcel/source.pyÚ__init__   s   
zAbstractSource.__init__c                 C   s   dS )zwreturn filename and path, otherwise not useful

        see also `:meth:pyexcel.internal.core.get_book_stream`
        )NNr   ©r   r   r   r   Úget_source_info   s   zAbstractSource.get_source_infoc                    s.   ‡ fdd„| j D ƒ}dd„ |D ƒ}t|ƒdkS )zL
        If all required keys are present, this source is activated
        c                    s   g | ]}t |ˆ ƒ‘qS r   )Ú
_has_field)Ú.0Úfield©r   r   r   Ú
<listcomp>*   s    z1AbstractSource.is_my_business.<locals>.<listcomp>c                 S   s   g | ]}|d u r|‘qS )Fr   )r   Ústatusr   r   r   r   +   s    r   )ÚfieldsÚlen)ÚclsÚactionr   ÚstatusesÚresultsr   r   r   Úis_my_business%   s   zAbstractSource.is_my_businessc                 C   ó   t dƒ‚)zWrite data to a data sourceÚ ©ÚNotImplementedError)r   Úcontentr   r   r   Ú
write_data.   ó   zAbstractSource.write_datac                 C   r   )zGet data from a data sourcer   r   r
   r   r   r   Úget_data2   r   zAbstractSource.get_dataN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	constantsÚSOURCEr   Ú
attributesÚtargetsÚactionsÚkeyr	   r   Úclassmethodr   r   r    r   r   r   r   r      s    
r   c                   @   s   e Zd ZdZdd„ ZdS )ÚMemorySourceMixinziA memory source should an internal memory stream

    And it is desirable to get its internal stream
    c                 C   s   | j S )z|Get memory repsentation of the formatted data

        e.g. StringIO instance which contains the csv formatted data
        )Ú_contentr
   r   r   r   Úget_content=   s   zMemorySourceMixin.get_contentN)r!   r"   r#   r$   r.   r   r   r   r   r,   7   s    r,   c                 C   s   | |v o	||  d uS r   r   )r   r   r   r   r   r   E   s   r   )r$   Úpyexcel.constantsr%   Úobjectr   r,   r   r   r   r   r   Ú<module>   s
    	*