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   sb  | du s| dkrt | S |du rd}|otj}|p|}|o |dk}t| tr.|s.|s.t | S d}t| trCdt|  v rCtt| } t| tr|dur`tdd	|d }	t
| |	k r`td} |  \}
}}t
|t| d	krd
| } | d\}}t|||||||}d||S d| }nt| }|d dkrd}|dd }d|v r|d\}}|dur|d| }n|d}}|dur|d|t|  7 }|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   Tr   ez0.10   z{:e}z{}e{}z{:f}-   .)r   r   USE_THOUSAND_SEPARATOR
isinstanceint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 r3   O/var/www/html/rh/venv/lib/python3.10/site-packages/django/utils/numberformat.pyr      s   


	


r   )Nr   r   FN)decimalr   django.confr   django.utils.safestringr   r   r3   r3   r3   r4   <module>   s    