intellecton/venv/lib/python3.12/site-packages/smmap/__pycache__/util.cpython-312.pyc

54 lines
10 KiB
Text
Raw Normal View History

<EFBFBD>
J<>j4<00><00><><00>dZddlZddlZddlmZmZddlmZgd<05>Zd<06>Zd<07>ZGd<08>d <09>Z Gd
<EFBFBD>d <0B>Z
Gd <0C>d e <0B>Z y)zlModule containing a memory memory manager which provides a sliding window on a number of memory mapped files<65>N)<02>mmap<61> ACCESS_READ<41><01>ALLOCATIONGRANULARITY)<06> align_to_mmap<61> is_64_bit<69> MapWindow<6F> MapRegion<6F> MapRegionListrc<00>F<00>|tztz}|r||k7r |tz }|S)a=
Align the given integer number to the closest page offset, which usually is 4096 bytes.
:param round_up: if True, the next higher multiple of page size is used, otherwise
the lower page_size will be used (i.e. if True, 1 becomes 4096, otherwise it becomes 0)
:return: num rounded to closest pager)<03>num<75>round_up<75>ress <20>M/home/antigravity/intellecton/venv/lib/python3.12/site-packages/smmap/util.pyrrs.<00><00> <0F>'<27> '<27>+@<40>
@<40>C<EFBFBD><0F>S<EFBFBD>C<EFBFBD>Z<EFBFBD> <0B>$<24>$<24><03> <0E>J<EFBFBD>c<00>(<00>tjdkDS)zO:return: True if the system is 64 bit. Otherwise it can be assumed to be 32 bitl<00><EFBFBD>)<02>sys<79>maxsize<7A>rrrrs<00><00> <0E>;<3B>;<3B><1D> &<26>&rc<00>H<00>eZdZdZdZd<03>Zd<04>Zed<05><00>Zd<06>Z d<07>Z
d<08>Z d <09>Z y
) r zWUtility type which is used to snap windows towards each other, and to adjust their size<7A><02>ofs<66>sizec<00> <00>||_||_y<00>Nr)<03>self<6C>offsetrs r<00>__init__zMapWindow.__init__-s<00><00><19><04><08><18><04> rc<00>8<00>d|j|jfzS)NzMapWindow(%i, %i)r<00>rs r<00>__repr__zMapWindow.__repr__1s<00><00>"<22>d<EFBFBD>h<EFBFBD>h<EFBFBD><04> <09> <09>%:<3A>:<3A>:rc<00>D<00>||j|j<00><00>S)z!:return: new window from a region<6F><02>_br)<02>cls<6C>regions r<00> from_regionzMapWindow.from_region4s<00><00><13>6<EFBFBD>9<EFBFBD>9<EFBFBD>f<EFBFBD>k<EFBFBD>k<EFBFBD>m<EFBFBD>,<2C>,rc<00>4<00>|j|jzSrrr s r<00>ofs_endzMapWindow.ofs_end9s<00><00><13>x<EFBFBD>x<EFBFBD>$<24>)<29>)<29>#<23>#rc<00><><00>t|jd<01>}|xj|j|z
z c_||_t|jd<02>|_y)z<Assures the previous window area is contained in the new oner<00>N)rrr)r<00>nofss r<00>alignzMapWindow.align<sA<00><00><1C>T<EFBFBD>X<EFBFBD>X<EFBFBD>q<EFBFBD>)<29><04> <0C> <09> <09>T<EFBFBD>X<EFBFBD>X<EFBFBD><04>_<EFBFBD>$<24> <09><17><04><08>!<21>$<24>)<29>)<29>Q<EFBFBD>/<2F><04> rc<00><><00>|j|j<00>z
}||jz}||t||<02>z
z}|xj|zc_|xj|z c_y)z<>Adjust the offset to start where the given window on our left ends if possible,
but don't make yourself larger than max_size.
The resize will assure that the new window still contains the old window areaN)rr)r<00>min)r<00>window<6F>max_size<7A>rofs<66>nsizes r<00>extend_left_tozMapWindow.extend_left_toCsY<00><00><14>x<EFBFBD>x<EFBFBD>&<26>.<2E>.<2E>*<2A>*<2A><04><14>t<EFBFBD>y<EFBFBD>y<EFBFBD> <20><05> <0C><05><03>E<EFBFBD>8<EFBFBD>,<2C>,<2C>,<2C><04> <0C><08><08>D<EFBFBD><18><08> <0C> <09> <09>T<EFBFBD><19> rc<00>v<00>t|j|j|j<00>z
z|<02>|_y)zpAdjust the size to make our window end where the right window begins, but don't
get larger than max_sizeN)r/rrr))rr0r1s r<00>extend_right_tozMapWindow.extend_right_toMs*<00><00><18><04> <09> <09>V<EFBFBD>Z<EFBFBD>Z<EFBFBD>$<24>,<2C>,<2C>.<2E>%@<40>A<>8<EFBFBD>L<><04> rN) <0A>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__<5F> __slots__rr!<00> classmethodr'r)r-r4r6rrrr r %s?<00><00>a<><06>I<EFBFBD>
<19>;<3B><11>-<2D><11>-<2D>$<24>0<><1A>Mrr c<00>^<00>eZdZdZgd<02>Zdd<03>Zd<04>Zd<05>Zd<06>Zd<07>Z d<08>Z
d <09>Z d
<EFBFBD>Z d <0B>Z dd <0C>Zd <0A>Zy)r
z{Defines a mapped region of memory, aligned to pagesizes
**Note:** deallocates used region automatically on destruction)r$<00>_mf<6D>_uc<75>_size<7A> __weakref__c <00>d<00>||_d|_d|_t|t<00>r|}n9t j |t
jtt
dd<01>z|z<00>} tt|<02><03>}|}|}tt j|<05>j|z
|<07>} t|| fi|<06><01>|_t!|j<00>|_t|t"<00>rt j$|<05> |j'<00>y#t|t"<00>rt j$|<05>wwxYw)a<>Initialize a region, allocate the memory map
:param path_or_fd: path to the file to map, or the opened file descriptor
:param ofs: **aligned** offset into the file to be mapped
:param size: if size is larger then the file on disk, the whole file will be
allocated the the size automatically adjusted
:param flags: additional flags to be given when opening the file.
:raise Exception: if no memory can be allocatedr<00>O_BINARY)<02>accessrN)r$r@r?<00>
isinstance<EFBFBD>int<6E>os<6F>open<65>O_RDONLY<4C>getattr<74>dictrr/<00>fstat<61>st_sizerr><00>len<65>str<74>close<73>increment_client_count)
r<00>
path_or_fdrr<00>flags<67>fd<66>kwargs<67>corrected_size<7A>sizeofs<66> actual_sizes
rrzMapRegion.__init__cs<><00><00><16><04><07><16><04>
<EFBFBD><14><04><08> <15>j<EFBFBD>#<23> &<26><1B>B<EFBFBD><13><17><17><1A>R<EFBFBD>[<5B>[<5B>7<EFBFBD>2<EFBFBD>z<EFBFBD>1<EFBFBD>3M<33>%M<>PU<50>%U<>V<>B<EFBFBD> <1D><19><1B>S<EFBFBD>9<>F<EFBFBD>!<21>N<EFBFBD><19>G<EFBFBD>
<1E>b<EFBFBD>h<EFBFBD>h<EFBFBD>r<EFBFBD>l<EFBFBD>2<>2<>W<EFBFBD><<3C>n<EFBFBD>M<>K<EFBFBD><1B>B<EFBFBD> <0B>6<>v<EFBFBD>6<>D<EFBFBD>H<EFBFBD><1D>T<EFBFBD>X<EFBFBD>X<EFBFBD><1D>D<EFBFBD>J<EFBFBD><19>*<2A>c<EFBFBD>*<2A><12><08><08><12> <0C> <0A>#<23>#<23>%<25><> <1A>*<2A>c<EFBFBD>*<2A><12><08><08><12> <0C>+<2B>s <00>#A-D<00>(D/c<00>@<00>d|j|j<00>fzS)NzMapRegion<%i, %i>r#r s rr!zMapRegion.__repr__<5F>s<00><00>"<22>d<EFBFBD>g<EFBFBD>g<EFBFBD>t<EFBFBD>y<EFBFBD>y<EFBFBD>{<7B>%;<3B>;<3B>;rc<00><00>|jS)z':return: a buffer containing the memory<72>r>r s r<00>bufferzMapRegion.buffer<65><00> <00><00><13>x<EFBFBD>x<EFBFBD>rc<00><00>|jS)z+:return: a memory map containing the memoryr[r s r<00>mapz MapRegion.map<61>r]rc<00><00>|jS)z>:return: absolute byte offset to the first byte of the mapping)r$r s r<00> ofs_beginzMapRegion.ofs_begin<69>s <00><00><13>w<EFBFBD>w<EFBFBD>rc<00><00>|jS)z1:return: total size of the mapped region in bytes)r@r s rrzMapRegion.size<7A>s <00><00><13>z<EFBFBD>z<EFBFBD>rc<00>4<00>|j|jzS)zE:return: Absolute offset to one byte beyond the mapping into the file<6C>r$r@r s rr)zMapRegion.ofs_end<6E>s<00><00><13>w<EFBFBD>w<EFBFBD><14><1A><1A>#<23>#rc<00>d<00>|j|cxkxr|j|jzkScS)zB:return: True if the given offset can be read in our mapped regionrd<00>rrs r<00> includes_ofszMapRegion.includes_ofs<66>s)<00><00><13>w<EFBFBD>w<EFBFBD>#<23>4<><04><07><07>$<24>*<2A>*<2A> 4<>4<>4<>4<>4rc<00><00>|jS)z6:return: number of clients currently using this region)r?r s r<00> client_countzMapRegion.client_count<6E>r]rc<00><><00>|xj|z c_|jdkDsJd|jz<00><00>|j<00>dk(r|j<00>yy)z<>Adjust the usage count by the given positive or negative offset.
If usage count equals 0, we will auto-release our resources
:return: True if we released resources, False otherwise. In the latter case, we can still be used<65><64><EFBFBD><EFBFBD><EFBFBD>z<Increments must match decrements, usage counter negative: %irTF)r?ri<00>releaserfs rrQz MapRegion.increment_client_count<6E>sS<00><00> <0A><08><08>C<EFBFBD><0F><08><13>x<EFBFBD>x<EFBFBD>"<22>}<7D>g<>\<5C>_c<5F>_g<5F>_g<5F>g<>g<>}<7D> <0F> <1C> <1C> <1E>!<21> #<23> <10>L<EFBFBD>L<EFBFBD>N<EFBFBD><17>rc<00>8<00>|jj<00>y)zbRelease all resources this instance might hold. Must only be called if there usage_count() is zeroN)r>rPr s rrlzMapRegion.release<73>s<00><00> <0C><08><08><0E><0E>rN)r)r+)r7r8r9r:r;rr!r\r_rarr)rgrirQrlrrrr
r
SsG<00><00>F<01><06>I<EFBFBD>%&<26>N<<3C>
<18><18><17><1A>$<24>5<><18> <19>rr
c<00>8<00><00>eZdZdZdZ<04>fd<03>Zd<04>Zd<05>Zd<06>Z<08>xZ S)r zFList of MapRegion instances associating a path with a list of regions.<2E><02> _path_or_fd<66>
_file_sizec<00>"<00><01>t<00>|<00>|<00>Sr)<02>super<65>__new__)r%<00>path<74> __class__s <20>rrtzMapRegionList.__new__<5F>s<00><><00><14>w<EFBFBD><EFBFBD>s<EFBFBD>#<23>#rc<00> <00>||_d|_yrro)rrRs rrzMapRegionList.__init__<5F>s<00><00>%<25><04><18><1E><04>rc<00><00>|jS)z3:return: path or file descriptor we are attached to)rpr s rrRzMapRegionList.path_or_fd<66>s<00><00><13><1F><1F>rc<00>6<00>|j<00><>t|jt<00>r:t j
|j<00>j |_|jSt j|j<00>j |_|jS)z :return: size of file we manager)rqrErprOrG<00>statrMrLr s r<00> file_sizezMapRegionList.file_size<7A>sn<00><00> <0F>?<3F>?<3F> "<22><19>$<24>*<2A>*<2A>C<EFBFBD>0<>"$<24>'<27>'<27>$<24>*:<3A>*:<3A>";<3B>"C<>"C<><04><0F>
<14><EFBFBD><EFBFBD><1E>#%<25>(<28>(<28>4<EFBFBD>+;<3B>+;<3B>"<<3C>"D<>"D<><04><0F><14><EFBFBD><EFBFBD>r)
r7r8r9r:r;rtrrRr{<00> __classcell__)rvs@rr r <00>s!<00><><00>P<><06>I<EFBFBD>
$<24><1F> <20> rr ) r:rGrrrr<00>__all__rrr r
<00>listr rrr<00><module>rsL<00><01>r<> <09>
<EFBFBD>"<22>&<26> O<01><07> <0F>'<27>+M<01>+M<01>\h<19>h<19>Z<1F>D<EFBFBD>r