utils.category module

Module used for handling categories of let’s say form values and for categorizing them.

class utils.category.CategoryBase(value)[source]

Bases: object

Base class for categories

Parameters:value – Value to be categorized.
utils.category.categorize(iterable, cat)[source]

Function taking iterable of values and a dictionary of rules to categorize the values.

Keys of the dictionary are callables, taking one parameter - the current iterable item. If the call on it returns positive, then the value part of dictionary is taken (assumed callable) and it is called with the current item.

  • iterable – Iterable to categorize.
  • cat – Category specification dictionary