Ë
    Ã?Æi÷  ã                  ó€   — d Z ddlmZ ddl­ ddlmZmZmZ dZ	 dd„Z	dd„Z
dd„Zdd	„Z	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 dd
„Zy)uì  T.C. Kimlik No. (Turkish personal identification number)

The Turkish Identification Number (TÃ¼rkiye Cumhuriyeti Kimlik NumarasÄ±) is a
unique personal identification number assigned to every citizen of Turkey.
The number consists of 11 digits and the last two digits are check digits.

More information:

* https://en.wikipedia.org/wiki/Turkish_Identification_Number
* https://tckimlik.nvi.gov.tr/

>>> validate('17291716060')
'17291716060'
>>> validate('17291716050')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('1729171606')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('07291716092')  # number must not start with a 0
Traceback (most recent call last):
    ...
InvalidFormat: ...
é    )Úannotations)Ú*)ÚcleanÚget_soap_clientÚisdigitsz7https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDLc                ó4   — t        | «      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    úY/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/tr/tckimlik.pyÚcompactr   :   s   € ô �‹=×ÑÓ Ð ó    c           	     óŽ   — dt        d„ t        | dd «      D «       «      z
  dz  }|t        d„ | dd D «       «      z   dz  }d||fz  S )ztCalculate the check digits for the specified number. The number
    passed should not have the check digit included.é
   c              3  óJ   K  — | ]  \  }}d |dz     t        |«      z  –— Œ y­w))é   é   é   N©Úint)Ú.0ÚiÚns      r   ú	<genexpr>z$calc_check_digits.<locals>.<genexpr>C   s-   è ø€ ò 1Ù�!�Qð ˜a !™e‘}¤s¨1£vÕ-ñ 1ùs   ‚!#Né	   c              3  ó2   K  — | ]  }t        |«      –— Œ y ­w)Nr   )r   r   s     r   r   z$calc_check_digits.<locals>.<genexpr>E   s   è ø€ Ò6 aœ3˜qŸ6Ñ6ùs   ‚z%d%d)ÚsumÚ	enumerate)r   Úcheck1Úcheck2s      r   Úcalc_check_digitsr!   @   se   € ð ”3ñ 1Ü# F¨2¨A JÓ/ô1ó 1ñ 1Ø46ñ7€Fà”sÑ6¨6°"°1¨:Ô6Ó6Ñ6¸"Ñ<€FØ�V˜VÐ$Ñ$Ð$r   c                ó¼   — t        | «      } t        | «      r| d   dk(  r
t        «       ‚t        | «      dk7  r
t	        «       ‚t        | «      | dd k7  r
t        «       ‚| S )z_Check if the number is a valid T.C. Kimlik number. This checks the
    length and check digits.r   Ú0é   éþÿÿÿN)r   r   ÚInvalidFormatÚlenÚInvalidLengthr!   ÚInvalidChecksumr
   s    r   Úvalidater*   I   s]   € ô �V‹_€FÜ�FÔ˜v a™y¨CÒ/Ü‹oÐÜ
ˆ6ƒ{�bÒÜ‹oÐÜ˜Ó  F¨2¨3 KÒ/ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z2Check if the number is a valid T.C. Kimlik number.F)Úboolr*   ÚValidationErrorr
   s    r   Úis_validr.   V   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ó¤   — t        | «      } t        t        ||¬«      }|j                  | |||¬«      }t	        |d«      r|j                  d«      S |S )aF  Use the T.C. Kimlik validation service to check the provided number.

    Query the online T.C. Kimlik validation service run by the Directorate
    of Population and Citizenship Affairs. The timeout is in seconds. This
    returns a boolean but may raise a SOAP exception for missing or invalid
    values.

    The `timeout` argument specifies the network timeout in seconds.

    The `verify` argument is either a boolean that determines whether the
    server's certificate is validate or a string which must be a path the CA
    certificate bundle to use for verification.
    )ÚtimeoutÚverify)Ú
TCKimlikNoÚAdÚSoyadÚ	DogumYiliÚgetÚTCKimlikNoDogrulaResult)r   r   Útckimlik_wsdlÚTCKimlikNoDogrulaÚhasattrr6   )r   ÚnameÚsurnameÚ
birth_yearr0   r1   ÚclientÚresults           r   Ú	check_kpsr@   ^   sY   € ô. �V‹_€FÜœ]°GÀFÔK€FØ×%Ñ%Ø˜d¨'¸Zð &ó I€Fäˆv�uÔØ�z‰zÐ3Ó4Ð4Ø€Mr   N)r   ÚstrÚreturnrA   )r   rA   rB   r,   )é   T)r   rA   r;   rA   r<   rA   r=   r   r0   Úfloatr1   z
bool | strrB   r,   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r8   r   r!   r*   r.   r@   © r   r   ú<module>rJ      s†   ðñ*õ6 #ä ß 8Ñ 8ð J€Ø 9ó!ó%ó
óð ØðØðà
ðð ðð ð	ð
 ðð ðð 
ôr   