Skip to main content

A library of common functions used when creating and managing open-xpd-uuid, a common, globally-unique name space (uuid) for Product Declarations, including HPDs and EPDs, to help users find all environmental and health information related to a single product.

Project description

open-xpd-uuid-lib

A library of common functions used when creating and managing open-xpd-uuid, a common, globally-unique name space (uuid) for Product Declarations, including HPDs and EPDs, to help users find all environmental and health information related to a single product.

Open xPD UUID (short readable GUIDs)

open-xpd-uuid is a string that consists of 8 alpha-numeric characters and any number of dashes. For example: 123ABCED, ASB21M01, avbDK93S, -AB-11-cc-Ll---. GUIDs that consists of the following characters 1234567890ABCDEFGHJKMNPRQRSTUVWXYZ (L and O are not mentioned) are called "canonical". For example: 12345678, ABCDEFG1.

Character treatment

  • - or dash - is ignored
  • L or l or I or i - is treated as 1
  • O or o - is treated as 0(zero)

Install

pip install open-xpd-uuid-lib

Supported versions

The library supports python 3.6 and higher.

Usage

Generate short readable GUID

>>> from cqd import open_xpd_uuid
>>> open_xpd_uuid.generate()
'JKGEE5PN'

Sanitize short readable GUIDs

Use sanitize to replace ambiguous chars(0,o,O,1,L,l,I,i) with correct ones and remove dashes(-). This function is useful to turn guid received from a user into a canonical one.

For example: as-b2-lm-oL -> ASB21M01

>>> from cqd import open_xpd_uuid
>>> open_xpd_uuid.sanitize('as-b2-lm-oL')
'ASB21M01'

Validate short readable GUID

Use validate to validate short readable GUID and get error description if the GUID is not valid. validate accepts only "canonical" GUIDs: use sanitize function to make them "canonical".

>>> from cqd import open_xpd_uuid
>>> sanitized_guid = open_xpd_uuid.sanitize('as-b2-lm-oL')
>>> sanitized_guid
'ASB21M01'
>>> open_xpd_uuid.validate(sanitized_guid)
# no exception - the `sanitized_guid` is valid

>>> try:
...     open_xpd_uuid.validate('as-b2-lm-oL')
... except open_xpd_uuid.GuidValidationError as e:
...     print(e)
...     
`guid` length must be 8 characters long

Project details


Download files

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

Source Distribution

open-xpd-uuid-0.0.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

open_xpd_uuid-0.0.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file open-xpd-uuid-0.0.1.tar.gz.

File metadata

  • Download URL: open-xpd-uuid-0.0.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.9

File hashes

Hashes for open-xpd-uuid-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6c91c5581d9c6c43786bfc769b6f87daf960b7da625937f1ff928d7f978e4030
MD5 ff4d8787bad6c2557f1342f4a7764915
BLAKE2b-256 82b3cf13ad71cd0954863719773ae92a2a5774aa6303253897f0a36b49f2f476

See more details on using hashes here.

File details

Details for the file open_xpd_uuid-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: open_xpd_uuid-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.9

File hashes

Hashes for open_xpd_uuid-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab70fc670c5a0ad6cbab4bdd27802fbb823fbd17e5043e8291493e2ffacb3e65
MD5 4b8b341d49e9942494b63720f146865e
BLAKE2b-256 be820c42c0bda61de646705ab543df6ed4bc96ed3960e0d5fa73f7b0ee864074

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