Ë
    Ã?Æiò  ã                  óv   — d Z ddlm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y)aæ  PIN (Personal Identification Number, Kenya tax number).

The Personal Identification Number (KRA PIN) is an 11 digit unique number that
is issued by Kenya Revenue Authority (KRA) for purposes of transacting business
with KRA, other Government agencies and service providers. It can be issued for
individuals and non-individuals like companies, schools, organisations, etc.

The number consists of 11 characters, where the first one is an A (for
individuals) or a P (for non-individuals), the last one is a letter, and the
rest are digits.

More information:

* https://www.kra.go.ke/individual/individual-pin-registration/learn-about-pin/about-pin
* https://itax.kra.go.ke/KRA-Portal/pinChecker.htm

>>> validate('P051365947M')
'P051365947M'
>>> validate('A004416331M')
'A004416331M'
>>> validate('12345')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('V1234567890')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> format('a004416331m')
'A004416331M'
é    )ÚannotationsN)Ú*)Úcleanz^[A|P]{1}[0-9]{9}[A-Z]{1}$c                óR   — t        | d«      j                  «       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Úupper©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/ke/pin.pyÚcompactr   C   s#   € ô �˜Ó×$Ñ$Ó&×,Ñ,Ó.Ð.ó    c                óŽ   — t        | «      } t        | «      dk7  r
t        «       ‚t        j	                  | «      }|s
t        «       ‚| S )zaCheck if the number is a valid Kenya PIN number.

    This checks the length and formatting.
    é   )r   ÚlenÚInvalidLengthÚ_pin_reÚsearchÚInvalidFormat)r
   Úmatchs     r   Úvalidater   I   s?   € ô
 �V‹_€FÜ
ˆ6ƒ{�bÒÜ‹oÐÜ�N‰N˜6Ó"€EÙÜ‹oÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z0Check if the number is a valid Kenya PIN number.F)Úboolr   ÚValidationErrorr	   s    r   Úis_validr   W   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   r   )Ú__doc__Ú
__future__r   ÚreÚstdnum.exceptionsÚstdnum.utilr   Úcompiler   r   r   r   r   © r   r   ú<module>r&      s@   ðñ*õ@ #ã 	ä Ý ð ˆ"�*‰*Ð2Ó
3€ó/óóôr   