schrodinger.infra.mmcheck module¶
-
schrodinger.infra.mmcheck.
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
-
exception
schrodinger.infra.mmcheck.
MmException
(wrapped_function, args, rc)¶ Bases:
Exception
An exception class that specifically indicates the failure of an mmlibs call. The underlying value of the error code returned by the mmlib function can be retrieved through the ‘rc’ attribute of the exception. The name of the return code can be retrieved through the ‘rc_name’ attribute of the exception.
-
__init__
(wrapped_function, args, rc)¶ Initialize with the wrapped function, arguments used, and the return code.
-
args
¶
-
__str__
()¶ Return str(self).
-
__cause__
¶ exception cause
-
__class__
¶ alias of
builtins.type
-
__context__
¶ exception context
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.infra.mmcheck', '__doc__': "\n\n An exception class that specifically indicates the failure of an\n mmlibs call. The underlying value of the error code returned by the\n mmlib function can be retrieved through the 'rc' attribute of the\n exception. The name of the return code can be retrieved through the\n 'rc_name' attribute of the exception.\n\n ", '__init__': <function MmException.__init__>, '__str__': <function MmException.__str__>, '__weakref__': <attribute '__weakref__' of 'MmException' objects>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.infra.mmcheck'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶ Return repr(self).
-
__setattr__
¶ Implement setattr(self, name, value).
-
__setstate__
()¶
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__suppress_context__
¶
-
__traceback__
¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
schrodinger.infra.mmcheck.
ReturnCode
¶ Bases:
object
A class to hold special return code values and translate return code values into names.
-
ok_pattern
= re.compile('^[A-Z][A-Z0-9]*_OK$')¶
-
error_pattern
= re.compile('^[A-Z][A-Z0-9]*_(ERR(OR)?|BUMMER)$')¶
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
add_code
(module, name, value=None)¶ Add a code name and value to the object. If value is not provided, look it up in the pymmlibs module from the name given.
-
get_name
(value)¶ Return the name associated with the value.
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.infra.mmcheck', '__doc__': '\n A class to hold special return code values and translate return code\n values into names.\n\n ', 'ok_pattern': re.compile('^[A-Z][A-Z0-9]*_OK$'), 'error_pattern': re.compile('^[A-Z][A-Z0-9]*_(ERR(OR)?|BUMMER)$'), '__init__': <function ReturnCode.__init__>, 'add_code': <function ReturnCode.add_code>, 'get_name': <function ReturnCode.get_name>, '__dict__': <attribute '__dict__' of 'ReturnCode' objects>, '__weakref__': <attribute '__weakref__' of 'ReturnCode' objects>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.infra.mmcheck'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶ Return repr(self).
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
-
schrodinger.infra.mmcheck.
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.