Ë
    Ã?Æi5  ã                  ó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
)u€  CN (æ³•äººç•ªå�·, hÅ�jin bangÅ�, Japanese Corporate Number).

The Corporate Number is assigned by the Japanese National Tax Agency to
identify government organs, public entities, registered corporations and
other organisations. The number consists of 13 digits where the first digit
is a non-zero check digit.

More information:

 * https://en.wikipedia.org/wiki/Corporate_Number
 * https://www.nta.go.jp/taxes/tetsuzuki/mynumberinfo/houjinbangou/

>>> validate('5-8356-7825-6246')
'5835678256246'
>>> validate('2-8356-7825-6246')
Traceback (most recent call last):
  ...
InvalidChecksum: ...
>>> format('5835678256246')
'5-8356-7825-6246'
é    )Úannotations)Ú*)ÚcleanÚisdigitsc                ó6   — t        | d«      j                  «       S )zˆConvert the number to the minimal representation. This strips the
    number of any valid separators and removes surrounding whitespace.z- )r   Ústrip©Únumbers    úS/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/jp/cn.pyÚcompactr   1   s   € ô �˜Ó×$Ñ$Ó&Ð&ó    c           	     ór   — d}t        d„ t        |t        | «      «      D «       «      dz  }t        d|z
  «      S )zZCalculate the check digit. The number passed should not have
    the check digit included.)é   é   r   r   r   r   r   r   r   r   r   r   c              3  ó>   K  — | ]  \  }}|t        |«      z  –— Œ y ­w)N)Úint)Ú.0ÚwÚns      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>;   s   è ø€ ÒB™4˜1˜aˆA”�A“�JÑBùs   ‚é	   )ÚsumÚzipÚreversedÚstr)r
   ÚweightsÚss      r   Úcalc_check_digitr   7   s8   € ð 3€GÜÑB¤3 w´¸Ó0@Ó#AÔBÓBÀQÑF€AÜˆq�1‰u‹:Ðr   c                ó²   — t        | «      } t        | «      dk7  r
t        «       ‚t        | «      s
t	        «       ‚t        | dd «      | d   k7  r
t        «       ‚| S )zICheck if the number is valid. This checks the length and check
    digit.é   r   Nr   )r   ÚlenÚInvalidLengthr   ÚInvalidFormatr   ÚInvalidChecksumr	   s    r   Úvalidater%   ?   sV   € ô �V‹_€FÜ
ˆ6ƒ{�bÒÜ‹oÐÜ�FÔÜ‹oÐÜ˜˜q˜r˜
Ó# v¨a¡yÒ0ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z"Check if the number is a valid CN.F)Úboolr%   ÚValidationErrorr	   s    r   Úis_validr)   L   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                óZ   — t        | «      } dj                  | d   | dd | dd | dd f«      S )z8Reformat the number to the standard presentation format.ú-r   r   é   r   r    )r   Újoinr	   s    r   Úformatr.   T   s>   € ä�V‹_€FØ�8‰8Ø	�‰�F˜1˜Q�K ¨¨! ¨f°Q°r¨lÐ;ó=ð =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.   ðñ*õ, #ä ß 'ó'óó
óô=r   