Ë
    Ã?Æi£  ã                  ó~   — 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dd„Zy)a  ISO 6346 (International standard for container identification)

ISO 6346 is an international standard covering the coding, identification and
marking of intermodal (shipping) containers used within containerized
intermodal freight transport. The standard establishes a visual identification
system for every container that includes a unique serial number (with check
digit), the owner, a country code, a size, type and equipment category as well
as any operational marks. The standard is managed by the International
Container Bureau (BIC).

More information:

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

>>> validate('csqu3054383')
'CSQU3054383'
>>> validate('CSQU3054384')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('tasu117 000 0')
'TASU 117000 0'
é    )ÚannotationsN)Ú*)Úcleanz^\w{3}(U|J|Z|R)\d{7}$c                ó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.ú )r   ÚstripÚupper©Únumbers    úU/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/iso6346.pyÚcompactr   8   s#   € ô �˜Ó×#Ñ#Ó%×+Ñ+Ó-Ð-ó    c                óv   ‡— t        | «      } dŠt        t        ˆfd„t        | «      D «       «      dz  dz  «      S )zVCalculate check digit and return it for the 10 digit owner code and
    serial number.z'0123456789A BCDEFGHIJK LMNOPQRSTU VWXYZc              3  ó`   •K  — | ]%  \  }}‰j                  |«      t        d |«      z  –— Œ' y­w)é   N)ÚindexÚpow)Ú.0ÚiÚnÚalphabets      €r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>C   s1   øè ø€ ò 'áˆAˆqð 	�‰�qÓœC  1›IÕ%ñ'ùs   ƒ+.é   é
   )r   ÚstrÚsumÚ	enumerate)r   r   s    @r   Úcalc_check_digitr   >   sI   ø€ ô �V‹_€FØ8€HÜŒsó 'ä˜fÓ%ô'ó 'à)+ñ,à.0ñ1ó 2ð 2r   c                óÆ   — t        | «      } t        | «      dk7  r
t        «       ‚t        j	                  | «      s
t        «       ‚t        | dd «      | d   k7  r
t        «       ‚| S )z?Validate the given number (unicode) for conformity to ISO 6346.r   Néÿÿÿÿ)r   ÚlenÚInvalidLengthÚ_iso6346_reÚmatchÚInvalidFormatr   ÚInvalidChecksumr
   s    r   Úvalidater'   H   sZ   € ä�V‹_€FÜ
ˆ6ƒ{�bÒÜ‹oÐÜ×Ñ˜VÔ$Ü‹oÐÜ˜˜s ˜Ó$¨¨r©
Ò2ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z„Check whether the number conforms to the standard ISO6346. Unlike
    the validate function, this will not raise ValidationError(s).F)Úboolr'   ÚValidationErrorr
   s    r   Úis_validr+   T   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                óR   — t        | «      } dj                  | dd | dd | dd f«      S )z8Reformat the number to the standard presentation format.r   Né   r    )r   Újoinr
   s    r   Úformatr/   ]   s3   € ä�V‹_€FØ�8‰8�V˜B˜Q�Z ¨¨" ¨v°b°c¨{Ð;Ó<Ð<r   )r   r   Úreturnr   )r   r   r0   r)   )Ú__doc__Ú
__future__r   ÚreÚstdnum.exceptionsÚstdnum.utilr   Úcompiler#   r   r   r'   r+   r/   © r   r   ú<module>r8      sD   ðñ*õ0 #ã 	ä Ý ð ˆb�j‰jÐ1Ó2€ó.ó2ó	óô=r   