Ë
    Ã?Æi„  ã                  óV   — d Z ddlmZ ddl­ ddlmZmZ dd„Zdd„Zdd„Z	dd„Z
dd	„Zy
)u&  RUT (Rol Ãšnico Tributario, Chilean national tax number).

The RUT, the Chilean national tax number is the same as the RUN (Rol Ãšnico
Nacional) the Chilean national identification number. The number consists of
8 digits, followed by a check digit.

>>> validate('76086428-5')
'760864285'
>>> validate('CL 12531909-2')
'125319092'
>>> validate('12531909-3')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('76086A28-5')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> format('125319092')
'12.531.909-2'
é    )Úannotations)Ú*)ÚcleanÚisdigitsc                ó‚   — t        | d«      j                  «       j                  «       } | j                  d«      r| dd } | S )zˆConvert the number to the minimal representation. This strips the
    number of any valid separators and removes surrounding whitespace.z -.ÚCLé   N)r   ÚupperÚstripÚ
startswith©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/cl/rut.pyÚcompactr   3   s@   € ô �6˜5Ó!×'Ñ'Ó)×/Ñ/Ó1€FØ×Ñ˜ÔØ˜˜�ˆØ€Mó    c           	     óT   — t        d„ t        | ddd…   «      D «       «      }d|dz     S )zZCalculate the check digit. The number passed should not have the
    check digit included.c              3  óP   K  — | ]  \  }}t        |«      d d|z
  dz  z   z  –— Œ  y­w)é   é   é   N)Úint)Ú.0ÚiÚns      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>?   s)   è ø€ ÒK©4¨1¨aŒC�‹F�a˜1˜q™5 A™+‘oÕ&ÑKùs   ‚$&NéÿÿÿÿÚ0123456789Ké   )ÚsumÚ	enumerate)r   Úss     r   Úcalc_check_digitr"   <   s0   € ô 	ÑK´9¸VÁDÀbÀD¹\Ó3JÔKÓK€AØ˜˜R™Ñ Ð r   c                ó¶   — t        | «      } t        | «      dvr
t        «       ‚t        | dd «      s
t	        «       ‚| d   t        | dd «      k7  r
t        «       ‚| S )z[Check if the number is a valid RUT. This checks the length, formatting
    and check digit.)é   é	   Nr   )r   ÚlenÚInvalidLengthr   ÚInvalidFormatr"   ÚInvalidChecksumr   s    r   Úvalidater*   C   s]   € ô �V‹_€FÜ
ˆ6ƒ{˜&Ñ Ü‹oÐÜ�F˜3˜B�KÔ Ü‹oÐØˆb�zÔ% f¨S¨b kÓ2Ò2ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z#Check if the number is a valid RUT.F)Úboolr*   ÚValidationErrorr   s    r   Úis_validr.   P   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                óX   — t        | «      } | dd dz   | dd z   dz   | dd z   dz   | d   z   S )z8Reformat the number to the standard presentation format.Niùÿÿÿú.éüÿÿÿr   ú-)r   r   s    r   Úformatr3   X   sP   € ä�V‹_€FØ�3�BˆK˜#Ñ  r¨" Ñ-°Ñ3Ø�2�bˆMñØñ Ø"(¨¡*ñ-ð .r   N)r   ÚstrÚreturnr4   )r   r4   r5   r,   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r"   r*   r.   r3   © r   r   ú<module>r;      s.   ðñ.õ, #ä ß 'óó!ó
óô.r   