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.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)
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)
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)
acquire()

acquires ownership of the pointer

addMessagesAsDetails(self, base_message) std::string
append()

appends another ‘this’ object

disown()

releases ownership of the pointer

getMessages(self) std::string
getMessagesOrDefault(self, _def) std::string
property messages
next()

returns the next ‘this’ object

own()

returns/sets ownership of the pointer

restore(self)
this
thisown