Skip to content

dp3.common.mac_address

MACAddress

MACAddress(mac: Union[bytes, str, MACAddress])

Represents a MAC Address.

Can be initialized from colon or comma separated string, or from raw bytes.

Source code in dp3/common/mac_address.py
def __init__(self, mac: Union[bytes, str, "MACAddress"]):
    if isinstance(mac, self.__class__):
        mac = mac.mac  # type: ignore
    if not isinstance(mac, bytes) or len(mac) != 6:
        mac = self._parse_mac(mac)

    self.mac: bytes = mac