403Webshell
Server IP : 74.208.236.52  /  Your IP : 216.73.217.98
Web Server : Apache
System : Linux infong527 4.4.400-icpu-115 #2 SMP Mon Jul 6 08:15:05 UTC 2026 x86_64
User : u44043973 ( 5404757)
PHP Version : 8.4.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/mercurial/__pycache__/util.cpython-313.pyc
�

6�h�����%SrSSKJr SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSK
r
SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJrJrJrJrJrJrJrJrJ r J!r! SSK"J#r# SSK$J%r% \RL(aSSK%r%SSK'J(r( SS	K)J*r*J+r+J,r,J-r-J.r.J/r/J0r0 SS
K1J2r3J4r5 SSK6J7r7J8r8J9r9J:r: \\\\\/(de\RL(a
SSK;J<r< \!"S
SS9r=\-R|"S5r?S\@S'\-R|"S5rA\?R�rB\?R�rC\.R�rD\.R�rE\.R�rF\.R�rG\	R�rI\IrJ\.R�rK\0R�rL\0R�rM\0R�rN\.R�rP\.R�(aSSK)JRrS OSSK)JTrS \,R�rU\SR�rV\SR�rW\SR�rX\SR�rY\SR�rZ\SR�r[\SR�r\\SR�r]\SR�r^\SR�r_\SR�r`\SR�ra\SR�rb\SR�rc\AR�rd\SR�re\SR�rf\SR�rg\SR�rh\SR�ri\SR�rj\SR�rk\SR�rl\SR�rm\SR�rn\SR�ro\SR�rp\SR�rq\SR�rr\SR�rs\SR�rt\SR�ru\SR�rv\SR�rw\SR�rx\SR�ry\SR�rz\{"\AS\SR�5r|\SR�r}\SR�r~\SR�q\SGRr�\SGRr�\RL(a\!"SSS9r�S�Sjr�\7GRr�\7GR
r�\7GRr�\�"5r�Sr�\�"\*GRGRS55r�\�(aB\GR"SS\�S5 \GR"SS\�S5 \GR"SS\�S5 \�(aB\GR"S S!\�S5 \GR"S S"\�S5 \GR"S S#\�S5 S�S$jr�\GR"\8GR$\GR&S%.r�/S&Qr�\�Hr�\�\�;aMe "S'S(5r�"S)S*5r�\�r�S,r�"S-S.5r�S/r�S�S0jr�"S1S25r�"S3S45r�"S5S6\�5r�1S7kr�"S8S95r�"S:S;5r�"S<S=\�5r�S�S?jr�"S@SA\�5r�S�SBjr�SCr�S�SDjr�SEr�"SFS5r�"SGSH\GRZ5r�"SISJ\�\�5r�"SKSL\�\�5r�"SMSN\GRd5r�\GRhS�SOj5r�\GRhS�SPj5r�"SQSR5r�"SSST5r�SUr�"SVSW5r�SXr�S�SZjr�S[r�S\r�S�S�S]jjr�\GRhS^5r�S_r�\.GR�(aS`r�S�Sajr�S�Sbjr�1Sckr�S�Sdjr�S�Sejr�1Sfkr�Sgr�S�Shjr�\{"\SiS5r�\.R�(a\�r�\�(d
\GR�r�O \SGR�r�\�(d\R(r�S�Sjjr�S�Skjr�Slr�S�Smjr�Snq�Sq�SSK�r�Sq�Sor�"SpSq5r�\�"5r0r�S�Srjr�S�Ssjr�S�Stjr�S�Sujr�S�S�Svjjr�"SwS5r�"SxSy5r�Szr�S�S�S{jjr�S�S|jr�S�S�S}jjr�S�S~jr�S�Sjr�S�S�jr�"S�S�5r�S�r�\�S4S�jr�"S�S�5r�S�r�S�S�jr�\�"S�S�\U"S�54S�S�\U"S�54SS�\U"S�54S�S�\U"S�54S�S�\U"S�54SS�\U"S�54S�SY\U"S�54S�SY\U"S�54SSY\U"S�54SS\U"S�545
r�"S�S�\/GR�5r�\GR�"S�5r�S�S�jr�S�S�jr�S�S�jr�\.GR�S�:Xa\�r�\�r�\�r�O'\.GR�r�\.GR�r�\.GR�r�\RL(aS�S�jr�S�S�jr�S�S�jr�S�r�S�S�jr�S�S�jr�S�S�jr�\�"SS�\U"S�54S�S\U"S�54S�S\U"S�54SS\U"S�54S�S�\U"S�54S�S�\U"S�54SS�\U"S�54S�S�\U"S�54S�S�\U"S�54SS�\U"S�54S�S�\U"S�54S�S�\U"S�54SS�\U"S�545
r�\%GR"S�S�55Gr\GRhS�5GrSG\GlS�GrS�GrS�S�jGr"S�S�\3GR5GrS�S�jGr	S�S\9GR\9GRSS�4S�jGrG\Gr
S�S�jGrS�GrS�GrS�Gr\GRhS�5GrS�S�jGrg!\�a	 S�S+jr�GN�f=f!\�a S>q�GNf=f)�z�Mercurial utility functions and platform specific implementations.

This contains helper routines that are independent of the SCM core and
hide platform-specific details from the core.
�)�annotationsN)
�Any�BinaryIO�Callable�Iterable�Iterator�List�Optional�Tuple�Type�TypeVar�)�hex)�attr)�tracing)�encoding�error�i18n�policy�pycompat�typelib�urllibcompat)�misc�modules)�compression�hashutil�procutil�
stringutil)�Self�_Tcow�cow)�bound�base85z
intmod.Base85�osutil)�windows)�posix�	statfiles�
_Tfilestat�filestatc�|�[R(ag[R"U5 US-=[lqg)z%updates the umask. used by chg serverNi�)r�	iswindows�os�umask�platform)�vals �0/usr/lib/python3/dist-packages/mercurial/util.py�setumaskr1�s)�������H�H�S�M� �5�[�(�H�N�U�c�$�SnUHnX-nM	 U$�Nr�)�	container�bits�bits   r0�bitsfromr9�s���D��������Kr2sHGEMITWARNINGS�default��	mercurial�hgext�hgext3rd�ignorez
bad escapezinvalid escape sequencezthe imp module is deprecatedc���[(aZUSU--
n[R"[R"U5[
US-5 [RR5 gg)zpIssue an python native deprecation warning

This is a noop outside of tests, use 'ui.deprecwarn' when possible.
sF
(compatibility will be dropped after Mercurial-%s, update your code.)rN)	�_dowarn�warnings�warnr�sysstr�DeprecationWarning�sys�stderr�flush)�msg�version�
stacklevels   r0�nouideprecwarnrL�sU��
�w��
#���	��	�
�
�h�o�o�c�*�,>�
�Q��O��
�
����r2)�md5�sha1�sha512)rOrNrMc�D�\rSrSrSrS
SjrSrSrSr\	S5r
Srg	)�digesteriafhelper to compute digests.

This helper can be used to compute one or more digests given their name.

>>> d = digester([b'md5', b'sha1'])
>>> d.update(b'foo')
>>> [k for k in sorted(d)]
['md5', 'sha1']
>>> d[b'md5']
'acbd18db4cc2f85cedef654fccc4a4d8'
>>> d[b'sha1']
'0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
>>> digester.preferred([b'md5', b'sha1'])
'sha1'
c���0UlUHJnU[;a"[R"[	S5U-5e[U"5URU'ML U(aURU5 gg�Nsunknown digest type: %s)�_hashes�DIGESTSr�Abort�_�update)�self�digests�s�ks    r0�__init__�digester.__init__s]������A�����k�k�!�$>�"?�!�"C�D�D�%�a�j�l�D�L�L��O��
��K�K��N�
r2c�h�URR5HnURU5 M g�N)rT�valuesrX)rY�data�hs   r0rX�digester.updates$�����$�$�&�A�
�H�H�T�N�'r2c��U[;a&[R"[S5[-5e[URUR55$rS)rUrrVrWr\rrT�digest)rY�keys  r0�__getitem__�digester.__getitem__#sA���g���+�+�a� :�;�a�?�@�@��4�<�<��$�+�+�-�.�.r2c�,�[UR5$r`)�iterrT�rYs r0�__iter__�digester.__iter__(s���D�L�L�!�!r2c�0�[HnX;dM
Us $ g)z@returns the strongest digest type in both supported and DIGESTS.N)�DIGESTS_BY_STRENGTH)�	supportedr\s  r0�	preferred�digester.preferred+s��%�A��~���%�r2)rTN)r2)�__name__�
__module__�__qualname__�__firstlineno__�__doc__r]rXrhrm�staticmethodrr�__static_attributes__r5r2r0rQrQs/��� ��/�
"����r2rQc�.�\rSrSrSrSrSSjrSrSrg)	�
digestcheckeri5z�file handle wrapper that additionally checks content against a given
size and digests.

    d = digestchecker(fh, size, {'md5': '...'})

When multiple digests are given, all of them are validated.
c��XlX lSUl[U5Ul[URR
55Ulgr4)�_fh�_size�_got�dict�_digestsrQ�keys�	_digester)rY�fh�sizerZs    r0r]�digestchecker.__init__>s7�����
���	��W�
��
�!�$�-�-�"4�"4�"6�7��r2c��URRU5nURRU5 U=R[U5-
slU$r`)r~�readr�rXr��len)rY�length�contents   r0r��digestchecker.readEs=���(�(�-�-��'�������g�&��	�	�S��\�!�	��r2c�t�URUR:wa8[R"[	S5URUR4-5eUR
R
5HHupX RU:wdM[R"[	S5XURU4-5e g)Ns"size mismatch: expected %d, got %ds %s mismatch: expected %s, got %s)rr�rrVrWr��itemsr��rYr\�vs   r0�validate�digestchecker.validateKs����:�:����"��+�+��7�8��:�:�t�y�y�)�*��
��M�M�'�'�)�D�A��N�N�1�%�%��k�k��9�:��T�^�^�A�.�/�0���*r2)r�r�r~r�rN����)	rtrurvrwrxr]r�r�rzr5r2r0r|r|5s���8��r2r|c��Ub [U5XU-nUR5$[U5USnUR5$r`)�
memoryview�
toreadonly)�	sliceable�offsetr��views    r0�bufferr�^sJ�����i�(��6�/�B�D���� � ��i�(���1�D���� � r2ic�^�\rSrSrSrU4SjrSr\S5r\S5r	Sr
SrS	rS
r
SrSr\4S
jrSrU=r$)�bufferedinputpipeiia3a manually buffered input pipe

Python will not let us use buffered IO and lazy reading with 'polling' at
the same time. We cannot probe the buffer state and select will not detect
that data are ready to read if they are already buffered.

This class let us work around that by implementing its own buffering
(allowing efficient readline) while offering a way to know if the buffer is
empty from the output (allowing collaboration of the buffer with polling).

This class lives in the 'util' module because it makes use of the 'os'
module from the python stdlib.
c�X>�[U[5(a[n[TU]U5$r`)�
isinstance�fileobjectproxy�observedbufferedinputpipe�super�__new__)�clsr��	__class__s  �r0r��bufferedinputpipe.__new__xs&����b�/�*�*�+�C��w��s�#�#r2c�:�Xl/UlSUlSUlg)NFr)�_input�_buffer�_eof�_lenbuf)rY�inputs  r0r]�bufferedinputpipe.__init__�s���������	���r2c�,�[UR5$)z�True is any data is currently buffered

This will be used externally a pre-step for polling IO. If there is
already data then no polling should be set in place.)�boolr�rls r0�	hasbuffer�bufferedinputpipe.hasbuffer�s���D�L�L�!�!r2c�.�URR$r`)r��closedrls r0r��bufferedinputpipe.closed�s���{�{�!�!�!r2c�6�URR5$r`)r��filenorls r0r��bufferedinputpipe.fileno�s���{�{�!�!�#�#r2c�6�URR5$r`)r��closerls r0r��bufferedinputpipe.close�s���{�{� � �"�"r2c���UR(dCURU:a3UR5 UR(dURU:aM3URU5$r`)r�r��_fillbuffer�_frombuffer�rYr�s  r0r��bufferedinputpipe.read�sE���9�9�4�<�<�$�#6������9�9�4�<�<�$�#6�����%�%r2c���UR(d/URS:XaUR[U[55 UR[
URU55$r4)r�r�r��max�
_chunksizer��minr�s  r0�unbufferedread� bufferedinputpipe.unbufferedread�sE���y�y�T�\�\�Q�.����S��z�2�3�����D�L�L�$� 7�8�8r2c���[UR5S:�a>SRUR5/Ul[URS5UlSnUR(aURSR	S5nUR
(d^US:aXUR
5 UR(aURSR	S5nUR
(dUS:aMXUS-nUS:a
URnO@[UR5S:�a'X@R[URS5-
-
nURU5$)Nrr2rr��
)r�r��joinr��findr�r�r�)rY�args�kwargs�lfir�s     r0�readline�bufferedinputpipe.readline�s	���t�|�|��q� � �H�H�T�\�\�2�3�D�L��t�|�|�A��/�D�L����<�<��,�,�r�"�'�'��.�C��9�9�#��'������|�|��l�l�2�&�+�+�E�2���9�9�#��'��Q�w����7��<�<�D�
����
��
"��L�L�3�t�|�|�B�'7�#8�8�8�D�����%�%r2c�@�US:XdUR(dgURSn[UR5S:�aSRUR5nUSUnU[U5SnU(aU/Ul[U5UlU$/UlSUlU$)zQreturn at most 'size' data from the buffer

The data are removed from the buffer.rr2rN)r�r�r�r�)rYr��bufrbs    r0r��bufferedinputpipe._frombuffer�s����1�9�D�L�L���l�l�1�o���t�|�|��q� ��(�(�4�<�<�(�C��5�D�z���#�d�)�+�����5�D�L��s�8�D�L����D�L��D�L��r2c��[R"URR5U5nU(d	SUlU$U=R
[
U5-
slURRU5 U$)zread data to the bufferT)	r,r�r�r�r�r�r�r��append)rYr�rbs   r0r��bufferedinputpipe._fillbuffer�s[���w�w�t�{�{�)�)�+�T�2����D�I�
��
�L�L�C��I�%�L��L�L����%��r2)r�r�r�r�)rtrurvrwrxr�r]�propertyr�r�r�r�r�r�r�r�r�r�rz�
__classcell__�r�s@r0r�r�isg����$���"��"��"��"�$�#�&�
9�
&�*�( *�	�	r2r�c�P�[[S5=(d [[S5$)N�background_mmap_populate�MAP_POPULATE)�hasattrr$�mmapr5r2r0�has_mmap_populater��s#���6�5�6��'��n�;�r2c�^^^^�US:XagUcSn[TSU4Sj5"5n[R(aSnOL[Rm[[S5mT(aT(dT[[SS5-mS	UUU4SjjnU"X15$![a( [R"U5RS:Xagef=f)
a�Read a file content using mmap

The responsibility of checking the file system is mmap safe is the
responsibility of the caller (see `vfs.is_mmap_safe`).

In some case, a normal string might be returned.

If `pre_populate` is True (the default), the mmapped data will be
pre-populated in memory if the system support this option, this slow down
the initial mmapping but avoid potentially crippling page fault on later
access. If this is not the desired behavior, set `pre_populate` to False.
rr2r�c�>�T$r`r5��fps�r0�<lambda>�mmapread.<locals>.<lambda>�s���rr2c�H�[R"X[RS9$)N)�access)r��ACCESS_READ)�fdr�s  r0r�r��s�����2�D�<L�<L�!Mr2r�r�c�>�[R"XT[RS9nT(aT(a[RU5 U$)N)�flags�prot)r��	PROT_READr$r�)r�r��m�bg_populater��pre_populates   ���r0�_mmap�mmapread.<locals>._mmap�s1����	�	�"�%�d�n�n�E�A����/�/��2��Hr2)�returnz	mmap.mmap)�getattrrr+r��MAP_PRIVATEr�r$�
ValueErrorr,�fstat�st_size)r�r�r�r�r�r�r�s` `  @@r0�mmapreadr��s�����q�y��	
����	��X�z�	*�	,�B����M��� � ���f�&@�A�����W�T�>�1�5�5�E�	�	���R�������8�8�B�<���1�$��
��s�
B�.C�Cc�4�\rSrSr%S\S'SSjrS	SjrSrg)
�uncacheable_cachestati�Optional[os.stat_result]�statc��SUlgr`�r�rls r0r]�uncacheable_cachestat.__init__s	����	r2c��g�NFr5rls r0�	cacheable�uncacheable_cachestat.cacheables��r2r�N�r��None�r�r�)rtrurvrw�__annotations__r]rrzr5r2r0r�r�s��
"�"��r2r�c��\rSrSrSrSrSrSrSr\r	Sr
SrS	rS
r
SrSrS
rSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSr Sr!g) r�iz�A proxy around file objects that tells a watcher when events occur.

This type is intended to only be used for testing purposes. Think hard
before using it in important code.
��_orig�	_observerc�`�[RUSU5 [RUSU5 g�Nr
r��object�__setattr__)rYr��observers   r0r]�fileobjectproxy.__init__!s&�����4��"�-����4��h�7r2c�~�1SknX;a[RX5$[[RUS5U5$)N>r��seek�tellr�rH�read1�write�detachr��isatty�readall�readable�readintor��seekable�truncate�writabler�	readlines�
writelinesr
�r�__getattribute__r�)rY�name�ourss   r0r#� fileobjectproxy.__getattribute__%s<��
��@�<��*�*�4�6�6��v�.�.�t�W�=�t�D�Dr2c�@�[[RUS55$�Nr
�r�rr#rls r0�__nonzero__�fileobjectproxy.__nonzero__K����F�+�+�D�'�:�;�;r2c�B�[[RUS5U5$r(��delattrrr#�rYr$s  r0�__delattr__�fileobjectproxy.__delattr__P����v�.�.�t�W�=�t�D�Dr2c�B�[[RUS5X5$r(��setattrrr#�rYr$�values   r0r�fileobjectproxy.__setattr__S����v�.�.�t�W�=�t�K�Kr2c�J�[RUS5R5$r()rr#rmrls r0rm�fileobjectproxy.__iter__Vs���&�&�t�W�5�>�>�@�@r2c��[RUS5n[XA5"U0UD6n[RUS5n[XaS5nU(aU"U/UQ70UD6 U$r
r"�rYr$r�r��orig�resr�fns        r0�
_observedcall�fileobjectproxy._observedcallY�b���&�&�t�W�5���d�!�4�2�6�2���*�*�4��=��
�X�T�
*��
��s�$�T�$�V�$��
r2c�B�[RUS5"S/UQ70UD6$)NrBr��rr#�rYr�r�s   r0r��fileobjectproxy.closeg�/���&�&�t�_�=��
��
�$�
�	
r2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��fileobjectproxy.filenol�/���&�&�t�_�=��
��
�%�
�	
r2c�B�[RUS5"S/UQ70UD6$)NrBrHrFrGs   r0rH�fileobjectproxy.flushqrIr2c�B�[RUS5"S/UQ70UD6$)NrBrrFrGs   r0r�fileobjectproxy.isattyvrLr2c�B�[RUS5"S/UQ70UD6$)NrBrrFrGs   r0r�fileobjectproxy.readable{�/���&�&�t�_�=��
��
�!'�
�	
r2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��fileobjectproxy.readline�rSr2c�B�[RUS5"S/UQ70UD6$)NrBr rFrGs   r0r �fileobjectproxy.readlines��/���&�&�t�_�=��
��
�"(�
�	
r2c�B�[RUS5"S/UQ70UD6$)NrBrrFrGs   r0r�fileobjectproxy.seek��/���&�&�t�_�=��
��
�#�
�	
r2c�B�[RUS5"S/UQ70UD6$)NrBrrFrGs   r0r�fileobjectproxy.seekable�rSr2c�B�[RUS5"S/UQ70UD6$)NrBrrFrGs   r0r�fileobjectproxy.tell�r[r2c�B�[RUS5"S/UQ70UD6$)NrBrrFrGs   r0r�fileobjectproxy.truncate�rSr2c�B�[RUS5"S/UQ70UD6$)NrBrrFrGs   r0r�fileobjectproxy.writable�rSr2c�B�[RUS5"S/UQ70UD6$)NrBr!rFrGs   r0r!�fileobjectproxy.writelines��/���&�&�t�_�=��
��
�#)�
�	
r2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��fileobjectproxy.read�r[r2c�B�[RUS5"S/UQ70UD6$)NrBrrFrGs   r0r�fileobjectproxy.readall��/���&�&�t�_�=��
��
� &�
�	
r2c�B�[RUS5"S/UQ70UD6$)NrBrrFrGs   r0r�fileobjectproxy.readinto�rSr2c�B�[RUS5"S/UQ70UD6$)NrBrrFrGs   r0r�fileobjectproxy.write�rIr2c�B�[RUS5"S/UQ70UD6$)NrBrrFrGs   r0r�fileobjectproxy.detach�rLr2c�B�[RUS5"S/UQ70UD6$)NrBrrFrGs   r0r�fileobjectproxy.read1�rIr2r5N)"rtrurvrwrx�	__slots__r]r#r*�__bool__r1rrmrBr�r�rHrrr�r rrrrrr!r�rrrrrrzr5r2r0r�r�s�����I�
8�$E�L<��H�E�L�A��
�

�

�

�

�

�

�

�

�

�

�

�

�

�

�

�

�

�

r2r�c�J^�\rSrSrSr\4U4SjjrU4SjrU4SjrSr	U=r
$)r�i�a�A variation of bufferedinputpipe that is aware of fileobjectproxy.

``bufferedinputpipe`` makes low-level calls to ``os.read()`` that
bypass ``fileobjectproxy``. Because of this, we need to make
``bufferedinputpipe`` aware of these operations.

This variation of ``bufferedinputpipe`` can notify observers about
``os.read()`` events. It also re-publishes other events, such as
``read()`` and ``readline()``.
c�>�[TU]US9n[URRSS5nU(aU"X!5 U$)N)r��osread)r�r�r�r�r�rYr�r@rAr�s    �r0r��%observedbufferedinputpipe._fillbuffer�s<����g�!�t�!�,��
�T�[�[�*�*�H�d�
;��
��s�M��
r2c�>�[TU]U5n[URRSS5nU(aU"X!5 U$)N�bufferedread)r�r�r�r�rrys    �r0r��observedbufferedinputpipe.read�s8����g�l�4� ��
�T�[�[�*�*�N�D�
A��
��s�M��
r2c�>�[TU]"U0UD6n[URRSS5nU(aU"U5 U$)N�bufferedreadline)r�r�r�r�r)rYr�r�r@rAr�s     �r0r��"observedbufferedinputpipe.readline�s?����g���/��/��
�T�[�[�*�*�,>��
E��
��s�G��
r2r5)rtrurvrwrxr�r�r�r�rzr�r�s@r0r�r��s!���	� *����r2r�>�recv�send�sendto�sendall�makefile�recvfrom�	recv_into�
gettimeout�
setsockopt�
settimeout�setblocking�
recvfrom_intoc��\rSrSrSrSrSrSrSrSr	Sr
\
rS	rS
r
SrSrS
rSrSrSrSrSrSrSrSrSrg)�socketproxyiz�A proxy around a socket that tells a watcher when events occur.

This is like ``fileobjectproxy`` except for sockets.

This type is intended to only be used for testing purposes. Think hard
before using it in important code.
r	c�`�[RUSU5 [RUSU5 gr
r)rY�sockrs   r0r]�socketproxy.__init__s&�����4��$�/����4��h�7r2c��U[;a[RX5$[[RUS5U5$r()�PROXIED_SOCKET_METHODSrr#r�r0s  r0r#�socketproxy.__getattribute__s6���)�)��*�*�4�6�6��v�.�.�t�W�=�t�D�Dr2c�B�[[RUS5U5$r(r.r0s  r0r1�socketproxy.__delattr__r3r2c�B�[[RUS5X5$r(r5r7s   r0r�socketproxy.__setattr__r:r2c�@�[[RUS55$r(r)rls r0r*�socketproxy.__nonzero__r,r2c��[RUS5n[XA5"U0UD6n[RUS5n[XaS5nU(aU"U/UQ70UD6 U$r
r"r>s        r0rB�socketproxy._observedcall$rDr2c
��[RUS5"S/UQ70UD6n[RUS5n[URUURUR
URURURS9$)NrBr�r��reads�writes�logdata�logdataapis)	rr#�makeloggingfileobjectr�r$r�r�r�r�)rYr�r�r@rs     r0r��socketproxy.makefile2s~���%�%�d�O�<��
��
�!'�
���*�*�4��=��$��K�K���M�M��.�.��?�?��$�$� �,�,�
�	
r2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��socketproxy.recvDr[r2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��socketproxy.recvfromIrSr2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��socketproxy.recvfrom_intoNs/���&�&�t�_�=��
�"�
�&,�
�	
r2c�B�[RUS5"S/UQ70UD6$)NrB�	recv_inforFrGs   r0r��socketproxy.recv_intoSrXr2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��socketproxy.sendXr[r2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��socketproxy.sendall]rkr2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��socketproxy.sendtobrLr2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��socketproxy.setblockinggs/���&�&�t�_�=��
� �
�$*�
�	
r2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��socketproxy.settimeoutlrfr2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��socketproxy.gettimeoutqrfr2c�B�[RUS5"S/UQ70UD6$)NrBr�rFrGs   r0r��socketproxy.setsockoptvrfr2r5N)rtrurvrwrxrtr]r#r1rr*rurBr�r�r�r�r�r�r�r�r�r�r�r�rzr5r2r0r�r�sr����I�
8�E�E�L�<��H��
�$
�

�

�

�

�

�

�

�

�

�

r2r�c� �\rSrSrSrSrSrg)�baseproxyobserveri|c�4�XlX lX0lX@lgr`)r�r$r�r�)rYr�r$r�r�s     r0r]�baseproxyobserver.__init__}s�����	���&�r2c�6�UR(dGUR(a5URRS5 URR	5 gSU;a�UR(a3URRS[
R"U5-5 O>URRSUR[
R"U54-5 URR	5 gUR(aURRS5 URS5nUHAnURRSUR[
R"U54-5 MC URR	5 g)Nr�s: %s
s%s>     %s
s:
T)	r�r�r�rrHr�	escapestrr$�
splitlines)rYrb�lines�lines    r0�
_writedata�baseproxyobserver._writedata�s���|�|�������
�
�e�$����
�
������������
�
�i�*�*>�*>�t�*D�D�E����
�
�#�t�y�y�*�2F�2F�t�2L�&M�M��
�G�G�M�M�O������G�G�M�M�&�!�����%���D��G�G�M�M��4�9�9�j�.B�.B�4�.H�"I�I�
��	
���
�
�r2)r�r�r�r$N)rtrurvrwr]r�rzr5r2r0r�r�|s��'�r2r�c�d^�\rSrSrSrSU4SjjrS
SjrS
SjrSrSr	Sr
S	rS
rSr
U=r$)�fileobjectobserveri�zLogs file object activity.c�>>�[TU]XXV5 X0lX@lgr`)r�r]r�r�)rYr�r$r�r�r�r�r�s       �r0r]�fileobjectobserver.__init__�s���	����7�8��
��r2c��UR(dgUcSnUS:XaUS:XagUR(a4URRSURU[U54-5 UR
U5 g)Nr2r�s%s> read(%d) -> %d�r�r�r�rr$r�r��rYr@r�s   r0r��fileobjectobserver.read�sb���z�z���;��C��2�:�#��*�

�����G�G�M�M�/�4�9�9�d�C��H�2M�M�N�����r2c���UR(dgUR(a3URRSUR[U54-5 UR
U5 g)Ns%s> readline() -> %dr�)rYr@�limits   r0r��fileobjectobserver.readline�sD���z�z������G�G�M�M�1�T�Y�Y��C��4I�I�J�����r2c�2�UR(dgUR(a4URRSUR[U5U4-5 UbUSUOSn[
U[5(aUR5nURU5 g)Ns%s> readinto(%d) -> %rrr2)
r�r�r�rr$r�r�r��tobytesr�)rYr@�destrbs    r0r�fileobjectobserver.readinto�su���z�z������G�G�M�M�)�T�Y�Y��D�	�3�,G�G�
�"�o�t�A�c�{�3���d�J�'�'��<�<�>�D�����r2c��UR(dgUcU(a[U5nUR(a4URR	SUR
[U5U4-5 UR
U5 g)Ns%s> write(%d) -> %r)r�r�r�r�rr$r�)rYr@rbs   r0r�fileobjectobserver.write�sX���{�{���;�4��d�)�C�����G�G�M�M�0�D�I�I�s�4�y�#�3N�N�O�����r2c�|�UR(dgURRSURU4-5 g)Ns%s> flush() -> %r
)r�r�rr$�rYr@s  r0rH�fileobjectobserver.flush�s+���{�{�����
�
�,��	�	�3�/?�?�@r2c���UR(dgUR(a4URRSURU[U54-5 UR
U5 g)Ns%s> bufferedread(%d) -> %dr�r�s   r0r|�fileobjectobserver.bufferedread�sJ���z�z������G�G�M�M�-����D�#�c�(�0K�K�
�	
����r2c���UR(dgUR(a3URRSUR[U54-5 UR
U5 g)Ns%s> bufferedreadline() -> %dr�r�s  r0r�#fileobjectobserver.bufferedreadline�sH���z�z������G�G�M�M�/�4�9�9�c�#�h�2G�G�
�	
����r2)r�r��TTFTr�)rtrurvrwrxr]r�r�rrrHr|rrzr�r�s@r0r�r��s;���$�MQ���&��$�A�	�	�	r2r�Fc	�4�[UUUUUUS9n[X5$)z.Turn a file object into a logging file object.r�)r�r�)�loghr�r$r�r�r�r�rs        r0r�r�s-��
"�������
�H��2�(�(r2c�^�\rSrSrSrSU4SjjrSSjrSSjrSSjrSSjr	SSjr
SS	jrSS
jrSSjr
SrS
rSrSrSrU=r$)�socketobserverizLogs socket activity.c�J>�[TU]XXg5 X0lX@lXPlgr`)r�r]r�r��states)	rYr�r$r�r�r�r�r�r�s	        �r0r]�socketobserver.__init__s#���	����7�8��
����r2c�|�UR(dgURRSURX#4-5 g)Ns%s> makefile(%r, %r)
�r�r�rr$)rYr@�mode�bufsizes    r0r��socketobserver.makefile's+���{�{�����
�
�/�4�9�9�d�2L�L�Mr2c	���UR(dgUR(a4URRSURX#[U54-5 UR
U5 g)Ns%s> recv(%d, %d) -> %dr��rYr@r�r�s    r0r��socketobserver.recv-sJ���z�z������G�G�M�M�)�T�Y�Y��S��X�,N�N�
�	
����r2c
���UR(dgUR(a7URRSURX#[US54-5 UR
US5 g)Ns%s> recvfrom(%d, %d) -> %drr�r�s    r0r��socketobserver.recvfrom7sU���z�z������G�G�M�M�-��9�9�d�3�s�1�v�;�7�8�
�
	
����A��r2c���UR(dgUR(a.URRSURX4US4-5 URUSUS5 g)Ns%s> recvfrom_into(%d, %d) -> %dr�r�r�r�rr$r��rYr@r�r�r�s     r0r��socketobserver.recvfrom_intoCsW���z�z������G�G�M�M�2��9�9�d�3�q�6�2�3�
�
	
����A��A���(r2c���UR(dgUR(a+URRSURX4U4-5 URUSU5 g)Ns%s> recv_into(%d, %d) -> %drr�r�s     r0r��socketobserver.recv_intoOsL���z�z������G�G�M�M�.�$�)�)�T�#�1N�N�
�	
����A�c�
�#r2c	���UR(dgURRSUR[	U5U[	U54-5 URU5 g)Ns%s> send(%d, %d) -> %d)r�r�rr$r�r��rYr@rbr�s    r0r��socketobserver.sendZsG���{�{�����
�
�%����C��I�u�c�#�h�(O�O�	
�	
����r2c���UR(dgUR(a4URRSUR[U5U4-5 UR
U5 g)Ns%s> sendall(%d, %d)�r�r�r�rr$r�r�r�s    r0r��socketobserver.sendallcsJ���{�{������G�G�M�M�&�$�)�)�S��Y��)F�F�
�	
����r2c���UR(dgU(aUnOSnUR(a5URRSUR[U5XTU4-5 UR
U5 g)Nrs%s> sendto(%d, %d, %r) -> %dr�)rYr@rb�flagsoraddress�addressr�s      r0r��socketobserver.sendtoos\���{�{���"�E��E�����G�G�M�M�/��9�9�c�$�i���=�>�
�
	
����r2c�|�UR(dgURRSURU4-5 g)Ns%s> setblocking(%r)
r�)rYr@�flags   r0r��socketobserver.setblocking�s+���{�{�����
�
�.�$�)�)�T�1B�B�Cr2c�|�UR(dgURRSURU4-5 g)Ns%s> settimeout(%r)
r�)rYr@r8s   r0r��socketobserver.settimeout�s+���{�{�����
�
�-����E�0B�B�Cr2c�|�UR(dgURRSURU4-5 g)Ns%s> gettimeout() -> %f
r�r�s  r0r��socketobserver.gettimeout�s+���{�{�����
�
�1�T�Y�Y��4D�D�Er2c�~�UR(dgURRSURX#XA4-5 g)Ns!%s> setsockopt(%r, %r, %r) -> %r
r�)rYr@�level�optnamer8s     r0r��socketobserver.setsockopt�s2���{�{�����
�
�1��y�y�%�%�5�
6�	
r2)r�r�r��TTTFT�NN�r)rrr`)rtrurvrwrxr]r�r�r�r�r�r�r�r�r�r�r�r�rzr�r�s@r0r�r�sa���������
�N��
 �
)�	$��
��"D�D�F�
�
r2r�c
�6�[UUUUUUUS9n[X5$)z$Turn a socket into a logging socket.)r�r�r�r�r�)r�r�)	r�r�r$r�r�r�r�r�rs	         r0�makeloggingsocketr�s0�����������H��r�$�$r2c�d�SSKJn URR5$![a gf=f)z(Return version information if available.r��__version__sunknown)r;rrJ�encode�ImportErrorrs r0rJrJ�s3���!��"�"�)�)�+�+������s�"�
/�/c�|�U(d
[5n[R"SU5nU(dSUpCO;URS5(aUR	5up4OURS5SpCUce/nURS5HnUR
[U55 M  [U5S:a"UR
S5 [U5S:aM"US:Xa
USUS4$US:XaUSUSUS4$US	:XaUSUSUSU4$[R"S
U-5e![a  M�f=f)a�Parses a Mercurial version string into an N-tuple.

The version string to be parsed is specified with the ``v`` argument.
If it isn't defined, the current Mercurial version string will be parsed.

``n`` can be 2, 3, or 4. Here is how some version strings map to
returned values:

>>> v = b'3.6.1+190-df9b73d2d444'
>>> versiontuple(v, 2)
(3, 6)
>>> versiontuple(v, 3)
(3, 6, 1)
>>> versiontuple(v, 4)
(3, 6, 1, '190-df9b73d2d444')

>>> versiontuple(b'3.6.1+190-df9b73d2d444+20151118')
(3, 6, 1, '190-df9b73d2d444+20151118')

>>> v = b'3.6'
>>> versiontuple(v, 2)
(3, 6)
>>> versiontuple(v, 3)
(3, 6, None)
>>> versiontuple(v, 4)
(3, 6, None, None)

>>> v = b'3.9-rc'
>>> versiontuple(v, 2)
(3, 9)
>>> versiontuple(v, 3)
(3, 9, None)
>>> versiontuple(v, 4)
(3, 9, None, 'rc')

>>> v = b'3.9-rc+2-02a8fea4289b'
>>> versiontuple(v, 2)
(3, 9)
>>> versiontuple(v, 3)
(3, 9, None)
>>> versiontuple(v, 4)
(3, 9, None, 'rc+2-02a8fea4289b')

>>> versiontuple(b'4.6rc0')
(4, 6, None, 'rc0')
>>> versiontuple(b'4.6rc0+12-425d55e54f98')
(4, 6, None, 'rc0+12-425d55e54f98')
>>> versiontuple(b'.1.2.3')
(None, None, None, '.1.2.3')
>>> versiontuple(b'12.34..5')
(12, 34, None, '..5')
>>> versiontuple(b'1.2.3.4.5.6')
(1, 2, 3, '.4.5.6')
s(\d+(?:\.\d+){,2})[+-]?(.*)r2�rN�.�r�s invalid version part request: %d)rJ�remod�match�group�groups�splitr��intr�r�r�ProgrammingError)r��nr��vparts�extra�vints�is       r0�versiontupler'�s=��n
��I��
���3�Q�7�A���Q��	
���������
�
�������
�D�������E�
�\�\�$�
��	��L�L��Q�� � ��e�*�q�.�
���T���e�*�q�.�	�A�v��a��%��(�#�#��A�v��a��%��(�E�!�H�-�-��A�v��a��%��(�E�!�H�e�4�4�
�
 �
 �!D�q�!H�
I�I���	��	�s�D,�,
D;�:D;c�^^^�TRRS:Xa/mUU4SjnU$0mTRRS:Xa	UU4SjnU$UU4SjnU$)z"cache the result of function callsrc�X>�[T5S:XaTRT"55 TS$r4)r�r�)�func�	listcaches��r0�f�cachefunc.<locals>.fs)����9�~��"�� � ���(��Q�<�r2rc�0>�UT;aT"U5TU'TU$r`r5)�arg�cacher*s ��r0r,r-&s"����%��!�#�Y��c�
���:�r2c�*>�UT;aT"U6TU'TU$r`r5)r�r0r*s ��r0r,r--s"����5� �"�D�k��d����;�r2)�__code__�co_argcount)r*r,r0r+s` @@r0�	cachefuncr4sW����}�}� � �A�%��	�	 �
���E��}�}� � �A�%�	�
�H�	�

�Hr2c�8�\rSrSr%SrS\S'S	SjrS
SjrSrg)r!i5zVhelper class to make copy-on-write easier

Call preparewrite before doing any writes.
r �_copiedc�v�[USS5(a&U=RS-slURU5$U$)z;call this before writes, return self or a copied new objectr6rr)r�r6r�rls r0�preparewrite�cow.preparewrite=s3���4��A�&�&��L�L�A��L��>�>�$�'�'��r2c�0�[USS5S-UlU$)zalways do a cheap copyr6rr)r�r6rls r0�copy�cow.copyEs���t�Y��2�Q�6����r2)r6N)rYr r�r �r�r)	rtrurvrwrxrr8r;rzr5r2r0r!r!5s���
�L��r2c�Z^�\rSrSrSrU4Sjr\R(aSrSr	Sr
U=r$)�sortdictiKa7a simple sorted dictionary

>>> d1 = sortdict([(b'a', 0), (b'b', 1)])
>>> d2 = d1.copy()
>>> list(d2.items())
[('a', 0), ('b', 1)]
>>> d2.update([(b'a', 2)])
>>> list(d2.keys()) # should still be in last-set order
['b', 'a']
>>> d1.insert(1, b'a.5', 0.5)
>>> list(d1.items())
[('a', 0), ('a.5', 0.5), ('b', 1)]
c�2>�X;aX	[TU]X5 gr`)r��__setitem__)rYrgr8r�s   �r0rA�sortdict.__setitem__Zs����;��	�
���C�'r2c��[U[5(aUR5nUH	up4X@U'M UH	nX#X'M gr`)r�r�r�)rY�srcr,r\r�s     r0rX�sortdict.updateas@���#�t�$�$��i�i�k������Q������$���r2c��[[UR555HunupVXA:XaX0U'XA:�dMX	X`U'M  gr`)�	enumerate�listr�)rY�positionrgr8r&r\r�s       r0�insert�sortdict.insertis?��"�4��
�
��#5�6�I�A�v���}�!�S�	��}��G��Q��7r2r5)rtrurvrwrxrAr�ispypyrXrJrzr�r�s@r0r?r?Ks%����(�
���	��r2r?c��\rSrSrSrSrg)�cowdictiraTcopy-on-write dict

Be sure to call d = d.preparewrite() before writing to d.

>>> a = cowdict()
>>> a is a.preparewrite()
True
>>> b = a.copy()
>>> b is a
True
>>> c = b.copy()
>>> c is a
True
>>> a = a.preparewrite()
>>> b is a
False
>>> a is a.preparewrite()
True
>>> c = c.preparewrite()
>>> b is c
False
>>> b is b.preparewrite()
True
r5N�rtrurvrwrxrzr5r2r0rNrNrs��r2rNc��\rSrSrSrSrg)�cowsortdicti�zRcopy-on-write sortdict

Be sure to call d = d.preparewrite() before writing to d.
r5NrOr5r2r0rQrQ�s��r2rQc�|�\rSrSrSr\RS	Sj5r\RS	Sj5rS
Sjr	S	Sjr
Srg)�
transactionali�zBBase class for making a transactional type into a context manager.c��g)z$Successfully closes the transaction.Nr5rls r0r��transactional.close���r2c��g)z_Marks the end of the transaction.

If the transaction has not been closed, it will be aborted.
Nr5rls r0�release�transactional.release�rVr2c��U$r`r5rls r0�	__enter__�transactional.__enter__�����r2c�v�UcUR5 UR5 g!UR5 f=fr`)r�rX)rY�exc_type�exc_val�exc_tbs    r0�__exit__�transactional.__exit__�s)��	����
�
���L�L�N��D�L�L�N�s�&�8r5Nrr=)rtrurvrwrx�abc�abstractmethodr�rXr[rbrzr5r2r0rSrS�sA��L����3��3�	�������r2rSc#��# �U(dSv� gSv� UR5 UR5 g![Ra UR5 ef=f!UR5 f=f7f)z�A context manager that closes the transaction on InterventionRequired

If no transaction was provided, this simply runs the body and returns
N)r�r�InterventionRequiredrX)�trs r0�acceptinterventionri�sZ����
���
�
���
�
	�
�
���	�%�%��
���
�
���	�
�
��s%�
A4�6�A4�&A�A�A1�1A4c#�# �Uv� g7fr`r5)�enter_results r0�nullcontextmanagerrl�s���
��s�c�(�\rSrSrSrSrSrSrSrg)�
_lrucachenodei�z�A node in a doubly linked list.

Holds a reference to nodes on either side as well as a key-value
pair for the dictionary entry.
)�next�prevrgr8�costc�N�XlXl[UlSUlSUlgr4)rorp�_notsetrgr8rqrls r0r]�_lrucachenode.__init__�s!���	��	������
���	r2c�6�[UlSUlSUlg)zMark the node as emptied.Nr)rsrgr8rqrls r0�	markempty�_lrucachenode.markempty�s�������
���	r2)rqrgrorpr8N)	rtrurvrwrxrtr]rvrzr5r2r0rnrn�s���9�I��r2rnc��\rSrSrSrSSjrSrSrSrSr	SSjr
S	rS
r\
4SjrSS
jr\
4SjrSrSSjrSrSSjrSSjrSrSrg)�lrucachedicti�a�Dict that caches most recent accesses and sets.

The dict consists of an actual backing dict - indexed by original
key - and a doubly linked circular list defining the order of entries in
the cache.

The head node is the newest entry in the cache. If the cache is full,
we recycle head.prev and make it the new head. Cache accesses result in
the node being moved to before the existing head and being marked as the
new head node.

Items in the cache can be inserted with an optional "cost" value. This is
simply an integer that is specified by the caller. The cache can be queried
for the total cost of all items presently in the cache.

The cache can also define a maximum cost. If a cache insertion would
cause the total cost of the cache to go beyond the maximum cost limit,
nodes will be evicted to make room for the new code. This can be used
to e.g. set a max memory limit and associate an estimated bytes size
cost to each item in the cache. By default, no maximum cost is enforced.
c�d�0Ul[5UlSUlXlSUlX lg)Nrr)�_cachern�_headr�capacity�	totalcost�maxcost)rYr�rs   r0r]�lrucachedict.__init__�s*�����"�_��
���
��
�����r2c�,�[UR5$r`)r�r{rls r0�__len__�lrucachedict.__len__�s���4�;�;��r2c��XR;$r`)r{�rYr\s  r0�__contains__�lrucachedict.__contains__s���K�K��r2c#�# �URn[[UR55HnURv� UR
nM g7fr`)r|�ranger�r{rgro)rYr"r&s   r0rm�lrucachedict.__iter__s8����J�J���s�4�;�;�'�(�A��%�%�K����A�)�s�A
Ac�Z�URUnURU5 UR$r`)r{�_movetoheadr8)rYr\�nodes   r0rh�lrucachedict.__getitem__
s'���{�{�1�~��������z�z�r2c���URRU5nUbsU=RUR-slX$lX4lU=RU-
slURU5 UR(aUR5 gURUR:aUR5nOURRnUR[La6U=RUR-slURUR	Xl
X$lX4lU=RU-
slX@RU'X@lUR(aUR5 gg)z8Insert a new item in the cache with optional cost value.N)r{�getr~rqr8r�r�_enforcecostlimitrr}�_addcapacityr|rprgrs)rYr\r�rqr�s     r0rJ�lrucachedict.inserts���{�{���q�!�����N�N�d�i�i�'�N��J��I��N�N�d�"�N����T�"��|�|��&�&�(���:�:��
�
�%��$�$�&�D��:�:�?�?�D��8�8�7�"��N�N�d�i�i�'�N����D�H�H�%����
��	����$������A���
��<�<��"�"�$�r2c�&�URX5 gr`)rJr�s   r0rA�lrucachedict.__setitem__6s�����A�r2c�&�URU5 gr`)�popr�s  r0�__delitem__�lrucachedict.__delitem__9s
������r2c�0�URRU5nURnU=R
UR-slUR5 URU5 URUl
U$![a U[LaeUs$f=fr`)r{r��KeyErrorrsr8r~rqrvr�ror|)rYr\r:r�r8s     r0r��lrucachedict.pop<s���	��;�;�?�?�1�%�D��
�
�����$�)�)�#������	
������Y�Y��
�����	��'�!���N�	�s�A<�<B�BNc�J�URU5$![a Us$f=fr`)rhr�)rYr\r:s   r0r��lrucachedict.getQs,��	��#�#�A�&�&���	��N�	�s��"�"c�r�URUnUR$![a U[LaeUs$f=f)z�Get the specified item without moving it to the head

Unlike get(), this doesn't mutate the internal state. But be aware
that it doesn't mean peek() is thread safe.
)r{r8r�rs)rYr\r:r�s    r0�peek�lrucachedict.peekWs=��	��;�;�q�>�D��:�:����	��'�!���N�	�s��6�6c��URnUR[LaPU=RUR-slUR5 URnUR[LaMPURR5 gr`)	r|rgrsr~rqrvror{�clear)rYr"s  r0r��lrucachedict.cleares[���J�J���e�e�7�"��N�N�a�f�f�$�N�
�K�K�M����A��e�e�7�"�
	
�����r2c��U=(d URnU=(d URn[XS9nURRnUR
[La=X@RLa/URnUR
[LaX@RLaM/[[UR55H>nURUR
URURS9 URnM@ U$)aCreate a new cache as a copy of the current one.

By default, the new cache has the same capacity as the existing one.
But, the cache capacity can be changed as part of performing the
copy.

Items in the copy have an insertion/access order matching this
instance.
)r)rq)
r}rryr|rprgrsr�r�r{rJr8rq)rYr}r�resultr"r&s      r0r;�lrucachedict.copyns����,�t�}�}���)�T�\�\���h�8��
�J�J�O�O���e�e�w��1�J�J�#6����A��e�e�w��1�J�J�#6�
�s�4�;�;�'�(�A��M�M�!�%�%����q�v�v�M�6����A�)��
r2c�z�UR(dgURRnUR[La!URnUR[LaM!URUR
p2URUR	U=RUR-slUR5 X#4$)zeRemove the oldest item from the cache.

Returns the (key, value) describing the removed cache entry.
N)	r{r|rprgrsr8r~rqrv)rYr"rgr8s    r0�	popoldest�lrucachedict.popoldest�s���
�{�{��
�J�J�O�O���e�e�w�����A��e�e�w���U�U�A�G�G�U�
�K�K��������!�&�&� ��	���
��z�r2c�,�URnURURlURURlURUlURRUlXRlXRlXlg)a�Mark a node as the newest, making it the new head.

When a node is accessed, it becomes the freshest entry in the LRU
list, which is denoted by self._head.

Visually, let's make ``N`` the new head node (* denotes head):

    previous/oldest <-> head <-> next/next newest

    ----<->--- A* ---<->-----
    |                       |
    E <-> D <-> N <-> C <-> B

To:

    ----<->--- N* ---<->-----
    |                       |
    E <-> D <-> C <-> B <-> A

This requires the following moves:

   C.next = D  (node.prev.next = node.next)
   D.prev = C  (node.next.prev = node.prev)
   E.next = N  (head.prev.next = node)
   N.prev = E  (node.prev = head.prev)
   N.next = A  (node.next = head)
   A.prev = N  (head.prev = node)
N)r|rorp)rYr��heads   r0r��lrucachedict._movetohead�s^��:�z�z������	�	������	�	���I�I��	��I�I�N�N��	��	�	���	�	���
r2c��URn[5nX!RlURUlXlX!lU=RS-
slU$)zXAdd a node to the circular linked list.

The new node is inserted before the head node.
r)r|rnrpror)rYr�r�s   r0r��lrucachedict._addcapacity�sD��
�z�z������	�	���I�I��	��	��	��
�
�a��
��r2c�F�[U5S::dURUR::ag[URS-5nURR
nUR[La!UR
nUR[LaM![U5S:�a�URU:�auURUR	U=RUR-slUR5 UR
n[U5S:�aURU:�aMsgggg)Nrg�?)r�r~rr r|rprgrsr{rqrv)rY�
targetcostr"s   r0r��lrucachedict._enforcecostlimit�s����t�9��>�T�^�^�t�|�|�;�������,�-�
��J�J�O�O���e�e�w�����A��e�e�w���$�i�!�m����� ;����A�E�E�"��N�N�a�f�f�$�N�
�K�K�M����A�	�$�i�!�m����� ;�m� ;�mr2)r{r|rr}rr~rr`r4)r�rn)r�rn)rtrurvrwrxr]r�r�rmrhrJrAr�rsr�r�r�r�r;r�r�r�r�rzr5r2r0ryry�sh���,� � ���
%%�N��%��*�&����>�0-�^�r2ryc�^^^�0m[R"5mTRRS:Xa
UUU4SjnU$UUU4SjnU$)z+cache most recent results of function callsrc�>�UT;a,[T5S:�aTTR5	T"U5TU'OTRU5 TRU5 TU$�N��r��popleft�remover�)r/r0r*�orders ���r0r,�lrucachefunc.<locals>.f	sS����%���u�:��?��e�m�m�o�.�!�#�Y��c�
����S�!��L�L�����:�r2c�>�UT;a)[T5S:�aTTR5	T"U6TU'OTRU5 TRU5 TU$r�r�)r�r0r*r�s ���r0r,r�sS����5� ��u�:��?��e�m�m�o�.�"�D�k��d�����T�"��L�L�����;�r2)�collections�dequer2r3)r*r,r0r�s` @@r0�lrucachefuncr�s@����E�����E��}�}� � �A�%�	�,
�H�	�
�Hr2c�*�\rSrSrSrSSjrSrSrg)�
propertycachei"c�2�XlURUlgr`)r*rtr$)rYr*s  r0r]�propertycache.__init__#s���	��M�M��	r2Nc�J�URU5nURX5 U$r`)r*�
cachevalue)rY�obj�typer�s    r0�__get__�propertycache.__get__'s �����3�������$��
r2c�4�X!RUR'gr`)�__dict__r$)rYr�r8s   r0r��propertycache.cachevalue,s��"'���T�Y�Y�r2)r*r$r`)rtrurvrwr]r�r�rzr5r2r0r�r�"s��"��
(r2r�c�j�[R"U5nXR;aURU	gg)z2clear a cached property value, if one has been setN)rrDr�)r��props  r0�clearcachedpropertyr�1s+���?�?�4� �D��|�|���L�L���r2�c#�"# �Sn/nSnUHcnURU5 U[U5-
nXQ:�dM)X:aUS-nSU"U5-nXq:�aUnX:�aUnSRU5v� Sn/nMe U(aSRU5v� gg7f)znreturn no less than min bytes per chunk while data remains,
doubling min after each chunk until it reaches maxc�T�U(dgSnU(aUS-nUS-
nU(aMUS-
$)Nrrr5)�xr&s  r0�log2�increasingchunks.<locals>.log2<s4����
���
�!�G�A�
��F�A��a��1�u�r2rrr2N)r�r�r�)�sourcer�r�r�r��blen�chunk�nmins        r0�increasingchunksr�8s�����
�C��D����
�
�5����E�
����;��y��Q�h���D��J����:��C��9��C��(�(�3�-���D��C����h�h�s�m���s�/B�ABc��g�NTr5�rAs r0�alwaysr�Ys��r2c��grr5r�s r0�neverr�]s��r2c�2�Uc
[5$[U5$)a�disable garbage collector

Python's garbage collector triggers a GC each time a certain number of
container objects (the number being defined by gc.get_threshold()) are
allocated even when marked not to be tracked by the collector. Tracking has
no effect on when GCs are triggered, only on what objects the GC looks
into. As a workaround, disable GC while building complex (huge)
containers.

This garbage collector issue have been fixed in 2.7. But it still affect
CPython's performance.
)�
_nogc_context�_nogc_decorator)r*s r0�nogcr�as���|�����t�$�$r2c#��# �[R"5n[R"5 Sv� U(a[R"5 gg!U(a[R"5 ff=f7fr`)�gc�	isenabled�disable�enable)�	gcenableds r0r�r�tsC�������I��J�J�L��
���I�I�K���9��I�I�K��s�+A2�A�A2�A/�/A2c�^�U4SjnU$)Nc�^>�[5 T"U0UD6sSSS5 $!,(df   g=fr`)r�)r�r�r*s  �r0�wrapper� _nogc_decorator.<locals>.wrapper�s���
�_���(��(��_�_�s��
,r5�r*r�s` r0r�r�s���)��Nr2c��U$r`r5�r�s r0r�r��s��Qr2c�6�U(d[U5$[RRU5(a�[RR	U5S[RR	U5S:wa)[RRU[U55$SR[
U5U45n[U5URS5pCUR5 UR5 U(aOU(aHUSUS:Xa<UR5 UR5 U(aU(aUSUS:XaM<UR5 [RRS/[U5-U-5=(d S$)aAreturn the relative path from one place to another.
root should use os.sep to separate directories
n1 should use os.sep to separate directories
n2 should use "/" to separate directories
returns an os.sep-separated path.

If n1 is a relative path, it's assumed it's
relative to root.
n2 should always be relative to root.
r�/r��..r)�	localpathr,�path�isabs�
splitdriver��pconvert�	splitpathr�reverser�r�ossepr�)�root�n1�n2�a�bs     r0�pathtor�s�����}��	�w�w�}�}�R���
�7�7���d�#�A�&�"�'�'�*<�*<�R�*@��*C�C��7�7�<�<��i��m�4�4�
�Y�Y�����+�
,���R�=�"�(�(�4�.�q��I�I�K��I�I�K�
��a��e�q��u�n�	����	������a��e�q��u�n��I�I�K��>�>�����#�a�&� 0�A�5�6�>�$�>r2c�^^�UU4SjnU$)z5wrap a function with code to check for calling errorsc��>�T"U0UD6$![aK [[R"[R
"5S55T:Xa[Reef=f)Nr)�	TypeErrorr��	traceback�
extract_tbrF�exc_infor�SignatureError)r�r��depthr*s  ��r0�check�checksignature.<locals>.check�sY���	���(��(�(���	��9�'�'�����q�(9�:�;�u�D��*�*�*��	�s
��AA r5)r*r
rs`` r0�checksignaturer
�s�����Lr2>
�hfs�jfs�ufs�xfs�zfs�NTFS�apfs�ext2�ext3�ext4�btrfs�tmpfs�reiserfsc���U(a	U(aeSn[RRU5(a0U(aU=(a [R	U5n[U5 U(aFU(a?[
[RRU55n	U	[;aUbU"5 SnU(a([X5 UbSn
[R"U
5eg[RRU5(aG[R "[R""U5U5 UbSn
[R"U
5eg[$R&"X5 U(a[$R("X5 O�[$R*"X5 U(awUR,(af[R	U5nUR/U5(a;UR,[,R0S-S-n
[R2"XU
45 Ub%[5USS9nUR7U5 SSS5 gg![a Sn	GN�f=f![a3nUR[R:wa
UbU"5 SnAGN�SnAff=f!,(df   g=f![$R8a/n[R:"[<R>"U55eSnAff=f)	aJcopy a file, preserving mode and optionally other stat info like
atime/mtime

checkambig argument is used with filestat, and is useful only if
destination file is guarded by any lock (e.g. repo.lock or
repo.wlock).

copystat and checkambig should be exclusive.

nb_bytes: if set only copy the first `nb_bytes` of the source file.
NFz7the `nb_bytes` argument is incompatible with `hardlink`z"cannot use `nb_bytes` on a symlinkr��zr+)r�) r,r��lexistsr)�frompath�unlink�	getfstype�dirname�OSError�_hardlinkfswhitelist�oslinkrr!�errno�EEXIST�islink�symlink�readlink�shutil�copyfile�copystat�copymoder��isambig�ST_MTIME�utime�openr�ErrorrVr�forcebytestr)rDr��hardlinkr,�
checkambig�nb_bytes�no_hardlink_cb�check_fs_hardlink�oldstat�fstyper��exc�newstat�advancedr,�insts                r0r+r+�s/��*�Z�(�(��G�	�w�w���t���� �<�X�%6�%6�t�%<�G��t���%�	��r�w�w���t�4�5�F��-�-��)�� ��H��	!��3���#�M���,�,�Q�/�/��

�w�w�~�~�c���
�
�
�2�;�;�s�#�T�*���4�A��(�(��+�+� �	=��O�O�C�&������*�����*��w�|�|�&�/�/��5�G����w�/�/�$�L�L����7�!�;�&�$'������(�';�<��#��$�T�*�a��J�J�x�(�+�*�$��S�	��F�	���	!��y�y�E�L�L�(�^�-G�� ���	!��:+�*���|�|�	=��+�+�j�5�5�d�;�<�<��	=�sa�6(I�<&I�CJ$�$J�6J$�I�I�
J�(J�J�
J!�J$�!J$�$K'�8*K"�"K'c�h^^�SnUU4Sjn[RRU5(a�Tc^[R"U5R[R"[RRU55R:HmU"5 [R"U5 [U5HWupg[RRX5n[RRX5n	[X�TT5umn
XJ-
nMY TU4$Tc{[R"[RRU55R[R"[RRU55R:HmU"5 T(a
[X5 O[R"X5 US-
nT(aTR!5 TU4$![a@nUR[R:waSm[R"X5 SnANeSnAff=f)z2Copy a directory tree using hardlinks if possible.rc�Z>�T(a#T(a[S5O
[S5Tlgg)Nslinkingscopying)rW�topic)r4�progresss��r0�settopic�copyfiles.<locals>.settopics����.6�Q�z�]�A�j�M�H�N�r2NFr)r,r��isdirr��st_devr!�mkdir�listdirr��	copyfilesr$r"r%r&r*r;�	increment)rD�dstr4rB�numrCr$�kind�srcname�dstnamer"r;s  ``        r0rIrIs����
�C�J�
�w�w�}�}�S����������#�#�r�w�w�r�w�w���s�/C�'D�'K�'K�K�
�	�
�
����
�!�#�,�J�D��g�g�l�l�3�-�G��g�g�l�l�3�-�G�#�G�h��I�K�H�a��H�C�	'�6�S�=��+�����������,�-�4�4��7�7�2�7�7�?�?�3�/�0�7�7�8�
�	�
��
&��s� �
�K�K��!��q������� ��S�=����
&��9�9����,�$�H����C�%�%��	
&�s�%G'�'
H1�16H,�,H1>�aux�con�nul�prn�com1�com2�com3�com4�com5�com6�com7�com8�com9�lpt1�lpt2�lpt3�lpt4�lpt5�lpt6�lpt7�lpt8�lpt9s:*?"<>|c�\�URS5(a[S5$SU;a[S5$URSS5RS5H�nU(dM[	U5HTnU[
;a[S5U-s s $[
U5S::dM0[S5[R"U5-s s $ URS	5S
nU(a(UR5[;a[S5U-s $USSnUS
;dM�US;dM�[S5U-s $ g)aCheck that the base-relative path is a valid filename on Windows.
Returns None if the path is ok, or a UI string describing the problem.

>>> checkwinfilename(b"just/a/normal/path")
>>> checkwinfilename(b"foo/bar/con.xml")
"filename contains 'con', which is reserved on Windows"
>>> checkwinfilename(b"foo/con.xml/bar")
"filename contains 'con', which is reserved on Windows"
>>> checkwinfilename(b"foo/bar/xml.con")
>>> checkwinfilename(b"foo/bar/AUX/bla.txt")
"filename contains 'AUX', which is reserved on Windows"
>>> checkwinfilename(b"foo/bar/bla:.txt")
"filename contains ':', which is reserved on Windows"
>>> checkwinfilename(b"foo/bar/b\07la.txt")
"filename contains '\\x07', which is invalid on Windows"
>>> checkwinfilename(b"foo/bar/bla ")
"filename ends with ' ', which is not allowed on Windows"
>>> checkwinfilename(b"../bar")
>>> checkwinfilename(b"foo\\")
"filename ends with '\\', which is invalid on Windows"
>>> checkwinfilename(b"foo\\/bar")
"directory name ends with '\\', which is invalid on Windows"
�\s3filename ends with '\', which is invalid on Windowss\/s9directory name ends with '\', which is invalid on Windowsr�s4filename contains '%s', which is reserved on Windows�s3filename contains '%s', which is invalid on Windowsrrr�Ns. r�s8filename ends with '%s', which is not allowed on Windows)�endswithrW�replacer�_filenamebytestr�_winreservedchars�ordrr��lower�_winreservednames)r�r"�c�base�ts     r0�checkwinfilenamers_s-��0�}�}�U����H�I�I�
��~��N�O�O�
�\�\�%��
&�
,�
,�T�
2����!�!�$�A��%�%��&���	���1�v��|��J���(�(��+�,�,�%��w�w�t�}�Q����D�J�J�L�$5�5��I�J���
�
�b�c�F����:�!�5�.��"���	�
�13r2�perf_counterc��[R"X5$![a)nUR[R:XaeSnAOSnAf[
a Of=f[R[R-[R-[[SS5-n[R"X5n[R"X@5 [R"U5 g![R"U5 f=f)z�Create a lock file atomically if possible

This may leave a stale lock file if symlink isn't supported and signal
interrupt is enabled.
N�O_BINARYr)
r,r(r"r%r&�AttributeError�O_CREAT�O_WRONLY�O_EXCLr�r1rr�)�info�pathname�whyr��lds     r0�makelockr�s���
��z�z�$�)�)�����9�9����$��%���
��
��
�J�J����$�r�y�y�0�7�2�z�1�3M�M�E�	����	!�B��
�����
�����������s&��
A�A�
A�A�4C!�!C9c�*�[U5$![a9nUR[R[R4;aeSnAOSnAf[
a Of=f[
US5nUR5sSSS5 $!,(df   g=f)N�rb)r)r"r%�EINVAL�ENOSYSrw�	posixfiler�)r|r}r�s   r0�readlockr��so��
���!�!�����9�9�U�\�\�5�<�<�8�8��9���
��
��	�8�U�	#�r��w�w�y�
$�	#�	#�s&�

�
A�/A�
A�A�*B�
Bc��[R"UR55$![a# [R"UR
5s$f=f)z1stat file object that may not have fileno method.)r,r�r�rwr�r$r�s r0r�r��s>�� ��x�x��	�	��$�$��� ��w�w�r�w�w��� �s�#&�*A�Ac�`�[R"U5n[RRU5up#UR	5nX4:XaUR5nX4:Xag[RR
X$5n[R"U5nXa:Xagg![a gf=f)z�
Return true if the given path is on a case-sensitive filesystem

Requires a path (like /foo/.hg) ending with a foldable final
directory component.
TF)r,�lstatr�r�upperrnr�r")r��s1�dr�b2�p2�s2s       r0�fscasesensitiver��s���
���$��B�
�7�7�=�=���D�A�	
����B��w�
�W�W�Y���7��	�����a�	�B��
�X�X�b�\��
�8��������s�B � 
B-�,B-c��U$r`r5r�s r0r�r��s��qr2c�D�[c[R5 [$)z0return True is re2 is available, False otherwise)�_re2�_re�	_checkre2r5r2r0�has_re2r��s���|��
�
���Kr2c�>�\rSrSr\S5rSSjr\S5rSr	g)r�i	c��[bgSnSn[[R"X55q[R"5nSUl
Uqg![a SqN.[
a^ [R"U5n[R"U5n[[R"X55q[RqN�f=f![a gf=f)Ns\[([^\[]+)\]s[ui]F)
r�r��re2rrrrrD�
_re2_input�Options�
log_errors�_re2_optionsrw)�
check_pattern�check_input�quiets   r0r��
_re._checkre2	s���
���(�
���	)���	�	�-�=�>�D�	��K�K�M�E�$�E�� �L���	��D��	)�%�O�O�M�:�M�"�/�/�+�6�K���	�	�-�=�>�D�!���J�
	)���	��	�s)�A
�C�
C�A$C�C�
C�Cc��[cUR5 [(a�U[R[R-)-S:Xa�U[R-(aSU-nU[R-(aSU-n[U5n[b[R"U[S9nU$[R"U5nU$[R"X5$![Ra N,f=f)z�Compile a regular expression, using re2 if possible

For best performance, use only re2-compatible regexp features. The
only flags from the re module that are re2-compatible are
IGNORECASE and MULTILINE.rs(?i)s(?m))�options)
r�r�r�
IGNORECASE�	MULTILINEr�r�r��compiler)rY�patr��input_regex�compileds     r0r��_re.compile	s����<��N�N���4�U�u�/�/�%�/�/�A�B�B�q�H��u�'�'�'���m���u���&���m��
�(��o���+�"�{�{�;��M�H� �� #�{�{�;�7�H����}�}�S�(�(���9�9�
��
�s�,C"�4C"�"C9�8C9c��[cUR5 [(a[R$[R$)z�Return the version of escape corresponding to self.compile.

This is imperfect because whether re2 or re is used for a particular
function depends on the flags, etc, but it's the best we can do.
)r�r�r��escaperrls r0r��
_re.escape7	s,���<��N�N���4��:�:���<�<�r2r5Nr)
rtrurvrwryr�r�r�r�rzr5r2r0r�r�	s-������:)�0� �� r2r�c���Sn[Rn[R(aU[R-nURSS5 [R
"SX34-5n[RRU5n/nURU5H�upxU(aURU5 MU[;aU"U5[U'[Un	U	RU5n
U
(d"U"U5=[U'n	U	RU5n
URU
=(d U5 [RRXW5nM� SRU5$)a Get name in the case stored in the filesystem

The name should be relative to root, and be normcase-ed for efficiency.

Note that this function is unnecessary, and should not be
called, for case-sensitive filesystems (simply because it's expensive).

The root should be normcase-ed, too.
c�n�[R"U5Vs0sHn[U5U_M sn$s snfr`)r,rH�normcase)�dirr"s  r0�_makefspathcacheentry�%fspath.<locals>._makefspathcacheentryW	s*��(*�
�
�3��8��1����Q���8�8��8s�2rgs\\s([^%s]+)|([%s]+)r2)rr��osaltseprjrr�r,r��normpath�findallr��_fspathcacher�r�)r$r�r��seps�patternr�r��part�sep�contents�founds           r0�fspathr�L	s��9��>�>�D�����h�'�'�'���L�L��� ��m�m�0�D�<�?�@�G�
�'�'�
�
�4�
 �C�
�F��_�_�T�*�	����M�M�#����l�"� 5�c� :�L�����$�����T�"���,A��+E�E�L�����L�L��&�E��
�
�e�m�t�$��g�g�l�l�3�%��#+�&�8�8�F��r2c�"�Supn[R"S[RR	U5-S[RRU5S9upA[R"U5 SUSS-n[X5 [U5n[U5S:�UbUR
5 X4HnUb[R"U5 MM! $![a M1f=f![aM UbUR
5 X4H0nUb[R"U5 MM!![a M.f=f g	f=f!UbUR
5 X4H0nUb[R"U5 MM!![a M.f=f f=f)
z5check whether hardlink count reporting works properly)NNN�.%s-s1~��prefix�suffixr�s%s2~N���rF)r�mkstempr,r��basenamer!r�r$r��nlinksrr")�testfile�f1�f2r�r�r,s      r0�
checknlinkr�x	st��
"�J�B�B���!�!��R�W�W�-�-�h�7�7��������)�
���
	�����
�r�#�2�w�
���r���r�]���b�z�A�~��>��H�H�J���A�
��=��I�I�a�L�!����
��
�����
�>��H�H�J���A�
��=��I�I�a�L�!���
��
��	����>��H�H�J���A�
��=��I�I�a�L�!���
��
��	�sl�BC(�7C�
C%�$C%�(
D?�2E�
D*�*
D8�7D8�>D?�?E�F�E:�6F�:
F	�F�F	�Fc���[UR[R5=(d6 [R=(a UR[R55$)z)Check path ends with os.sep or os.altsep.)r�rirr�r��r�s r0�endswithsepr��	sD����
�
�h�n�n�%�	-����-��M�M�(�+�+�,��r2c�@�UR[R5$)z�Split path by os.sep.
Note that this function does not use os.altsep because this is
an alternative of simple "xxx.split(os.sep)".
It is recommended to use os.path.normpath() before using this
function if need.)rrr�r�s r0r�r��	s���:�:�h�n�n�%�%r2c��[RRU5upE[R"SU-SUS9upg[R
"U5 [
XX#5 U(aU$[US5n[US5n
[U5HnU
RU5 M UR5 U
R5 U$![aCn	U	R[R:XaUsSn	A	$[U	SS5(dX	leSn	A	ff=f! [R"U5 e![a ef=f=f)aCreate a temporary file with the same contents from name

The permission bits are copied from the original file.

If the temporary file is going to be truncated immediately, you
can use emptyok=True as an optimization.

Returns the name of the temporary file.
r��~r�r�N�filenameswb)r,r�rrr�r�r-r�r"r%�ENOENTr�r��
filechunkiterrr)r$�emptyok�
createmode�enforcewritabler�rAr��temp�ifpr>�ofpr�s            r0�
mktempcopyr��	s��
�G�G�M�M�$��E�A����w��|�D�a�H�H�B��H�H�R�L�
�T��5�����	��D�%�(�C���e�$��"�3�'�E��I�I�e��(��	�	���	�	���K��#�	��z�z�U�\�\�)����4��T�2�2� $�
���	���	��I�I�d�O�	���	��
�	�sa�*C�6AD�
D�D�0D�1D�6D�D�D�E�D1�0E�1
D>�;E�=D>�>Ec��\rSrSrSrSSjr\S
Sj5r\SSj5r\	Rr
SSjrSSjrSSjr
SS	jrS
rg)r)i�	z�help to exactly detect change of a file

'stat' attribute is result of 'os.stat()' if specified 'path'
exists. Otherwise, it is None. This can avoid preparative
'exists()' examination on client side of this class.
c��Xlgr`r�)rYr�s  r0r]�filestat.__init__�	s���	r2c�d�[R"U5nU"U5$![a SnNf=fr`)r,r��FileNotFoundError)r�r�r�s   r0r�filestat.frompath�	s6��	��7�7�4�=�D��4�y���!�	��D�	�s� �/�/c�Z�[R"UR55nU"U5$r`)r,r�r�)r�r�r�s   r0�fromfp�filestat.fromfp�	s ���x�x��	�	��$���4�y�r2c���URRURR:H=(a} UR[RUR[R:H=(a; UR[RUR[R:H$![a Of=fURSL=(a URSL$![a gf=fr)r�r��ST_CTIMEr/rw�rY�olds  r0�__eq__�filestat.__eq__�	s���
	�
�	�	�!�!�S�X�X�%5�%5�5�H��I�I�d�m�m�,�������0G�G�H��I�I�d�m�m�,�������0G�G�
��
�	��	��	��9�9��$�9����T�)9�9���	��	�s$�B0B3�3
C�?C�"C'�'
C4�3C4c��UR[RUR[R:H$![a gf=f)agExamine whether new (= self) stat is ambiguous against old one

"S[N]" below means stat of a file at N-th change:

- S[n-1].ctime  < S[n].ctime: can detect change of a file
- S[n-1].ctime == S[n].ctime
  - S[n-1].ctime  < S[n].mtime: means natural advancing (*1)
  - S[n-1].ctime == S[n].mtime: is ambiguous (*2)
  - S[n-1].ctime  > S[n].mtime: never occurs naturally (don't care)
- S[n-1].ctime  > S[n].ctime: never occurs naturally (don't care)

Case (*2) above means that a file was changed twice or more at
same time in sec (= S[n-1].ctime), and comparison of timestamp
is ambiguous.

Base idea to avoid such ambiguity is "advance mtime 1 sec, if
timestamp is ambiguous".

But advancing mtime only in case (*2) doesn't work as
expected, because naturally advanced S[n].mtime in case (*1)
might be equal to manually advanced S[n-1 or earlier].mtime.

Therefore, all "S[n-1].ctime == S[n].ctime" cases should be
treated as ambiguous regardless of mtime, to avoid overlooking
by confliction between such mtime.

Advancing mtime "if isambig(oldstat)" ensures "S[n-1].mtime !=
S[n].mtime", even if size of a file isn't changed.
F)r�r�rwr�s  r0r.�filestat.isambig
s>��<	��9�9�T�]�]�+�s�x�x��
�
�/F�F�F���	��	�s�:=�
A
�	A
c��UR[RS-S-n[R"XU45 g![a gf=f)aChange file stat of specified path to avoid ambiguity

'old' should be previous filestat of 'path'.

This skips avoiding ambiguity, if a process doesn't have
appropriate privileges for 'path'. This returns False in this
case.

Otherwise, this returns True, as "ambiguity is avoided".
rrFT)r�r/r,r0�PermissionError)rYr�r�r=s    r0�
avoidambig�filestat.avoidambig)
sQ���H�H�T�]�]�+�a�/�:�=��	��H�H�T�h�/�0�
��	�	��	�s�>�
A�
Ac��X:X+$r`r5)rY�others  r0�__ne__�filestat.__ne__=
s��� � r2r�N)r�r�r�r)r��Type[_Tfilestat]r��bytesr�r()r�r�r�rr�r(r)r�r(r�r�)r�r�r�r(r�r�)rtrurvrwrxr]�classmethodrr�r�__hash__r�r.r�r�rzr5r2r0r)r)�	sT���������������H��"!�F�(!r2c�@�\rSrSrSrSSjrSrSrSrSr	S	r
S
rg)�atomictempfileiA
a�writable file object that atomically updates a file

All writes will go to a temporary copy of the original file. Call
close() when you are done writing, and atomictempfile will rename
the temporary copy to the original name, making the changes
visible. If the object is destroyed without being closed, all your
writes are discarded.

checkambig argument of constructor is used with filestat, and is
useful only if target file is guarded by any lock (e.g. repo.lock
or repo.wlock).
Nc���Xl[USU;USU;S9Ul[URU5UlX@lURRUlURRUlURRUlURRUl	URRUl
URRUlg)N�w)r�r�r�)�_atomictempfile__namer��	_tempnamer��_fp�_checkambigr�rr!rrr�)rYr$r�r�r5s     r0r]�atomictempfile.__init__O
s�����#���T�\�!�!�T�\�	
����T�^�^�T�2���%���H�H�M�M��	��X�X�^�^��
��(�(�-�-����H�H�M�M��	��H�H�M�M��	��h�h�o�o��r2c�D�URR(GdURR5 [UR5nUR
=(a [RU5nU(a�UR(a~[URU5 [RU5nURU5(a<UR[RS-S-n[R"XU45 gg[URU5 gg)Nrr)r�r�r�r�r�r�r)rr��renamer�r.r/r,r0)rYr�r9r<r=s     r0r��atomictempfile.closec
s����x�x�����H�H�N�N�� ����-�H��&�&�F�8�+<�+<�X�+F�G��7�<�<��t�~�~�x�0�"�+�+�H�5���?�?�7�+�+� '���T�]�]� ;�a� ?�:�M�H��H�H�X�(�';�<�,�
�t�~�~�x�0�r2c���URR(d<[R"UR5 URR
5 gg![
a N(f=fr`)r�r�r,rr�r"r�rls r0�discard�atomictempfile.discardr
sK���x�x���
��	�	�$�.�.�)�
�H�H�N�N�����
��
�s� A�
A&�%A&c�H�[US5(aUR5 gg)Nr�)r�rrls r0�__del__�atomictempfile.__del__z
s���4�����L�L�N� r2c��U$r`r5rls r0r[�atomictempfile.__enter__~
r]r2c�L�UbUR5 gUR5 gr`)rr�)rY�exctype�excvaluers    r0rb�atomictempfile.__exit__�
s�����L�L�N��J�J�Lr2)
�__namer�r�r�r�r�rrrr!)sw+bNF)rtrurvrwrxr]r�rrr[rbrzr5r2r0r�r�A
s%���&�(
1����r2r�c���[U5 g![aLnUR[R:wa$UR[R:waeSnAgSnAgSnAff=fr`)�
removedirsr"r%r��	ENOTEMPTY)r,�es  r0�tryrmdirr�
sI����1�
�����7�7�e�l�l�"�q�w�w�%�/�/�'A��(B�"���s��
A$�=A�A$c���U(a[U5 O[U5 U(a*[[RRU55 gg![a gf=f)z.unlink and remove the directory if it is emptyN)�	tryunlinkrrr,r�r!r")r,�
ignoremissing�rmdirs   r0�
unlinkpathr�
sK����!���q�	��	��r�w�w���q�)�*�
���	��	�s�(A�
A�Ac�<�[U5 g![a gf=f)zsAttempt to remove a file, ignoring FileNotFoundError.

Returns False in case the file did not exit, True otherwise
TF)rr�)r,s r0rr�
s#��
��q�	�������s��
�c��[X5 Ub[
R"X5 gg![a�nUR[R:XaSnAgUR[R:wdU(de[
RR[U55nX@:Xae[XAU5 [X5 SnAN�![a-nUR[R:Xa	SnASnAgeSnAff=fSnAff=f)z�recursive directory creation with parent mode inheritance

Newly created directories are marked as "not to be indexed by
the content indexing service", if ``notindexed`` is specified
for "write" mode access.
N)�makedirr"r%r&r�r,r�r!�abspath�makedirs�chmod)r$r��
notindexed�err�parents     r0rr�
s������!�"��
�������!���9�9����$���9�9����$�D����������/���>����z�*�	��D�%�%���	��y�y�E�L�L�(�����		���sE�(�
D�D�A D�6C�
C=�C8�.D�7C8�8C=�=D�Dc�p�[US5nUR5sSSS5 $!,(df   g=f)N�rb)r1r�)r�r�s  r0�readfiler&�
s#��	
�d�D�	�R��w�w�y�
�	�	�s�'�
5c�r�[US5nURU5 SSS5 g!,(df   g=f)N�wb�r1r�r��textr�s   r0�	writefiler,�
�%��	
�d�D�	�R�
�����
�	�	���(�
6c�r�[US5nURU5 SSS5 g!,(df   g=f)N�abr)r*s   r0�
appendfiler1�
r-r.c�8�\rSrSrSrSrSrS	SjrS
SjrSr	g)�chunkbufferi�
zkAllow arbitrary sized chunks of data to be efficiently read from an
iterator over chunks of arbitrary size.c�t�SnU"U5Ul[R"5UlSUlSUlg)z?in_iter is the iterator that's iterating over the input chunks.c3�# �UHIn[U5S:�a3SnU[U5:a US-nXUv� UnU[U5:aMMCMEUv� MK g7f)N�r��r�)�chunksr��pos�ends    r0�splitbig�&chunkbuffer.__init__.<locals>.splitbig�
s\������u�:��%��C���E�
�*�!�E�k��#��n�,�!����E�
�*�*�
 �K� �s�AA�
ArN)rkr�r��_queue�_chunkoffset�_absolute_offset)rY�in_iterr<s   r0r]�chunkbuffer.__init__�
s5��		 ��W�%��	�!�'�'�)������ !��r2c#�# �UR(axURR5nUR(aXRSnOUnU=R[	U5-
slUv� SUlUR(aMxUR
H%nU=R[	U5-
slUv� M' g7fr4)r>r�r?r@r�rk)rYr�r�s   r0rm�chunkbuffer.__iter__�
s�����k�k��K�K�'�'�)�E�� � ��+�+�-�.�����!�!�S��V�+�!��G� !�D���k�k�k����A��!�!�S��V�+�!��G��s�BC�6Cc��UR$)z&tell how much data we have read so far)r@rls r0r�chunkbuffer.tell�
s���$�$�$r2Nc��Uc;SRUR5nU=R[U5-
slU$Un/nURnUS:�GaU(dDSnURH*nURU5 U[U5-nUS::dM* O U(dO�USn[U5nURn	U	S:Xa,X8:�a'X8-nUR5 URU5 M�X�-
n
X::�a/X:-nUR5 URXyS5 SUlO.URXyX�-5 U=RU-
slX:-nUS:�aGMSRU5nU=R[U5-
slU$)z�Read L bytes of data from the iterator of chunks of data.
Returns less than L bytes if the iterator runs dry.

If size parameter is omitted, read everythingNr2rr7)r�rkr@r�r>r�r?r�)rY�lr��leftr��queue�targetr��chunklr��chunkremainings           r0r��chunkbuffer.readsx��

�9�������#�A��!�!�S��V�+�!��H����������Q�h����!�Y�Y�E��L�L��'��c�%�j�(�F���{��	'�
���!�H�E���Z�F��&�&�F���{�t�~�����
�
���
�
�5�!��#�_�N��%��&���
�
���
�
�5��>�*�$%��!��
�
�5�&�-�8�9��!�!�T�)�!��&��[�Q�h�^
�H�H�S�M������Q��'���r2)r@r?r>rk)r�r r`)
rtrurvrwrxr]rmrr�rzr5r2r0r3r3�
s��/�"�&�%�>r2r3ic#��# �US:�deUbUS:�deUcUnO[X!5nU=(a URU5nU(dgU(aU[U5-nUv� MN7f)aECreate a generator that produces the data in the file size
(default 131072) bytes at a time, up to optional limit (default is
to read all data).  Chunks may be less than size bytes if the
chunk is the last chunk in the file, or the file is a socket or
some other type of file that sometimes reads less data than is
requested.rN)r�r�r�)r,r�r��nbytesr[s     r0r�r�Gsm����1�9��9��=�E�Q�J�&�&�
��=��F���%�F��%�q�v�v�f�~������S��V�O�E����s�A#A%c�.�\rSrSrSrSrSSjrSrSrg)	�cappedreaderi]a�A file object proxy that allows reading up to N bytes.

Given a source file object, instances of this type allow reading up to
N bytes from that source file object. Attempts to read past the allowed
limit are treated as EOF.

It is assumed that I/O is not performed on the original file object
in addition to I/O that is performed by this instance. If there is,
state tracking will get out of sync and unexpected results will ensue.
c��XlX lg)z,Allow reading up to <limit> bytes from <fh>.N�r~�_left)rYr�r�s   r0r]�cappedreader.__init__is�����
r2c�
�UR(dgUS:aURnURR[XR55nU=R[	U5-slURS:�deU$)Nr2r)rUr~r�r�r�)rYr"rbs   r0r��cappedreader.readns^���z�z���q�5��
�
�A��x�x�}�}�S��J�J�/�0���
�
�c�$�i��
��z�z�Q�����r2c�n�UR[U55nUcgX!S[U5&[U5$r4)r�r�)rYrr@s   r0r�cappedreader.readinto{s2���i�i��A�����;���!�c�#�h���3�x�r2rTNr�)	rtrurvrwrxr]r�rrzr5r2r0rRrR]s��	��
�r2rRc�^�U4SjnU$)z@return a function that renders a readable count of some quantityc�x>�TH)upn[U5X!-:�dMX0[U5--s $ TSSU-$)Nr�r)�abs�float)�count�
multiplier�divisor�format�	unittables    �r0�go�unitcountfn.<locals>.go�sI���+4�'�J���5�z�W�1�1���w��!7�8�8�,5���}�Q��%�'�'r2r5)rcrds` r0�unitcountfnrf�s���(��Ir2c��X-
S:a[R"[S55eUS:a[R"[S55eUS-
U4$)aZCheck that linerange <fromline>:<toline> makes sense and return a
0-based range.

>>> processlinerange(10, 20)
(9, 20)
>>> processlinerange(2, 1)
Traceback (most recent call last):
    ...
ParseError: line range must be positive
>>> processlinerange(0, 5)
Traceback (most recent call last):
    ...
ParseError: fromline must be strictly positive
rsline range must be positivers"fromline must be strictly positive)r�
ParseErrorrW)�fromline�tolines  r0�processlinerangerk�sS����1�����q�!?�@�A�A��!�|����q�!F�G�H�H��a�<���r2�d�@s%.0f GB�
s%.1f GBs%.2f GBr6s%.0f MBs%.1f MBs%.2f MBs%.0f KBs%.1f KBs%.2f KBs
%.0f bytesc�@�\rSrSrSrS	SjrS
SjrS
SjrSSjrSr	g)�transformingwriteri�z3Writable file wrapper to transform data by functionc��XlX lgr`)r��_encode)rYr�rs   r0r]�transformingwriter.__init__�s�����r2c�8�URR5 gr`)r�r�rls r0r��transformingwriter.close���������r2c�8�URR5 gr`)r�rHrls r0rH�transformingwriter.flush�rvr2c�V�URRURU55$r`)r�rrr)rYrbs  r0r�transformingwriter.write�s���x�x�~�~�d�l�l�4�0�1�1r2)rrr�N)r�rrzCallable[[bytes], bytes]r�rr)rbr�r�r )
rtrurvrwrxr]r�rHrrzr5r2r0rprp�s��=����2r2rps\r*\nc�.�[RSU5$)Nr���_eolre�sub�r[s r0�tolfr��s���:�:�e�Q��r2c�.�[RSU5$)N�
r|rs r0�tocrlfr��s���:�:�g�q�!�!r2c�"�[U[5$r`)rpr�r�s r0�_crlfwriterr��s���b�&�)�)r2r�c��[er`��NotImplementedErrorrs r0�tonativeeolr�����!�!r2c��[er`r�rs r0�
fromnativeeolr��r�r2c��[er`r�r�s r0�nativeeolwriterr��r�r2c��U$r`r5r�s r0�iterfiler��s��
�Ir2c#�R# �UHnUR5Shv�N M gN	7fr`)r�)�iteratorr�s  r0�	iterlinesr��s$������#�#�%�%�%��%�s�'�%�
'c�z�[RR[RRU55$r`)r,r��
expanduser�
expandvarsr�s r0�
expandpathr��s&��
�7�7���b�g�g�0�0��6�7�7r2c�^^�T=(d SmSRTR55nU(a$USU--
n[U5S:�aUSSnOUnUTU'[R"SX4-5nURUU4SjU5$)a�Return the result of interpolating items in the mapping into string s.

prefix is a single character string, or a two character string with
a backslash as the first character if the prefix needs to be escaped in
a regular expression.

fn is an optional function that will be applied to the replacement text
just before replacement.

escape_prefix is an optional flag that allows using doubled prefix for
its escaping.
c��U$r`r5rs r0r��interpolate.<locals>.<lambda>s��!r2�|rNs%s(%s)c�<>�T"TUR5SS5$)Nr)r)r�rA�mappings ��r0r�r�s���2�g�a�g�g�i���m�4�5r2)r�r�r�rr�r~)r�r�r[rA�
escape_prefix�patterns�prefix_char�rs ` `    r0�interpolater��s����
�	��B��y�y�����(�H���D�6�M�!���v�;��?� ���*�K� �K�*����
�
�
�j�F�#5�5�6�A��5�5�5�q�9�9r2g@�@s%.0f ss%.1f ss%.2f ss%.3f sg����MbP?s%.1f mss%.2f mss%.3f msg���ư>s%.1f uss%.2f uss%.3f usg��&�.>s%.1f nss%.2f nss%.3f nsc���\rSrSrSr\R"\R"S5S9r\R"SS9r	\R"SS9r
Sr\R"\5rSrg	)
�timedcmstatsi)zFStats information produced by the timedcm context manager on entering.c��[5$r`)�timerr5r2r0r��timedcmstats.<lambda>/s���r2)r:rrc�R�UR(a[UR5$S$)Ns	<unknown>)�elapsed�	timecountrls r0�	__bytes__�timedcmstats.__bytes__6s��*.�,�,�y����&�H�L�Hr2r5N)rtrurvrwrxr�ib�Factory�startr�r	r�r�	strmethod�__str__rzr5r2r0r�r�)sT��P�
�G�G�D�L�L��9�:�E��g�g�a� �G��G�G�A��E�I�� � ��+�Gr2r�c'�# �[=RS-
sl[[RS9n[R"U/UQ76 Uv� SSS5 [5UR-
Ul[=RS-slg!,(df   ND=f![5UR-
Ul[=RS-slf=f7f)z�A context manager that produces timing information for a given context.

On entering a timedcmstats instance is produced.

This context manager is reentrant.

r)r	N)�timedcm�_nestedr�r�logr�r�r�)�	whencefmt�
whenceargs�timing_statss   r0r�r�<s�����O�O�q��O��g�o�o�6�L��
�[�[��
0�Z�
0���1� %�w��);�);�;������1���	1�
0�� %�w��);�);�;������1���s4�1C�B�B�B�6C�
B�B�7C�Cc�^�U4SjnU$)z�Report the execution time of a function call to stderr.

During development, use as a decorator when you need to measure
the cost of a function, e.g. as follows:

@util.timed
def foo(a, b, c):
    pass
c�H>�[[R"TR55nT"U0UD6nSSS5 [R
nUR
SSWR-S-[R"TR5U4-5 W$!,(df   Ne=f)Ns	%s%s: %s
� r)r�r�bytestrrtrrGrr	)r�r��
time_statsr�rGr*s     �r0r��timed.<locals>.wrapper^s����
�X�%�%�d�m�m�4�
5���4�*�6�*�F�6����������z�'�'�'�!�+�� � ����/���
�	
��
�6�
5�s�	B�
B!r5r�s` r0�timedr�Ss�����Nr2))�mr6)�kr�)�grm)skbr�)smbr6)sgbrm)�brc
�L�UR5R5n[HAup#URU5(dM[	[US[
U5*5U-5s $ [	U5$![a# [R"[S5U-5ef=f)z~Convert a space specifier to a byte count.

>>> sizetoint(b'30')
30
>>> sizetoint(b'2.2kb')
2252
>>> sizetoint(b'6M')
6291456
Nscouldn't parse size: %s)�striprn�
_sizeunitsrir r^r�r�rrhrW)r[rrr\�us    r0�	sizetointr�zs���	
���	����A�B��D�A��z�z�!�}�}��5��9�c�!�f�W��.��2�3�3���1�v�
���B����q�!;�<�q�@�A�A�B�s�A6�%A6�)A6�6-B#c�2�\rSrSrSrSrSSjrS	SjrSrg)
�hooksi�z�A collection of hook functions that can be used to extend a
function's behavior. Hooks are called in lexicographic order,
based on the names of their sources.c��/Ulgr`��_hooksrls r0r]�hooks.__init__�s	����r2c�<�URRX45 gr`)r�r�)rYr��hooks   r0�add�	hooks.add�s�������F�>�*r2c��URRSS9 /nURHup4URU"U65 M U$)Nc��US$r4r5r�s r0r�� hooks.__call__.<locals>.<lambda>�s��q��tr2)rg)r��sortr�)rYr��resultsr�r�s     r0�__call__�hooks.__call__�sA�������^��,��� �K�K�L�F��N�N�4��;�'�(��r2r�N)r�r�r�rr�r)r�r	)	rtrurvrwrxr]r�r�rzr5r2r0r�r��s��,��+�r2r�c
#�^# �[R"5SU*S-
VVVVs/sH7upEpgU[R"U5U4-[R"U54PM9 snnnnU*SnU(a1[	SU55n	UHup�UcX�U4v� MXX�4-v� M ggs snnnnf7f)a�Yields lines for a nicely formatted stacktrace.
Skips the 'skip' last entries, then return the last 'depth' entries.
Each file+linenumber is formatted according to fileline.
Each line is formatted according to line.
If line is None, it yields:
  length of longest filepath+line number,
  filepath+linenumber,
  function

Not be used in production code but very convenient while developing.
Nrc3�># �UHn[US5v� M g7f�rNr8)�.0�entrys  r0�	<genexpr>�!getstackframes.<locals>.<genexpr>�s���7�w�e�C��a��M�M�w�s�)r�
extract_stackr�sysbytesr�)�skipr��fileliner
rA�lnr*�_text�entries�fnmax�fnlns           r0�getstackframesr��s����$-�#:�#:�#<�[��u�q�y�#I��#I��B�D�
�X�&�&�r�*�B�/�	/��1B�1B�4�1H�I�#I��
�f�g��G���7�w�7�7��!�J�D��|��D�)�)��T�0�0�0�	"���	�s�"B-�>B%
�"AB-s
stacktracer2c���U(aUR5 URSXPR54-5 [US-US9HnURXV-5 M UR5 g)aCWrites a message to f (stderr) with a nicely formatted stacktrace.
Skips the 'skip' entries closest to the call, then show 'depth' entries.
By default it will flush stdout first.
It can be used everywhere and intentionally does not require an ui object.
Not be used in production code but very convenient while developing.
s	%s%s at:
r)r
N)rHr�rstripr�)rIr�r,�otherfr
r�r�s       r0�debugstacktracer��sV��������G�G�M�V�Z�Z�\�2�2�3��t�a�x�u�5��	����
��6��G�G�Ir2c��Uc
[5nSX4-nXB;aXC;aU$[R"S5HnSXU4-nXB;dMXC;dMUs $ g)a�
Generate a name that it is safe to rename f to in the given context.

f:      filename to rename
tag:    a string tag that will be included in the new name
ctx:    a context, in which the new name must not exist
others: a set of other filenames that the new name must not be in

Returns a file name of the form oldname~tag[~number] which does not exist
in the provided context and is not in the set of other names.
Ns%s~%srs%s~%s~%s)�set�	itertoolsr_)r,�tag�ctx�othersrAr"s      r0�safenamer��s[���~����	�Q�H�	�B�	�}��)��	�
�_�_�Q�
��
�A�A�;�
&��
�=�R�-��I� r2c��URU5n[U5U:a-[R"[	S5[U5U4-5eU$)z=read n bytes from stream.read and abort if less was availables5stream ended unexpectedly (got %d bytes, expected %d))r�r�rrVrW)�streamr"r[s   r0�readexactlyr��sK�����A��A�
�1�v��z��k�k�
�F�G��1�v�q�k�
�
�	
�
�Hr2c�H�US:a[R"SU-5eUS-nUS-n/nU(a;UR[R"SU-55 US-nUS-nU(aM;UR[R"U55 SRU5$)aEncode an unsigned integer value to a varint.

A varint is a variable length integer of 1 or more bytes. Each byte
except the last has the most significant bit set. The lower 7 bits of
each byte store the 2's complement representation, least significant group
first.

>>> uvarintencode(0)
'\x00'
>>> uvarintencode(1)
'\x01'
>>> uvarintencode(127)
'\x7f'
>>> uvarintencode(1337)
'\xb9\n'
>>> uvarintencode(65536)
'\x80\x80\x04'
>>> uvarintencode(-1)
Traceback (most recent call last):
    ...
ProgrammingError: negative value for uvarint: -1
rsnegative value for uvarint: %d���r2)rr!r�r�bytechrr�)r8r7r�s   r0�
uvarintencoder��s���.
�q�y��$�$�%F��%N�O�O��4�<�D�	�a�K�E��E�
�
���X�%�%�d�T�k�2�3��t�|��
�!����%�
�L�L��!�!�$�'�(��8�8�E�?�r2c�p�SnSn[[US55nXS-U--nUS-(dU$US-
nM2)aDecode an unsigned variable length integer from a stream.

The passed argument is anything that has a ``.read(N)`` method.

>>> from io import BytesIO
>>> uvarintdecodestream(BytesIO(b'\x00'))
0
>>> uvarintdecodestream(BytesIO(b'\x01'))
1
>>> uvarintdecodestream(BytesIO(b'\x7f'))
127
>>> uvarintdecodestream(BytesIO(b'\xb9\n'))
1337
>>> uvarintdecodestream(BytesIO(b'\x80\x80\x04'))
65536
>>> uvarintdecodestream(BytesIO(b'\x80'))
Traceback (most recent call last):
    ...
Abort: stream ended unexpectedly (got 0 bytes, expected 1)
rrr�r�r�)rmr�)r�r��shift�bytes    r0�uvarintdecodestreamr
sM��*�F�
�E�
��;�r�1�%�&���$�;�5�(�(���t���M�
��
��r2c#�# �[R"[RS5nUS:XaQ[R"[RS5 Sv� [R"[RU5 gSv� g![Ra NEf=f![R"[RU5 f=f7f)N�Cr;)�locale�	setlocale�LC_CTYPEr2)�oldlocs r0�
with_lc_ctyper	F
s����
�
�
�f�o�o�t�
4�F�
��}�		6�
�� � ����"�5�

����V�_�_�f�5�
���<�<�
��
��
���V�_�_�f�5�s:�,C�%B�B�+C�B�B�B�B�'C�Cc��^^	�[RRS5(adSSKJmJm	 SSKJnJnJ	nJ
n "UU	4SjSU5nU"5nU"U5UlURRU"U55 UR$[R "[R"S5n[R "[R"S5nXg-$![$a g	[&a g	f=f)
z}Provide an estimate for the available system memory in Bytes.

If no estimate can be provided on the platform, returns None.
swinr)�c_long�c_ulonglong)�	Structure�byref�sizeof�windllc
�b>�\rSrSrSY4SY4SY4SY4SY4SY4SY4S	Y4S
Y4/	rSrg)
�'_estimatememory.<locals>.MEMORYSTATUSEXih
�dwLength�dwMemoryLoad�ullTotalPhys�ullAvailPhys�ullTotalPageFile�ullAvailPageFile�ullTotalVirtual�ullAvailVirtual�ullExtendedVirtualr5N)rtrurvrw�_fields_rz)�DWORD�	DWORDLONGs��r0�MEMORYSTATUSEXrh
sR����U�#���'���+���+�#�Y�/�#�Y�/�"�I�.�"�I�.�%�y�1�
�Hr2r�SC_PAGE_SIZE�
SC_PHYS_PAGESN)r�sysplatform�
startswith�ctypesrr�ctypes.wintypesr
rrrr�kernel32�GlobalMemoryStatusExrr,�sysconf�
sysconf_namesr"r�)
r
rrrrr��pagesize�pagesrrs
        @@r0�_estimatememoryr,X
s����
���&�&�v�.�.�	E�	
�	
�	�	�Y�	�
����A�Y��
����,�,�U�1�X�6��~�~��

��:�:�b�.�.�~�>�?���
�
�2�+�+�O�<�=�������
���
��
�s�AC�
C6�*	C6�5C6)r/r r�r)rr�r�r�r)Nrr`)r�i)r�r)r�r�r�r�r�r�r�r�)FFFNNTr
)r�r�r�zOptional[bytes])r{r�r|r�r�r)r|r�r�r�)r�r�r�r�)r$r�r�r�r�r�)r�r�r�r�)r�r�r�zList[bytes])FNF)
r$r�r�r�r��
Optional[int]r�r�r�r�)FT)r,r�rr�rr�r�r)r,r�r�r�r)r$r�r�r-r!r�r�r)r�r�r�r�)r�r�r+r�r�r)rir rjr r�zTuple[int, int])r[r�r�r�)r��typelib.BinaryIO_Proxyr�r.)r�zIterable[bytes]r�zIterator[bytes])r[r�r�r )rs %-*s in %s
s%s:%dr)r�r-(rx�
__future__rrdr��
contextlibr%r��hashlib�ior�rr�r,�pickle�rerr*r�rF�timer�typingrBrrrrrr	r
rrr
r�r�
thirdpartyr�
TYPE_CHECKING�hgdemandimportrr;rrrrrrr�
interfacesr�int_miscr�intmod�utilsrrrr�typing_extensionsrr �	importmodr#rr$�	b85decode�	b85encode�	cookielib�httplib�safehasattr�socketserver�BytesIO�bytesio�stringio�	xmlrpclib�
httpserver�urlerr�urlreqr�rkr+r%r.r&rWr�bindunixsocket�	cachestat�	checkexec�	checklinkr-�expandglobs�getfsmountpointr �get_password�groupmembers�	groupname�isexec�isownerrHr��	lookupregrr�r�r��normcasespec�normcasefallback�
openhardlinksr$�parsepatchoutputr��pollr�r)rr�
samedevice�samefile�samestat�setflagsrr�r'�
statisexec�
statislinkr-r�usernamer(r1�compengines�
SERVERROLE�
CLIENTROLErrsr9r��environr�rA�filterwarningsrErL�md5�sha1�sha512rUrpr\rQr|r��	NameErrorr�r�r�r�r�r�r�r�r�r�r�r�r�rrJr'r4r!�OrderedDictr?r�rNrQ�ABCrS�contextmanagerrirlrnryr�r�r�r�r�r�r�r�r�rLrr
r#r+rIrorlrsr��checkosfilename�clockrr�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�r)r�rrrrr&r,r1r3�DEFAULT_FILE_CHUNKr�rRrfrk�	bytecount�BinaryIO_Proxyrpr�r}r�r�r��	oslinesepr�r�r��identityr�r�r�r�r�r[r�r�r�r�r�r��IHooksr�r�rG�stdoutr�rKr�r�r�rr	r,r5r2r0�<module>rzsH���#�
����	��	��
��	���
��
���
�������
����"�������
����	����
����
�G�5�)�E��(�(��2��
�2�	�	�	�(�	#�����	����	����	�
�
�
���"�"���$�$��
�*�*�������	�
�
$�
$�
�	�	�	��	�	�	���#�#�����%�#��F�F��
�
�
���(�(�����	����	����	������"�"���*�*�����	��$�$���$�$�����	�	����
�
�
��
�.�.�����	����	�
�
�
��	�������������$�$���,�,���&�&�
�	�����,�,�������}�}�����	�����	����
�
 �
 �
�
�
 �
 �
������������������F�K��);�);�<�	�
�
 �
 �
�
�
 �
 �
�����	��������
�����Z�8�J�)��%�%��
�
#�
#�
�
�
#�
#�
��(����x���#�#�$5�6�
7��
�
���I�r�+=�{�K����I�r�+=�w�G����I�r�+=�z�J�
�����,� 2�K��
����+�-?���
����&���	�� 
�K�K�
�]�]��~�~���3��	�A���<��<�
�-�-�`"�"�J	!�
�F��
�k�k�\�+�\��o
�o
�d'� 1�'�T
�� x
�x
�v"�"�Ja�*�a�JIM�
)� D
�&�D
�V�����%�0�TJ�n
�>��,$�{�&�&�$�N�c�4��6�#�x���C�G�G��2������$��������0c�c�L	
�>(�(���B��%�&��������?�?�?��D�?�6���(�
��
���M=�`*�Z��0��:�z	��n�d�+�����&�O���
�
����.�.�O���	�	���,	� ��0�
������D�
�D �D �N	�U����)�X�B�&�� $�!�	-�
�-�
�-��-��	-�
�-�`c!�c!�LD�D�N�:>�
��
�!�
�26�
�	�
� 	�AF��
��$��9=��	��>�
�
�
g�g�T#��-�D��,$�$�N	� �,
��'�1�Z�=�!���!�J�-� ����:����'�1�Z�=�!���!�J�-� ����:����'�1�Z�=�!���!�J�-� ����:�����1�]���
�	�2��/�/�2�(
���y�	!�� �"�*����� ��K��M�!�O��#�#�K��%�%�M��'�'�O�	���"�"�"�
�&�
8�:�4
���Q�y�\���!�Q�y�\����A�i�L����1�Y�<���%��:������*�
����q��}���(�A�j�M�"���1�Z�=�!���!�J�-� ��+�q��}�%���a�
�m�$���Q�z�]�#�
�	�"���,�,��,�$������&����8�
�B�(�H�O�O��&1�4	�	
��o�o��?�?�
��
�.���0
�"�J�T������",
��y_�!�!�!��r<���D��s$�7h$�!h6�$h3�2h3�6i�i

Youez - 2016 - github.com/yon3zu
LinuXploit