Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/maxminddb/__pycache__/file.cpython-311.pyc



]jijdZddlZddlmZ	ddlmZn#e$r	ddlmZYnwxYwGddZdS)z<For internal use only. It provides a slice-like file reader.N)Union)LockceZdZdZdeddfdZdeeeffdZ	de
d	edefd
ZdefdZddZ
eed
rdedede
fdZdSdedede
fdZdS)
FileBufferzA slice-able file readerdatabasereturnNct|d|_tj|jj|_ttdst|_	dSdS)Nrbpread)
open_handleosfstatfilenost_size_sizehasattrr_lock)selfrs  n/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/maxminddb/file.py__init__zFileBuffer.__init__s`Hd++Xdl113344<
r7##	 DJJJ	 	 keyct|tr(||j|jz
|jSt|t
r|d|dSt
d)NrzInvalid argument type.)
isinstanceslice_readstopstartint	TypeError)rrs  r__getitem__zFileBuffer.__getitem__smc5!!	?::ch2CI>>>c3	)::a%%a((0111rneedler c||j|z
dz
||}|dkr|S||zS)zReverse find needle from startr)rrrfind)rr$r poss    rr'zFileBuffer.rfindsGjje+a/77==fEE"99Js{rc|jS)zSize of file)rrs rsizezFileBuffer.size%s
zrc8|jdS)z
Close fileN)r
closer*s rr-zFileBuffer.close)srr
buffersizeoffsetc\tj|j||S)zread that uses pread)rrr
rrr.r/s   rrzFileBuffer._read/s&8DL//11:vFFFrc|j5|j||j|cdddS#1swxYwYdS)aread with a lock

            This lock is necessary as after a fork, the different processes
            will share the same file table entry, even if we dup the fd, and
            as such the same offsets. There does not appear to be a way to
            duplicate the file table entry and we cannot re-open based on the
            original path as that file may have replaced with another or
            unlinked.
            N)rr
seekreadr1s   rrzFileBuffer._read6s
5
5!!&)))|((44
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5s4A		A
A
)rN)__name__
__module____qualname____doc__strrrrr!r#bytesr'r+r-rrrrrrr
s3""      2uUCZ02222E##cwr75	GC	G	G	G	G	G	G	G	G	5C	5	5	5	5	5	5	5	5rr)	r8rtypingrmultiprocessingrImportError	threadingrr;rr<module>r@sBB				$$$$$$$55555555555555555555s##
Back to Directory File Manager