schrodinger.infra.mmerr module¶
Utility functions for the mmerr library.
Copyright Schrodinger, LLC. All rights reserved.
-
schrodinger.infra.mmerr.push_level(mmerr_level, mmerr_handle=None)¶ Set the specified mmerr level and push the previous level onto a stack.
Parameters: - mmerr_level (int) – The logging level to use.
- mmerr_handle (int) – The mmerr handle to use. Defaults to mm.error_handler.
-
schrodinger.infra.mmerr.pop_level(mmerr_handle=None)¶ Pop the mmerr level stack and set logging level to the previous value.
Return the mmerr level that has been set (i.e. the current logging level in use after the function returns).
Parameters: mmerr_handle (int) – The mmerr handle to use. Defaults to mm.error_handler.
-
class
schrodinger.infra.mmerr.ErrorHandler(queued=False, silent=False, level=None)¶ Bases:
objectA class for managing mmerr handlers.
-
__init__(queued=False, silent=False, level=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
pop_errors()¶ Return any queued errors and clear the queue.
-
push_level(level)¶
-
pop_level()¶
-
-
class
schrodinger.infra.mmerr.Level(level=4, handle=None)¶ Bases:
contextlib.ContextDecoratorChange mmerr level within a context or while a function is being run. Uses the default mm.error_handler level (MMERR_WARNING) if none is provided. Uses the default mm.error_handle if none is provided.
-
__init__(level=4, handle=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
schrodinger.infra.mmerr.disable_mmerr(handle=None)¶ Bases:
schrodinger.infra.mmerr.LevelTurn off mmerr reporting within a context or while a function is being run. Uses the default mm.error_handle if none is provided
-
__init__(handle=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
schrodinger.infra.mmerr.Capture(handle=-1)¶ Bases:
objectCapture all mmerr in a context. At the end of the context, messages will be available in the messages attribute. Messages are not printed.
usage:
with Capture() as captured: # make some mm calls print captured.messages
-
__init__(handle=-1)¶ Initialize self. See help(type(self)) for accurate signature.
-