decorateme._over

Decorators for types that are “basically” a simpler type.

Module Contents

Functions

float_type(attribute)

Auto-adds a __float__ using the __float__ of some attribute.

int_type(attribute)

Auto-adds an __int__ using the __int__ of some attribute.

iterable_over(attribute)

Auto-adds an __iter__ over elements in an iterable attribute.

collection_over(attribute)

Auto-adds an __iter__ and __len__ over elements in a collection attribute.

sequence_over(attribute)

Auto-adds __getitem__ and __len__ over elements in an iterable attribute.

decorateme._over.float_type(attribute: str)

Auto-adds a __float__ using the __float__ of some attribute. Used to annotate a class as being “essentially an float”.

Parameters

attribute – The name of the attribute of this class

decorateme._over.int_type(attribute: str)

Auto-adds an __int__ using the __int__ of some attribute. Used to annotate a class as being “essentially an integer”.

Parameters

attribute – The name of the attribute of this class

decorateme._over.iterable_over(attribute: str)

Auto-adds an __iter__ over elements in an iterable attribute. Used to annotate a class as being “essentially an iterable” over some elements.

Parameters

attribute – The name of the attribute of this class

decorateme._over.collection_over(attribute: str)

Auto-adds an __iter__ and __len__ over elements in a collection attribute. Used to annotate a class as being “essentially a collection” over some elements.

Parameters

attribute – The name of the attribute of this class

decorateme._over.sequence_over(attribute: str)

Auto-adds __getitem__ and __len__ over elements in an iterable attribute. Used to annotate a class as being “essentially a list” over some elements.

Parameters

attribute – The name of the attribute of this class