U
    ±[Öe:  ã                   @   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-2022 by Onni Software Ltd.
    :license: New BSD License
é    )Ú	constantsc                   @   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)Z	_keywords)ÚselfÚkeywords© r   úP/var/www/html/services/stratfitenv/lib/python3.8/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 kr|‘qS )Fr   )r   Ústatusr   r   r   r   +   s      r   )ÚfieldsÚlen)ÚclsÚactionr   ZstatusesÚresultsr   r   r   Úis_my_business%   s    zAbstractSource.is_my_businessc                 C   s   t dƒ‚dS )zWrite data to a data sourceÚ N©ÚNotImplementedError)r   Úcontentr   r   r   Ú
write_data.   s    zAbstractSource.write_datac                 C   s   t dƒ‚dS )zGet data from a data sourcer   Nr   r
   r   r   r   Úget_data2   s    zAbstractSource.get_dataN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Z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   | |ko||  d k	S r   r   )r   r   r   r   r   r   E   s    r   N)r!   Zpyexcelr   Úobjectr   r'   r   r   r   r   r   Ú<module>   s   	*