Ë
    Ã?Æ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	)uw  PVM (PridÄ—tinÄ—s vertÄ—s mokestis mokÄ—tojo kodas, Lithuanian VAT number).

The PVM is used for VAT purposes in Lithuania. It is 9 digits (for legal
entities) or 12 digits long (for temporarily registered taxpayers). This
module does not check the format of Lithuanian personal codes (Asmens
kodas).

>>> validate('119511515')  # organisation
'119511515'
>>> validate('LT 100001919017')  # temporarily registered
'100001919017'
>>> validate('100001919018')  # invalid check digit
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('100004801610')  # second step in check digit calculation
'100004801610'
é    )Ú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 -ÚLTé   N)r   ÚupperÚstripÚ
startswith©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/lt/pvm.pyÚcompactr   .   s@   € ô �6˜4Ó ×&Ñ&Ó(×.Ñ.Ó0€FØ×Ñ˜ÔØ˜˜�ˆØ€Mó    c                ó    — t        d„ t        | «      D «       «      dz  }|dk(  rt        d„ t        | «      D «       «      }t        |dz  dz  «      S )zZCalculate the check digit. The number passed should not have the
    check digit included.c              3  óJ   K  — | ]  \  }}d |dz  z   t        |«      z  –— Œ y­w)é   é	   N©Úint©Ú.0ÚiÚns      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>:   s%   è ø€ ÒC©¨¨A��Q˜‘U‘œc !›fÕ$ÑCùs   ‚!#é   é
   c              3  óP   K  — | ]  \  }}d |dz   dz  z   t        |«      z  –— Œ  y­w)r   r	   r   Nr   r   s      r   r   z#calc_check_digit.<locals>.<genexpr><   s)   è ø€ ÒM±4°1°a�Q˜!˜a™% 1™‘_¬¨A«Õ.ÑMùs   ‚$&)ÚsumÚ	enumerateÚstr)r   Úchecks     r   Úcalc_check_digitr$   7   sM   € ô ÑC´¸6Ó1BÔCÓCÀbÑH€EØ�‚{ÜÑM¼9ÀVÓ;LÔMÓMˆÜˆu�r‰z˜B‰ÓÐr   c                ó  — t        | «      } t        | «      s
t        «       ‚t        | «      dk(  r| d   dk7  r4t	        «       ‚t        | «      dk(  r| d   dk7  rt	        «       ‚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   é   Ú1é   r   Néÿÿÿÿ)r   r   ÚInvalidFormatÚlenÚInvalidComponentÚInvalidLengthr$   ÚInvalidChecksumr   s    r   Úvalidater/   @   sŒ   € ô �V‹_€FÜ�FÔÜ‹oÐÜ
ˆ6ƒ{�aÒà�!‰9˜ÒÜ"Ó$Ð$Ü	ˆV‹˜Ò	à�"‰:˜ÒÜ"Ó$Ð$ä‹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_validr3   U   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"N)r   r"   Úreturnr"   )r   r"   r4   r1   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r$   r/   r3   © r   r   ú<module>r:      s)   ðñ*õ& #ä ß 'óó óô*r   