Ë
    Ã?ÆiÊ  ã                  óV   — d Z ddlmZ ddl­ ddlmZ ddlmZ dd„Zdd„Z	dd„Z
dd	„Zy
)aÕ  ISO 11649 (Structured Creditor Reference).

The ISO 11649 structured creditor number consists of 'RF' followed by two
check digits and up to 21 digits. The number may contain letters.

The reference number is validated by moving RF and the check digits to the
end of the number, and checking that the ISO 7064 Mod 97, 10 checksum of this
string is 1.

More information:

* https://en.wikipedia.org/wiki/Creditor_Reference

>>> validate('RF18 5390 0754 7034')
'RF18539007547034'
>>> validate('RF18 5390 0754 70Y')
'RF185390075470Y'
>>> is_valid('RF18 5390 0754 7034')
True
>>> validate('RF17 5390 0754 7034')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('RF18539007547034')
'RF18 5390 0754 7034'
é    )Úannotations)Ú*)Ú	mod_97_10)Úcleanc                óR   — t        | d«      j                  «       j                  «       S )zŠConvert the number to the minimal representation. This strips the
    number of any invalid separators and removes surrounding whitespace.z -.,/:)r   ÚupperÚstrip©Únumbers    úV/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/iso11649.pyÚcompactr   7   s#   € ô �˜Ó"×(Ñ(Ó*×0Ñ0Ó2Ð2ó    c                óÚ   — t        | «      } t        | «      dk  st        | «      dkD  r
t        «       ‚| j                  d«      s
t	        «       ‚t        j                  | dd | dd z   «       | S )z[Check if the number provided is a valid ISO 11649 structured creditor
    reference number.é   é   ÚRFé   N)r   ÚlenÚInvalidLengthÚ
startswithÚInvalidFormatr   Úvalidater
   s    r   r   r   =   se   € ô �V‹_€FÜ
ˆ6ƒ{�Q‚œ#˜f›+¨Ò*Ü‹oÐØ×Ñ˜TÔ"Ü‹oÐÜ×Ñ�v˜a˜b�z F¨2¨A JÑ.Ô/Ø€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z†Check if the number provided is a valid ISO 11649 structured creditor
    number. This checks the length, formatting and check digits.F)Úboolr   ÚValidationErrorr
   s    r   Úis_validr   I   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c           	     óv   ‡ — t        ‰ «      Š dj                  ˆ fd„t        dt        ‰ «      d«      D «       «      S )zÑFormat the number provided for output.

    Blocks of 4 characters, the last block can be less than 4 characters. See
    https://www.paymentstandards.ch/dam/downloads/ig-qr-bill-en.pdf chapter
    3.6.2.
    ú c              3  ó.   •K  — | ]  }‰||d z    –— Œ y­w)r   N© )Ú.0Úir   s     €r   ú	<genexpr>zformat.<locals>.<genexpr>Z   s   øè ø€ ÒF¨�F˜1˜Q ™U”OÑFùs   ƒr   r   )r   ÚjoinÚranger   r
   s   `r   Úformatr&   R   s0   ø€ ô �V‹_€FØ�8‰8ÓF¬U°1´c¸&³kÀ1Ó-EÔFÓFÐFr   N)r   ÚstrÚreturnr'   )r   r'   r(   r   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.iso7064r   Ústdnum.utilr   r   r   r   r&   r    r   r   ú<module>r.      s-   ðñ*õ6 #ä Ý $Ý ó3ó	óôGr   