HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/lib/python3.5/dbm/__pycache__/dumb.cpython-35.pyc


Fa+@s}dZddlZddlZddlZddlZddgZdZ	e
ZGdddejZ
dd	d
dZdS)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')

Nerroropenic@s!eZdZeZeZdddZddZddZdd	ZeZ	d
dZ
dd
ZddZddZ
ddZddZddZddZddZddZddZeZd d!Zd"d#ZeZd$d%Zd&d'Zd(d)Zd*S)+	_DatabaseccCsc||_|dk|_|d|_|d|_|d|_d|_|j||jdS)Nrz.dirz.datz.bak)_mode	_readonly_dirfile_datfile_bakfile_index_create_update)selfZfilebasenamemodeflagr/usr/lib/python3.5/dbm/dumb.py__init__0s	


	
z_Database.__init__cCs|dkrUxF|j|j|jfD],}ytj|Wq%tk
rPYq%Xq%Wytj|jddd}WnGtk
rtj|jddd}|j|jWdQRXYnX|j	dS)NnrencodingzLatin-1w)
r
rr	_osremoveOSError_ior_chmodclose)rrfilenamefrrrr
Is
	
z_Database._createcCsi|_ytj|jddd}Wntk
rI|j|_YnfXd|_|SxK|D]C}|j}tj	|\}}|j
d}||j|<qaWWdQRXdS)NrrzLatin-1F)rrrr	rr	_modifiedrstrip_astZliteral_evalencode)rrlinekeypos_and_siz_pairrrrrZs	
	
z_Database._updatecCs|jdks|jrdSy|jj|jWntk
rHYnXy|jj|j|jWntk
rzYnX|jj	|jddd]}|j
|jxC|jjD]2\}}d|jd|f}|j
|qWWdQRXdS)NrrzLatin-1z%r, %r
)rr runlinkrrrenamer	rrritemsdecodewrite)rrr%r&entryrrr_commitls

!z_Database._commitcCs|jdkrtddS)Nz"DBM object has already been closed)rr)rrrr_verify_opensz_Database._verify_openc	Cszt|tr|jd}|j|j|\}}tj|jd#}|j||j	|}WdQRX|S)Nzutf-8rb)

isinstancestrr#r.rrrr
seekread)rr%possizrZdatrrr__getitem__s

z_Database.__getitem__cCstj|jdg}|jddt|j}|tdtt}|jd|||}|j|WdQRX|t|fS)Nzrb+rs)	rrr
r2inttell
_BLOCKSIZEr+len)rvalrr4Znposrrr_addvalsz_Database._addvalc
CsItj|jd!}|j||j|WdQRX|t|fS)Nzrb+)rrr
r2r+r<)rr4r=rrrr_setvals
z_Database._setvalcCsf||j|<tj|jddd7}|j|j|jd|jd|fWdQRXdS)NarzLatin-1z%r, %r
)rrrr	rr+r*)rr%r&rrrr_addkeys
z_Database._addkeycCsAt|tr!|jd}n!t|ttfsBtdt|trc|jd}n!t|ttfstd|jd|_||jkr|j	||j
|n{|j|\}}|tdt}t|tdt}||kr'|j
|||j|<n|j
||j|<dS)Nzutf-8zkeys must be bytes or stringszvalues must be bytes or stringsTr8)r0r1r#bytes	bytearray	TypeErrorr.r rrAr>r;r<r?)rr%r=r4r5Z	oldblocksZ	newblocksrrr__setitem__s$
	z_Database.__setitem__cCsIt|tr|jd}|jd|_|j|=|jdS)Nzutf-8T)r0r1r#r.r rr-)rr%rrr__delitem__s
	
z_Database.__delitem__cCs9yt|jSWn!tk
r4tddYnXdS)Nz"DBM object has already been closed)listrrDr)rrrrkeyss
z_Database.keyscs*jfddjjDS)Ncs g|]}||fqSrr).0r%)rrr
<listcomp>s	z#_Database.items.<locals>.<listcomp>)r.rrH)rr)rrr)s
z_Database.itemscCslt|tr|jd}y||jkSWn6tk
rg|jdkr`tddnYnXdS)Nzutf-8z"DBM object has already been closed)r0r1r#rrDr)rr%rrr__contains__s
z_Database.__contains__cCs9yt|jSWn!tk
r4tddYnXdS)Nz"DBM object has already been closed)iterrrDr)rrrriterkeyss
z_Database.iterkeyscCs9yt|jSWn!tk
r4tddYnXdS)Nz"DBM object has already been closed)r<rrDr)rrrr__len__s
z_Database.__len__cCs4z|jWdd|_|_|_|_XdS)N)r-rr
r	r)rrrrrsz_Database.closecCs,t|jdr(|jj||jdS)Nchmod)hasattrrrOr)rfilerrrrsz_Database._chmodcCs|S)Nr)rrrr	__enter__sz_Database.__enter__cGs|jdS)N)r)rargsrrr__exit__sz_Database.__exit__N)__name__
__module____qualname__rrrr
rr-syncr.r6r>r?rArErFrHr)rKrM__iter__rNr__del__rrRrTrrrrr#s2
	#
rric
CsSy tjd}tj|Wntk
r4YnX||@}t||d|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).

    rr)rumaskAttributeErrorr)rQrrZumrrrrs
)__doc__Zastr"iorosrcollections__all__r;rrMutableMappingrrrrrr<module>s