Ë
    Ã?Æil  ã                  óN   — d Z ddlmZ ddl­ ddlmZ dZdd„Zdd„Zdd„Z	dd	„Z
y
)a  EIC (European Energy Identification Code).

The EIC (Energy Identification Code) a 16 character code used in Europe to
uniquely identify entities and objects in the electricity and gas sector.

The number uses letters, digits and the minus sign. The first 2 character
identify the issuing office, 1 character for the object type, 12 digits for
the object and 1 check character.

More information:

* https://en.wikipedia.org/wiki/Energy_Identification_Code
* https://www.entsoe.eu/data/energy-identification-codes-eic/

>>> validate('22XWATTPLUS----G')
'22XWATTPLUS----G'
>>> validate('22XWATTPLUS----X')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('23X--130302DLGW-')  # check digit cannot be minus
Traceback (most recent call last):
    ...
InvalidFormat: ...
é    )Úannotations)Ú*)Úcleanz%0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-c                ó6   — t        | d«      j                  «       S )z‰Convert the number to the minimal representation. This strips the
    number of any valid separators and removes surrounding white space.ú )r   Ústrip©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/eu/eic.pyÚcompactr   8   s   € ô �˜Ó×#Ñ#Ó%Ð%ó    c                óx   — t        | «      } t        d„ t        | dd «      D «       «      }t        d|dz
  dz  z
     S )z)Calculate the check digit for the number.c              3  óX   K  — | ]"  \  }}d |z
  t         j                  |«      z  –— Œ$ y­w)é   N)Ú	_alphabetÚindex)Ú.0ÚiÚns      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>A   s&   è ø€ ÒM©d¨a°ˆR�!‰V”y—‘ qÓ)Õ)ÑMùs   ‚(*Né   é$   é   é%   )r   ÚsumÚ	enumerater   )r
   Úss     r   Úcalc_check_digitr   >   s>   € ä�V‹_€FÜÑM´iÀÀsÈÀÓ6LÔMÓM€AÜ�R˜A ™E R™<Ñ(Ñ)Ð)r   c                óÞ   — t        | «      } t        d„ | D «       «      s
t        «       ‚t        | «      dk7  r
t	        «       ‚| d   dk(  r
t        «       ‚| d   t        | «      k7  r
t        «       ‚| S )úQCheck if the number is valid. This checks the length, format and check
    digit.c              3  ó,   K  — | ]  }|t         v –— Œ y ­w)N)r   )r   Úxs     r   r   zvalidate.<locals>.<genexpr>I   s   è ø€ Ò. !ˆq”IŒ~Ñ.ùs   ‚r   éÿÿÿÿú-)r   ÚallÚInvalidFormatÚlenÚInvalidLengthr   ÚInvalidChecksumr	   s    r   Úvalidater*   E   sk   € ô �V‹_€FÜÑ. vÔ.Ô.Ü‹oÐÜ
ˆ6ƒ{�bÒÜ‹oÐØˆb�z�SÒÜ‹oÐØˆb�zÔ% fÓ-Ò-ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r    F)Úboolr*   ÚValidationErrorr	   s    r   Úis_validr.   T   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"N)r
   ÚstrÚreturnr/   )r
   r/   r0   r,   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r   r*   r.   © r   r   ú<module>r6      s0   ðñ*õ4 #ä Ý ð 4€	ó&ó*óôr   