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

Module compat

source code

Module containing backported language/library functionality.

Functions [hide private]
 
all(seq, pred=bool)
Returns True if pred(x) is True for every element in the iterable.
source code
 
any(seq, pred=bool)
Returns True if pred(x) is True for at least one element in the iterable.
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
Variables [hide private]
  functools = None
  roman = None
  partial = functools.partial

Imports: itertools


Function Details [hide private]

all(seq, pred=bool)

source code 

Returns True if pred(x) is True for every element in the iterable.

Please note that this function provides a pred parameter which isn't available in the version included in Python 2.5 and above.

any(seq, pred=bool)

source code 

Returns True if pred(x) is True for at least one element in the iterable.

Please note that this function provides a pred parameter which isn't available in the version included in Python 2.5 and above.

_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