Ë
    Ã?Æii  ã                  óf   — 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
dd	„Zdd
„Zdd„Zy)uk  CCC (CÃ³digo Cuenta Corriente, Spanish Bank Account Code)

CCC code is the country-specific part in Spanish IBAN codes. In order to
fully validate an Spanish IBAN you have to validate as well the country
specific part as a valid CCC. It was used for home banking transactions until
February 1st 2014 when IBAN codes started to be used as an account ID.

The CCC has 20 digits, all being numbers: EEEE OOOO DD NNNNNNNNNN

* EEEE: banking entity
* OOOO: office
* DD: check digits
* NNNNN NNNNN: account identifier

This module does not check if the bank code to exist. Existing bank codes are
published on the 'Registro de Entidades' by 'Banco de EspaÃ±a' (Spanish
Central Bank).

More information:

* https://es.wikipedia.org/wiki/CÃ³digo_cuenta_cliente
* https://www.bde.es/bde/es/secciones/servicios/Particulares_y_e/Registros_de_Ent/

>>> validate('1234-1234-16 1234567890')
'12341234161234567890'
>>> validate('134-1234-16 1234567890')  # wrong length
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('12X4-1234-16 1234567890')  # non numbers
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('1234-1234-00 1234567890')  # invalid check digits
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('12341234161234567890')
'1234 1234 16 12345 67890'
>>> to_iban('21000418450200051331')
'ES2121000418450200051331'
é    )Ú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.z -)r   ÚstripÚupper©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/es/ccc.pyÚcompactr   G   s#   € ô �˜Ó×$Ñ$Ó&×,Ñ,Ó.Ð.ó    c           	     ób   — t        | «      } dj                  | dd | dd | dd | dd | dd g«      S )z8Reformat the number to the standard presentation format.ú r   é   é   é
   é   é   )r   Újoinr
   s    r   Úformatr   M   sN   € ä�V‹_€FØ�8‰8Øˆq�ˆØˆq�ˆØˆq�ˆØˆr�"ˆØˆr�"ˆðó ð r   c                óp   — t        d„ t        | «      D «       «      dz  }t        |dk  r|«      S d|z
  «      S )zBCalculate a single check digit on the provided part of the number.c              3  óD   K  — | ]  \  }}t        |«      d |z  z  –— Œ y­w)é   N)Úint)Ú.0ÚiÚns      r   ú	<genexpr>z$_calc_check_digit.<locals>.<genexpr>[   s    è ø€ Ò>¡D A q”�A“˜˜a™•Ñ>ùs   ‚ é   r   )ÚsumÚ	enumerateÚstr)r   Úchecks     r   Ú_calc_check_digitr%   Y   s9   € äÑ>¬I°fÓ,=Ô>Ó>ÀÑC€EÜ˜ š	ˆuÓ2Ð2 r¨E¡zÓ2Ð2r   c                óX   — t        | «      } t        d| dd z   «      t        | dd «      z   S )zuCalculate the check digits for the number. The supplied number should
    have check digits included but are ignored.Ú00Nr   r   )r   r%   r
   s    r   Úcalc_check_digitsr(   _   s7   € ô �V‹_€Fä˜$ ¨¨ Ñ+Ó,Ô/@ÀÈÈÀÓ/MÑMðOr   c                ó¬   — t        | «      } t        | «      dk7  r
t        «       ‚t        | «      s
t	        «       ‚| dd t        | «      k7  r
t        «       ‚| S )ú,Check if the number provided is a valid CCC.r   r   r   )r   ÚlenÚInvalidLengthr   ÚInvalidFormatr(   ÚInvalidChecksumr
   s    r   Úvalidater/   g   sQ   € ä�V‹_€FÜ
ˆ6ƒ{�bÒÜ‹oÐÜ�FÔÜ‹oÐØˆa�€|Ô(¨Ó0Ò0ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r*   F)Úboolr/   ÚValidationErrorr
   s    r   Úis_validr3   s   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ón   — ddl m} d| v rdnd}|j                  d|j                  d| z   «      z   | f«      S )zConvert the number to an IBAN.r   )Úibanr   Ú ÚESÚES00)Ústdnumr5   r   r(   )r   r5   Ú	separators      r   Úto_ibanr;   {   sB   € åØ˜f‘}‘¨"€IØ�>‰>Øˆt×%Ñ% f¨v¡oÓ6Ñ6Øðó ð r   N)r   r#   Úreturnr#   )r   r#   r<   r1   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r   r%   r(   r/   r3   r;   © r   r   ú<module>rB      s:   ðñ,)õV #ä ß 'ó/ó	ó3óOó	óôr   