common package

Provide common classes and functions.

The common module and its submodules probides varies functions ans classes which can be used in any context.

Functions

This module provides the following functions which are alias of ones in sub-modules.

print_args
Decorate a function so that print arguments before calling it.
print_return
Decorate a function so that print result after calling it.
constant
Decorate a function so that the result is a constant value.
memoized
Decorate a function to memoize results.

Submodules

common.decorator module

Defines common decorators.

This module provides useful decorators.

common.decorator.constant(func)[source]

Decorate a function so that the result is a constant value.

Functions wraped by this decorator will be run just one time. The computational result will be stored and reused for any other input.

To store each result for each input, use memoized() instead.

common.decorator.memoized(func)[source]

Decorate a function to memoize results.

Functions wraped by this decorator won’t compute twice for each input. Any results will be stored. This decorator might increase used memory in order to shorten computational time.

common.decorator.print_args(output=<open file '<stdout>', mode 'w'>)[source]

Decorate a function so that print arguments before calling it.

Parameters:output – writable to print args. (Default: sys.stdout)
common.decorator.print_return(output=<open file '<stdout>', mode 'w'>)[source]

Decorate a function so that print result after calling it.

Parameters:output – writable to print return values. (Default: sys.stdout)

common.helper module

Mixins for algebraic classes.

class common.helper.ImmutableAdditiveGroup[source]

Bases: object

class common.helper.ImmutableMathHelper[source]

Bases: object

class common.helper.JSONable[source]

Bases: object

class common.helper.MathHelper[source]

Bases: common.helper.ImmutableMathHelper

class common.helper.MultipliableImmutableAdditiveGroup[source]

Bases: common.helper.ImmutableAdditiveGroup

common.writer module

Provides writers to output information in certain format.

class common.writer.CSVWriter(output, headers)[source]

Bases: object

Output reviewers in CSV format.

write(item)[source]
class common.writer.JSONWriter(output)[source]

Bases: object

Output reviewers in JSON format.

write(item)[source]