Package logilab :: Package common
[frames] | no frames]

Package common

source code

Logilab common library (aka Logilab's extension to the standard library).
Submodules

Classes
  attrdict
A dictionary for which keys are also accessible as attributes.
  dictattr
  nullobject
  tempattr
Functions
list
flatten(iterable, tr_func=None, results=None)
Flatten a list of list with any level.
source code
list
make_domains(lists)
Given a list of lists, return a list of domain for each list to produce all combinations of possibles values.
source code
Variables
  __pkginfo__ = types.ModuleType('__pkginfo__')
tuple STD_BLACKLIST = 'CVS', '.svn', '.hg', 'debian', 'dist', 'build'
directories ignored by default by the functions in this package which have to recurse into directories
tuple IGNORED_EXTENSIONS = '.pyc', '.pyo', '.elc', '~', '.swp', '.orig'
file extensions that may usually be ignored
  USE_MX_DATETIME = True
Function Details

flatten(iterable, tr_func=None, results=None)

source code 

Flatten a list of list with any level.

If tr_func is not None, it should be a one argument function that'll be called on each final element.

>>> flatten([1, [2, 3]])
[1, 2, 3]
Returns: list

make_domains(lists)

source code 

Given a list of lists, return a list of domain for each list to produce all combinations of possibles values.

Example:

>>> make_domains(['a', 'b'], ['c','d', 'e'])
[['a', 'b', 'a', 'b', 'a', 'b'], ['c', 'c', 'd', 'd', 'e', 'e']]
Returns: list