<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><title>Python: storage</title> </head><body bgcolor="#f0f0f8"> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>storage</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br>(built-in)</font></td></tr></table> <p><tt>The storage module allows users to save information to disk as key:value<br> pairs without having to interact with files directly. This module gives<br> users access to two classes: StorageSets and StorageLists. Sets match<br> keys to values. Lists hold multiple sets.</tt></p> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ee77aa"> <td colspan=3 valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> <td width="100%"><dl> <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> </font></dt><dd> <dl> <dt><font face="helvetica, arial"><a href="storage.html#StorageList">StorageList</a> </font></dt><dt><font face="helvetica, arial"><a href="storage.html#StorageSet">StorageSet</a> </font></dt></dl> </dd> </dl> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="StorageList">class <strong>StorageList</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> <td colspan=2><tt><a href="#StorageList-__init__">__init__</a>(self, list=None)<br> <br> Create a new storage list. A Python list of storage sets may be<br> supplied, from which to build the storage list.<br> </tt></td></tr> <tr><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="StorageList-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#StorageList-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl> <dl><dt><a name="StorageList-add"><strong>add</strong></a>(...)</dt><dd><tt><a href="#StorageList-add">add</a>(storage_set)<br> <br> Append a new storage set to the storage list.</tt></dd></dl> <dl><dt><a name="StorageList-sets"><strong>sets</strong></a>(...)</dt><dd><tt><a href="#StorageList-sets">sets</a>()<br> <br> Returns a python list of all the sets in the storage list.</tt></dd></dl> <hr> Data and other attributes defined here:<br> <dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#StorageList-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> </td></tr></table> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom> <br> <font color="#000000" face="helvetica, arial"><a name="StorageSet">class <strong>StorageSet</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> <td colspan=2><tt><a href="#StorageSet-__init__">__init__</a>(self, filename=None)<br> <br> Create a new storage set. If a file name is supplied, read a storage set<br> in from the specified file.<br> </tt></td></tr> <tr><td> </td> <td width="100%">Methods defined here:<br> <dl><dt><a name="StorageSet-__contains__"><strong>__contains__</strong></a>(...)</dt><dd><tt><a href="#StorageSet-__contains__">__contains__</a>(name) <==> name in self</tt></dd></dl> <dl><dt><a name="StorageSet-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#StorageSet-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl> <dl><dt><a name="StorageSet-close"><strong>close</strong></a>(...)</dt><dd><tt><a href="#StorageSet-close">close</a>()<br> <br> Recursively close a storage set and all of its children sets and lists.<br> MUST be called when the storage set has finished being used. Garbage<br> collection will not delete the set.</tt></dd></dl> <dl><dt><a name="StorageSet-contains"><strong>contains</strong></a>(...)</dt><dd><tt><a href="#StorageSet-contains">contains</a>(name)<br> <br> Returns True or False if the set contains an entry by the given name.</tt></dd></dl> <dl><dt><a name="StorageSet-readBool"><strong>readBool</strong></a>(...)</dt><dd><tt>Same as readString, for booleans. Returns False if entry does not exist.</tt></dd></dl> <dl><dt><a name="StorageSet-readDouble"><strong>readDouble</strong></a>(...)</dt><dd><tt>Same as readString, for floating points. Returns 0 if entry does not exist..</tt></dd></dl> <dl><dt><a name="StorageSet-readInt"><strong>readInt</strong></a>(...)</dt><dd><tt>Same as readString, for integers. Returns 0 if entry does not exist.</tt></dd></dl> <dl><dt><a name="StorageSet-readList"><strong>readList</strong></a>(...)</dt><dd><tt>Same as readString, for storage lists. Returns an empty storage list<br> if entry does not exist.</tt></dd></dl> <dl><dt><a name="StorageSet-readSet"><strong>readSet</strong></a>(...)</dt><dd><tt>Same as readString, for storage sets. Returns an empty set if entry<br> does not exist.</tt></dd></dl> <dl><dt><a name="StorageSet-readString"><strong>readString</strong></a>(...)</dt><dd><tt><a href="#StorageSet-readString">readString</a>(name)<br> <br> Read a string value from the storage set. Return empty string if the<br> storage set does not contain an entry by the given name.</tt></dd></dl> <dl><dt><a name="StorageSet-storeBool"><strong>storeBool</strong></a>(...)</dt><dd><tt>Same as storeString, for boolean values.</tt></dd></dl> <dl><dt><a name="StorageSet-storeDouble"><strong>storeDouble</strong></a>(...)</dt><dd><tt>Same as storeString, for floating point values.</tt></dd></dl> <dl><dt><a name="StorageSet-storeInt"><strong>storeInt</strong></a>(...)</dt><dd><tt>Same as storeString, for integers.</tt></dd></dl> <dl><dt><a name="StorageSet-storeList"><strong>storeList</strong></a>(...)</dt><dd><tt>Same as storeString, for storage lists.</tt></dd></dl> <dl><dt><a name="StorageSet-storeSet"><strong>storeSet</strong></a>(...)</dt><dd><tt>Same as storeString, for storage sets.</tt></dd></dl> <dl><dt><a name="StorageSet-storeString"><strong>storeString</strong></a>(...)</dt><dd><tt><a href="#StorageSet-storeString">storeString</a>(name, val)<br> <br> Store a string value in the storage set.</tt></dd></dl> <dl><dt><a name="StorageSet-write"><strong>write</strong></a>(...)</dt><dd><tt><a href="#StorageSet-write">write</a>(filename)<br> <br> Write the contents of a storage set to the specified file name.</tt></dd></dl> <hr> Data and other attributes defined here:<br> <dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#StorageSet-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> </td></tr></table></td></tr></table> </body></html>