Dicts - shmolyneaux/SquareJam GitHub Wiki

Dict inherits from PStorBaseObject. It has be designed to replicate the functionality of standard python dictionaries, but on a persistent database.

The class contains the following methods:

  • __init__
  • __len__
  • __getitem__
  • __setitem__
  • getcontents
  • __str__
  • __repr__
  • __add__
  • __delitem__
  • __contains__
  • iter
  • clear
  • copy
  • fromkeys
  • get
  • has_key
  • items
  • keys
  • values
  • iteritems
  • iterkeys
  • pop
  • popitem
  • update
  • setdefault

Members

All of the names of the above methods are added to __reserved__ from PStorBaseObject except for __init__ and getcontents (though these may be an error). contents is also appended to __reserved__ though it isn't a method - this may be an issue.

Methods

Except for the listed methods below, Dict methods should behave the same way as standard dictionaries. See the python documentation for detail on methods that have not been listed below.

_init_( connection, key )

  • creates a reference object that refers to a mutable object in the persistent storage system.

getcontents()

  • returns a list containing the __key__ of each attribute.

keys()

  • returns a list of keys as opposed to a View in standard python 3

_str_()

  • returns Dict(%s) where %s is repr(self.__key__).

_repr_()

  • functional the same as __str__.

_add_()

  • not implemented in python 3, and currently does not work. This is a known issue.