Ë
    Ã?Æ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  ej                  d«      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dd„Zdd„Zddd„Zddd„Zdd„Zy)a­  MAC address (Media Access Control address).

A media access control address (MAC address, sometimes Ethernet address) of a
device is meant as a unique identifier within a network at the data link
layer.

More information:

* https://en.wikipedia.org/wiki/MAC_address
* https://en.wikipedia.org/wiki/Organizationally_unique_identifier
* https://standards.ieee.org/faqs/regauth.html#2

>>> validate('D0-50-99-84-A2-A0')
'd0:50:99:84:a2:a0'
>>> to_eui48('d0:50:99:84:a2:a0')
'D0-50-99-84-A2-A0'
>>> is_multicast('d0:50:99:84:a2:a0')
False
>>> get_manufacturer('d0:50:99:84:a2:a0')
'ASRock Incorporation'
>>> get_oui('d0:50:99:84:a2:a0')
'D05099'
>>> get_iab('d0:50:99:84:a2:a0')
'84A2A0'
é    )ÚannotationsN)Únumdb)Ú*)Úcleanz^([0-9a-f]{2}:){5}[0-9a-f]{2}$c                óÀ   — t        | d«      j                  «       j                  «       j                  dd«      } dj	                  d„ | j                  d«      D «       «      S )zBConvert the MAC address to the minimal, consistent representation.ú ú-ú:c              3  óF   K  — | ]  }t        |«      d k(  rd|z   n|–— Œ y­w)é   Ú0N)Úlen©Ú.0Úns     úQ/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/mac.pyú	<genexpr>zcompact.<locals>.<genexpr>>   s#   è ø€ ÒM°aœs 1›v¨š{�C˜!’G°Ó1ÑMùs   ‚!)r   ÚstripÚlowerÚreplaceÚjoinÚsplit©Únumbers    r   Úcompactr   :   sK   € ä�6˜3Ó×%Ñ%Ó'×-Ñ-Ó/×7Ñ7¸¸SÓA€Fà�8‰8ÑM¸6¿<¹<ÈÓ;LÔMÓMÐMó    c                ó8  — t        | «      j                  dd«      j                  «       } t        j                  d«      j                  | «      }	 dj                  d„ |dd D «       «      |d   d   d	   j                  d
d«      fS # t        $ r t        «       ‚w xY w)ú2Look up the manufacturer in the IEEE OUI registry.r
   Ú Úouic              3  ó&   K  — | ]	  }|d    –— Œ y­w)r   N© r   s     r   r   z_lookup.<locals>.<genexpr>G   s   è ø€ Ò,˜Q�A�a•DÑ,ùs   ‚Néÿÿÿÿéþÿÿÿr   Úoú%ú")	r   r   Úupperr   ÚgetÚinfor   Ú
IndexErrorÚInvalidComponent)r   r*   s     r   Ú_lookupr-   A   s˜   € ä�V‹_×$Ñ$ S¨"Ó-×3Ñ3Ó5€FÜ�9‰9�UÓ× Ñ  Ó(€Dð!à�G‰GÑ, $ s¨ )Ô,Ó,Ø�‰H�Q‰K˜Ñ×$Ñ$ S¨#Ó.ð0ð 	0øô ò !ÜÓ Ð ð!ús   Á5B ÂBc                ó   — t        | «      d   S )r   r   ©r-   r   s    r   Úget_manufacturerr0   M   ó   € ä�6‹?˜1ÑÐr   c                ó   — t        | «      d   S )z<Return the OUI (organization unique ID) part of the address.r   r/   r   s    r   Úget_ouir3   R   r1   r   c                ó‚   — t        | «      j                  dd«      j                  «       } | t        t	        | «      «      d S )z>Return the IAB (individual address block) part of the address.r
   r   N)r   r   r(   r   r3   r   s    r   Úget_iabr5   W   s8   € ä�V‹_×$Ñ$ S¨"Ó-×3Ñ3Ó5€FØ”#”g˜f“oÓ&Ð'Ð(Ð(r   c                óB   — t        | «      } t        | dd d«      dz  dk(  S )zrCheck whether the number is a unicast address.

    Unicast addresses are received by one node in a network (LAN).Né   é   r   r   ©r   Úintr   s    r   Ú
is_unicastr;   ]   s*   € ô �V‹_€FÜˆv�b�qˆz˜2Ó Ñ" aÑ'Ð'r   c                ó   — t        | «       S )zšCheck whether the number is a multicast address.

    Multicast addresses are meant to be received by (potentially) multiple
    nodes in a network (LAN).)r;   r   s    r   Úis_multicastr=   e   s   € ô
 ˜&Ó!Ð!Ð!r   c                ó"   — t        | «      } | dk(  S )zCheck whether the number is the broadcast address.

    Broadcast addresses are meant to be received by all nodes in a network.zff:ff:ff:ff:ff:ff)r   r   s    r   Úis_broadcastr?   m   s   € ô �V‹_€FØÐ(Ñ(Ð(r   c                óB   — t        | «      } t        | dd d«      dz  dk(  S )zDCheck if the address is supposed to be assigned by the manufacturer.Nr7   r8   r   r9   r   s    r   Úis_universally_administeredrA   u   s(   € ä�V‹_€FÜˆv�b�qˆz˜2Ó Ñ" aÑ'Ð'r   c                ó   — t        | «       S )zCCheck if the address is meant to be configured by an administrator.)rA   r   s    r   Úis_locally_administeredrC   {   s   € ä*¨6Ó2Ð2Ð2r   c                óÂ   — t        | «      } t        | «      dk7  r
t        «       ‚t        j	                  | «      s
t        «       ‚|dur|st        | «      rt        | «       | S )zïCheck if the number provided is a valid MAC address.

    The existence of the manufacturer is by default only checked for
    universally administered addresses but can be explicitly set with the
    `validate_manufacturer` argument.
    é   F)r   r   ÚInvalidLengthÚ_mac_reÚmatchÚInvalidFormatrA   r0   ©r   Úvalidate_manufacturers     r   ÚvalidaterL   €   sU   € ô �V‹_€FÜ
ˆ6ƒ{�bÒÜ‹oÐÜ�=‰=˜Ô Ü‹oÐØ EÑ)Ù Ô$?ÀÔ$GÜ˜VÔ$Ø€Mr   c                óN   — 	 t        t        | |¬«      «      S # t        $ r Y yw xY w)z-Check if the number provided is a valid IBAN.)rK   F)ÚboolrL   ÚValidationErrorrJ   s     r   Úis_validrP   ’   s,   € ðÜ”H˜VÐ;PÔQÓRÐRøÜò Ùðús   ‚ ˜	$£$c                óT   — t        | «      j                  «       j                  dd«      S )z)Convert the MAC address to EUI-48 format.r
   r	   )r   r(   r   r   s    r   Úto_eui48rR   š   s"   € ä�6‹?× Ñ Ó"×*Ñ*¨3°Ó4Ð4r   )r   ÚstrÚreturnrS   )r   rS   rT   ztuple[str, str])r   rS   rT   rN   )N)r   rS   rK   úbool | NonerT   rS   )r   rS   rK   rU   rT   rN   )Ú__doc__Ú
__future__r   ÚreÚstdnumr   Ústdnum.exceptionsÚstdnum.utilr   ÚcompilerG   r   r-   r0   r3   r5   r;   r=   r?   rA   rC   rL   rP   rR   r"   r   r   ú<module>r]      sp   ðñ(õ4 #ã 	å Ü Ý ð ˆ"�*‰*Ð5Ó
6€óNó	!óó
ó
)ó(ó"ó)ó(ó3ô
ô$ô5r   