python-macaddress
Port variant py310
Summary MAC hardware identifier module (3.10)
Package version 2.0.2
Homepage https://github.com/mentalisttraceur/python-macaddress
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v11
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 23 JAN 2023, 06:04:31 UTC
Port created 07 JAN 2023, 04:18:24 UTC
Subpackage Descriptions
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.', ... ) ...
Configuration Switches (platform-specific settings discarded)
PY310 ON Build using Python 3.10 PY311 OFF Build using Python 3.11
Package Dependencies by Type
Build (only) python-pip:single:py310
autoselect-python:single:standard
Build and Runtime python310:single:standard
Download groups
main mirror://PYPIWHL/6e/40/cfad5b515667b0465a3169757b5c9f17639dc1da145c65248e5b9fe481d8
Distribution File Information
6f4a0430f9b5af6d98a582b8d527ba2cd3f0825fce5503a9ce5c73acb772c30f 8027 macaddress-2.0.2-py3-none-any.whl
Ports that require python-macaddress:py310
python-netdoc:py310 Network documentation plugin for NetBox (3.10)