Ë
    Ã?ÆiM  ã                  ór   — d Z ddlmZ ddl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dd„Zy)aƒ  Personnummer (Swedish personal identity number).

The Swedish Personnummer is assigned at birth to all Swedish nationals and to
immigrants for tax and identification purposes. The number consists of 10 or
12 digits and starts with the birth date, followed by a serial and a check
digit.

More information:

* https://en.wikipedia.org/wiki/Personal_identity_number_(Sweden)

>>> validate('880320-0016')
'880320-0016'
>>> validate('880320-0018')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> get_gender('890102-3286')
'F'
>>> get_birth_date('811228-9841')
datetime.date(1981, 12, 28)
>>> format('8803200016')
'880320-0016'
é    )ÚannotationsN)Úluhn)Ú*)ÚcleanÚisdigitsc                ó²   — t        | d«      } t        | «      dv r| d   dvr| dd ›d| dd ›�} | dd j                  dd«      j                  d	d«      | dd z   S )
zˆConvert the number to the minimal representation. This strips the
    number of any valid separators and removes surrounding whitespace.z :)é
   é   éûÿÿÿú-+Néüÿÿÿú-Ú ú+)r   ÚlenÚreplace©Únumbers    ú]/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/se/personnummer.pyÚcompactr   9   sn   € ô �6˜4Ó €FÜ
ˆ6ƒ{�hÑ 6¨"¡:°TÑ#9Ø" 3 BšK¨°°©Ð5ˆØ�#�2ˆ;×Ñ˜s BÓ'×/Ñ/°°RÓ8¸6À"À#¸;ÑFÐFó    c                óì  — t        | «      } t        | «      dk(  r+t        | dd «      }t        | dd «      }t        | dd «      }n‚t        j                  j                  «       j                  }|dz  }t        | dd «      |dz  kD  r|dz  }| d	   d
k(  r|dz  }t        d|| dd fz  «      }t        | dd «      }t        | dd «      }	 t        j                  |||«      S # t        $ r t        «       ‚w xY w)uå   Determine the birth date from the number.

    For people aged 100 and up, the minus/dash in the personnummer is changed to a plus
    on New Year's Eve the year they turn 100.

    See FolkbokfÃ¶ringslagen (1991:481), Â§18.
    é   r   é   é   é   éd   é   é   r   r   z%d%s)	r   r   ÚintÚdatetimeÚdateÚtodayÚyearÚ
ValueErrorÚInvalidComponent)r   r$   ÚmonthÚdayÚcenturys        r   Úget_birth_dater*   B   s	  € ô �V‹_€FÜ
ˆ6ƒ{�bÒÜ�6˜!˜A�;ÓˆÜ�F˜1˜Q�KÓ ˆÜ�&˜˜1�+Ó‰ä�}‰}×"Ñ"Ó$×)Ñ)ˆØ˜#‘+ˆÜˆv�a˜ˆ{Ó˜d S™jÒ(Ø�q‰LˆGØ�"‰:˜ÒØ�q‰LˆGÜ�6˜W f¨Q¨q kÐ2Ñ2Ó3ˆÜ�F˜1˜Q�KÓ ˆÜ�&˜˜1�+Óˆð!Ü�}‰}˜T 5¨#Ó.Ð.øÜò !ÜÓ Ð ð!ús   ÃC ÃC3c                ó>   — t        | «      } t        | d   «      dz  ryy)z+Get the person's birth gender ('M' or 'F').éþÿÿÿr   ÚMÚF)r   r    r   s    r   Ú
get_genderr/   _   s!   € ä�V‹_€FÜ
ˆ6�"‰:ƒ˜ÒØàr   c                óÞ   — t        | «      } t        | «      dvr
t        «       ‚| dd | dd z   }| d   dvst        |«      s
t	        «       ‚t        | «       t        j                  |dd «       | S )ú/Check if the number is a valid identity number.)é   r   Nr   r   r   iöÿÿÿ)r   r   ÚInvalidLengthr   ÚInvalidFormatr*   r   Úvalidate)r   Údigitss     r   r5   r5   h   so   € ä�V‹_€FÜ
ˆ6ƒ{˜(Ñ"Ü‹oÐØ�C�Rˆ[˜6 " #˜;Ñ&€FØˆb�z˜Ñ¤X¨fÔ%5Ü‹oÐÜ�6ÔÜ‡M�M�&˜˜�,ÔØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r1   F)Úboolr5   ÚValidationErrorr   s    r   Úis_validr:   u   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ó   — t        | «      S )z8Reformat the number to the standard presentation format.)r   r   s    r   Úformatr<   }   s   € ä�6‹?Ðr   )r   ÚstrÚreturnr=   )r   r=   r>   zdatetime.date)r   r=   r>   r8   )Ú__doc__Ú
__future__r   r!   Ústdnumr   Ústdnum.exceptionsÚstdnum.utilr   r   r   r*   r/   r5   r:   r<   © r   r   ú<module>rE      s:   ðñ.õ2 #ã å Ü ß 'óGó!ó:ó
óôr   