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: object

A class for managing mmerr handlers.

__init__(queued=False, silent=False, level=None)

Initialize self. See help(type(self)) for accurate signature.

push_level(level)
pop_level()
level(level)

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

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

Bases: contextlib.ContextDecorator

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.

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

__init__(handle=None)

Initialize self. See help(type(self)) for accurate signature.

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

Bases: pymmlibs.CaptureMMErr

Prefer using mm.CaptureMMErr directly.

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 schrodinger.infra.CaptureMMErr() as captured:
    # make some mm calls
print captured.messages
__init__(handle=- 1)

Initialize self. See help(type(self)) for accurate signature.

acquire()

acquires ownership of the pointer

addMessagesAsDetails(base_message) → std::string
append()

appends another ‘this’ object

disown()

releases ownership of the pointer

getMessages() → std::string
getMessagesOrDefault(arg2) → std::string
property messages
next()

returns the next ‘this’ object

own()

returns/sets ownership of the pointer

restore()
this
thisown