Ë
    Ã?ÆiÍ	  ã                  óN   — 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
y	)u�  NIF (NÃºmero de identificaÃ§Ã£o fiscal, Portuguese VAT number).

The NIF (NÃºmero de identificaÃ§Ã£o fiscal, NIPC, NÃºmero de IdentificaÃ§Ã£o de
Pessoa Colectiva) is used for VAT purposes. It is a 9-digit number with a
simple checksum.

>>> validate('PT 501 964 843')
'501964843'
>>> validate('PT 501 964 842')  # invalid check digits
Traceback (most recent call last):
    ...
InvalidChecksum: ...
é    )Ú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 -.ÚPTé   N)r   ÚupperÚstripÚ
startswith©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/pt/nif.pyÚcompactr   )   s@   € ô �6˜5Ó!×'Ñ'Ó)×/Ñ/Ó1€FØ×Ñ˜ÔØ˜˜�ˆØ€Mó    c                ó`   — t        d„ t        | «      D «       «      }t        d|z
  dz  dz  «      S )zZCalculate 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>5   s!   è ø€ Ò;¡  AˆQ�‰U”c˜!“fÕÑ;ùs   ‚ é   é
   )ÚsumÚ	enumerateÚstr)r   Úss     r   Úcalc_check_digitr    2   s1   € ô 	Ñ;¬°6Ó):Ô;Ó;€AÜ��Q‘˜"‰}˜rÑ!Ó"Ð"r   c                óÂ   — t        | «      } t        | «      r| d   dk(  r
t        «       ‚t        | «      dk7  r
t	        «       ‚t        | dd «      | d   k7  r
t        «       ‚| S )zbCheck if the number is a valid VAT number. This checks the length,
    formatting and check digit.r   Ú0r   Néÿÿÿÿ)r   r   ÚInvalidFormatÚlenÚInvalidLengthr    ÚInvalidChecksumr   s    r   Úvalidater(   9   sa   € ô �V‹_€FÜ�FÔ˜v a™y¨CÒ/Ü‹oÐÜ
ˆ6ƒ{�aÒÜ‹oÐÜ˜˜s ˜Ó$¨¨r©
Ò2ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z*Check if the number is a valid VAT number.F)Úboolr(   ÚValidationErrorr   s    r   Úis_validr,   F   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"N)r   r   Úreturnr   )r   r   r-   r*   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r    r(   r,   © r   r   ú<module>r3      s)   ðñ*õ #ä ß 'óó#ó
ôr   