Ë
    Ã?Æ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  RUC number (Registro Ãšnico de Contribuyentes, Paraguay tax number).

The Registro Ãšnico del Contribuyente (RUC) is the unique taxpayer registry
that maintains identification numbers for all persons (national or foreign)
and legal entities in Paraguay.

The RUC number for legal entities consists of 8 digits starting after
80000000. Number for residents and foreigners are up to 9 digits. The last
digit is a check digit.

More information:

* https://www.ruc.com.py/

>>> validate('80028061-0')
'800280610'
>>> validate('9991603')
'9991603'
>>> validate('2660-3')
'26603'
>>> validate('800532492')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('80123456789')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> format('800000358')
'80000035-8'
é    )Úannotations)Ú*)ÚcleanÚisdigitsc                óR   — t        | d«      j                  «       j                  «       S )z’Convert the number to the minimal representation.

    This strips the number of any valid separators and removes surrounding
    whitespace.
    z -)r   ÚupperÚstrip©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/py/ruc.pyÚcompactr   ;   s#   € ô �˜Ó×$Ñ$Ó&×,Ñ,Ó.Ð.ó    c                ón   — t        d„ t        t        | «      «      D «       «      }t        | dz  dz  «      S )z`Calculate the check digit.

    The number passed should not have the check digit included.
    c              3  óD   K  — | ]  \  }}|d z   t        |«      z  –— Œ y­w)é   N)Úint)Ú.0ÚiÚns      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>I   s!   è ø€ ÒE¡  AˆQ�‰U”c˜!“fÕÑEùs   ‚ é   é
   )ÚsumÚ	enumerateÚreversedÚstr)r   Úss     r   Úcalc_check_digitr   D   s3   € ô
 	ÑE¬´8¸FÓ3CÓ)DÔEÓE€AÜ���R‘˜2‰~ÓÐr   c                ó²   — t        | «      } t        | «      dkD  r
t        «       ‚t        | «      s
t	        «       ‚| d   t        | dd «      k7  r
t        «       ‚| S )zqCheck if the number is a valid Paraguay RUC number.

    This checks the length, formatting and check digit.
    é	   éÿÿÿÿN)r   ÚlenÚInvalidLengthr   ÚInvalidFormatr   ÚInvalidChecksumr
   s    r   Úvalidater&   M   sV   € ô
 �V‹_€FÜ
ˆ6ƒ{�Q‚Ü‹oÐÜ�FÔÜ‹oÐØˆb�zÔ% f¨S¨b kÓ2Ò2ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z3Check if the number is a valid Paraguay RUC number.F)Úboolr&   ÚValidationErrorr
   s    r   Úis_validr*   \   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                óJ   — t        | «      } dj                  | dd | d   g«      S )z8Reformat the number to the standard presentation format.ú-Nr!   )r   Újoinr
   s    r   Úformatr.   d   s)   € ä�V‹_€FØ�8‰8�V˜C˜R�[ &¨¡*Ð-Ó.Ð.r   N)r   r   Úreturnr   )r   r   r/   r(   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r   r&   r*   r.   © r   r   ú<module>r5      s/   ðñ*õ@ #ä ß 'ó/óóóô/r   