U
    [e                     @   sh   d Z ddlmZ ddlmZ ddlmZmZ dd Zdd Z	d	d
 Z
dd Zdd Zdd Zdd ZdS )z
    pyexcel.internal.core
    ~~~~~~~~~~~~~~~~~~~~~~

    elementary functions to read and write generic excel content

    :copyright: (c) 2015-2021 by Onni Software Ltd.
    :license: New BSD License
    )SOURCE)DEFAULT_NO_DATA)
BookStreamSheetStreamc                  K   sN   t jf | }| \}}| }|r>t| \}}t||S ttg gS dS )z=
    Get an instance of SheetStream from an excel source
    N)r   
get_sourceget_source_infoget_data_one_sheet_tupleitemsr   r   )keywordsa_sourcefilenamepathsheetsZ
sheet_namedata r   W/var/www/html/services/stratfitenv/lib/python3.8/site-packages/pyexcel/internal/core.pyget_sheet_stream   s    
r   c                  K   s.   t jf | }| \}}| }t|||dS )z
    Get an instance of BookStream from an excel source

    Where the dictionary should have text as keys and two dimensional
    array as values.
    )r   r   )r   Zget_book_sourcer   r   r   )r   r   r   r   r   r   r   r   get_book_stream   s    r   c                 K   s   t jf |}t|| S )z-
    Save a sheet instance to any source
    )r   Zget_writable_source	_save_any)Zsheetr   r   r   r   r   
save_sheet*   s    r   c                 K   s   t jf |}t|| S )z,
    Save a book instance to any source
    )r   Zget_writable_book_sourcer   )bookr   r   r   r   r   	save_book2   s    r   c                 C   s<   |  | z|  }t| |W S  tk
r6   Y d S X d S )N)
write_dataget_content_seek_at_zeroAttributeError)r   instanceZcontent_streamr   r   r   r   :   s    
r   c                 C   s2   dd l }z| d W n |jk
r,   Y nX d S )Nr   )ioseekUnsupportedOperation)Za_streamr   r   r   r   r   D   s
    r   c                 C   s    t | } | d d | d d fS )Nr      )list)r
   r   r   r   r	   M   s    r	   N)__doc__Zpyexcel.internalr   Zpyexcel.constantsr   Zpyexcel.internal.generatorsr   r   r   r   r   r   r   r   r	   r   r   r   r   <module>   s   	
	