Ë
    Ã?ÆiÁ  ã                  ó¼  — d Z ddlmZ ddlZddl­ ddlmZmZ dZerddl	m
Z
 i dd	d
g“dddg“dd	dg“dddg“dd	dg“dd	dg“dddg“dddg“dd	dg“dddg“d d	d!g“d"dd#g“d$d%d&g“d'd(d)g“d*d	d+g“d,d(d-g“Z eej                  «       «      Z	 d:d.„Z G d/„ d0«      Z ed1„ ej%                  «       D «       «      Zd;d<d2„Zd=d3„Zd;d>d4„Zd;d?d5„Zd@d6„Zd=d7„Zd;d>d8„Zd;d>d9„Zy)Aa”  St.-Nr. (Steuernummer, German tax number).

The Steuernummer (St.-Nr.) is a tax number assigned by regional tax offices
to taxable individuals and organisations. The number is being replaced by the
Steuerliche Identifikationsnummer (IdNr).

The number has 10 or 11 digits for the regional form (per Bundesland) and 13
digits for the number that is unique within Germany. The number consists of
(part of) the Bundesfinanzamtsnummer (BUFA-Nr.), a district number, a serial
number and a check digit.

More information:

* https://de.wikipedia.org/wiki/Steuernummer

>>> validate(' 181/815/0815 5')
'18181508155'
>>> validate('201/123/12340', 'Sachsen')
'20112312340'
>>> validate('4151081508156', 'Thuringen')
'4151081508156'
>>> validate('4151181508156', 'Thuringen')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('136695978')
Traceback (most recent call last):
    ...
InvalidLength: ...
é    )ÚannotationsN)Ú*)ÚcleanÚisdigitsF)ÚIterableu   Baden-WÃ¼rttembergÚ
FFBBBUUUUPÚ28FF0BBBUUUUPÚBayernÚFFFBBBUUUUPÚ9FFF0BBBUUUUPÚBerlinÚ11FF0BBBUUUUPÚBrandenburgÚ0FFBBBUUUUPÚ30FF0BBBUUUUPÚBremenÚ24FF0BBBUUUUPÚHamburgÚ22FF0BBBUUUUPÚHessenÚ26FF0BBBUUUUPzMecklenburg-VorpommernÚ40FF0BBBUUUUPÚNiedersachsenÚ23FF0BBBUUUUPzNordrhein-WestfalenÚFFFBBBBUUUPÚ5FFF0BBBBUUUPzRheinland-PfalzÚ27FF0BBBUUUUPÚSaarlandÚ10FF0BBBUUUUPÚSachsenÚ2FFBBBUUUUPÚ32FF0BBBUUUUPzSachsen-AnhaltÚ1FFBBBUUUUPÚ31FF0BBBUUUUPzSchleswig-HolsteinÚ21FF0BBBUUUUPu
   ThÃ¼ringenÚ41FF0BBBUUUUPc                óN   — dj                  d„ | j                  «       D «       «      S )zmConvert the region name to something that we can use for comparison
    without running into encoding issues.Ú c              3  ó(   K  — | ]
  }|d v r|–— Œ y­w)ÚabcdefghijklmnopqrstvwxyzN© )Ú.0Úxs     úU/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/de/stnr.pyú	<genexpr>z _clean_region.<locals>.<genexpr>]   s!   è ø€ ò -ØØÐ+Ñ+ô 	
ñ-ùs   ‚)ÚjoinÚlower©Úregions    r.   Ú_clean_regionr4   Z   s(   € ð �7‰7ñ -Ø—<‘<“>ô-ó -ð -ó    c                  ó$   — e Zd Zdd„Zdd„Zdd„Zy)Ú_Formatc                óx   — || _         t        j                  dt        j                  dd„ |«      z  «      | _        y )Nz^%s$ú([FBUP])\1*c                ó<   — dt        | j                  d«      «      z  S )Nz(\d{%d})r   )ÚlenÚgroup)r-   s    r.   ú<lambda>z"_Format.__init__.<locals>.<lambda>h   s   € �k¤C¨¯©°«
£OÑ3€ r5   )Ú_fmtÚreÚcompileÚsubÚ_re)ÚselfÚfmts     r.   Ú__init__z_Format.__init__d   s3   € ØˆŒ	Ü—:‘:˜f¤r§v¡vØÙ3°Só(:ñ :ó ;ˆ�r5   c                ó8   — | j                   j                  |«      S ©N)rB   Úmatch)rC   Únumbers     r.   rH   z_Format.matchj   s   € Ø�x‰x�~‰~˜fÓ%Ð%r5   c                ój   ‡— t        ||||g«      Št        j                  dˆfd„| j                  «      S )Nr9   c                ó   •— t        ‰«      S rG   )Únext)r-   Úitemss    €r.   r=   z!_Format.replace.<locals>.<lambda>o   s   ø€ ´°U³€ r5   )Úiterr?   rA   r>   )rC   ÚfÚbÚuÚprM   s        @r.   Úreplacez_Format.replacem   s-   ø€ Ü�a˜˜A˜q�\Ó"ˆÜ�v‰v�nÓ&;¸T¿Y¹YÓGÐGr5   N)rD   ÚstrÚreturnÚNone)rI   rT   rU   zre.Match[str] | None)
rO   rT   rP   rT   rQ   rT   rR   rT   rU   rT   )Ú__name__Ú
__module__Ú__qualname__rE   rH   rS   r+   r5   r.   r7   r7   b   s   „ ó;ó&ôHr5   r7   c              #  ór   K  — | ]/  \  }}t        |«      |t        |d    «      t        |d   «      ff–— Œ1 y­w)r   é   N)r4   r7   )r,   r3   Úformatss      r.   r/   r/   s   sH   è ø€ ò "Cñ 	ˆ�ô �6ÓØ”˜ ™
Ó#¤W¨W°Q©ZÓ%8ð:ô ;ñ"Cùs   ‚57c                ó|   — | r't        | «      } | t        vr
t        «       ‚t        |    gS t        j                  «       S )z"Return the formats for the region.)r4   Ú_number_formats_per_regionÚInvalidComponentÚvaluesr2   s    r.   Ú_get_formatsra   y   s>   € áÜ˜vÓ&ˆØÔ3Ñ3Ü"Ó$Ð$Ü*¨6Ñ2Ð3Ð3Ü%×,Ñ,Ó.Ð.r5   c                ó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©rI   s    r.   Úcompactre   ƒ   s   € ô �˜Ó!×'Ñ'Ó)Ð)r5   c                óÄ   ‡ — t        ‰ «      Š t        ‰ «      s
t        «       ‚t        ‰ «      dvr
t	        «       ‚t        ˆ fd„t        |«      D «       «      s
t        «       ‚‰ S )úªCheck if the number is a valid tax number. This checks the length and
    formatting. The region can be supplied to verify that the number is
    assigned in that region.)é
   é   é   c              3  ón   •K  — | ],  \  }}}|j                  ‰«      xs |j                  ‰«      –— Œ. y ­wrG   ©rH   ©r,   Ú_regionÚ
region_fmtÚcountry_fmtrI   s       €r.   r/   zvalidate.<locals>.<genexpr>’   s?   øè ø€ ò MÙ3�7˜J¨ð ×Ñ Ó'ÒD¨;×+<Ñ+<¸VÓ+DÓDñ Mùó   ƒ25)re   r   ÚInvalidFormatr;   ÚInvalidLengthÚanyra   ©rI   r3   s   ` r.   Úvalidaterv   ‰   s\   ø€ ô �V‹_€FÜ�FÔÜ‹oÐÜ
ˆ6ƒ{˜,Ñ&Ü‹oÐÜó MÜ7CÀFÓ7KôMô Mä‹oÐØ€Mr5   c                óL   — 	 t        t        | |«      «      S # t        $ r Y yw xY w)rg   F)Úboolrv   ÚValidationErrorru   s     r.   Úis_validrz   ˜   s+   € ðÜ”H˜V VÓ,Ó-Ð-øÜò Ùðús   ‚ —	#¢#c                óR   ‡ — t        ‰ «      Š t        ˆ fd„t        «       D «       «      S )z2Return a list of regions this number is valid for.c              3  ón   •K  — | ],  \  }}}|j                  ‰«      s|j                  ‰«      r|–— Œ. y ­wrG   rl   )r,   r3   ro   rp   rI   s       €r.   r/   z guess_regions.<locals>.<genexpr>¥   s<   øè ø€ ò BÙ2�6˜: {Ø×Ñ˜FÔ# {×'8Ñ'8¸Ô'@ô 	ñBùrq   )re   Úsortedra   rd   s   `r.   Úguess_regionsr~   ¢   s,   ø€ ä�V‹_€FÜó BÜ6B³nôBó Bð Br5   c                ó¶   — t        | «      } t        «       D ]8  \  }}}|j                  | «      }|sŒ |j                  |j	                  «       Ž c S  t        «       ‚)z9Convert the number to a regional (10 or 11 digit) number.)re   ra   rH   rS   Úgroupsrr   )rI   rn   ro   rp   Úms        r.   Úto_regional_numberr‚   ª   sY   € ä�V‹_€FÜ,8«Nò 3Ñ(ˆ�˜[Ø×Ñ˜fÓ%ˆÚØ%�:×%Ñ% q§x¡x£zÐ2Ò2ð3ô ‹/Ðr5   c                ó  ‡ — t        ‰ «      Š ˆ fd„t        |«      D «       }|D ��cg c]  \  }}|r||f‘Œ }}}|s
t        «       ‚t        |«      dk7  r
t	        «       ‚ |d   d   j
                  |d   d   j                  «       Ž S c c}}w )z‡Convert the number to the nationally unique number. The region is
    needed if the number is not only valid for one particular region.c              3  óL   •K  — | ]  \  }}}|j                  ‰«      |f–— Œ y ­wrG   rl   rm   s       €r.   r/   z$to_country_number.<locals>.<genexpr>¸   s1   øè ø€ ò Fá,ˆG�Z ð 
×	Ñ	˜&Ó	! ;Ô/ñFùs   ƒ!$r[   r   )re   ra   rr   r;   r_   rS   r€   )rI   r3   Úformats_iterÚregion_matchrp   r\   s   `     r.   Úto_country_numberr‡   ´   s¢   ø€ ô �V‹_€FóFä0<¸VÓ0DôF€Lð
 *6÷á%ˆL˜+Ùð 
�{Ò#ð€Gñ ñ Ü‹oÐÜ
ˆ7ƒ|�qÒÜÓ Ð Ø ˆ7�1‰:�a‰=× Ñ  '¨!¡*¨Q¡-×"6Ñ"6Ó"8Ð9Ð9ùós   ¦Bc                óÌ   — t        | «      } t        |«      D ]J  \  }}}|j                  | «      }|sŒ|j                  «       \  }}}}	|j	                  |dz   |dz   ||	«      c S  | S )z2Reformat the passed number to the standard format.ú/)re   ra   rH   r€   rS   )
rI   r3   rn   ro   Ú_country_fmtr�   rO   rP   rQ   rR   s
             r.   Úformatr‹   Æ   sr   € ä�V‹_€FÜ-9¸&Ó-Aò >Ñ)ˆ�˜\Ø×Ñ˜VÓ$ˆÚØŸ™›‰JˆAˆq�!�QØ×%Ñ% a¨#¡g¨q°3©w¸¸1Ó=Ò=ð	>ð
 €Mr5   )r3   rT   rU   rT   rG   )r3   ú
str | NonerU   z&Iterable[tuple[str, _Format, _Format]])rI   rT   rU   rT   )rI   rT   r3   rŒ   rU   rT   )rI   rT   r3   rŒ   rU   rx   )rI   rT   rU   z	list[str])Ú__doc__Ú
__future__r   r?   Ústdnum.exceptionsÚstdnum.utilr   r   ÚTYPE_CHECKINGÚcollections.abcr   Ú_number_formats_per_region_rawr}   ÚkeysÚREGIONSr4   r7   ÚdictrM   r^   ra   re   rv   rz   r~   r‚   r‡   r‹   r+   r5   r.   ú<module>r—      s´  ðñ,õ> #ã 	ä ß 'ð €ÙÝ(ð"Ø˜<¨Ð9ð"àˆ}˜oÐ.ð"ð ˆ|˜_Ð-ð"ð �M ?Ð3ð	"ð
 ˆ|˜_Ð-ð"ð �˜oÐ.ð"ð ˆ}˜oÐ.ð"ð ˜}¨oÐ>ð"ð �l OÐ4ð"ð ˜M¨?Ð;ð"ð ˜ oÐ6ð"ð � Ð0ð"ð �˜Ð/ð"ð �} oÐ6ð"ð ˜<¨Ð9ð"ð  �= /Ð2ð!"Ð ñ& Ð/×4Ñ4Ó6Ó
7€Ø .ó-÷Hñ Hñ" "ñ "Cð :×?Ñ?ÓAô"Có CÐ ô/ó*ôôóBóô:õ$r5   