Ë
    Ã?Æ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	)a0  FIGI (Financial Instrument Global Identifier).

The Financial Instrument Global Identifier (FIGI) is a 12-character
alpha-numerical unique identifier of financial instruments such as common
stock, options, derivatives, futures, corporate and government bonds,
municipals, currencies, and mortgage products.

More information:

* https://openfigi.com/
* https://en.wikipedia.org/wiki/Financial_Instrument_Global_Identifier

>>> validate('BBG000BLNQ16')
'BBG000BLNQ16'
>>> validate('BBG000BLNQ14')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
é    )Ú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.ú )r   ÚstripÚupper©Únumbers    úR/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/figi.pyÚcompactr   .   s#   € ô �˜Ó×#Ñ#Ó%×+Ñ+Ó-Ð-ó    c                ó–   ‡— dŠdj                  ˆfd„t        | dd «      D «       «      } t        dt        d„ | D «       «      z
  dz  «      S )z*Calculate the check digits for the number.Ú$0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÚ c              3  ój   •K  — | ]*  \  }}t        ‰j                  |«      d |dz     z  «      –— Œ, y­w))é   é   r   N)ÚstrÚindex)Ú.0ÚiÚnÚalphabets      €r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>9   s8   øè ø€ ò ,áˆAˆqô 	ˆH�N‰N˜1Ó  q¨1¡u¡Ñ-×.ñ,ùs   ƒ03Né   é
   c              3  ó2   K  — | ]  }t        |«      –— Œ y ­w)N)Úint)r   r   s     r   r   z#calc_check_digit.<locals>.<genexpr><   s   è ø€ Ò0 Aœ˜QŸÑ0ùs   ‚)ÚjoinÚ	enumerater   Úsum)r   r   s    @r   Úcalc_check_digitr$   4   sR   ø€ ð 6€Hà�W‰Wó ,ä˜f S b˜kÓ*ô,ó ,€Fô �”SÑ0¨Ô0Ó0Ñ0°BÑ6Ó7Ð7r   c                óR  — t        | «      } t        d„ | D «       «      s
t        «       ‚t        | «      dk7  r
t	        «       ‚t        | d   «      st        | d   «      r
t        «       ‚| dd dv r
t        «       ‚| d   dk7  r
t        «       ‚t        | dd	 «      | d	   k7  r
t        «       ‚| S )
ú-Check if the number provided is a valid FIGI.c              3  ó$   K  — | ]  }|d v –— Œ
 y­w)Ú0123456789BCDFGHJKLMNPQRSTVWXYZN© )r   Úxs     r   r   zvalidate.<locals>.<genexpr>B   s   è ø€ ÒF¸!ˆqÐ5Ô5ÑFùs   ‚é   r   r   Nr   )ÚBSÚBMÚGGÚGBÚVGÚGéÿÿÿÿ)	r   ÚallÚInvalidFormatÚlenÚInvalidLengthr   ÚInvalidComponentr$   ÚInvalidChecksumr   s    r   Úvalidater9   ?   s¦   € ä�V‹_€FÜÑF¸vÔFÔFÜ‹oÐÜ
ˆ6ƒ{�bÒÜ‹oÐÜ��q‘	Ôœh v¨a¡yÔ1Ü‹oÐØˆbˆq€zÐ3Ñ3ÜÓ Ð Øˆa�y�CÒÜÓ Ð Ü˜˜s ˜Ó$¨¨r©
Ò2ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r&   F)Úboolr9   ÚValidationErrorr   s    r   Úis_validr=   Q   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"N)r   r   Úreturnr   )r   r   r>   r;   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r$   r9   r=   r)   r   r   ú<module>rC      s)   ðñ(õ( #ä ß 'ó.ó8óô$r   