o
    ˜¨Êh•  ã                   @   s<   d dl mZ d dlmZ d dlmZ 		 			d	dd„ZdS )
é    )ÚDecimal)Úsettings)Ú	mark_safeNÚ Fc                 C   sL  |p|du ot jot j}|p|}|o|dk}t| tƒr#|s#|s#t| ƒS d}t| tƒr8dt| ƒ ¡ v r8t	t| ƒƒ} t| t	ƒrˆ|durUt	dd 
|d¡ ƒ}	t| ƒ|	k rUt	dƒ} |  ¡ \}
}}t|ƒt|ƒ dkr‚d	 | ¡} |  d¡\}}t|||||||ƒ}d
 ||¡S d | ¡}nt| ƒ}|d dkršd}|dd… }d|v r°| d¡\}}|dur¯|d|… }n|d}}|durÃ|d|t|ƒ   }|oÈ|| }|�r zt|ƒ}W n tyß   |dg}Y nw | d¡}d}d}|ddd… D ](}|�r||k�r|�r| d¡�p|}||ddd… 7 }d}||7 }|d7 }qð|ddd… }|| | S )aT  
    Get a number (as a number or string), and return it as a string,
    using formats defined as arguments:

    * decimal_sep: Decimal separator symbol (for example ".")
    * decimal_pos: Number of decimal positions
    * grouping: Number of digits in every group limited by thousand separator.
        For non-uniform digit grouping, it can be a sequence with the number
        of digit group sizes following the format used by the Python locale
        module in locale.localeconv() LC_NUMERIC grouping (e.g. (3, 2, 0)).
    * thousand_sep: Thousand separator symbol (for example ",")
    Nr   r   Úez0.Ú1Ú0éÈ   z{:e}z{}e{}z{:f}ú-é   Ú.éÿÿÿÿ)r   ÚUSE_L10NÚUSE_THOUSAND_SEPARATORÚ
isinstanceÚintr   ÚfloatÚstrÚlowerr   ÚrjustÚabsÚas_tupleÚlenÚformatÚsplitÚlistÚ	TypeErrorÚpop)ÚnumberÚdecimal_sepÚdecimal_posÚgroupingÚthousand_sepÚforce_groupingÚuse_l10nÚuse_groupingÚsignÚcutoffÚ_ÚdigitsÚexponentÚcoefficientÚ
str_numberÚint_partÚdec_partÚ	intervalsÚactive_intervalÚint_part_gdÚcntÚdigit© r4   úK/var/www/html/env/lib/python3.10/site-packages/django/utils/numberformat.pyr      s~   ÿþ

ù	€
þ

r   )Nr   r   FN)Údecimalr   Údjango.confr   Údjango.utils.safestringr   r   r4   r4   r4   r5   Ú<module>   s    ù