o
    ‹¨ÊhÊ  ã                   @   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-2017 by Onni Software Ltd.
    :license: New BSD License
é    )ÚPY2)ÚSOURCE)Ú
BookStreamÚSheetStreamc                  K   s2   t jdi | ¤Ž}| ¡ }t| ¡ ƒ\}}t||ƒS )z=
    Get an instance of SheetStream from an excel source
    N© )r   Ú
get_sourceÚget_dataÚ_one_sheet_tupleÚitemsr   )ÚkeywordsÚa_sourceÚsheetsÚ
sheet_nameÚdatar   r   úG/var/www/html/env/lib/python3.10/site-packages/pyexcel/internal/core.pyÚget_sheet_stream   s   
r   c                  K   s2   t jdi | ¤Ž}| ¡ }| ¡ \}}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.
    )ÚfilenameÚpathNr   )r   Úget_book_sourcer   Úget_source_infor   )r   r   r   r   r   r   r   r   Úget_book_stream   s   r   c                 K   ó   t jdi |¤Ž}t|| ƒS )z-
    Save a sheet instance to any source
    Nr   )r   Úget_writable_sourceÚ	_save_any)Úsheetr   r   r   r   r   Ú
save_sheet&   ó   
r   c                 K   r   )z,
    Save a book instance to any source
    Nr   )r   Úget_writable_book_sourcer   )Úbookr   r   r   r   r   Ú	save_book.   r   r   c                 C   s6   |   |¡ z|  ¡ }t|ƒ |W S  ty   Y d S w )N)Ú
write_dataÚget_contentÚ_seek_at_zeroÚAttributeError)r   ÚinstanceÚcontent_streamr   r   r   r   6   s   
ÿr   c                 C   sZ   t rz|  d¡ W d S  ty   Y d S w dd l}z|  d¡ W d S  |jy,   Y d S w )Nr   )r   ÚseekÚIOErrorÚioÚUnsupportedOperation)Úa_streamr(   r   r   r   r"   @   s   ÿÿr"   c                 C   s$   t st| ƒ} | d d | d d fS )Nr   é   )r   Úlist)r
   r   r   r   r	   O   s   r	   N)Ú__doc__Úpyexcel._compactr   Úpyexcel.internalr   Úpyexcel.internal.generatorsr   r   r   r   r   r   r   r"   r	   r   r   r   r   Ú<module>   s    	

