B
    ª0H[¬	  ã               @   s2   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   sž  t jo
t j}|p|}|o|dk}t| tƒr>|s>|s>tt| ƒƒS d}t| tƒrXd | ¡}nt| ƒ}|d dkr|d}|dd… }d|kr¨| 	d¡\}	}
|dk	r²|
d|… }
n
|d }	}
|dk	rÎ|
d|t
|
ƒ   }
|
rÚ||
 }
|�r’yt|ƒ}W n tk
�r
   |dg}Y nX | d¡}d}d}xd|	ddd	… D ]R}|�rn||k�rn|�rX| d¡�pV|}||ddd	… 7 }d}||7 }|d7 }�q.W |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 ",")
    r   r   z{:f}ú-é   NÚ.Ú0éÿÿÿÿ)r   ZUSE_L10NZUSE_THOUSAND_SEPARATORÚ
isinstanceÚintr   Ústrr   ÚformatÚsplitÚlenÚlistÚ	TypeErrorÚpop)ÚnumberZdecimal_sepZdecimal_posÚgroupingZthousand_sepZforce_groupingZuse_groupingÚsignZ
str_numberZint_partZdec_partZ	intervalsZactive_intervalZint_part_gdZcntÚdigit© r   ú]C:\Users\HIRONO~1\AppData\Local\Temp\pip-install-6bm3nxem\django\django\utils\numberformat.pyr      sN    


r   )Nr   r   F)Údecimalr   Zdjango.confr   Zdjango.utils.safestringr   r   r   r   r   r   Ú<module>   s    