module documentation

Undocumented

Class Require A prerequisite to building or installing a distribution
Function extract_constant Extract the constant value of 'symbol' from 'code'
Function find_module Just like 'imp.find_module()', but with package support
Function get_module_constant Find 'module' by searching 'paths', and extract 'symbol'
Function maybe_close Undocumented
Function _update_globals Patch the globals to remove the objects not available on some platforms.
def extract_constant(code, symbol, default=-1): (source)

Extract the constant value of 'symbol' from 'code' If the name 'symbol' is bound to a constant value by the Python code object 'code', return that value. If 'symbol' is bound to an expression, return 'default'. Otherwise, return 'None'. Return value is based on the first assignment to 'symbol'. 'symbol' must be a global, or at least a non-"fast" local in the code block. That is, only 'STORE_NAME' and 'STORE_GLOBAL' opcodes are checked, and 'symbol' must be present in 'code.co_names'.

def find_module(module, paths=None): (source)

Just like 'imp.find_module()', but with package support

def get_module_constant(module, symbol, default=-1, paths=None): (source)

Find 'module' by searching 'paths', and extract 'symbol' Return 'None' if 'module' does not exist on 'paths', or it does not define 'symbol'. If the module defines 'symbol' as a constant, return the constant. Otherwise, return 'default'.

def maybe_close(f): (source)

Undocumented

def _update_globals(): (source)

Patch the globals to remove the objects not available on some platforms. XXX it'd be better to test assertions about bytecode instead.