ok

Mini Shell

Direktori : /lib64/python2.7/bsddb/
Upload File :
Current File : //lib64/python2.7/bsddb/dbshelve.pyo

�
{fc@s�dZddlZejddkZer6ddUnddlZejddkrdddlZnzejdkr�ddlZn\ddlZej�Zej	�z)ej
dd	d
de�ddlZWdej�X[ej
Z
d�Zejdkrdd
lmZnddlZejZejdejddd�Zdejfd��YZdefd��YZddd��YZdS(sNManage shelves of pickled objects using bsddb database files for the
storage.
i����Niisfrom . import dbiitignoretmessages1the cPickle module has been removed in Python 3.0tcategorycCstj|d|�S(Ntprotocol(tcPickletdumps(tobjectR((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt_dumpsDs(t	DictMixini�cCs�t|�td�kr�|}|dkr6tj}q�|dkrKd}q�|dkrctj}q�|dkr{tj}q�|dkr�tjtjB}q�tjd�nt|�}|j|||||�|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_CREATEtDB_TRUNCATEtDBErrortDBShelftopen(tfilenametflagstmodetfiletypetdbenvtdbnametsflagtd((s&/usr/lib64/python2.7/bsddb/dbshelve.pyRPs 	t
DBShelveErrorcBseZRS((t__name__t
__module__(((s&/usr/lib64/python2.7/bsddb/dbshelve.pyRssRcBseZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
dd�Zej
dkrud�Znd�Zd
�Zd�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:tj|�|_t|_tr-t|_n	d|_dS(Ni(RtDBtTruet_closedtHIGHEST_PROTOCOLR(tselfR((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt__init__zs
	cCs|j�dS(N(tclose(R&((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt__del__�scCst|j|�S(sTMany methods we can just pass through to the DB object.
        (See below)
        (tgetattrR(R&tname((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt__getattr__�scCs
t|j�S(N(tlenR(R&((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt__len__�scCs|j|}tj|�S(N(RRtloads(R&tkeytdata((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt__getitem__�s
cCs#t||j�}||j|<dS(N(RRR(R&R0tvalueR1((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt__setitem__�scCs|j|=dS(N(R(R&R0((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt__delitem__�scCs-|dk	r|jj|�S|jj�SdS(N(tNoneRtkeys(R&ttxn((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR7�siiccs#x|jj�D]}|VqWdS(N(RR7(R&tk((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt__iter__�scOs |jj||�t|_dS(N(RRtFalseR$(R&targstkwargs((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR�scOs |jj||�t|_dS(N(RR(R#R$(R&R<R=((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR(�scCs1|jrdt|�Stt|j���SdS(Ns<DBShelf @ 0x%x - closed>(R$tidtreprtdictt	iteritems(R&((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt__repr__�s	cCsm|dk	r!|jj|�}n|jj�}g}x0|D](\}}|j|tj|�f�q=W|S(N(R6RtitemstappendRR/(R&R8RCtnewitemsR9tv((s&/usr/lib64/python2.7/bsddb/dbshelve.pyRC�s cCs@|dk	r!|jj|�}n|jj�}ttj|�S(N(R6RtvaluestmapRR/(R&R8RG((s&/usr/lib64/python2.7/bsddb/dbshelve.pyRG�scCs%t||j�}|jj||�S(N(RRRRD(R&R3R8R1((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt__append�scCs5|j�tjkr(|j|d|�Std�dS(NR8sOappend() only supported when dbshelve opened with filetype=dbshelve.db.DB_RECNO(tget_typeRtDB_RECNOt_DBShelf__appendR(R&R3R8((s&/usr/lib64/python2.7/bsddb/dbshelve.pyRD�sicCs"|d�}|jj|||�S(NcSsYtjddks"t|t�r4tj|�}ntjt|d��}|||�S(Niis	iso8859-1(tsystversion_infot
isinstancetbytesRR/(tpriKeytpriDatatrealCallbackR1((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt_shelf_callback�s"(Rt	associate(R&tsecondaryDBtcallbackRRT((s&/usr/lib64/python2.7/bsddb/dbshelve.pyRU�scOsK|jj||�}ytj|�SWntttjfk
rF|SXdS(N(RtgetRR/tEOFErrort	TypeErrortUnpicklingError(R&R<tkwR1((s&/usr/lib64/python2.7/bsddb/dbshelve.pyRX�s
cCs:t||j�}|jj||||�}tj|�S(N(RRRRXRR/(R&R0R3R8RR1((s&/usr/lib64/python2.7/bsddb/dbshelve.pytget_both�scCs+t|jj||��}|j|_|S(N(t
DBShelfCursorRtcursorR(R&R8RR
((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR_scCs+t||j�}|jj||||�S(N(RRRtput(R&R0R3R8RR1((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR`scCs
t�dS(N(tNotImplementedError(R&t
cursorListR((s&/usr/lib64/python2.7/bsddb/dbshelve.pytjoinsN(ii(R R!t__doc__R6R'R)R,R.R2R4R5R7RMRNR:RR(RBRCRGRLRDRURXR]R_R`Rc(((s&/usr/lib64/python2.7/bsddb/dbshelve.pyRvs0			
							
	R^cBseZdZd�Zd�Zd�Zdd�Zdd�Zd�Zd�Z	d	�Z
d
�Zdd�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.7/bsddb/dbshelve.pyR'!scCs|j�dS(N(R((R&((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR)$scCst|j|�S(sHSome methods we can just pass through to the cursor object.  (See below)(R*Re(R&R+((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR,(sicCs(t|jj|��}|j|_|S(N(R^RetdupR(R&RR
((s&/usr/lib64/python2.7/bsddb/dbshelve.pyRf/scCs(t||j�}|jj|||�S(N(RRReR`(R&R0R3RR1((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR`5scGs-t|�}t|d|�}||�dS(Nsget_%d(R-R*(R&R<tcounttmethod((s&/usr/lib64/python2.7/bsddb/dbshelve.pyRX:scCs|jj|�}|j|�S(N(ReRXt_extract(R&Rtrec((s&/usr/lib64/python2.7/bsddb/dbshelve.pytget_1?scCs"|jj||�}|j|�S(N(ReRXRi(R&R0RRj((s&/usr/lib64/python2.7/bsddb/dbshelve.pytget_2CscCs4t||j�}|jj||�}|j|�S(N(RRReRXRi(R&R0R3RR1Rj((s&/usr/lib64/python2.7/bsddb/dbshelve.pytget_3GscCs|j|tjB�S(N(RkRt
DB_CURRENT(R&R((s&/usr/lib64/python2.7/bsddb/dbshelve.pytcurrentMR	cCs|j|tjB�S(N(RkRtDB_FIRST(R&R((s&/usr/lib64/python2.7/bsddb/dbshelve.pytfirstNR	cCs|j|tjB�S(N(RkRtDB_LAST(R&R((s&/usr/lib64/python2.7/bsddb/dbshelve.pytlastOR	cCs|j|tjB�S(N(RkRtDB_NEXT(R&R((s&/usr/lib64/python2.7/bsddb/dbshelve.pytnextPR	cCs|j|tjB�S(N(RkRtDB_PREV(R&R((s&/usr/lib64/python2.7/bsddb/dbshelve.pytprevQR	cCs|j|tjB�S(N(RkRt
DB_CONSUME(R&R((s&/usr/lib64/python2.7/bsddb/dbshelve.pytconsumeRR	cCs|j|tjB�S(N(RkRtDB_NEXT_DUP(R&R((s&/usr/lib64/python2.7/bsddb/dbshelve.pytnext_dupSR	cCs|j|tjB�S(N(RkRt
DB_NEXT_NODUP(R&R((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt
next_nodupTR	cCs|j|tjB�S(N(RkRt
DB_PREV_NODUP(R&R((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt
prev_nodupUR	cCs4t||j�}|jj||�}|j|�S(N(RRReR]Ri(R&R0R3RR1Rj((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR]XscCs"|jj||�}|j|�S(N(RetsetRi(R&R0RRj((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR�^scCs"|jj||�}|j|�S(N(Ret	set_rangeRi(R&R0RRj((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR�bscCs"|jj||�}|j|�S(N(Ret	set_recnoRi(R&trecnoRRj((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR�fscCsq|dkrdS|\}}tjddks>t|t�rQ|tj|�fS|tjt|d��fSdS(Niis	iso8859-1(R6RMRNRORPRR/(R&RjR0R1((s&/usr/lib64/python2.7/bsddb/dbshelve.pyRils"(R R!RdR'R)R,RfR`RXRkRlRmRoRqRsRuRwRyR{R}RR]R�R�R�tset_bothRi(((s&/usr/lib64/python2.7/bsddb/dbshelve.pyR^s2							(ii(ii((RdRMRNtabsolute_importRRtwarningstcatch_warningsRt	__enter__tfilterwarningstDeprecationWarningt__exit__R%RtUserDictRtMutableMappingtcollectionsRtDB_HASHR6RRRRR^(((s&/usr/lib64/python2.7/bsddb/dbshelve.pyt<module>s<
			"�

Zerion Mini Shell 1.0