
    Ehl              
       b    S SK r S SKrS SKrSS jrS	S jrS	S jrS rS	S jr\\\\\\\\\S.	rg)
    Nc                     Uc  [         R                  " U 5      n[        U S5       n[        UR	                  5       X5      sSSS5        $ ! , (       d  f       g= f)ak  
Convert a file into the format expected by the Download component.
:param path: path to the file to be sent
:param filename: name of the file, if not provided the original filename is used
:param type: type of the file (optional, passed to Blob in the javascript layer)
:return: dict of file content (base64 encoded) and meta data used by the Download component
Nrb)ntpathbasenameopen
send_bytesread)pathfilenametypefs       cC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\dash/dcc/express.py	send_filer      s@     ??4(	dD	Q!&&(H3 
		s   A


Ac                     [        U [        5      (       a  U O[        [        R                  " 5       U 40 UD6n[        [        R                  " U5      R                  5       UUSS9$ )ao  
Convert data written to BytesIO into the format expected by the Download component.
:param src: array of bytes or a writer that can write to BytesIO
:param filename: the name of the file
:param type: type of the file (optional, passed to Blob in the javascript layer)
:return: dict of data frame content (base64 encoded) and meta data used by the Download component
Tcontentr   r   base64)	
isinstancebytes
_io_to_strioBytesIOdictr   	b64encodedecodesrcr   r   kwargsr   s        r   r   r      sW      U++cBJJL#1XQW1XG  )002	     c                     [        U [        5      (       a  U O[        [        R                  " 5       U 40 UD6n[        XAUSS9$ )ao  
Convert data written to StringIO into the format expected by the Download component.
:param src: a string or a writer that can write to StringIO
:param filename: the name of the file
:param type: type of the file (optional, passed to Blob in the javascript layer)
:return: dict of data frame content (NOT base64 encoded) and meta data used by the Download component
Fr   )r   strr   r   StringIOr   r   s        r   send_stringr#   )   s9      S))cz"++-/WPV/WGeLLr   c                 n    U R                   nS U l         U" U 40 UD6  U R                  5       nU" 5         U$ )Nc                      g N r'   r   r   <lambda>_io_to_str.<locals>.<lambda>8   s    Dr   )closegetvalue)data_iowriterr   data_io_close
data_values        r   r   r   5   s8    MMM GM
7f!!#JOr   c                     U R                   nU[        R                  5       ;  a  [        SR	                  U5      5      e[        U   " XU40 UD6$ )a  
Convert data frame into the format expected by the Download component.
:param writer: a data frame writer
:param filename: the name of the file
:param type: type of the file (optional, passed to Blob in the javascript layer)
:return: dict of data frame content (base64 encoded) and meta data used by the Download component

Examples
--------

>>> df = pd.DataFrame({'a': [1, 2, 3, 4], 'b': [2, 1, 5, 6], 'c': ['x', 'x', 'y', 'y']})
...
>>> send_data_frame(df.to_csv, "mydf.csv")  # download as csv
>>> send_data_frame(df.to_json, "mydf.json")  # download as json
>>> send_data_frame(df.to_excel, "mydf.xls", index=False) # download as excel
>>> send_data_frame(df.to_pickle, "mydf.pkl") # download as pickle

zZThe provided writer ({}) is not supported, try calling send_string or send_bytes directly.)__name___data_frame_senderskeys
ValueErrorformat)r-   r   r   r   names        r   send_data_framer7   @   sS    & ??D&++-->>DfTl
 	

 t$VtFvFFr   )	to_csvto_jsonto_htmlto_excel
to_feather
to_parquet
to_msgpackto_stata	to_pickle)NNr&   )	r   r   r   r   r   r#   r   r7   r2   r'   r   r   <module>rA      sN    	  
4 "	MG> 
 r   