Ë
    Ã?Æië  ã                  óŠ   — d Z ddlmZ ddlZddl­ ddlmZ ddlmZ  ej                  d«      Z
dd„Zdd	„Zdd
„Zdd„Zdd„Zy)uÈ  RCS (French trade registration number for commercial companies).

The RCS number (Registre du commerce et des sociÃ©tÃ©s) is given by INSEE to a
company with commercial activity when created. It is required for most of
administrative procedures.

The number consists of "RCS" letters followed by name of the city where the company was registered
followed by letter A for a retailer or B for society
followed by the SIREN number

More information:

* https://entreprendre.service-public.fr/vosdroits/F31190
* https://fr.wikipedia.org/wiki/Registre_du_commerce_et_des_sociÃ©tÃ©s_(France)

>>> validate('RCS Nancy B 323 159 715')
'RCS Nancy B 323159715'
>>> validate('RCS Nancy B 323 159 716')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('RCSNancy B 323 159 716')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> format('RCS Nancy B323159715')
'RCS Nancy B 323 159 715'
>>> to_siren('RCS Nancy B 323159 715')
'323159715'
é    )ÚannotationsN)Ú*)Úsiren)ÚcleanzQ^ *(?P<tag>RCS|rcs) +(?P<city>.*?) +(?P<letter>[AB]) *(?P<siren>(?:\d *){9})\b *$c           	     óÜ   — t        | «      j                  «       j                  «       }dj                  |dd «      }dj                  |dd |dd t	        j
                  |dd «      gz   «      S )z1Convert the number to the minimal representation.Ú é   Nú é   )r   ÚstripÚsplitÚjoinr   Úcompact)ÚnumberÚpartsÚrests      úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/fr/rcs.pyr   r   B   se   € ä�&‹M×ÑÓ!×'Ñ'Ó)€EØ�7‰7�5˜˜�9Ó€DØ�8‰8�E˜"˜1�I  b q ¬5¯=©=¸¸a¸b¸Ó+BÐ CÑCÓDÐDó    c                óÐ   — t        | «      } t        j                  | «      }|s
t        «       ‚t	        j
                  |j                  d«      «      }t	        j                  |«      }| S )z-Validate number is a valid French RCS number.r   )r   Ú_rcs_validation_regexÚmatchÚInvalidFormatr   ÚvalidateÚgroupÚformat)r   r   Úsiren_numbers      r   r   r   I   sP   € ä�V‹_€FÜ!×'Ñ'¨Ó/€EÙÜ‹oÐÜ—>‘> %§+¡+¨gÓ"6Ó7€LÜ—<‘< Ó-€LØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z&Check if the number provided is valid.F)Úboolr   ÚValidationError)r   s    r   Úis_validr    T   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c           
     ó  — t        | «      } t        j                  | «      }|s
t        «       ‚dj	                  d|j                  d«      |j                  d«      t        j                  |j                  d«      «      f«      S )z8Reformat the number to the standard presentation format.r
   ÚRCSÚcityÚletterr   )r   r   r   r   r   r   r   r   ©r   r   s     r   r   r   \   sl   € ä�V‹_€FÜ!×'Ñ'¨Ó/€EÙÜ‹oÐØ�8‰8àØ�K‰K˜ÓØ�K‰K˜Ó!Ü�L‰L˜Ÿ™ WÓ-Ó.ð		
óð r   c                óŽ   — t        | «      } t        j                  t        | «      «      }|s
t	        «       ‚|j                  d«      S )zlExtract SIREN number from the RCS number.

    The SIREN number is the 9 last digits of the RCS number.
    r   )r   r   r   r   r   r   r%   s     r   Úto_sirenr'   l   s;   € ô
 �V‹_€FÜ!×'Ñ'¬¨f«Ó6€EÙÜ‹oÐØ�;‰;�wÓÐr   )r   ÚstrÚreturnr(   )r   r(   r)   r   )Ú__doc__Ú
__future__r   ÚreÚstdnum.exceptionsÚ	stdnum.frr   Ústdnum.utilr   Úcompiler   r   r   r    r   r'   © r   r   ú<module>r2      sK   ðñ*õ> #ã 	ä Ý Ý ð #˜Ÿ
™
ØXóÐ ó
Eóóóô 	 r   