Ë
    Ã?ÆiU
  ã                  ó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¸  Orgnr (Organisasjonsnummer, Norwegian organisation number).

The Organisasjonsnummer is a 9-digit number with a straightforward check
mechanism.

More information:

* https://nn.wikipedia.org/wiki/Organisasjonsnummer
* https://no.wikipedia.org/wiki/Organisasjonsnummer

>>> validate('988 077 917')
'988077917'
>>> validate('988 077 918')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('988077917')
'988 077 917'
é    )Ú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.ú )r   Ústrip©Únumbers    úV/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/no/orgnr.pyÚcompactr   1   s   € ô �˜Ó×#Ñ#Ó%Ð%ó    c                óD   — d}t        d„ t        || «      D «       «      dz  S )zCalculate the checksum.)	é   é   é   é   é   é   r   r   é   c              3  ó>   K  — | ]  \  }}|t        |«      z  –— Œ y ­w)N)Úint)Ú.0ÚwÚns      r   ú	<genexpr>zchecksum.<locals>.<genexpr>:   s   è ø€ Ò;™d˜a ˆq”3�q“6�zÑ;ùs   ‚é   )ÚsumÚzip)r   Úweightss     r   Úchecksumr!   7   s$   € à)€GÜÑ;¤c¨'°6Ó&:Ô;Ó;¸bÑ@Ð@r   c                ó¦   — t        | «      } t        | «      s
t        «       ‚t        | «      dk7  r
t	        «       ‚t        | «      dk7  r
t        «       ‚| S )zkCheck if the number is a valid organisation number. This checks the
    length, formatting and check digit.é	   r   )r   r   ÚInvalidFormatÚlenÚInvalidLengthr!   ÚInvalidChecksumr
   s    r   Úvalidater(   =   sL   € ô �V‹_€FÜ�FÔÜ‹oÐÜ
ˆ6ƒ{�aÒÜ‹oÐÜ�Ó˜1ÒÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z3Check if the number is a valid organisation number.F)Úboolr(   ÚValidationErrorr
   s    r   Úis_validr,   J   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                óF   — t        | «      } | dd dz   | dd z   dz   | dd z   S )z8Reformat the number to the standard presentation format.Nr   r   r   )r   r
   s    r   Úformatr.   R   s7   € ä�V‹_€FØ�"�1ˆ:˜Ñ˜f Q q˜kÑ)¨CÑ/°&¸¸°*Ñ<Ð<r   N)r   ÚstrÚreturnr/   )r   r/   r0   r   )r   r/   r0   r*   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r!   r(   r,   r.   © r   r   ú<module>r6      s/   ðñ.õ( #ä ß 'ó&óAó
óô=r   