Ë
    Ã?ÆiO  ã                  óz   — d Z ddlmZ ddlZddlmZ ddl­ ddlmZ  ej                  d«      Z
dd„Zdd	„Zdd
„Zy)a  EPIC (Electoral Photo Identity Card, Indian Voter ID).

The Electoral Photo Identity Card (EPIC) is an identity document issued by
the Election Commission of India (ECI) only to the India citizens who have
reached the age of 18.

Each EPIC contains an unique 10 digit alphanumeric identifier known as EPIC
number or Voter ID number.

Every EPIC number begins with a Functional Unique Serial Number (FUSN), a 3
letter unique identifier for each Assembly Constituency. FUSN is followed by
a 6 digit serial number and 1 check digit of the serial number calculated
using Luhn algorithm.

More information:

* https://en.wikipedia.org/wiki/Voter_ID_(India)
* https://www.kotaksecurities.com/ksweb/voter-id/serial-number-in-elctoral-roll

>>> validate('WKH1186253')
'WKH1186253'
>>> validate('WKH118624')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('1231186253')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('WKH1186263')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
é    )ÚannotationsN)Úluhn)Ú*)Úcleanz^[A-Z]{3}[0-9]{7}$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   ÚupperÚstrip©Únumbers    úV/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/in_/epic.pyÚcompactr   C   s#   € ô �˜Ó×$Ñ$Ó&×,Ñ,Ó.Ð.ó    c                ó²   — t        | «      } t        | «      dk7  rt        ‚t        j	                  | «      s
t        «       ‚t        j                  | dd «       | S )úiCheck if the number provided is a valid EPIC number. This checks the
    length, formatting and checksum.é
   é   N)r   ÚlenÚInvalidLengthÚ_EPIC_REÚmatchÚInvalidFormatr   Úvalidater
   s    r   r   r   I   sJ   € ô �V‹_€FÜ
ˆ6ƒ{�bÒÜÐÜ�>‰>˜&Ô!Ü‹oÐÜ‡M�M�&˜˜�*ÔØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r   F)Úboolr   ÚValidationErrorr
   s    r   Úis_validr   U   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡")r   ÚstrÚreturnr   )r   r   r   r   )Ú__doc__Ú
__future__r   ÚreÚstdnumr   Ústdnum.exceptionsÚstdnum.utilr   Úcompiler   r   r   r   © r   r   ú<module>r'      s>   ðñ(!õF #ã 	å Ü Ý ð ˆ2�:‰:Ð+Ó,€ó/ó	ôr   