Ë
    Ã?Æiö	  ã                  óv   — d Z ddlmZ ddlZddl­ ddlmZ  ej                  d«      Zdd„Z	dd„Z
dd	„Zdd
„Zy)aÌ  CAS RN (Chemical Abstracts Service Registry Number).

The CAS Registry Number is a unique identifier assigned by the Chemical
Abstracts Service (CAS) to a chemical substance.

More information:

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

>>> validate('87-86-5')
'87-86-5'
>>> validate('87-86-6')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('012770-26-2')
Traceback (most recent call last):
    ...
InvalidFormat: ...
é    )ÚannotationsN)Ú*)Úcleanz ^[1-9][0-9]{1,6}-[0-9]{2}-[0-9]$c                ó|   — t        | d«      j                  «       } d| vrdj                  | dd | dd | dd f«      } | S )z1Convert the number to the minimal representation.ú ú-Néýÿÿÿéÿÿÿÿ)r   ÚstripÚjoin©Únumbers    úS/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/casrn.pyÚcompactr   4   sK   € ä�6˜3Ó×%Ñ%Ó'€FØ
�&ÑØ—‘˜6 # 2˜;¨¨r°"¨°v¸b¸c°{ÐCÓDˆØ€Mó    c           
     ó†   — | j                  dd«      } t        t        d„ t        t	        | «      «      D «       «      dz  «      S )ziCalculate the check digit for the number. The passed number should not
    have the check digit included.r   Ú c              3  óD   K  — | ]  \  }}|d z   t        |«      z  –— Œ y­w)é   N)Úint)Ú.0ÚiÚns      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>A   s!   è ø€ ÒE¡  AˆQ�‰U”c˜!“fÕÑEùs   ‚ é
   )ÚreplaceÚstrÚsumÚ	enumerateÚreversedr   s    r   Úcalc_check_digitr!   <   s@   € ð �^‰^˜C Ó$€FÜÜÑE¬´8¸FÓ3CÓ)DÔEÓEÈÑJóLð Lr   c                óè   — t        | «      } dt        | «      cxk  rdk  st        «       ‚ t        «       ‚t        j	                  | «      s
t        «       ‚| d   t        | dd «      k7  r
t        «       ‚| S )ú/Check if the number provided is a valid CAS RN.é   é   r
   N)r   ÚlenÚInvalidLengthÚ_cas_reÚmatchÚInvalidFormatr!   ÚInvalidChecksumr   s    r   Úvalidater,   D   sk   € ä�V‹_€FØ”�F“Ô!˜rÒ!Ü‹oÐð "Ü‹oÐÜ�=‰=˜Ô Ü‹oÐØˆb�zÔ% f¨S¨b kÓ2Ò2ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r#   F)Úboolr,   ÚValidationErrorr   s    r   Úis_validr0   P   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡")r   r   Úreturnr   )r   r   r1   r.   )Ú__doc__Ú
__future__r   ÚreÚstdnum.exceptionsÚstdnum.utilr   Úcompiler(   r   r!   r,   r0   © r   r   ú<module>r9      s@   ðñ(õ* #ã 	ä Ý ð ˆ"�*‰*Ð8Ó
9€óóLó	ôr   