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.
Metadata
Release files for pd-code-sanity 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pd_code_sanity-0.1.1.tar.gz | 2.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pd_code_sanity-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.6 kB
Release files / pd_code_sanity-0.1.1.tar.gz
| Download URL | pd_code_sanity-0.1.1.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68f65538b96816f9c7165a71ad8a48103863d001e04eb7c4de71e348fc5a477b
|
|
BLAKE2b-256 checksum How to use checksums |
924eec22e30f4cd808534aa718832897240cb07e46e848f9c12e221f9143f260
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.11.15 Windows/10
|
Release files / pd_code_sanity-0.1.1-py3-none-any.whl
| Download URL | pd_code_sanity-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
496e9bbf129e77efdfd1e749702872d26b10c554be20c3b3d35c75f0c21846de
|
|
BLAKE2b-256 checksum How to use checksums |
6749526c4960fa1005be8d5dd3398a03d8516e0c04d7bc4ed8518e1d0b06a93c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.11.15 Windows/10
|