schrodinger.infra.mmim module¶
Wrapper classes and functions for dealing with the MMIM library, which is used to read & write Impact and QSite input files.
See MMIMDict documentation for more details.
Copyright Schrodinger, LLC. All rights reserved.
-
schrodinger.infra.mmim.
convert_string
(key, value)¶ Given a key (as integer or string) and a value (string), try to convert the value to the proper type for this keyword. Return converted value. Will raise a KeyError if the wrong key value is specified.
NOTE: Used by glide.py
-
class
schrodinger.infra.mmim.
MMIMArgList
(handle, key, converter=None, getter=None, setter=None, get_len=None, set_len=None)¶ Bases:
schrodinger.infra.mmkv.MMKVArgList
-
__init__
(handle, key, converter=None, getter=None, setter=None, get_len=None, set_len=None)¶ Create an instance from the MMKV/MMIM handle and key (int or string).
Takes functions to get and set indexed values, and a function to determine the length. If these are not provided, they are looked up based on the key provided.
get_len and set_len methods should be defined for array types only.
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.infra.mmim', '__init__': <function MMIMArgList.__init__>, '__doc__': None})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__getitem__
(index)¶
-
__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.
-
__iter__
()¶
-
__le__
¶ Return self<=value.
-
__len__
()¶
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.infra.mmim'¶
-
__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).
-
__setitem__
(index, 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)
-
append
(value)¶ Append a new value to the current MMKV arglist.
Parameters: value (str, int, bool, or float depending on the MMKV arglist type) – The new value to append.
-
setSize
(size)¶ Set the size of the MMKV argument list.
-
-
class
schrodinger.infra.mmim.
MMIMDict
(handle)¶ Bases:
collections.abc.MutableMapping
A class for setting and getting MMIM keyword values. Given an MMIM handle, create an instance as follows:
mydict = MMIMDict(mmim_handle)
Then set any keywords:
mydict[<keywordname>] = <value>
-
__init__
(handle)¶ Create an instance from the given MMIM handle.
-
__getitem__
(key)¶ Return the value stored in the MMIM handle for the given key (integer or string). Note that if no explicit setting has been made for a keyword that the default value will be returned.
-
__setitem__
(key, value)¶ Set the value for the provided key (integer or string) to <value>. If the key type is an MMIM arglist (array), then the value provided must be an list with elements of the proper type.
-
__delitem__
(key)¶
-
keys
() → a set-like object providing a view on D's keys¶
-
__len__
()¶
-
__iter__
()¶
-
__abstractmethods__
= frozenset()¶
-
__class__
¶ alias of
abc.ABCMeta
-
__contains__
(key)¶
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.infra.mmim', '__doc__': '\n A class for setting and getting MMIM keyword values.\n Given an MMIM handle, create an instance as follows:\n\n mydict = MMIMDict(mmim_handle)\n\n Then set any keywords:\n\n mydict[<keywordname>] = <value>\n\n ', '_NOT_IMPLEMENTED_MSG': 'mmim cannot report known keys.', '__init__': <function MMIMDict.__init__>, '__getitem__': <function MMIMDict.__getitem__>, '__setitem__': <function MMIMDict.__setitem__>, '__delitem__': <function MMIMDict.__delitem__>, 'keys': <function MMIMDict.keys>, '_get_handlers_for_key': <function MMIMDict._get_handlers_for_key>, '__len__': <function MMIMDict.__len__>, '__iter__': <function MMIMDict.__iter__>, '__dict__': <attribute '__dict__' of 'MMIMDict' objects>, '__weakref__': <attribute '__weakref__' of 'MMIMDict' objects>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
(other)¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
= None¶
-
__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.mmim'¶
-
__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).
-
__reversed__
= None¶
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__slots__
= ()¶
-
__str__
¶ Return str(self).
-
classmethod
__subclasshook__
(C)¶ 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)
-
clear
() → None. Remove all items from D.¶
-
get
(k[, d]) → D[k] if k in D, else d. d defaults to None.¶
-
items
() → a set-like object providing a view on D's items¶
-
pop
(k[, d]) → v, remove specified key and return the corresponding value.¶ If key is not found, d is returned if given, otherwise KeyError is raised.
-
popitem
() → (k, v), remove and return some (key, value) pair¶ as a 2-tuple; but raise KeyError if D is empty.
-
setdefault
(k[, d]) → D.get(k,d), also set D[k]=d if k not in D¶
-
update
([E, ]**F) → None. Update D from mapping/iterable E and F.¶ If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
-
values
() → an object providing a view on D's values¶
-