Ë
    Ã?Æi�  ã                  óf   — 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y)a  NRIC No. (Malaysian National Registration Identity Card Number).

The NRIC No. is the unique identifier for issued to Malaysian citizens and
permanent residents.

The number consist of 12 digits in three sections. The first 6 digits
represent the birth date, followed by two digits representing the birth
place and finally four digits. The gender of a person can be derived from
the last digit: odd numbers for males and even numbers for females.

>>> validate('770305-02-1234')
'770305021234'
>>> validate('771305-02-1234')  # invalid date
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> validate('770305-17-1234')  # unknown birth place code
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> format('770305021234')
'770305-02-1234'
é    )Ú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.z -*)r   Ústrip©Únumbers    úU/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/my/nric.pyÚcompactr   4   s   € ô �˜Ó×%Ñ%Ó'Ð'ó    c                ó$  — t        | «      } t        | dd «      }t        | dd «      }t        | dd «      }	 t        j                  |dz   ||«      S # t        $ r Y nw xY w	 t        j                  |dz   ||«      S # t        $ r t        «       ‚w xY w)zºSplit the date parts from the number and return the birth date.
    Note that in some cases it may return the registration date instead of
    the birth date and it may be a century off.r   é   é   é   il  iÐ  )r   ÚintÚdatetimeÚdateÚ
ValueErrorÚInvalidComponent)r
   ÚyearÚmonthÚdays       r   Úget_birth_dater   :   sŸ   € ô �V‹_€FÜˆv�a˜ˆ{Ó€DÜ��q˜�Ó€EÜ
ˆf�Q�qˆkÓ
€CðÜ�}‰}˜T D™[¨%°Ó5Ð5øÜò Ùðúð!Ü�}‰}˜T D™[¨%°Ó5Ð5øÜò !ÜÓ Ð ð!ús   ·A Á	AÁAÁ!A; Á;Bc                ó’   — ddl m} t        | «      } |j                  d«      j	                  | dd «      d   d   }|s
t        «       ‚|S )z¥Use the number to look up the place of birth of the person. This can
    either be a state or federal territory within Malaysia or a country
    outside of Malaysia.r   )Únumdbzmy/bpr   é   é   )Ústdnumr   r   ÚgetÚinfor   )r
   r   Úresultss      r   Úget_birth_placer#   M   sJ   € õ Ü�V‹_€FØ�i‰i˜Ó ×%Ñ% f¨Q¨q kÓ2°1Ñ5°aÑ8€GÙÜÓ Ð Ø€Nr   c                ó¢   — t        | «      } t        | «      dk7  r
t        «       ‚t        | «      s
t	        «       ‚t        | «       t        | «       | S )zlCheck if the number is a valid NRIC number. This checks the length,
    formatting and birth date and place.é   )r   ÚlenÚInvalidLengthr   ÚInvalidFormatr   r#   r	   s    r   Úvalidater)   Y   sF   € ô �V‹_€FÜ
ˆ6ƒ{�bÒÜ‹oÐÜ�FÔÜ‹oÐÜ�6ÔÜ�FÔØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z+Check if the number is a valid NRIC number.F)Úboolr)   ÚValidationErrorr	   s    r   Úis_validr-   f   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	   s    r   Úformatr0   n   s7   € ä�V‹_€FØ�"�1ˆ:˜Ñ˜f Q q˜kÑ)¨CÑ/°&¸¸°*Ñ<Ð<r   )r
   ÚstrÚreturnr1   )r
   r1   r2   zdatetime.date)r
   r1   r2   zdict[str, str])r
   r1   r2   r+   )Ú__doc__Ú
__future__r   r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r   r#   r)   r-   r0   © r   r   ú<module>r8      s6   ðñ(õ0 #ã ä ß 'ó(ó!ó&	ó
óô=r   