schrodinger.infra.mmerr module

Utility functions for the mmerr library.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.infra.mmerr.Capture(handle=-1)

Bases: object

Capture 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
class schrodinger.infra.mmerr.ErrorHandler(queued=False, silent=False, level=None)

Bases: object

A class for managing mmerr handlers.

level(level)

Enter a context in which the mmerr level is set to level. Public interface to context manager functionality.

pop_errors()

Return any queued errors and clear the queue.

pop_level()
push_level(level)
class schrodinger.infra.mmerr.Level(level=4, handle=None)

Bases: schrodinger.infra.util.DecoratorAndContextManager

Change 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.

class schrodinger.infra.mmerr.disable_mmerr(handle=None)

Bases: schrodinger.infra.mmerr.Level

Turn off mmerr reporting within a context or while a function is being run. Uses the default mm.error_handle if none is provided

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.
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.