Skip to main content

Overview

infi.dtypes.wwn provides a datatype for representing WWNs from strings in various formats.

Usage

WWN accepts an optional 0x prefix and either : or - as the group separator. Whatever the input form, the address is normalized to sixteen lowercase hex digits, so values parsed from different formats compare equal:

>>> from infi.dtypes.wwn import WWN
>>> wwn = WWN("01:02:03:04:ab:cd:ef:08")
>>> wwn
01020304abcdef08
>>> wwn == "01-02-03-04-AB-CD-EF-08"
True
>>> wwn == "0x01020304abcdef08"
True

Short addresses are left-padded to the full width:

>>> WWN("1")
0000000000000001

Instances are hashable and orderable, so they can be used as dictionary keys and sorted. Comparing against a string that cannot be parsed yields False rather than raising:

>>> wwn == "not-a-wwn"
False

Equality is supported against strings and other WWN instances only. Comparing a WWN against an integer returns False.

Installing

pip install infi.dtypes.wwn

Requires Python 3.3 or later. infi and infi.dtypes are PEP 420 implicit namespace packages, so they contain no __init__.py.

Checking out the code

git clone https://github.com/Infinidat/infi.dtypes.wwn.git
cd infi.dtypes.wwn
pip install --editable .

Running the tests

python -m unittest discover -s tests -v

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

infi_dtypes_wwn-0.2.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

infi_dtypes_wwn-0.2.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file infi_dtypes_wwn-0.2.0.tar.gz.

File metadata

  • Download URL: infi_dtypes_wwn-0.2.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.13

File hashes

Hashes for infi_dtypes_wwn-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e6d85174577ad3fbb8942b1be57b0c19a8c56218978c2f913c3e7a9004fdd02c
MD5 0360e50fb8e6143f0a862168c8df34dd
BLAKE2b-256 239f77c8aa4320d21d6035b9847364eea951d3f953dfaf6ac83fd1dd4320674a

See more details on using hashes here.

File details

Details for the file infi_dtypes_wwn-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for infi_dtypes_wwn-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a331dcf936e11c1d665e3810bb62b289ea310b0012e150d50ec0dbd8fb8c879a
MD5 43be515eba86c88f6b37cae05a0e5ad1
BLAKE2b-256 d7cb2c1d8b1d3e507d2e10c9db1b3b22ccfcf7c578c7424669c1adeee1c26aa2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page