Package schrodinger :: Package infra :: Module mmkv :: Class MMKVSettings
[hide private]
[frames] | no frames]

Class MMKVSettings

UserDict.DictMixin --+
                     |
                    MMKVSettings

A class for setting and getting MMKV keyword values.

mydict = MMKVSettings()

Then set any keywords:

mydict[<keywordname>] = <value>

Instance Methods [hide private]
 
__init__(self, handle=None)
Create an instance from the given MMKV handle.
 
__getitem__(self, key)
Return the value stored in the MMKV handle for the given key (integer or string).
 
__setitem__(self, key, value)
Set the value for the provided key (integer or string) to <value>.
 
__delitem__(self, key)
 
get_default(self, key)
Return the default value for the given keyword.
 
keys(self)
 
parseInputFile(self, filename, jobtype)
Populate this MMKV instance based on the data from an input file.
 
write(self, filename)
Write the stored keywords to the specified file.
 
get_command(self)
Return the command string corresponding to the stored keywords.
 
get_command_arguments(self)
Return the arguments corresponding to the stored keywords.
 
_get_handlers_for_key(self, key)
Retrieve the mmkv functions to use in getting and setting the provided key (integer or string).

Inherited from UserDict.DictMixin: __cmp__, __contains__, __iter__, __len__, __repr__, clear, get, has_key, items, iteritems, iterkeys, itervalues, pop, popitem, setdefault, update, values

Method Details [hide private]

__init__(self, handle=None)
(Constructor)

 

Create an instance from the given MMKV handle. If none is given, a new MMKV handle is created.

__getitem__(self, key)
(Indexing operator)

 

Return the value stored in the MMKV 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__(self, key, value)
(Index assignment operator)

 

Set the value for the provided key (integer or string) to <value>. If the key type is an MMKV arglist (array), then the value provided must be an list with elements of the proper type.

_get_handlers_for_key(self, key)

 

Retrieve the mmkv functions to use in getting and setting the provided key (integer or string).

Returns a tuple of key ID and converter/getter/setter functions. Will raise a KeyError if the wrong key value (or type) is specified, because the exception is passed onto the getter/setter methods.

NOTE: The mmkv library needs to be initialized before using this method.