Skip to content

[types] Add module for type validation#23

Open
Ableytner wants to merge 24 commits intomasterfrom
add-type-module
Open

[types] Add module for type validation#23
Ableytner wants to merge 24 commits intomasterfrom
add-type-module

Conversation

@Ableytner
Copy link
Copy Markdown
Owner

@Ableytner Ableytner commented May 30, 2025

Adds a new module (abllib.types) which can validate types, raising a WrongTypeError on mismatch.

This adds the following new functions:

  • abllib.types.enforce_var: enforces the type of a given value
  • abllib.types.enforce_args: enforces the type of all function arguments and the return value
  • abllib.types.enforce: a combined function usable instead of the functions above

TODO before merge:

  • add support for recursive type hints (see _PersistentStorage.__setitem__)

@Ableytner Ableytner changed the title Add module for type validation [types] Add module for type validation Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant