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

Module compat

source code

Wrappers around some builtins introduced in python 2.3, 2.4 and
2.5, making them available in for earlier versions of python.

See another compatibility snippets from other projects:

    :mod:`lib2to3.fixes`
    :mod:`coverage.backward`
    :mod:`unittest2.compatibility`

Classes
  CalledProcessError
This exception is raised when a process run by check_call() returns a non-zero exit status.
  InheritableSet
hacked resolving inheritancy issue from old style class in 2.4
  range
xrange([start,] stop[, step]) -> xrange object
Functions
 
str_to_bytes(string) source code
 
str_encode(string, encoding) source code
 
callable(something) source code
value
raw_input(prompt=...)
Equivalent to eval(raw_input(prompt)).
bool

any(iterable)
Return True if bool(x) is True for any x in the iterable.
source code
bool

all(iterable)
Return True if bool(x) is True for all values x in the iterable.
source code
 
call(*popenargs, **kwargs)
Run command with arguments.
source code
 
check_call(*popenargs, **kwargs)
Run command with arguments.
source code
 
relpath(path, start=curdir)
Return a relative version of a path
source code
Variables
  method_type = types.MethodType
  izip = deprecated('izip exists in itertools since py2.3')(izip)
  imap = deprecated('imap exists in itertools since py2.3')(imap)
  chain = deprecated('chain exists in itertools since py2.3')(ch...
  sum = deprecated('sum exists in builtins since py2.3')(sum)
  enumerate = deprecated('enumerate exists in builtins since py2...
  frozenset = deprecated('frozenset exists in builtins since py2...
  reversed = deprecated('reversed exists in builtins since py2.4...
  sorted = deprecated('sorted exists in builtins since py2.4')(s...
  max = deprecated('max exists in builtins since py2.4')(max)
  json = None
hash(x)
Function Details

call(*popenargs, **kwargs)

source code 
Run command with arguments.  Wait for command to complete, then
return the returncode attribute.

The arguments are the same as for the Popen constructor.  Example:

retcode = call(["ls", "-l"])

check_call(*popenargs, **kwargs)

source code 
Run command with arguments.  Wait for command to complete.  If
the exit code was zero then return, otherwise raise
CalledProcessError.  The CalledProcessError object will have the
return code in the returncode attribute.

The arguments are the same as for the Popen constructor.  Example:

check_call(["ls", "-l"])


Variables Details

chain

Value:
deprecated('chain exists in itertools since py2.3')(chain)

enumerate

Value:
deprecated('enumerate exists in builtins since py2.3')(enumerate)

frozenset

Value:
deprecated('frozenset exists in builtins since py2.4')(frozenset)

reversed

Value:
deprecated('reversed exists in builtins since py2.4')(reversed)

sorted

Value:
deprecated('sorted exists in builtins since py2.4')(sorted)