Skip to main content

Read the docs

class-inspector API docs

Custom Validators

Extension of the validators from the attrs library, these allow the use of type checking the constituents of a collection.

Example attrs validator and the problem this is a solution to*:

possible: list = attr.ib(validator=[instance_of(list)])
not_possible: List[int] = attr.ib(validator=[instance_of(List[int])])

This means that we can't validate the members of a collection. However, with the custom validators we can do this:

now_possible: Collection = attr.ib(validator=[validate_generic_of_type(Collection, float)])

Meaning we can pass in any object that implements the following dunder methods [__contains__, __iter__, __len__] AND validate that each member of the collection is a float. This is possible for other types too.

*on closer inspection (ironic given this repo's name) of the attrs API reference this is a solved problem with deep_iterable() and deep_mapping(). attrs: 2, me: 0

generated repo map

└── class_inspector
    ├── docs
    │   └── source
    │       └── conf.py
    ├── src
    │   └── class_inspector
    │       ├── __init__.py
    │       ├── _logger.py
    │       ├── create_tests.py
    │       ├── cst_walkers.py
    │       ├── custom_validators.py
    │       ├── data_structures.py
    │       ├── guard_conditions.py
    │       ├── transform.py
    │       └── utils.py
    ├── tests
    │   ├── __init__.py
    │   ├── conftest.py
    │   ├── test_create_tests.py
    │   ├── test_custom_validators.py
    │   ├── test_guard_conditions.py
    │   ├── test_transform.py
    │   └── test_utils.py
    ├── README.md
    ├── pyproject.toml
    └── setup.py
::

Release files for class-inspector 0.3.1

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

Source distribution (sdist)

Source distribution for class-inspector 0.3.1
File Size Uploaded
class_inspector-0.3.1.tar.gz 13.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for class-inspector 0.3.1
File Interpreter ABI Platform
class_inspector-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.6 kB

Release files / class_inspector-0.3.1.tar.gz

Download URL class_inspector-0.3.1.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
283a22ce0618d1d10bbd8dacd5d539f0187bc26e26469fb3c112c41c9125c6a8
BLAKE2b-256 checksum
How to use checksums
7e420fe4be51becfcfd5da8e9bd1ff023a7a959a34a227caa733aad743453c74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 25, 2025.

Transparency log

Release files / class_inspector-0.3.1-py3-none-any.whl

Download URL class_inspector-0.3.1-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98f35a63b22711894c0db56c548ed4260630235f96d95fbafeb025b72b9dc4d4
BLAKE2b-256 checksum
How to use checksums
bc3050dd19ca3920689cc8d550889b3abbad6abb0cc2f9ca53ed59dd71742b40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 25, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.1

2 release files

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