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.

__int__()

Return the handle of the object so that the object reference can be used in functions that expect an integer handle.

__del__()

Decrement the reference count. If the handle is being actively managed, call _delete when it the count hits zero.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.infra.mmobject', '__doc__': '\n An abstraction of the bookkeeping needed to create a garbage collected\n MM object. To subclass, you must provide:\n\n 1. a static initialize() function that calls the necessary mmlib\n initialize functions. Takes a single argument that is the error\n handler.\n 2. a static terminate() function that takes no arguments and calls the\n mmlib terminate functions for everything initialized in init().\n 3. a _delete() instance method that takes no arguments (other than\n self) and deletes the object via mmlib calls.\n\n ', '__init__': <function MmObject.__init__>, '__int__': <function MmObject.__int__>, '__del__': <function MmObject.__del__>, '__dict__': <attribute '__dict__' of 'MmObject' objects>, '__weakref__': <attribute '__weakref__' of 'MmObject' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.infra.mmobject'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)