Ë
    Ã?Æi§  ã                  ól   — d Z ddlm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d„Zy)a  ISSN (International Standard Serial Number).

The ISSN (International Standard Serial Number) is the standard code to
identify periodical publications (e.g. magazines).

An ISSN has 8 digits and is formatted in two pairs of 4 digits separated by a
hyphen. The last digit is a check digit and may be 0-9 or X (similar to
ISBN-10).

More information:

* https://en.wikipedia.org/wiki/International_Standard_Serial_Number
* https://www.issn.org/

>>> validate('0024-9319')
'00249319'
>>> validate('0032147X')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('003214712')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> compact('0032-1478')
'00321478'
>>> format('00249319')
'0024-9319'
>>> to_ean('0264-3596')
'9770264359008'
é    )Úannotations)Úean)Ú*)ÚcleanÚisdigitsc                óR   — t        | d«      j                  «       j                  «       S )z‹Convert the ISSN to the minimal representation. This strips the number
    of any valid ISSN separators and removes surrounding whitespace.z -)r   ÚstripÚupper©Únumbers    úR/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/issn.pyÚcompactr   ;   s#   € ô �˜Ó×$Ñ$Ó&×,Ñ,Ó.Ð.ó    c                óh   — dt        d„ t        | «      D «       «      z
  dz  }|dk(  rdS t        |«      S )zsCalculate the ISSN check digit for 8-digit numbers. The number passed
    should not have the check digit included.é   c              3  óD   K  — | ]  \  }}d |z
  t        |«      z  –— Œ y­w)é   N)Úint)Ú.0ÚiÚns      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>D   s)   è ø€ ò 5Ù˜!˜Qð ˜1‘u¤ A£Õ&ñ 5ùs   ‚ é
   ÚX)ÚsumÚ	enumerateÚstr)r   Úchecks     r   Úcalc_check_digitr   A   sD   € ð ”#ñ 5Ü"+¨FÓ"3ô5ó 5ñ 5Ø8:ñ;€Eà˜2’+ˆ3Ð-¤3 u£:Ð-r   c                ó¸   — t        | «      } t        | dd «      s
t        «       ‚t        | «      dk7  r
t	        «       ‚t        | dd «      | d   k7  r
t        «       ‚| S )zgCheck if the number is a valid ISSN. This checks the length and
    whether the check digit is correct.Néÿÿÿÿr   )r   r   ÚInvalidFormatÚlenÚInvalidLengthr   ÚInvalidChecksumr   s    r   Úvalidater&   I   s\   € ô �V‹_€FÜ�F˜3˜B�KÔ Ü‹oÐÜ
ˆ6ƒ{�aÒÜ‹oÐÜ˜˜s ˜Ó$¨¨r©
Ò2ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z-Check if the number provided is a valid ISSN.F)Úboolr&   ÚValidationErrorr   s    r   Úis_validr*   V   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ó4   — t        | «      } | dd dz   | dd z   S )z8Reformat the number to the standard presentation format.Né   ú-)r   r   s    r   Úformatr.   ^   s'   € ä�V‹_€FØ�"�1ˆ:˜Ñ˜f Q R˜jÑ(Ð(r   c                óZ   — dt        | «      dd z   |z   } | t        j                  | «      z   S )z$Convert the number to EAN-13 format.Ú977Nr!   )r&   r   r   )r   Ú
issue_codes     r   Úto_eanr2   d   s3   € à”X˜fÓ% c rÐ*Ñ*¨ZÑ7€FØ”C×(Ñ(¨Ó0Ñ0Ð0r   N)r   r   Úreturnr   )r   r   r3   r(   )Ú00)r   r   r1   r   r3   r   )Ú__doc__Ú
__future__r   Ústdnumr   Ústdnum.exceptionsÚstdnum.utilr   r   r   r   r&   r*   r.   r2   © r   r   ú<module>r;      s7   ðñ(õ@ #å Ü ß 'ó/ó.ó
óó)õ1r   