Ë
    Ã?ÆiU  ã                  óv   — d Z ddlmZ ddl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dd„Zdd„Zy)uÞ  Enotna matiÄ�na Å¡tevilka obÄ�ana (Unique Master Citizen Number).

The EMÅ O is used for uniquely identify persons including foreign citizens
living in Slovenia, It is issued by Centralni Register Prebivalstva CRP
(Central Citizen Registry).

The number consists of 13 digits and includes the person's date of birth, a
political region of birth and a unique number that encodes a person's gender
followed by a check digit.

More information:

* https://en.wikipedia.org/wiki/Unique_Master_Citizen_Number
* https://sl.wikipedia.org/wiki/Enotna_matiÄ�na_Å¡tevilka_obÄ�ana

>>> validate('0101006500006')
'0101006500006'
>>> validate('0101006500007')  # invalid check digit
Traceback (most recent call last):
    ...
InvalidChecksum: ...
é    )ÚannotationsN)Ú*)Ú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    úU/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/si/emso.pyÚcompactr   4   s   € ô �˜Ó×#Ñ#Ó%Ð%ó    c                ób   — d}t        d„ t        | |«      D «       «      }t        | dz  dz  «      S )zCalculate the check digit.)é   é   é   é   é   é   r   r   r   r   r   r   c              3  ó>   K  — | ]  \  }}t        |«      |z  –— Œ y ­w)N)Úint)Ú.0ÚnÚws      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>=   s   è ø€ Ò<™t˜q !”�A“˜•
Ñ<ùs   ‚é   é
   )ÚsumÚzipÚstr)r   ÚweightsÚtotals      r   Úcalc_check_digitr#   :   s4   € à2€GÜÑ<¤s¨6°7Ó';Ô<Ó<€EÜ�ˆv˜‰{˜RÑÓ Ð r   c                óê   — t        | «      } t        | dd «      }t        | dd «      }t        | dd «      }|dk  r|dz  }n|dz  }	 t        j                  |||«      S # t        $ r t        «       ‚w xY w)u&   Return date of birth from valid EMÅ O.Nr   r   r   i   iÐ  iè  )r   r   ÚdatetimeÚdateÚ
ValueErrorÚInvalidComponent)r   ÚdayÚmonthÚyears       r   Úget_birth_dater,   A   sƒ   € ä�V‹_€FÜ
ˆf�R�aˆj‹/€CÜ��q˜�Ó€EÜˆv�a˜ˆ{Ó€DØˆc‚zØ�‰‰à�‰ˆð!Ü�}‰}˜T 5¨#Ó.Ð.øÜò !ÜÓ Ð ð!ús   ÁA ÁA2c                ó>   — t        | «      } t        | dd «      dk  ryy)z+Get the person's birth gender ('M' or 'F').é	   é   iô  ÚMÚF)r   r   r
   s    r   Ú
get_genderr2   Q   s$   € ä�V‹_€FÜ
ˆ6�!�Bˆ<Ó˜3ÒØàr   c                ó   — | dd S )u+   Return (political) region from valid EMÅ O.r   r.   © r
   s    r   Ú
get_regionr5   Z   s   € à�!�Aˆ;Ðr   c                óÂ   — t        | «      } t        | «      dk7  r
t        «       ‚t        | «      s
t	        «       ‚t        | «       t        | «      | d   k7  r
t        «       ‚| S )ud   Check if the number is a valid EMÅ O number. This checks the length,
    formatting and check digit.é   éÿÿÿÿ)r   ÚlenÚInvalidLengthr   ÚInvalidFormatr,   r#   ÚInvalidChecksumr
   s    r   Úvalidater=   _   sX   € ô �V‹_€FÜ
ˆ6ƒ{�bÒÜ‹oÐÜ�FÔÜ‹oÐÜ�6ÔÜ˜Ó 6¨"¡:Ò-ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)zcCheck if the number provided is a valid ID. This checks the length,
    formatting and check digit.F)Úboolr=   ÚValidationErrorr
   s    r   Úis_validrA   m   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ó   — t        | «      S )z8Reformat the number to the standard presentation format.)r   r
   s    r   ÚformatrC   v   s   € ä�6‹?Ðr   )r   r    Úreturnr    )r   r    rD   zdatetime.date)r   r    rD   r?   )Ú__doc__Ú
__future__r   r%   Ústdnum.exceptionsÚstdnum.utilr   r   r   r#   r,   r2   r5   r=   rA   rC   r4   r   r   ú<module>rI      s@   ðñ*õ. #ã ä ß 'ó&ó!ó!ó óó
óôr   