Skip to content

pymetrics/takes

Repository files navigation

Takes

image

image

Documentation Status

Decorator for run-time type checks.

Features

  • Convert undefined dictionaries accepted by functions to strong data types, without changing calling code.
  • Decorated functions can be called with dictionaries as before, or with instances of the desired type.

Example

This function takes an undocumented dictionary. Maintainers must read the function body to determine the expected shape of the data.

Takes lets you redefine this function to accept a well-defined data type, without needing to immediately change all of the calling code:

Further, takes performs type checks at run-time.

Credits

This package was created with Cookiecutter and the pymetrics/cookiecutter-python-library project template.