OpenQuizz
Une application de gestion des contenus pédagogiques
setuptools.depends Namespace Reference

Data Structures

class  Require
 

Functions

def maybe_close (f)
 
def get_module_constant (module, symbol, default=-1, paths=None)
 
def extract_constant (code, symbol, default=-1)
 

Function Documentation

◆ extract_constant()

def setuptools.depends.extract_constant (   code,
  symbol,
  default = -1 
)
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'.

◆ get_module_constant()

def setuptools.depends.get_module_constant (   module,
  symbol,
  default = -1,
  paths = None 
)
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'.

◆ maybe_close()

def setuptools.depends.maybe_close (   f)