Package schrodinger :: Package infra :: Module mmcheck
[hide private]
[frames] | no frames]

Module mmcheck

Classes [hide private]
  _Wrapper
Class used to wrap a function from pymmlibs, checking the return code and raising an exception if it is not of the correct 'OK' enum value.
  MmException
An exception class that specifically indicates the failure of an mmlibs call.
  ReturnCode
A class to hold special return code values and translate return code values into names.
  _CCodeProfiler
A class for profiling the time spent in C functions.
Functions [hide private]
 
_trace_log(function)
Create a new function that logs its name and arguments every time it is called.
 
wrap_module(module_dict, return_codes, ignored_functions, failure_dict, inserted_module_globals=None)
Create wrappers for all of the mmlibs and place them into the module's global namespace.
 
_get_mm_prefix(name)
Get the mmlib prefix from a function or variable name.
 
generate_return_code_dict(global_dict, code_lists)
Set up a dictionary of ReturnCode objects, indexed by the mmlib prefix names.
 
_c_function_proxy(fn, *args)
This function is a python level proxy for the C function 'fn'.
Variables [hide private]
  Null = object()
  _trace_logging = True
hash(x)
  _logger = logging.getLogger("schrodinger.infra.mm")
  IGNORED_SWIG_FUNCTIONS = set(['new_instancemethod', 'weakref_p...
Function Details [hide private]

wrap_module(module_dict, return_codes, ignored_functions, failure_dict, inserted_module_globals=None)

 

Create wrappers for all of the mmlibs and place them into the module's global namespace.

Parameters:
  • return_codes (dict) - Dict of ReturnCode objects, as generated by generate_return_codes
  • ignored_functions (iterable of strings) - are functions that are created by swig which don't match
  • failure_dict (dict) - error code returned if the function encounters an error, when it is not covered by the normal return_codes dict

_get_mm_prefix(name)

 

Get the mmlib prefix from a function or variable name.

The prefix is the lowercased string up to (but not including) the first underscore. If no underscore is present, return None.

generate_return_code_dict(global_dict, code_lists)

 

Set up a dictionary of ReturnCode objects, indexed by the mmlib prefix names. This dictionary is used to translate error codes into names so errors make more sense to the humans reading the error message.

Parameters:
  • global_dict - globals() dict of the module with these return codes
  • code_lists (list) - Each member of the code_lists list is a list of the names of the return codes for a specific mmlib. Please keep the list sorted by mmlib prefix so it is easy to find the proper place to add new return codes.

    The return codes are listed explicitly to speed the import of this module.


Variables Details [hide private]

IGNORED_SWIG_FUNCTIONS

Value:
set(['new_instancemethod', 'weakref_proxy', 'SwigStringFloatMap_swigre\
gister', 'SwigStringVector3_swigregister', 'SwigIntVector_swigregister\
', 'SwigInt64Vector_swigregister', 'SwigUInt64Vector2_swigregister', '\
SwigStringStringMap_swigregister', 'SwigFloatVector_swigregister', 'Sw\
igDoubleVector2_swigregister', 'SwigStringDoubleMap_swigregister', 'Sw\
igPyIterator_swigregister', 'SwigStringVector_swigregister', 'SwigIntD\
oubleMap_swigregister', 'ofstream_swigregister', 'istream_swigregister\
', 'SwigStringIntMap_swigregister', 'SwigUInt64Vector3_swigregister', \
...