Ë
    Ã?Æi÷
  ã                  óF   — d Z ddlmZ ddl­ d	d
d„Zd	dd„Zd	dd„Zd	dd„Zy)aH  The Luhn and Luhn mod N algorithms.

The Luhn algorithm is used to detect most accidental errors in various
identification numbers.

>>> validate('7894')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> checksum('7894')
6
>>> calc_check_digit('7894')
'9'
>>> validate('78949')
'78949'

An alternative alphabet can be provided to use the Luhn mod N algorithm.
The default alphabet is '0123456789'.

>>> validate('1234', alphabet='0123456789abcdef')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> checksum('1234', alphabet='0123456789abcdef')
14
é    )Úannotations)Ú*c                óÆ   ‡‡— t        ‰«      Št        ˆfd„t        t        | «      «      D «       «      }t	        |ddd…   «      t	        ˆfd„|ddd…   D «       «      z   ‰z  S )zˆCalculate the Luhn checksum over the provided number. The checksum
    is returned as an int. Valid numbers should have a checksum of 0.c              3  ó@   •K  — | ]  }‰j                  |«      –— Œ y ­w)N)Úindex)Ú.0ÚiÚalphabets     €úR/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/luhn.pyú	<genexpr>zchecksum.<locals>.<genexpr>8   s"   øè ø€ ò 3Øð —>‘> !×$ñ 3ùs   ƒNé   c              3  óN   •K  — | ]  }t        t        |d z  ‰«      «      –— Œ y­w)r   N)ÚsumÚdivmod)r   r	   Úns     €r   r   zchecksum.<locals>.<genexpr>;   s)   øè ø€ ò 'Øô ”F˜1˜q™5 !Ó$×%ñ 'ùs   ƒ"%é   )ÚlenÚtupleÚreversedÚstrr   )Únumberr
   Úvaluesr   s    ` @r   Úchecksumr   4   so   ù€ ô 	ˆH‹€AÜó 3Ü$¤S¨£[Ó1ô3ó 3€Fä�‘s˜�s‘ÓÜó 'Ø   1 ™ô'ó 'ñ'à*+ñ,ð ,ó    c                ó–   — t        | «      s
t        «       ‚	 t        | |«      dk(  }|s
t	        «       ‚| S # t        $ r t        «       ‚w xY w)z6Check if the number provided passes the Luhn checksum.r   )ÚboolÚInvalidFormatr   Ú	ExceptionÚInvalidChecksum)r   r
   Úvalids      r   Úvalidater!   ?   sS   € ä�Œ<Ü‹oÐðÜ˜ Ó*¨aÑ/ˆñ ÜÓÐØ€Møô	 ò Ü‹oÐðús	   —4 ´Ac                óL   — 	 t        t        | |«      «      S # t        $ r Y yw xY w)z-Check if the number passes the Luhn checksum.F)r   r!   ÚValidationError)r   r
   s     r   Úis_validr$   L   s+   € ðÜ”H˜V XÓ.Ó/Ð/øÜò Ùðús   ‚ —	#¢#c                óD   — t        t        | «      |d   z   |«      }||    S )z^Calculate the extra digit that should be appended to the number to
    make it a valid number.r   )r   r   )r   r
   Úcks      r   Úcalc_check_digitr'   T   s)   € ô 
”#�f“+ ¨¡Ñ+¨XÓ	6€BØ�R�C‰=Ðr   N)Ú
0123456789)r   r   r
   r   ÚreturnÚint)r   r   r
   r   r)   r   )r   r   r
   r   r)   r   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsr   r!   r$   r'   © r   r   ú<module>r/      s&   ðñ(õ6 #ä ô,ô
ôõr   