Ñò ñ” ]c@sWdZddkZddkZddkZeiddjZeo ddUn ddkZeid djo7eiZeid djo d„Zq¶d „ZndZd „Zydd k l Z Wn&e j od dd „ƒYZ nXei dei ddd„Zdeifd„ƒYZde fd„ƒYZddd„ƒYZdS(sNManage shelves of pickled objects using bsddb database files for the storage. iÿÿÿÿNiisfrom . import dbiicCsti||ƒS(N(tcPickletdumps(tobjecttprotocol((s&/usr/lib64/python2.6/bsddb/dbshelve.pyt_dumps1scCsti|d|ƒS(NR(RR(RR((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR4scCsti|d|ƒS(Ntbin(RR(RR((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR9s(t DictMixinRcBseZRS((t__name__t __module__(((s&/usr/lib64/python2.6/bsddb/dbshelve.pyRAsi°cCsÞt|ƒtdƒjoœ|}|djo ti}qµ|djo d}qµ|djo ti}qµ|djo ti}qµ|djotitiB}qµtid‚nt|ƒ}|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() ttrtrwitwtctnsJflags should be one of 'r', 'w', 'c' or 'n' or use the bsddb.db.DB_* flags(ttypetdbt DB_RDONLYt DB_CREATEt DB_TRUNCATEtDBErrortDBShelftopen(tfilenametflagstmodetfiletypetdbenvtdbnametsflagtd((s&/usr/lib64/python2.6/bsddb/dbshelve.pyRFs           t DBShelveErrorcBseZRS((RR(((s&/usr/lib64/python2.6/bsddb/dbshelve.pyRisRcBsõeZdZdd„Zd„Zd„Zd„Zd„Zd„Z d„Z dd„Z d „Z d „Z d „Zdd „Zdd „Zdd„Zdd„Zdd„Zd„Zddd„Zddd„Zddd„Zdd„ZRS(sŽA shelf to hold pickled objects, built upon a bsddb DB object. It automatically pickles/unpickles data objects going to/from the DB. cCs<ti|ƒ|_t|_to t|_n d|_dS(Ni(RtDBtTruet_closedtHIGHEST_PROTOCOLR(tselfR((s&/usr/lib64/python2.6/bsddb/dbshelve.pyt__init__ps   cCs|iƒdS(N(tclose(R$((s&/usr/lib64/python2.6/bsddb/dbshelve.pyt__del__yscCst|i|ƒS(sTMany methods we can just pass through to the DB object. (See below) (tgetattrR(R$tname((s&/usr/lib64/python2.6/bsddb/dbshelve.pyt __getattr__}scCs t|iƒS(N(tlenR(R$((s&/usr/lib64/python2.6/bsddb/dbshelve.pyt__len__‡scCs|i|}ti|ƒS(N(RRtloads(R$tkeytdata((s&/usr/lib64/python2.6/bsddb/dbshelve.pyt __getitem__‹s cCs#t||iƒ}||i|(R"tidtreprtdictt iteritems(R$((s&/usr/lib64/python2.6/bsddb/dbshelve.pyt__repr__ªs cCso|dj o|ii|ƒ}n|iiƒ}g}x0|D](\}}|i|ti|ƒfƒq?W|S(N(R4RtitemstappendRR-(R$R6R?tnewitemstktv((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR?±s   cCsB|dj o|ii|ƒ}n|iiƒ}tti|ƒS(N(R4RtvaluestmapRR-(R$R6RD((s&/usr/lib64/python2.6/bsddb/dbshelve.pyRD¼s cCs%t||iƒ}|ii||ƒS(N(RRRR@(R$R1R6R/((s&/usr/lib64/python2.6/bsddb/dbshelve.pyt__appendÇscCs7|iƒtijo|i|d|ƒStd‚dS(NR6sOappend() only supported when dbshelve opened with filetype=dbshelve.db.DB_RECNO(tget_typeRtDB_RECNOt_DBShelf__appendR(R$R1R6((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR@ËsicCs"|d„}|ii|||ƒS(NcSs\tiddjpt|tƒoti|ƒ}ntit|dƒƒ}|||ƒS(Niis iso8859-1(tsyst version_infot isinstancetbytesRR-(tpriKeytpriDatat realCallbackR/((s&/usr/lib64/python2.6/bsddb/dbshelve.pyt_shelf_callbackÒs$(Rt associate(R$t secondaryDBtcallbackRRQ((s&/usr/lib64/python2.6/bsddb/dbshelve.pyRRÑs cOsM|ii||Ž}yti|ƒSWn tttifj o|SXdS(N(RtgetRR-tEOFErrort TypeErrortUnpicklingError(R$R8tkwR/((s&/usr/lib64/python2.6/bsddb/dbshelve.pyRUÞs cCs:t||iƒ}|ii||||ƒ}ti|ƒS(N(RRRRURR-(R$R.R1R6RR/((s&/usr/lib64/python2.6/bsddb/dbshelve.pytget_bothêscCs+t|ii||ƒƒ}|i|_|S(N(t DBShelfCursorRtcursorR(R$R6RR ((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR\ðs cCs+t||iƒ}|ii||||ƒS(N(RRRtput(R$R.R1R6RR/((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR]öscCs t‚dS(N(tNotImplementedError(R$t cursorListR((s&/usr/lib64/python2.6/bsddb/dbshelve.pytjoinûsN(RRt__doc__R4R%R'R*R,R0R2R3R5RR&R>R?RDRIR@RRRURZR\R]R`(((s&/usr/lib64/python2.6/bsddb/dbshelve.pyRls,            R[cBseZdZd„Zd„Zd„Zdd„Zdd„Zd„Zd„Z d „Z d „Z dd „Z dd „Z dd „Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„ZeZd„ZRS(s cCs ||_dS(N(tdbc(R$R\((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR% scCs|iƒdS(N(R&(R$((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR'scCst|i|ƒS(sHSome methods we can just pass through to the cursor object. (See below)(R(Rb(R$R)((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR*sicCs(t|ii|ƒƒ}|i|_|S(N(R[RbtdupR(R$RR ((s&/usr/lib64/python2.6/bsddb/dbshelve.pyRcs cCs(t||iƒ}|ii|||ƒS(N(RRRbR](R$R.R1RR/((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR] scGs-t|ƒ}t|d|ƒ}||ŒdS(Nsget_%d(R+R((R$R8tcounttmethod((s&/usr/lib64/python2.6/bsddb/dbshelve.pyRU%s cCs|ii|ƒ}|i|ƒS(N(RbRUt_extract(R$Rtrec((s&/usr/lib64/python2.6/bsddb/dbshelve.pytget_1*scCs"|ii||ƒ}|i|ƒS(N(RbRURf(R$R.RRg((s&/usr/lib64/python2.6/bsddb/dbshelve.pytget_2.scCs4t||iƒ}|ii||ƒ}|i|ƒS(N(RRRbRURf(R$R.R1RR/Rg((s&/usr/lib64/python2.6/bsddb/dbshelve.pytget_32scCs|i|tiBƒS(N(RhRt DB_CURRENT(R$R((s&/usr/lib64/python2.6/bsddb/dbshelve.pytcurrent8scCs|i|tiBƒS(N(RhRtDB_FIRST(R$R((s&/usr/lib64/python2.6/bsddb/dbshelve.pytfirst9scCs|i|tiBƒS(N(RhRtDB_LAST(R$R((s&/usr/lib64/python2.6/bsddb/dbshelve.pytlast:scCs|i|tiBƒS(N(RhRtDB_NEXT(R$R((s&/usr/lib64/python2.6/bsddb/dbshelve.pytnext;scCs|i|tiBƒS(N(RhRtDB_PREV(R$R((s&/usr/lib64/python2.6/bsddb/dbshelve.pytprev<scCs|i|tiBƒS(N(RhRt DB_CONSUME(R$R((s&/usr/lib64/python2.6/bsddb/dbshelve.pytconsume=scCs|i|tiBƒS(N(RhRt DB_NEXT_DUP(R$R((s&/usr/lib64/python2.6/bsddb/dbshelve.pytnext_dup>scCs|i|tiBƒS(N(RhRt DB_NEXT_NODUP(R$R((s&/usr/lib64/python2.6/bsddb/dbshelve.pyt next_nodup?scCs|i|tiBƒS(N(RhRt DB_PREV_NODUP(R$R((s&/usr/lib64/python2.6/bsddb/dbshelve.pyt prev_nodup@scCs4t||iƒ}|ii||ƒ}|i|ƒS(N(RRRbRZRf(R$R.R1RR/Rg((s&/usr/lib64/python2.6/bsddb/dbshelve.pyRZCscCs"|ii||ƒ}|i|ƒS(N(RbtsetRf(R$R.RRg((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR}IscCs"|ii||ƒ}|i|ƒS(N(Rbt set_rangeRf(R$R.RRg((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR~MscCs"|ii||ƒ}|i|ƒS(N(Rbt set_recnoRf(R$trecnoRRg((s&/usr/lib64/python2.6/bsddb/dbshelve.pyRQscCsv|djodS|\}}tiddjpt|tƒo|ti|ƒfS|tit|dƒƒfSdS(Niis iso8859-1(R4RJRKRLRMRR-(R$RgR.R/((s&/usr/lib64/python2.6/bsddb/dbshelve.pyRfWs   $(RRRaR%R'R*RcR]RURhRiRjRlRnRpRrRtRvRxRzR|RZR}R~Rtset_bothRf(((s&/usr/lib64/python2.6/bsddb/dbshelve.pyR[ s2                      (iii(iii(((RaRRJRKtabsolute_importRR#RR4tUserDictRt ImportErrorRtDB_HASHRRRRR[(((s&/usr/lib64/python2.6/bsddb/dbshelve.pyts.         "