Ë
    Ã?Æi  ã                  óV   — 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y
)aŽ  IMO number (International Maritime Organization number).

A number used to uniquely identify ships (the hull) for purposes of
registering owners and management companies. The ship identification number
consists of a six-digit sequentially assigned number and a check digit. The
number is usually prefixed with "IMO".

Note that there seem to be a large number of ships with an IMO that does not
have a valid check digit or even have a different length.

>>> validate('IMO 9319466')
'9319466'
>>> validate('IMO 8814275')
'8814275'
>>> validate('8814274')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('8814275')
'IMO 8814275'
é    )Úannotations)Ú*)ÚcleanÚisdigitsc                ó‚   — t        | d«      j                  «       j                  «       } | j                  d«      r| dd } | S )zˆConvert the number to the minimal representation. This strips the
    number of any valid separators and removes surrounding whitespace.ú ÚIMOé   N)r   ÚupperÚstripÚ
startswith©Únumbers    úQ/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/imo.pyÚcompactr   1   s@   € ô �6˜3Ó×%Ñ%Ó'×-Ñ-Ó/€FØ×Ñ˜ÔØ˜˜�ˆØ€Mó    c           
     óV   — t        t        d„ t        | dd «      D «       «      dz  «      S )z*Calculate the check digits for 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!   è ø€ ÒF©¨¨1”3�q“6˜Q ™UÕ#ÑFùs   ‚ Né   é
   )ÚstrÚsumÚ	enumerater   s    r   Úcalc_check_digitr    :   s(   € äŒsÑF´	¸&ÀÀ!¸*Ó0EÔFÓFÈÑKÓLÐLr   c                ó²   — t        | «      } t        | «      s
t        «       ‚t        | «      dk7  r
t	        «       ‚t        | dd «      | d   k7  r
t        «       ‚| S )úRCheck if the number provided is valid. This checks the length and
    check digit.r   Néÿÿÿÿ)r   r   ÚInvalidFormatÚlenÚInvalidLengthr    ÚInvalidChecksumr   s    r   Úvalidater(   ?   sV   € ô �V‹_€FÜ�FÔÜ‹oÐÜ
ˆ6ƒ{�aÒÜ‹oÐÜ˜˜s ˜Ó$¨¨r©
Ò2ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r"   F)Úboolr(   ÚValidationErrorr   s    r   Úis_validr,   L   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ó   — dt        | «      z   S )z8Reformat the number to the standard presentation format.zIMO )r   r   s    r   Úformatr.   U   s   € à”G˜F“OÑ#Ð#r   N)r   r   Úreturnr   )r   r   r/   r*   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r    r(   r,   r.   © r   r   ú<module>r5      s/   ðñ*õ, #ä ß 'óóMó

óô$r   