schrodinger.infra.mmobject module

A base class for creation of garbage collected, object-oriented wrappers of the mmlibs.

class schrodinger.infra.mmobject.MmObject(handle, manage_handle=True, error_handler=None)

Bases: object

An abstraction of the bookkeeping needed to create a garbage collected MM object. To subclass, you must provide:

  1. a static initialize() function that calls the necessary mmlib initialize functions. Takes a single argument that is the error handler.

  2. a static terminate() function that takes no arguments and calls the mmlib terminate functions for everything initialized in init().

  3. a _delete() instance method that takes no arguments (other than self) and deletes the object via mmlib calls.

__init__(handle, manage_handle=True, error_handler=None)

Initialize an object with an existing MM handle - i.e. one created with direct calls to the mmlibs.

By default, the MM resources will be managed by the object. To keep these from being cleaned up on object deletion, set manage_handle=False.