U
    ±[Öe'  ã                   @   sZ   d Z ddlmZmZ ddlmZmZ ddlmZ ddl	m
Z
 G dd„ deeƒZd	d
„ ZdS )zá
    pyexcel.plugins.sources.pydata.bookdictsource
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Representation of book dict source

    :copyright: (c) 2015-2022 by Onni Software Ltd.
    :license: New BSD License
é    )ÚAbstractSourceÚMemorySourceMixin)ÚPY2ÚOrderedDict)Úparamsé   )Ú_FakeIOc                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚBookDictSourcezO
    Multiple sheet data source via a dictionary of two dimensional arrays
    c                 K   s    || _ tƒ | _tj| f|Ž d S ©N)Ú_BookDictSource__bookdictr   Ú_contentr   Ú__init__)ÚselfZbookdictÚkeywords© r   úi/var/www/html/services/stratfitenv/lib/python3.8/site-packages/pyexcel/plugins/sources/pydata/bookdict.pyr      s    zBookDictSource.__init__c                 C   s    | j }t| j tƒst| j ƒ}|S r
   )r   Ú
isinstancer   Ú_convert_dict_to_ordered_dict)r   Úthe_dictr   r   r   Úget_data   s    
zBookDictSource.get_datac                 C   s
   t jd fS r
   )r   ZBOOKDICT)r   r   r   r   Úget_source_info!   s    zBookDictSource.get_source_infoc                 C   s   | j  | ¡ ¡ d S r
   )r   ZsetvalueÚto_dict)r   Úbookr   r   r   Ú
write_data$   s    zBookDictSource.write_dataN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r	      s
   r	   c                 C   s<   |   ¡ }tst|ƒ}t|ƒ}tƒ }|D ]}| | ||< q&|S r
   )Úkeysr   ÚlistÚsortedr   )r   r   ÚretÚkeyr   r   r   r   (   s    r   N)r   Zpyexcel.sourcer   r   Zpyexcel._compactr   r   Zpyexcel.plugins.sourcesr   Úcommonr   r	   r   r   r   r   r   Ú<module>   s   	