
    Hf                         d Z ddlZddlZddlmZ ddlmZ d Zd Zd Z	d Z
d	 Zd
 Zeeeeee	ej        e
ej        e
ej        e
eedeeei	Zd Zd ZdS )z
    pyexcel.formatters
    ~~~~~~~~~~~~~~~~~~~

    These utilities help format the content

    :copyright: (c) 2014-2022 by Onni Software Ltd.
    :license: New BSD License, see LICENSE for more details
    N)Decimal)	constantsc                     |t           k    r#	 t          |           }nQ# t          $ r | }Y nCw xY w|t          k    r2	 t          |           }t          |          }n# t          $ r | }Y nw xY w| }|S )z"Convert string to specified format)float
ValueErrorintvaluetarget_formatrets      d/var/www/ffwdstore.be/apps/py-env/lib/python3.11/site-packages/pyexcel/internal/sheets/formatters.pystring_to_formatr      s    	,,CC 	 	 	CCC		#			,,Cc((CC 	 	 	CCC	 Js    ,,A A)(A)c                 v    |t           k    rt          |           }n|t          k    rt          |           }n| }|S )z!Convert float to specified format)r   strr	   s      r   float_to_formatr   $   s<    %jj	#		%jjJ    c                 v    |t           k    rt          |           }n|t          k    rt          |           }n| }|S )zConvert int to specified formatr   r   r	   s      r   int_to_formatr   0   s<    Ell	#		%jjJr   c                 @   |t           k    rt          | t          j                  r|                     d          }nbt          | t          j                  r|                     d          }n2t          | t          j                  r|                     d          }n| }|S )z Convert date to specified formatz%d/%m/%yz%H:%M:%S)r   
isinstancedatetimedatestrftimetimer	   s      r   date_to_formatr   ;   s    eX]++ 	-..,,CCx011 	-..,,CCx}-- 	-..,,CJr   c                 n    |t           k    rt          |           }n|t          k    r| dk    rd}nd}n| }|S )z Convert bool to specified format   truefalser   r	   s      r   boolean_to_formatr!   I   sF    Ell	#		A::CCCCJr   c                 V    |t           k    rd}n|t          k    rd}nt          j        }|S )z'Convert empty value to specified formatg        r   )r   r   r   
DEFAULT_NA)_r   r   s      r   empty_to_formatr%   W   s3    	#		"Jr   c                 *    t          j        |           S )N)jsondumps)r
   to_types     r   default_formatterr*   o   s    :er   c                     ||dk    rd}nt          |          }nd}t                              |t                    } |||           S )zWrapper utility function for format different formats

    :param type from_type: a python type
    :param type to_type: a python type
    :param value value: a python value
    N )typeCONVERSION_FUNCTIONSgetr*   )r)   r
   	from_typefuncs       r   	to_formatr2   s   sT     B;;IIUII	##I/@AAD4wr   )__doc__r'   r   decimalr   pyexcelr   r   r   r   r   r!   r%   r   r   r   r   r   boolr.   r*   r2    r   r   <module>r8      s	            * * * * * *  &	 	 	         		?~M>M>
/_
            r   