Skip to main content

class inspector package

Project description

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
::

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

class_inspector-0.3.1.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

class_inspector-0.3.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file class_inspector-0.3.1.tar.gz.

File metadata

  • Download URL: class_inspector-0.3.1.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for class_inspector-0.3.1.tar.gz
Algorithm Hash digest
SHA256 283a22ce0618d1d10bbd8dacd5d539f0187bc26e26469fb3c112c41c9125c6a8
MD5 08215b8d7038d383f800450dcc51bacd
BLAKE2b-256 7e420fe4be51becfcfd5da8e9bd1ff023a7a959a34a227caa733aad743453c74

See more details on using hashes here.

Provenance

The following attestation bundles were made for class_inspector-0.3.1.tar.gz:

Publisher: publish.yaml on second-ed/class_inspector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file class_inspector-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for class_inspector-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 98f35a63b22711894c0db56c548ed4260630235f96d95fbafeb025b72b9dc4d4
MD5 577a7aaab18f76d0055f0df9554b5d01
BLAKE2b-256 bc3050dd19ca3920689cc8d550889b3abbad6abb0cc2f9ca53ed59dd71742b40

See more details on using hashes here.

Provenance

The following attestation bundles were made for class_inspector-0.3.1-py3-none-any.whl:

Publisher: publish.yaml on second-ed/class_inspector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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