Ë
    Ã?ÆiÈ  ã                  ó~   — d Z ddlmZ ddlZddlmZ ddl­ ddl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)uf  BIS (Belgian BIS number).


The BIS number (BIS-nummer, NumÃ©ro BIS) is a unique identification number
for individuals who are not registered in the National Register, but who
still have a relationship with the Belgian government.
This includes frontier workers, persons who own property in Belgium,
persons with Belgian social security rights but who do not reside in Belgium, etc.

The number is issued by the Belgian Crossroads Bank for Social Security (Banque
Carrefour de la sÃ©curitÃ© sociale, Kruispuntbank voor Sociale Zekerheid) and is
constructed much in the same way as the Belgian National Number, i.e. consisting of
11 digits, encoding the person's date of birth and gender, a checksum, etc.
Other than with the national number though, the month of birth of the BIS number
is increased by 20 or 40, depending on whether the sex of the person was known
at the time or not.


More information:

* https://sma-help.bosa.belgium.be/en/faq/where-can-i-find-my-bis-number#7326
* https://www.socialsecurity.be/site_nl/employer/applics/belgianidpro/index.htm
* https://nl.wikipedia.org/wiki/Rijksregisternummer
* https://fr.wikipedia.org/wiki/NumÃ©ro_de_registre_national

>>> compact('98.47.28-997.65')
'98472899765'
>>> validate('98 47 28 997 65')
'98472899765'
>>> validate('01 49 07 001 85')
'01490700185'
>>> validate('12345678901')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('98472899765')
'98.47.28-997.65'
>>> get_birth_date('98.47.28-997.65')
datetime.date(1998, 7, 28)
>>> get_birth_year('98.47.28-997.65')
1998
>>> get_birth_month('98.47.28-997.65')
7
>>> get_gender('98.47.28-997.65')
'M'
é    )ÚannotationsN)Únn)Ú*)Úisdigitsc                ó,   — t        j                  | «      S )zˆConvert the number to the minimal representation. This strips the number
    of any valid separators and removes surrounding whitespace.)r   Úcompact©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/be/bis.pyr   r   M   s   € ô �:‰:�fÓÐó    c                óJ  — t        | «      } t        | «      rt        | «      dk  r
t        «       ‚t	        | «      dk7  r
t        «       ‚t        j                  | «       dt        | dd «      cxk  rdk  s0n dt        | dd «      cxk  rdk  st        d	«      ‚ t        d	«      ‚| S )
ú*Check if the number is a valid BIS Number.r   é   é   é   é   é    é(   é4   z'Month must be in 20..32 or 40..52 range)	r   r   ÚintÚInvalidFormatÚlenÚInvalidLengthr   Ú_get_birth_date_partsÚInvalidComponentr	   s    r   Úvalidater   S   sš   € ä�V‹_€FÜ�FÔœs 6›{¨aÒ/Ü‹oÐÜ
ˆ6ƒ{�bÒÜ‹oÐÜ×Ñ˜VÔ$Ø”�V˜A˜a�[Ó!Ô' RÔ'°´c¸&ÀÀ1¸+Ó6FÔ0LÈ"Ò0LÜÐHÓIÐIð 1MÜÐHÓIÐIØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r   F)Úboolr   ÚValidationErrorr	   s    r   Úis_validr    `   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ó,   — t        j                  | «      S )z8Reformat the number to the standard presentation format.)r   Úformatr	   s    r   r"   r"   h   s   € ä�9‰9�VÓÐr   c                ó,   — t        j                  | «      S )z"Return the year of the birth date.)r   Úget_birth_yearr	   s    r   r$   r$   m   ó   € ä×Ñ˜VÓ$Ð$r   c                ó,   — t        j                  | «      S )z#Return the month of the birth date.)r   Úget_birth_monthr	   s    r   r'   r'   r   s   € ä×Ñ˜fÓ%Ð%r   c                ó,   — t        j                  | «      S )zReturn the date of birth.)r   Úget_birth_dater	   s    r   r)   r)   w   r%   r   c                óf   — t        | «      } t        | dd «      dk\  rt        j                  | «      S y)zsGet the person's gender ('M' or 'F'), which for BIS
    numbers is only known if the month was incremented with 40.r   r   r   N)r   r   r   Ú
get_genderr	   s    r   r+   r+   |   s2   € ô �V‹_€FÜ
ˆ6�!�Aˆ;Ó˜2ÒÜ�}‰}˜VÓ$Ð$Ør   )r
   ÚstrÚreturnr,   )r
   r,   r-   r   )r
   r,   r-   z
int | None)r
   r,   r-   zdatetime.date | None)r
   r,   r-   z
str | None)Ú__doc__Ú
__future__r   ÚdatetimeÚ	stdnum.ber   Ústdnum.exceptionsÚstdnum.utilr   r   r   r    r"   r$   r'   r)   r+   © r   r   ú<module>r5      sD   ðñ*-õ^ #ã å Ü Ý  óó
óóó
%ó
&ó
%ô
r   