Modules that defines the package custom decorators that checks inputs/outputs types.

bredala.typedecorator.inputs(*accepted_arg_types)[source]

A decorator to validate the parameter types of a given function.

It is passed a tuple, eg. (<type ‘tuple’>, <type ‘int’>), and checks only types.

Special types are ‘self’ and ‘cls’ and are usefull for class methods.

Note: It doesn’t do a deep check, for example checking through a
tuple of types.
bredala.typedecorator.ordinal(num)[source]

Compute the ordinal number of a given integer, as a string.

Parameters:

num: int

an integer.

Returns:

ordinal: str

the ordinal representation of the input integer, eg. 1 -> 1st, 2 -> 2nd, 3 -> 3rd, etc.

bredala.typedecorator.returns(*accepted_return_type_tuple)[source]

Decorator to set the return types.

It is passed a tuple, eg. (<type ‘tuple’>, <type ‘int’>), and checks only types.

Note: It doesn’t do a deep check, for example checking through a
tuple of types.