Ñò
-8Zc           @   s  d  Z  d d k Z e i d d j Z e o d d Un d d k Z e i d d j o d d k Z n} e i d j  o d d k Z n] d d k Z e i ƒ  Z e i	 ƒ  z) e i
 d d	 d
 d e ƒd d k Z Wd e i ƒ  X[ e i d j o3 e i Z e i d j  o d „  Z q6d „  Z n d Z d „  Z e i d j  oG y d d k l Z Wn& e j
 o d d d „  ƒ  YZ n Xe Z n d d k Z e i Z e i d e i d d d „ Z d e i f d „  ƒ  YZ d e f d „  ƒ  YZ d d  d „  ƒ  YZ d S(!   sN   Manage shelves of pickled objects using bsddb database files for the
storage.
iÿÿÿÿNi    i   s   from . import dbi   i   t   ignoret   messages1   the cPickle module has been removed in Python 3.0t   categoryi   c         C   s   t  i |  | ƒ S(   N(   t   cPicklet   dumps(   t   objectt   protocol(    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   _dumpsK   s    c         C   s   t  i |  d | ƒS(   NR   (   R   R   (   R   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR   N   s    c         C   s   t  i |  d | ƒS(   Nt   bin(   R   R   (   R   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR   S   s    (   t	   DictMixinR	   c           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR	   \   s    i°  c         C   sÞ   t  | ƒ t  d ƒ j oœ | } | d j o t i } qµ | d j o
 d } qµ | d j o t i } qµ | d j o t i } qµ | d j o t i t i B} qµ t i d ‚ n t | ƒ } | i |  | | | | ƒ | S(	   s(  
    A simple factory function for compatibility with the standard
    shleve.py module.  It can be used like this, where key is a string
    and data is a pickleable object:

        from bsddb import dbshelve
        db = dbshelve.open(filename)

        db[key] = data

        db.close()
    t    t   rt   rwi    t   wt   ct   nsJ   flags should be one of 'r', 'w', 'c' or 'n' or use the bsddb.db.DB_* flags(   t   typet   dbt	   DB_RDONLYt	   DB_CREATEt   DB_TRUNCATEt   DBErrort   DBShelft   open(   t   filenamet   flagst   modet   filetypet   dbenvt   dbnamet   sflagt   d(    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR   e   s     
t   DBShelveErrorc           B   s   e  Z RS(    (   R
   R   (    (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR"   ˆ   s    R   c           B   s  e  Z d  Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d d „ Z e i d j o d „  Z n d „  Z d „  Z d „  Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d „  Z d d d „ Z d d d „ Z d d d „ Z d d „ Z RS(   sŽ   A shelf to hold pickled objects, built upon a bsddb DB object.  It
    automatically pickles/unpickles data objects going to/from the DB.
    c         C   s<   t  i | ƒ |  _  t |  _ t o t |  _ n
 d |  _ d  S(   Ni   (   R   t   DBt   Truet   _closedt   HIGHEST_PROTOCOLR   (   t   selfR   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   __init__   s
    	c         C   s   |  i  ƒ  d  S(   N(   t   close(   R'   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   __del__˜   s    c         C   s   t  |  i | ƒ S(   sT   Many methods we can just pass through to the DB object.
        (See below)
        (   t   getattrR   (   R'   t   name(    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   __getattr__œ   s    c         C   s   t  |  i ƒ S(   N(   t   lenR   (   R'   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   __len__¦   s    c         C   s   |  i  | } t i | ƒ S(   N(   R   R   t   loads(   R'   t   keyt   data(    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   __getitem__ª   s    c         C   s#   t  | |  i ƒ } | |  i | <d  S(   N(   R   R   R   (   R'   R1   t   valueR2   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   __setitem__¯   s    c         C   s   |  i  | =d  S(   N(   R   (   R'   R1   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   __delitem__´   s    c         C   s/   | d  j	 o |  i i | ƒ S|  i i ƒ  Sd  S(   N(   t   NoneR   t   keys(   R'   t   txn(    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR8   ¸   s    i   i   c         c   s#   x |  i  i ƒ  D] } | Vq Wd  S(   N(   R   R8   (   R'   t   k(    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   __iter__¿   s     c         O   s    |  i  i | | Ž  t |  _ d  S(   N(   R   R   t   FalseR%   (   R'   t   argst   kwargs(    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR   Ê   s    c         O   s    |  i  i | | Ž  t |  _ d  S(   N(   R   R)   R$   R%   (   R'   R=   R>   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR)   Ï   s    c         C   s3   |  i  o d t |  ƒ St t |  i ƒ  ƒ ƒ Sd  S(   Ns   <DBShelf @ 0x%x - closed>(   R%   t   idt   reprt   dictt	   iteritems(   R'   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   __repr__Ô   s    
c         C   so   | d  j	 o |  i i | ƒ } n |  i i ƒ  } g  } x0 | D]( \ } } | i | t i | ƒ f ƒ q? W| S(   N(   R7   R   t   itemst   appendR   R0   (   R'   R9   RD   t   newitemsR:   t   v(    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyRD   Û   s      c         C   sB   | d  j	 o |  i i | ƒ } n |  i i ƒ  } t t i | ƒ S(   N(   R7   R   t   valuest   mapR   R0   (   R'   R9   RH   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyRH   æ   s    c         C   s%   t  | |  i ƒ } |  i i | | ƒ S(   N(   R   R   R   RE   (   R'   R4   R9   R2   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   __appendñ   s    c         C   s7   |  i  ƒ  t i j o |  i | d | ƒSt d ‚ d  S(   NR9   sO   append() only supported when dbshelve opened with filetype=dbshelve.db.DB_RECNO(   t   get_typeR   t   DB_RECNOt   _DBShelf__appendR"   (   R'   R4   R9   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyRE   õ   s    i    c         C   s"   | d „ } |  i  i | | | ƒ S(   Nc         S   s\   t  i d d j  p t | t ƒ o t i | ƒ } n t i t | d ƒ ƒ } | |  | ƒ S(   Ni    i   s	   iso8859-1(   t   syst   version_infot
   isinstancet   bytesR   R0   (   t   priKeyt   priDatat   realCallbackR2   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   _shelf_callbackü   s    $(   R   t	   associate(   R'   t   secondaryDBt   callbackR   RU   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyRV   û   s    c         O   sM   |  i  i | | Ž  } y t i | ƒ SWn  t t t i f j
 o | SXd  S(   N(   R   t   getR   R0   t   EOFErrort	   TypeErrort   UnpicklingError(   R'   R=   t   kwR2   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyRY     s
    c         C   s:   t  | |  i ƒ } |  i i | | | | ƒ } t i | ƒ S(   N(   R   R   R   RY   R   R0   (   R'   R1   R4   R9   R   R2   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   get_both  s    c         C   s+   t  |  i i | | ƒ ƒ } |  i | _ | S(   N(   t   DBShelfCursorR   t   cursorR   (   R'   R9   R   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR`     s    c         C   s+   t  | |  i ƒ } |  i i | | | | ƒ S(   N(   R   R   R   t   put(   R'   R1   R4   R9   R   R2   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyRa      s    c         C   s
   t  ‚ d  S(   N(   t   NotImplementedError(   R'   t
   cursorListR   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   join%  s    N(   i   i   (   R
   R   t   __doc__R7   R(   R*   R-   R/   R3   R5   R6   R8   RN   RO   R;   R   R)   RC   RD   RH   RM   RE   RV   RY   R^   R`   Ra   Rd   (    (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR   ‹   s0   			
								R_   c           B   s  e  Z d  Z d „  Z d „  Z d „  Z d d „ Z d d „ Z d „  Z d „  Z	 d	 „  Z
 d
 „  Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z e Z d „  Z RS(   s   
    c         C   s   | |  _  d  S(   N(   t   dbc(   R'   R`   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR(   6  s    c         C   s   |  i  ƒ  d  S(   N(   R)   (   R'   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR*   9  s    c         C   s   t  |  i | ƒ S(   sH   Some methods we can just pass through to the cursor object.  (See below)(   R+   Rf   (   R'   R,   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR-   =  s    i    c         C   s(   t  |  i i | ƒ ƒ } |  i | _ | S(   N(   R_   Rf   t   dupR   (   R'   R   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyRg   D  s    c         C   s(   t  | |  i ƒ } |  i i | | | ƒ S(   N(   R   R   Rf   Ra   (   R'   R1   R4   R   R2   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyRa   J  s    c         G   s-   t  | ƒ } t |  d | ƒ } | | Œ  d  S(   Ns   get_%d(   R.   R+   (   R'   R=   t   countt   method(    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyRY   O  s    c         C   s   |  i  i | ƒ } |  i | ƒ S(   N(   Rf   RY   t   _extract(   R'   R   t   rec(    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   get_1T  s    c         C   s"   |  i  i | | ƒ } |  i | ƒ S(   N(   Rf   RY   Rj   (   R'   R1   R   Rk   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   get_2X  s    c         C   s4   t  | |  i ƒ } |  i i | | ƒ } |  i | ƒ S(   N(   R   R   Rf   RY   Rj   (   R'   R1   R4   R   R2   Rk   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   get_3\  s    c         C   s   |  i  | t i Bƒ S(   N(   Rl   R   t
   DB_CURRENT(   R'   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   currentb  s    c         C   s   |  i  | t i Bƒ S(   N(   Rl   R   t   DB_FIRST(   R'   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   firstc  s    c         C   s   |  i  | t i Bƒ S(   N(   Rl   R   t   DB_LAST(   R'   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   lastd  s    c         C   s   |  i  | t i Bƒ S(   N(   Rl   R   t   DB_NEXT(   R'   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   nexte  s    c         C   s   |  i  | t i Bƒ S(   N(   Rl   R   t   DB_PREV(   R'   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   prevf  s    c         C   s   |  i  | t i Bƒ S(   N(   Rl   R   t
   DB_CONSUME(   R'   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   consumeg  s    c         C   s   |  i  | t i Bƒ S(   N(   Rl   R   t   DB_NEXT_DUP(   R'   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   next_duph  s    c         C   s   |  i  | t i Bƒ S(   N(   Rl   R   t   DB_NEXT_NODUP(   R'   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt
   next_nodupi  s    c         C   s   |  i  | t i Bƒ S(   N(   Rl   R   t   DB_PREV_NODUP(   R'   R   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt
   prev_nodupj  s    c         C   s4   t  | |  i ƒ } |  i i | | ƒ } |  i | ƒ S(   N(   R   R   Rf   R^   Rj   (   R'   R1   R4   R   R2   Rk   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR^   m  s    c         C   s"   |  i  i | | ƒ } |  i | ƒ S(   N(   Rf   t   setRj   (   R'   R1   R   Rk   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR   s  s    c         C   s"   |  i  i | | ƒ } |  i | ƒ S(   N(   Rf   t	   set_rangeRj   (   R'   R1   R   Rk   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR‚   w  s    c         C   s"   |  i  i | | ƒ } |  i | ƒ S(   N(   Rf   t	   set_recnoRj   (   R'   t   recnoR   Rk   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyRƒ   {  s    c         C   sv   | d  j o d  S| \ } } t i d d j  p t | t ƒ o | t i | ƒ f S| t i t | d ƒ ƒ f Sd  S(   Ni    i   s	   iso8859-1(   R7   RN   RO   RP   RQ   R   R0   (   R'   Rk   R1   R2   (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyRj     s    $(   R
   R   Re   R(   R*   R-   Rg   Ra   RY   Rl   Rm   Rn   Rp   Rr   Rt   Rv   Rx   Rz   R|   R~   R€   R^   R   R‚   Rƒ   t   set_bothRj   (    (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyR_   3  s2   							(   i   i   (   i   i   (   i   i   (   i   i   (    (    (   Re   RN   RO   t   absolute_importR   R   t   warningst   catch_warningsR   t	   __enter__t   filterwarningst   DeprecationWarningt   __exit__R&   R   R7   t   UserDictR	   t   ImportErrort   MutableMappingt   collectionsR   t   DB_HASHR   R   R"   R   R_   (    (    (    s$   /usr/lib/python2.6/bsddb/dbshelve.pyt   <module>   sN   
		
	"¨