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

Release files for infi.dtypes.wwn 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for infi.dtypes.wwn 0.2.0
File Size Uploaded
infi_dtypes_wwn-0.2.0.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for infi.dtypes.wwn 0.2.0
File Interpreter ABI Platform
infi_dtypes_wwn-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.8 kB

Release files / infi_dtypes_wwn-0.2.0.tar.gz

Download URL infi_dtypes_wwn-0.2.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e6d85174577ad3fbb8942b1be57b0c19a8c56218978c2f913c3e7a9004fdd02c
BLAKE2b-256 checksum
How to use checksums
239f77c8aa4320d21d6035b9847364eea951d3f953dfaf6ac83fd1dd4320674a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.13

Release files / infi_dtypes_wwn-0.2.0-py3-none-any.whl

Download URL infi_dtypes_wwn-0.2.0-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a331dcf936e11c1d665e3810bb62b289ea310b0012e150d50ec0dbd8fb8c879a
BLAKE2b-256 checksum
How to use checksums
d7cb2c1d8b1d3e507d2e10c9db1b3b22ccfcf7c578c7424669c1adeee1c26aa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1

2 release files

0.0.2

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page