N
ψωO5c       s«   d  Z  y k l l Wn e j
 o k l l n Xy k l Wn e j
 o k l n Xd f  d     YZ d e f d     YZ	 d e f d     YZ
 d d  Z d	 S(
   s  Manage shelves of pickled objects.

A "shelf" is a persistent, dictionary-like object.  The difference
with dbm databases is that the values (not the keys!) in a shelf can
be essentially arbitrary Python objects -- anything that the "pickle"
module can handle.  This includes most class instances, recursive data
types, and objects containing lots of shared sub-objects.  The keys
are ordinary strings.

To summarize the interface (key is a string, data is an arbitrary
object):

	import shelve
	d = shelve.open(filename) # open, with (g)dbm filename -- no suffix

	d[key] = data	# store data at key (overwrites old data if
			# using an existing key)
	data = d[key]	# retrieve data at key (raise KeyError if no
			# such key)
	del d[key]	# delete data stored at key (raises KeyError
			# if no such key)
	flag = d.has_key(key)	# true if the key exists
	list = d.keys()	# a list of all existing keys (slow!)

	d.close()	# close it

Dependent on the implementation, closing a persistent dictionary may
or may not be necessary to flush changes to disk.
s   Shelfc      sb   d  Z  d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d	   Z	 d
   Z
 RS(   s   Base class for shelf implementations.

	This is initialized with a dictionary-like object.
	See the module's __doc__ string for an overview of the interface.
	c    s   | |  _  d  S(   N(   s   dicts   self(   s   selfs   dicts0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   __init__3 s    c    s   |  i i   Sd  S(   N(   s   selfs   dicts   keys(   s   selfs0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   keys6 s    c    s   t  |  i  Sd  S(   N(   s   lens   selfs   dict(   s   selfs0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   __len__9 s    c    s   |  i i |  Sd  S(   N(   s   selfs   dicts   has_keys   key(   s   selfs   keys0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   has_key< s    c    s'   t  |  i |  } t |  i   Sd  S(   N(   s   StringIOs   selfs   dicts   keys   fs	   Unpicklers   load(   s   selfs   keys   fs0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   __getitem__? s    c    s9   t    } t |  } | i |  | i   |  i | <d  S(   N(
   s   StringIOs   fs   Picklers   ps   dumps   values   getvalues   selfs   dicts   key(   s   selfs   keys   values   fs   ps0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   __setitem__C s    	c    s   |  i | =d  S(   N(   s   selfs   dicts   key(   s   selfs   keys0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   __delitem__I s    c    s(   y |  i i   Wn n Xd |  _ d  S(   Ni    (   s   selfs   dicts   close(   s   selfs0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   closeL s
    c    s   |  i   d  S(   N(   s   selfs   close(   s   selfs0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   __del__S s    c    s(   t  |  i d  o |  i i   n d  S(   Ns   sync(   s   hasattrs   selfs   dicts   sync(   s   selfs0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   syncV s    (   s   __doc__s   __init__s   keyss   __len__s   has_keys   __getitem__s   __setitem__s   __delitem__s   closes   __del__s   sync(    s0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   Shelf, s    									s
   BsdDbShelfc      s>   d  Z  d   Z d   Z d   Z d   Z d   Z d   Z RS(   s  Shelf implementation using the "BSD" db interface.

	This adds methods first(), next(), previous(), last() and
	set_location() that have no counterpart in [g]dbm databases.

	The actual database must be opened using one of the "bsddb"
	modules "open" routines (i.e. bsddb.hashopen, bsddb.btopen or
	bsddb.rnopen) and passed to the constructor.

	See the module's __doc__ string for an overview of the interface.
	c    s   t  i |  |  d  S(   N(   s   Shelfs   __init__s   selfs   dict(   s   selfs   dicts0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   __init__h s    c    s>   |  i i |  \ } } t |  } | t |  i   f Sd  S(   N(	   s   selfs   dicts   set_locations   keys   values   StringIOs   fs	   Unpicklers   load(   s   selfs   keys   values   fs0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   set_locationk s    c    s;   |  i i   \ } } t |  } | t |  i   f Sd  S(   N(	   s   selfs   dicts   nexts   keys   values   StringIOs   fs	   Unpicklers   load(   s   selfs   keys   values   fs0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   nextp s    c    s;   |  i i   \ } } t |  } | t |  i   f Sd  S(   N(	   s   selfs   dicts   previouss   keys   values   StringIOs   fs	   Unpicklers   load(   s   selfs   keys   values   fs0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   previousu s    c    s;   |  i i   \ } } t |  } | t |  i   f Sd  S(   N(	   s   selfs   dicts   firsts   keys   values   StringIOs   fs	   Unpicklers   load(   s   selfs   keys   values   fs0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   firstz s    c    s;   |  i i   \ } } t |  } | t |  i   f Sd  S(   N(	   s   selfs   dicts   lasts   keys   values   StringIOs   fs	   Unpicklers   load(   s   selfs   keys   values   fs0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   last s    (   s   __doc__s   __init__s   set_locations   nexts   previouss   firsts   last(    s0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys
   BsdDbShelf[ s    					s   DbfilenameShelfc      s   d  Z  d d  Z RS(   sΑ   Shelf implementation using the "anydbm" generic dbm interface.

	This is initialized with the filename for the dbm database.
	See the module's __doc__ string for an overview of the interface.
	c    s&   k  } t i |  | i | |   d  S(   N(   s   anydbms   Shelfs   __init__s   selfs   opens   filenames   flag(   s   selfs   filenames   flags   anydbms0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   __init__ s    s   c(   s   __doc__s   __init__(    s0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   DbfilenameShelf s    c    s   t  |  |  Sd S(   s«   Open a persistent dictionary for reading and writing.

	Argument is the filename for the dbm database.
	See the module's __doc__ string for an overview of the interface.
	N(   s   DbfilenameShelfs   filenames   flag(   s   filenames   flags0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   open s     s   cN(   s   __doc__s   cPickles   Picklers	   Unpicklers   ImportErrors   pickles	   cStringIOs   StringIOs   Shelfs
   BsdDbShelfs   DbfilenameShelfs   open(    s0   /var/tmp/python-root/usr/lib/python1.5/shelve.pys   ? s   /*