# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-macaddress VERSION= 2.0.2 KEYWORDS= python VARIANTS= v12 v13 SDESC[v12]= MAC hardware identifier module (3.12) SDESC[v13]= MAC hardware identifier module (3.13) HOMEPAGE= https://github.com/mentalisttraceur/python-macaddress CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/6e/40/cfad5b515667b0465a3169757b5c9f17639dc1da145c65248e5b9fe481d8 DISTFILE[1]= macaddress-2.0.2-py3-none-any.whl:main DIST_SUBDIR= python-src DF_INDEX= 1 SPKGS[v12]= single SPKGS[v13]= single OPTIONS_AVAILABLE= PY312 PY313 OPTIONS_STANDARD= none VOPTS[v12]= PY312=ON PY313=OFF VOPTS[v13]= PY312=OFF PY313=ON DISTNAME= macaddress-2.0.2.dist-info GENERATED= yes [PY312].USES_ON= python:v12,wheel [PY313].USES_ON= python:v13,wheel [FILE:2304:descriptions/desc.single] macaddress ========== A module for handling hardware identifiers like MAC addresses. This module makes it easy to: 1. check if a string represents a valid MAC address, or a similar hardware identifier like an EUI-64, OUI, etc, 2. convert between string and binary forms of MAC addresses and other hardware identifiers, and so on. Heavily inspired by the ipaddress module, but not yet quite as featureful. Versioning ---------- This library's version numbers follow the `SemVer 2.0.0 specification `_. Installation ------------ :: pip install macaddress Usage ----- Import: .. code:: python >>> import macaddress Classes are provided for the common hardware identifier types: EUI48 (also available as MAC), EUI64, OUI, and so on. If those aren't enough, you can easily define others with just a few lines of code. Parse or Validate String ~~~~~~~~~~~~~~~~~~~~~~~~ When only one address type is valid: All provided classes support the standard and common formats. For example, the EUI48 class supports the following formats: .. code:: python >>> macaddress.EUI48('01-23-45-67-89-ab') EUI48('01-23-45-67-89-AB') >>> macaddress.EUI48('01:23:45:67:89:ab') EUI48('01-23-45-67-89-AB') >>> macaddress.EUI48('0123.4567.89ab') EUI48('01-23-45-67-89-AB') >>> macaddress.EUI48('0123456789ab') EUI48('01-23-45-67-89-AB') You can inspect what formats a hardware address class supports by looking at its formats attribute: .. code:: python >>> macaddress.OUI.formats ('xx-xx-xx', 'xx:xx:xx', 'xxxxxx') Each x in the format string matches one hexadecimal "digit", and all other characters are matched literally. If the string does not match one of the formats, a ValueError is raised: .. code:: python >>> try: ... macaddress.MAC('foo bar') ... except ValueError as error: ... print(error) ... 'foo bar' cannot be parsed as EUI48 If you need to parse in a format that isn't supported, you can define a subclass and add the formats: .. code:: python >>> class MAC(macaddress.MAC): ... formats = macaddress.MAC.formats + ( ... 'xx-xx-xx-xx-xx-xx-', ... 'xx:xx:xx:xx:xx:xx:', ... 'xxxx.xxxx.xxxx.', ... ) ... [FILE:123:distinfo] 6f4a0430f9b5af6d98a582b8d527ba2cd3f0825fce5503a9ce5c73acb772c30f 8027 python-src/macaddress-2.0.2-py3-none-any.whl