Skip to main content

pd-code-sanity

Perform fast structural validation of planar-diagram codes.

Installation

pip install pd-code-sanity

Usage example

from pd_code_sanity import sanity

print(sanity([[1, 2, 3, 4]]))       # False: labels occur once
print(sanity([[1, 1, 2, 2]]))       # True
print(sanity([[True, 1, True, 1]])) # False: bool is not a label

Algorithm

Validation checks that the outer value and every crossing are lists, every crossing has exactly four entries, labels are consistently integers or strings, booleans are rejected, and every label occurs exactly twice. Counting uses collections.Counter, so runtime is linear in the number of crossing slots. This is structural validation; planarity is handled by the strong-sanity package.

Input conventions

A PD code is represented as a list of four-entry crossings. Arc labels normally occur exactly twice. Public functions validate inputs and return new values rather than mutating caller-owned data unless their API explicitly says otherwise.

External software

No external software is required.

Development

Run examples and package checks before release. Python packages require Python 3.10 or newer. Build PyPI artifacts with:

poetry check
poetry build

License

MIT. See LICENSE.

Download files

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

Source Distribution

pd_code_sanity-0.1.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

pd_code_sanity-0.1.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file pd_code_sanity-0.1.1.tar.gz.

File metadata

  • Download URL: pd_code_sanity-0.1.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Windows/10

File hashes

Hashes for pd_code_sanity-0.1.1.tar.gz
Algorithm Hash digest
SHA256 68f65538b96816f9c7165a71ad8a48103863d001e04eb7c4de71e348fc5a477b
MD5 5b4077269ead00e2894bfe6db8dd62ca
BLAKE2b-256 924eec22e30f4cd808534aa718832897240cb07e46e848f9c12e221f9143f260

See more details on using hashes here.

File details

Details for the file pd_code_sanity-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pd_code_sanity-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Windows/10

File hashes

Hashes for pd_code_sanity-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 496e9bbf129e77efdfd1e749702872d26b10c554be20c3b3d35c75f0c21846de
MD5 51bd52bfecbbb80da883e3e4823209a6
BLAKE2b-256 6749526c4960fa1005be8d5dd3398a03d8516e0c04d7bc4ed8518e1d0b06a93c

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 Sentry Error logging StatusPage Status page