Ë
    Ã?Æi“  ã                  óÜ   — d Z ddlmZ ddlZddlmZ ddl­ ddlmZ ddl	m
Z
mZmZ  ej                  d«      Z ej                  d	«      Zi Zdd
„Zdd„Zdd„Zdd„Zddd„Zddd„Zddd„Zy)a™  IBAN (International Bank Account Number).

The IBAN is used to identify bank accounts across national borders. The
first two letters are a country code. The next two digits are check digits
for the ISO 7064 Mod 97, 10 checksum. Each country uses its own format
for the remainder of the number.

Some countries may also use checksum algorithms within their number but
this is only checked for a few countries.

More information:

* https://en.wikipedia.org/wiki/International_Bank_Account_Number
* https://www.swift.com/products_services/bic_and_iban_format_registration_iban_format_r

>>> validate('GR16 0110 1050 0000 1054 7023 795')
'GR1601101050000010547023795'
>>> validate('BE31435411161155')
'BE31435411161155'
>>> compact('GR16 0110 1050 0000 1054 7023 795')
'GR1601101050000010547023795'
>>> format('GR1601101050000010547023795')
'GR16 0110 1050 0000 1054 7023 795'
>>> calc_check_digits('BExx435411161155')
'31'
é    )ÚannotationsN)Únumdb)Ú*)Ú	mod_97_10)ÚNumberValidationModuleÚcleanÚget_cc_moduleÚibanz([1-9][0-9]*)!([nac])c                óR   — t        | d«      j                  «       j                  «       S )z�Convert the iban number to the minimal representation. This strips the
    number of any valid separators and removes surrounding whitespace.z -.)r   ÚstripÚupper©Únumbers    úR/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/iban.pyÚcompactr   C   s#   € ô �˜Ó×%Ñ%Ó'×-Ñ-Ó/Ð/ó    c                óT   — t        | «      } t        j                  | dd | dd z   «      S )z‚Calculate the check digits that should be put in the number to make
    it valid. Check digits in the supplied number are ignored.é   Né   )r   r   Úcalc_check_digitsr   s    r   r   r   I   s/   € ô �V‹_€FÜ×&Ñ& v¨a¨b z°F¸2¸A°JÑ'>Ó?Ð?r   c                ób   — dd„}t        j                  dt        j                  || «      z  «      S )z^Convert an IBAN structure to a regular expression that can be used
    to validate the number.c                ó`   — ddddœ| j                  d«         }|›d| j                  d«      ›d�S )	Nz[0-9]z[A-Z]z[A-Za-z0-9])ÚnÚaÚcr   ú{é   ú})Úgroup)ÚmatchÚcharss     r   Úconvz_struct_to_re.<locals>.convS   s9   € àØØñ
ð �+‰+�a‹.ñ	ˆò
 ! %§+¡+¨a¥.Ð1Ð1r   z^%s$)r    zre.Match[str]ÚreturnÚstr)ÚreÚcompileÚ
_struct_reÚsub)Ú	structurer"   s     r   Ú_struct_to_rer*   P   s(   € ó2ô �:‰:�fœzŸ~™~¨d°IÓ>Ñ>Ó?Ð?r   c                ój   — | j                  «       } | t        vrt        | d«      t        | <   t        |    S )z.Get the IBAN module based on the country code.r
   )ÚlowerÚ_country_modulesr	   )Úccs    r   Ú_get_cc_moduler/   ]   s3   € à	�‰‹€BØ	Ô!Ñ!Ü,¨R°Ó8Ô˜ÑÜ˜BÑÐr   c                ój  — t        | «      } t        j                  | dd | dd z   «       t        j	                  | «      }|d   d   s
t        «       ‚| dd }t        |d   d   j                  dd«      «      j                  |«      s
t        «       ‚|r!t        | dd «      }|r|j                  | «       | S )z}Check if the number provided is a valid IBAN. The country-specific
    check can be disabled with the check_country argument.r   Nr   r   ÚbbanÚ r   )r   r   ÚvalidateÚ_ibandbÚinfoÚInvalidComponentr*   Úgetr    ÚInvalidFormatr/   )r   Úcheck_countryr5   r1   Úmodules        r   r3   r3   e   s®   € ô �V‹_€Fä×Ñ�v˜a˜b�z F¨2¨A JÑ.Ô/ä�<‰<˜Ó€DØ�‰7�1Š:ÜÓ Ð à�!�"ˆ:€DÜ˜˜a™ ™Ÿ™¨°Ó3Ó4×:Ñ:¸4Ô@Ü‹oÐáÜ  r¨ 
Ó+ˆÙØ�O‰O˜FÔ#à€Mr   c                óN   — 	 t        t        | |¬«      «      S # t        $ r Y yw xY w)z-Check if the number provided is a valid IBAN.)r9   F)Úboolr3   ÚValidationError)r   r9   s     r   Úis_validr>   |   s+   € ðÜ”H˜V°=ÔAÓBÐBøÜò Ùðús   ‚ ˜	$£$c           	     óv   ‡ — t        ‰ «      Š |j                  ˆ fd„t        dt        ‰ «      d«      D «       «      S )z9Reformat the passed number to the space-separated format.c              3  ó.   •K  — | ]  }‰||d z    –— Œ y­w)r   N© )Ú.0Úir   s     €r   ú	<genexpr>zformat.<locals>.<genexpr>‡   s   øè ø€ ÒL¨a˜&  1 q¡5œ/ÑLùs   ƒr   r   )r   ÚjoinÚrangeÚlen)r   Ú	separators   ` r   ÚformatrI   „   s.   ø€ ä�V‹_€FØ�>‰>ÓL´5¸¼CÀ»KÈÓ3KÔLÓLÐLr   )r   r$   r#   r$   )r)   r$   r#   zre.Pattern[str])r.   r$   r#   zNumberValidationModule | None)T)r   r$   r9   r<   r#   r$   )r   r$   r9   r<   r#   r<   )ú )r   r$   rH   r$   r#   r$   )Ú__doc__Ú
__future__r   r%   Ústdnumr   Ústdnum.exceptionsÚstdnum.iso7064r   Ústdnum.utilr   r   r	   r7   r4   r&   r'   r-   r   r   r*   r/   r3   r>   rI   rA   r   r   ú<module>rQ      st   ðñ(õ6 #ã 	å Ü Ý $ß DÑ Dð ˆ%�)‰)�FÓ
€ð ˆR�Z‰ZÐ0Ó1€
ð Ð ó0ó@ó
@ó ôô.õMr   