python (3.11.7)

(root)/
lib/
python3.11/
dbm/
__pycache__/
dumb.cpython-311.pyc

eJ-rdZddlZddlZddlZddlZddgZ	dZ
eZGddej
jZdd
ZdS)aA dumb and slow but simple dbm clone.

For database spam, spam.dir contains the index (a text file),
spam.bak *may* contain a backup of the index (also a text file),
while spam.dat contains the data (a binary file).

XXX TO DO:

- seems to contain a bug when updating...

- reclaim free space (currently, space once occupied by deleted or expanded
items is never reused)

- support concurrent access (currently, if two processes take turns making
updates, they can mess up the index)

- support efficient access to large databases (currently, the whole index
is read when the database is opened, and some updates rewrite the whole index)

- support opening for read-only (flag = 'm')

NerroropeniceZdZeZeZddZdZdZdZeZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZdZdZeZdZdZeZdZdZdZdS)	_Databasecc|j|}||_|dk|_|dz|_|dz|_|dz|_d|_|||	|dS)Nrs.dirs.dats.bak)
_osfsencode_mode	_readonly_dirfile_datfile_bakfile_index_create_update)selffilebasenamemodeflags    </BuggyBox/python/3.11.7/bootstrap/lib/python3.11/dbm/dumb.py__init__z_Database.__init__0sx((66
#+%w.
%w.
$w.
	
TTc|dkr<|j|j|jfD]'}	tj|#t
$rY$wxYw	t
j|jdd}|dS#t
$rY|dvrt
j|jdd5}|	|jdddYdS#1swxYwYYdSwxYw)Nnr	Latin-1encodingrrw)
rrrr
removeOSError_iorclose_chmod)rrfilenamefs    rrz_Database._createJsR3;;!]DM4=I

Jx((((D	i@@@A
GGIIIII
	+	+	+:%%$-yAAA
+QDM***
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+	+sD3
AAA66+C!C
<C
C	CC	CCcld|_i|_	tj|jdd}|5|D]L}|}t
j|\}}|d}||j|<M	ddddS#1swxYwYdS#t$r|dvrd|_YdSwxYw)NFr	rrr T)
	_modifiedrr$rrrstrip_astliteral_evalencoder#)rrr(linekeypos_and_siz_pairs      rrz_Database._update]s(	8i@@@A
8
888D;;==D,0,=d,C,C)C)**Y//C'7DK$$	8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8	"	"	":%%!DNNNN	"s#BABBBB32B3c@|j|jsdS	|j|jn#t
$rYnwxYw	|j|j|jn#t
$rYnwxYw|j	|jdd5}|
|j|jD]5\}}|dd|d}|
|6	ddddS#1swxYwYdS)Nr!rr, 
)rr*r
unlinkrr#renamerr$rr&itemsdecodewrite)rr(r0r1entrys     r_commitz_Database._commitqs;dnF	HOODM****			D		HOODM4=9999			D	X]]4=#	]
B
B	aKK
&&&)-):):)<)<

%%'*jj&;&;&;&;=M=M=MN	
																		s12
??%A))
A65A6A*DDDc2|jtddSN"DBM object has already been closed)rrrs r_verify_openz_Database._verify_opens!;<===rcZt|tr|d}||j|\}}tj|jd5}|||	|}dddn#1swxYwY|S)Nutf-8rb)

isinstancestrr.r@rr$rrseekread)rr0possizr(dats      r__getitem__z_Database.__getitem__sc3	&**W%%C;s#S
XdmT
*
*	a
FF3KKK&&++C															
s)+B  B$'B$ctj|jd5}|ddt	|}|tzdz
tztz}|d||z
z|}||dddn#1swxYwY|t|fS)Nrb+r)	r$rrrFinttell
_BLOCKSIZEr9len)rvalr(rHnposs     r_addvalz_Database._addvals
XdmU
+
+	q
FF1aLLLaffhh--C:%)j8JFD
GGE48$%%%C
GGCLLL
															SXXsBB..B25B2ctj|jd5}||||dddn#1swxYwY|t|fS)NrM)r$rrrFr9rT)rrHrUr(s    r_setvalz_Database._setvals
XdmU
+
+	q
FF3KKK
GGCLLL															SXXs+AAAc||j|<tj|jdd5}||j||dd|dddddS#1swxYwYdS)Narrr3r4)rr$rrr&r9r8)rr0r1r(s    r_addkeyz_Database._addkeys+C
XdmS9
=
=
=	LKK
&&&
GG#**Y"7"7"7"79I9I9IJKKK	L	L	L	L	L	L	L	L	L	L	L	L	L	L	L	L	L	LsA	A==BBc<|jrtdt|tr|d}n+t|t
tfstdt|tr|d}n+t|t
tfstd|d|_	||j
vr+||||dS|j
|\}}|tzdz
tz}t|tzdz
tz}||kr ||||j
|<dS|||j
|<dS)N'The database is opened for reading onlyrBzkeys must be bytes or stringszvalues must be bytes or stringsTrO)r
rrDrEr.bytes	bytearray	TypeErrorr@r*rr\rWrSrTrY)rr0rUrHrI	oldblocks	newblockss       r__setitem__z_Database.__setitem__s>	CABBBc3	=**W%%CCC%!344	=;<<<c3	?**W%%CCC%!344	?=>>>dk!!LLdll3//00000{3'HCz)A-*<ISJ.2zAII%%#'<<S#9#9C   
$(<<#4#4C   rc|jrtdt|tr|d}|d|_|j|=|dS)Nr^rBT)	r
rrDrEr.r@r*rr;rr0s  r__delitem__z_Database.__delitem__su>	CABBBc3	&**W%%CK
	
rch	t|jS#t$rtddwxYwr=)listrrarr?s rkeysz_Database.keysH	H$$$	H	H	H<==4G	H1cvfdjDS)Nc$g|]}||f
Sro).0r0rs  r
<listcomp>z#_Database.items.<locals>.<listcomp>s"???Sd3i ???r)r@rrjr?s`rr7z_Database.itemss=????DK,<,<,>,>????rct|tr|d}	||jvS#t$r|jtddwxYw)NrBr>)rDrEr.rrarrfs  r__contains__z_Database.__contains__snc3	&**W%%C	$+%%			{"@AAtK		s	5#Ach	t|jS#t$rtddwxYwr=)iterrrarr?s riterkeysz_Database.iterkeysrkrlch	t|jS#t$rtddwxYwr=)rTrrarr?s r__len__z_Database.__len__sH	Ht{###	H	H	H<==4G	Hrlc	|dx|_x|_x|_|_dS#dx|_x|_x|_|_wxYwN)r;rrrrr?s rr%z_Database.closes]	OLLNNNJNNDKN$-N$-$---$NDKN$-N$-$-NNNNs	4AcF|j||jdSrz)r
chmodr)rfiles  rr&z_Database._chmods tTZ(((((rc|Srzror?s r	__enter__z_Database.__enter__src.|dSrz)r%)rargss  r__exit__z_Database.__exit__s

rN)r)__name__
__module____qualname__r
r$rrrr;syncr@rKrWrYr\rdrgrjr7rsrv__iter__rxr%__del__r&rrrorrrr#syC

C4&888(2D>>>LLL555J


HHH@@@			HHH
HHHHOOOG)))rrrc	tjd}tj|||z}n#t$rYnwxYw|dvrtdt	|||S)aEOpen the database file, filename, and return corresponding object.

    The flag argument, used to control how the database is opened in the
    other DBM implementations, supports only the semantics of 'c' and 'n'
    values.  Other values will default to the semantics of 'c' value:
    the database will always opened for update and will be created if it
    does not exist.

    The optional mode argument is the UNIX mode of the file, used only when
    the database has to be created.  It defaults to octal code 0o666 (and
    will be modified by the prevailing umask).

    r)r	r!rrz)Flag must be one of 'r', 'w', 'c', or 'n')r)r
umaskAttributeError
ValueErrorr)r}rrums    rrr#s 
Yq\\	"


s|	



'''DEEET4d++++s(1
>>)rr)__doc__astr,ior$osr
collections.abccollections__all__rSr#rabcMutableMappingrrrorr<module>rs.F


}}}}}.}}}@,,,,,,r