Package ganeti :: Module compat
[hide private]
[frames] | no frames]

Module compat

source code

Module containing backported language/library functionality.

Functions [hide private]
 
_all(seq)
Returns True if all elements in the iterable are True.
source code
 
_any(seq)
Returns True if any element of the iterable are True.
source code
 
all(seq)
Returns True if all elements in the iterable are True.
source code
 
any(seq)
Returns True if any element of the iterable are True.
source code
 
partition(seq, pred=bool)
Partition a list in two, based on the given predicate.
source code
 
_partial(func, *args, **keywords)
Decorator with partial application of arguments and keywords.
source code
string or typeof(val)
TryToRoman(val, convert=True)
Try to convert a value to roman numerals
source code
 
UniqueFrozenset(seq)
Makes frozenset from sequence after checking for duplicate elements.
source code
Variables [hide private]
  functools = None
  roman = None
  sha1 = sha
  sha1_hash = sha.new
  partial = functools.partial
  fst = operator.itemgetter(0)
returns the first element of a list-like value
  snd = operator.itemgetter(1)
returns the second element of a list-like value

Imports: itertools, operator, md5_hash, sha


Function Details [hide private]

_partial(func, *args, **keywords)

source code 

Decorator with partial application of arguments and keywords.

This function was copied from Python's documentation.

TryToRoman(val, convert=True)

source code 

Try to convert a value to roman numerals

If the roman module could be loaded convert the given value to a roman numeral. Gracefully fail back to leaving the value untouched.

Parameters:
  • val (integer) - value to convert
  • convert (boolean) - if False, don't try conversion at all
Returns: string or typeof(val)
roman numeral for val, or val if conversion didn't succeed

UniqueFrozenset(seq)

source code 

Makes frozenset from sequence after checking for duplicate elements.

Raises:
  • ValueError - When there are duplicate elements