Ë
    Ã?Æi¬  ã                  ó†   — d Z ddlmZ ddl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å  Kennitala (Icelandic personal and organisation identity code).

Module for handling Icelandic personal and organisation identity codes
(kennitala).

>>> validate('450401-3150')  # organisation
'4504013150'
>>> validate('120174-3399')  # individual
'1201743399'
>>> validate('530575-0299')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('320174-3399')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> format('1201743399')
'120174-3399'
é    )ÚannotationsN)Ú*)Úcleanzf^(?P<day>[01234567]\d)(?P<month>[01]\d)(?P<year>\d\d)(?P<random>\d\d)(?P<control>\d)(?P<century>[09])$c                óR   — t        | d«      j                  «       j                  «       S )z“Convert the kennitala to the minimal representation. This
    strips surrounding whitespace and separation dash, and converts it
    to upper case.ú-)r   ÚupperÚstrip©Únumbers    ú[/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/is_/kennitala.pyÚcompactr   ?   s#   € ô �˜Ó×#Ñ#Ó%×+Ñ+Ó-Ð-ó    c                óD   — d}t        d„ t        || «      D «       «      dz  S )zCalculate the checksum.)
é   é   é   é   é   é   r   r   é   r   c              3  ó>   K  — | ]  \  }}|t        |«      z  –— Œ y ­w)N)Úint)Ú.0ÚwÚns      r   ú	<genexpr>zchecksum.<locals>.<genexpr>I   s   è ø€ Ò;™d˜a ˆq”3�q“6�zÑ;ùs   ‚é   )ÚsumÚzip)r   Úweightss     r   Úchecksumr!   F   s$   € à,€GÜÑ;¤c¨'°6Ó&:Ô;Ó;¸bÑ@Ð@r   c                ó  — t        | «      } t        j                  | «      }|s
t        «       ‚t	        |j                  d«      «      }t	        |j                  d«      «      }t	        |j                  d«      «      }|j                  d«      dk(  r|dz  }n|dz  }	 |dk\  rt        j                  |||dz
  «       nt        j                  |||«       t        | «      d	k7  r
t        «       ‚| S # t        $ r t        «       ‚w xY w)
z–Check if the number provided is a valid kennitala. It checks the
    format, whether a valid date is given and whether the check digit is
    correct.ÚdayÚmonthÚyearÚcenturyÚ9il  iÐ  é(   r   )r   Ú_kennitala_reÚsearchÚInvalidFormatr   ÚgroupÚdatetimeÚdateÚ
ValueErrorÚInvalidComponentr!   ÚInvalidChecksum)r   Úmatchr#   r$   r%   s        r   Úvalidater3   L   së   € ô �V‹_€FÜ× Ñ  Ó(€EÙÜ‹oÐÜ
ˆe�k‰k˜%Ó Ó
!€CÜ�—‘˜GÓ$Ó%€EÜˆu�{‰{˜6Ó"Ó#€DØ‡{�{�9Ó Ò$Ø�‰‰à�‰ˆð!Ø�"Š9Ü�M‰M˜$  s¨R¡xÕ0ä�M‰M˜$  sÔ+ô �Ó˜1ÒÜÓÐØ€Møô ò !ÜÓ Ð ð!ús   Â7C, Ã,D c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z�Check if the number provided is a valid HETU. It checks the format,
    whether a valid date is given and whether the check digit is correct.F)Úboolr3   ÚValidationErrorr
   s    r   Úis_validr7   i   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ó4   — t        | «      } | dd dz   | dd z   S )z8Reformat the number to the standard presentation format.Nr   r   )r   r
   s    r   Úformatr9   r   s'   € ä�V‹_€FØ�"�1ˆ:˜Ñ˜f Q R˜jÑ(Ð(r   )r   ÚstrÚreturnr:   )r   r:   r;   r   )r   r:   r;   r5   )Ú__doc__Ú
__future__r   r-   ÚreÚstdnum.exceptionsÚstdnum.utilr   Úcompiler)   r   r!   r3   r7   r9   © r   r   ú<module>rC      sL   ðñ,õ* #ã Û 	ä Ý ð �—
‘
ðó€ó.óAóó:ô)r   