Ë
    Ã?Æi	  ã                  óN   — d Z ddlmZ ddl­ ddlmZmZ d
d„Zd
d„Zdd„Z	d
d„Z
y	)aÁ  Postcode (the Swedish postal code).

The Swedish postal code consists of three numbers followed by two numbers,
separated by a single space.

More information:

* https://en.wikipedia.org/wiki/Postal_codes_in_Sweden
* https://sv.wikipedia.org/wiki/Postnummer_i_Sverige

>>> validate('114 18')
'11418'
>>> validate('SE-11418')
'11418'
>>> validate('1145 18')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> format('11418')
'114 18'
é    )Úannotations)Ú*)ÚcleanÚisdigitsc                ó‚   — t        | d«      j                  «       j                  «       } | j                  d«      r| dd } | S )zˆConvert the number to the minimal representation. This strips the
    number of any valid separators and removes surrounding whitespace.z -ÚSEé   N)r   ÚupperÚstripÚ
startswith©Únumbers    ú[/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/se/postnummer.pyÚcompactr   0   s@   € ô �6˜4Ó ×&Ñ&Ó(×.Ñ.Ó0€FØ×Ñ˜ÔØ˜˜�ˆØ€Mó    c                ó˜   — t        | «      } t        | «      r| j                  d«      r
t        «       ‚t	        | «      dk7  r
t        «       ‚| S )zCheck if the number is in the correct format. This currently does not
    check whether the code corresponds to a real address.Ú0é   )r   r   r   ÚInvalidFormatÚlenÚInvalidLengthr   s    r   Úvalidater   9   sC   € ô �V‹_€FÜ�FÔ˜v×0Ñ0°Ô5Ü‹oÐÜ
ˆ6ƒ{�aÒÜ‹oÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z+Check if the number is a valid postal code.F)Úboolr   ÚValidationErrorr   s    r   Úis_validr   D   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ó2   — t        | «      } | dd ›d| dd ›�S )z8Reformat the number to the standard presentation format.Né   ú )r   r   s    r   Úformatr    L   s"   € ä�V‹_€FØ˜R˜a’j &¨¨¡*Ð-Ð-r   N)r   ÚstrÚreturnr!   )r   r!   r"   r   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r   r   r    © r   r   ú<module>r(      s)   ðñ(õ, #ä ß 'óóóô.r   