403Webshell
Server IP : 50.21.180.56  /  Your IP : 216.73.216.139
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : ws67922704 ( 67922704)
PHP Version : 8.5.13
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /kunden/proc/self/root/usr/lib/python3/dist-packages/breezy/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /kunden/proc/self/root/usr/lib/python3/dist-packages/breezy/__pycache__/lockdir.cpython-313.pyc
�

p��g�����SrSSKrSSKrSSKrSSKJrJrJrJrJ	r	J
r
Jr SSKJ
r
 SSKJrJrJrJrJrJrJrJrJrJr SSKJr SSK	JrJrJr SS	KJrJr SS
K J!r!J"r" Sr#Sr$"S
S\RJ5r&"SS5r'Sr(g)a�On-disk mutex protecting a resource.

bzr on-disk objects are locked by the existence of a directory with a
particular name within the control directory.  We use this rather than OS
internal locks (such as flock etc) because they can be seen across all
transports, including http.

Objects can be read if there is only physical read access; therefore
readers can never be required to create a lock, though they will
check whether a writer is using the lock.  Writers can't detect
whether anyone else is reading from the resource as they write.
This works because of ordering constraints that make sure readers
see a consistent view of existing data.

Waiting for a lock must be done by polling; this can be aborted after
a timeout.

Locks must always be explicitly released, typically from a try/finally
block -- they are not released from a finalizer or when Python
exits.

Locks may fail to be released if the process is abruptly terminated
(machine stop, SIGKILL) or if a remote transport becomes permanently
disconnected.  There is therefore a method to break an existing lock.
This should rarely be used, and generally only with user approval.
Locks contain some information on when the lock was taken and by who
which may guide in deciding whether it can safely be broken.  (This is
similar to the messages displayed by emacs and vim.) Note that if the
lock holder is still alive they will get no notification that the lock
has been broken and will continue their work -- so it is important to be
sure they are actually dead.

A lock is represented on disk by a directory of a particular name,
containing an information file.  Taking a lock is done by renaming a
temporary directory into place.  We use temporary directories because
for all known transports and filesystems we believe that exactly one
attempt to claim the lock will succeed and the others will fail.  (Files
won't do because some filesystems or transports only have
rename-and-overwrite, making it hard to tell who won.)

The desired characteristics are:

* Locks are not reentrant.  (That is, a client that tries to take a
  lock it already holds may deadlock or fail.)
* Stale locks can be guessed at by a heuristic
* Lost locks can be broken by any client
* Failed lock operations leave little or no mess
* Deadlocks are avoided by having a timeout always in use, clients
  desiring indefinite waits can retry or set a silly big timeout.

Storage formats use the locks, and also need to consider concurrency
issues underneath the lock.  A format may choose not to use a lock
at all for some operations.

LockDirs always operate over a Transport.  The transport may be readonly, in
which case the lock can be queried but not acquired.

Locks are identified by a path name, relative to a base transport.

Calling code will typically want to make sure there is exactly one LockDir
object per actual lock on disk.  This module does nothing to prevent aliasing
and deadlocks will likely occur if the locks are aliased.

In the future we may add a "freshen" method which can be called
by a lock holder to check that their lock has not been broken, and to
update the timestamp within it.

Example usage:

>>> from breezy.transport.memory import MemoryTransport
>>> # typically will be obtained from a BzrDir, Branch, etc
>>> t = MemoryTransport()
>>> l = LockDir(t, 'sample-lock')
>>> l.create()
>>> token = l.wait_lock()
>>> # do something here
>>> l.unlock()

Some classes of stale locks can be predicted by checking: the host name is the
same as the local host name; the user name is the same as the local user; the
process id no longer exists.  The check on user name is not strictly necessary
but helps protect against colliding host names.
�N�)�config�debug�errors�lock�osutils�ui�urlutils)�only_raises)
�DirectoryNotEmpty�LockBreakMismatch�
LockBroken�LockContention�LockCorrupt�
LockFailed�LockNotHeld�	PathError�ResourceBusy�TransportError)�gettext)�format_delta�
get_host_name�
rand_chars)�mutter�note)�
FileExists�
NoSuchFile�g�?c��\rSrSrSrSrS!SjrSr\"S5r	S"Sjr
S	rS
rSr
Sr\"\\5S
5rSrSrSrSrSrSrSrSrSrSrS#SjrSrSrS"Sjr Sr!Sr"Sr#Sr$S r%g)$�LockDir�z#Write-lock guarding access to data.z/infoNc���XlX lSUlSUlSUlUS-UlUR
UR-UlX0lX@l	[UlXPlSUl
g)azCreate a new LockDir object.

The LockDir is initially unlocked - this just creates the object.

:param transport: Transport which will contain the lock

:param path: Path to the lock within the base directory of the
    transport.

:param extra_holder_info: If passed, {str:str} dict of extra or
    updated information to insert into the info file when the lock is
    taken.
Fz/heldN)�	transport�path�
_lock_held�_locked_via_token�_fake_read_lock�	_held_dir�_LockDir__INFO_NAME�_held_info_path�_file_modebits�
_dir_modebitsr�_report_function�extra_holder_info�_warned_about_lock_holder)�selfr#r$�
file_modebits�dir_modebitsr.s      �0/usr/lib/python3/dist-packages/breezy/lockdir.py�__init__�LockDir.__init__�si��*#���	����!&���$��������#�~�~��0@�0@�@���+��)�� $���!2��)-��&�c��SRURRURRUR
5$)Nz{}({}{}))�format�	__class__�__name__r#�baser$�r0s r3�__repr__�LockDir.__repr__�s4��� � ��N�N�#�#�T�^�^�%8�%8�$�)�)�
�	
r6c��UR$�N)r%r<s r3�<lambda>�LockDir.<lambda>�s��D�O�Or6c��URS5 URRURUS9 g![[
4an[
X5eSnAff=f)z�Create the on-disk lock.

This is typically only called when the object/directory containing the
directory is first created.  The lock is not held when it's created.
zcreate lock directory��modeN)�_tracer#�mkdirr$rrr)r0rE�es   r3�create�LockDir.create�sQ��	
���+�,�	&��N�N� � ����� �6���	�*�	&��T�%�%��	&�s�$8�A�A�Ac�D�URS5 [R"5nUR5nURRX R5 UR5nURSU5 Uc[
US	5eUR&UR&:waURS
5 [)U5eSUlURS[R"5U-
S-5 UR&$![R[
4a"nURSU5 [
X5eSnAff=f![R[
[[[4a~nURSU5 UR5nURSRU55 URU5 SnAOY![ a UR#U5 ef=fSnAf[$a)nURSU5 UR#U5 eSnAff=fGM�)
a�Make the pending directory and attempt to rename into place.

If the rename succeeds, we read back the info file to check that we
really got the lock.

If we fail to acquire the lock, this method is responsible for
cleaning up the pending directory if possible.  (But it doesn't do
that yet.)

:returns: The nonce of the lock, if it was successfully acquired.

:raises LockContention: If the lock is held by someone else.  The
    exception contains the info of the current holder of the lock.
z
lock_write...z$... failed to create pending dir, %sNTz... contention, %szother holder is {!r}z... lock failed, %szafter locking, info=%rz0lock was renamed into place, but now is missing!z8rename succeeded, but lock is still held by someone elsez... lock succeeded after %dms��)rF�time�_create_pending_dirrrrrr#�renamer(rrr�peekr8�_handle_lock_contention�
BaseException�_remove_pending_dir�	Exception�noncerr%)r0�
start_time�tmpnamerH�other_holder�infos      r3�
_attempt_lock�LockDir._attempt_lock�s���	
���O�$��Y�Y�[�
�	&��.�.�0�G��
����%�%�g�~�~�>��>�y�y�{�����,�d�3��<��T�#U�V�V��:�:����#��K�K�R�S� ��&�&�������3�d�i�i�k�J�6N�RV�5V�W��z�z���]�%�%�y�1�	&��K�K�>��B��T�%�%��	&���%�%��!����
����0�!�4�#�y�y�{�����2�9�9�,�G�H���0�0��>�>��$���,�,�W�5�����
����1�1�5��(�(��1���
��'sM�D�%E�E�D<�<E�)H�-AG&�0G�G#�#G&�&
H�3$H�Hc��Ub�UR5(a�UR5RS5(a~[RRS[R"URRUR5[U5S9 URU5 URS5 g[U5e)a�A lock we want to take is held by someone else.

This function can: tell the user about it; possibly detect that it's
safe or appropriate to steal the lock, or just raise an exception.

If this function returns (without raising an exception) the lock will
be attempted again.

:param other_holder: A LockHeldInfo for the current holder; note that
    it might be None if the lock can be seen to be held but the info
    can't be read.
Nzlocks.steal_dead�locks_steal_dead)�lock_url�other_holder_infozstole lock from dead holder)�is_lock_holder_known_dead�
get_config�getr	�
ui_factory�show_user_warningr
�joinr#r;r$�str�force_breakrFr)r0rXs  r3rQ�LockDir._handle_lock_contentions����#��5�5�7�7��?�?�$�(�(�);�<�<��M�M�3�3�*�!)���t�~�~�/B�/B�D�I�I�!N�*-�l�*;�4��
�$�$�\�2��K�K� =�>���T�"�"r6c��URSU5 URRXR-5 URR	U5 g![
an[
[S5U5 SnAgSnAff=f)z�Remove the pending directory.

This is called if we failed to rename into place, so that the pending
dirs don't clutter up the lockdir.
z	remove %szerror removing pending lock: %sN)rFr#�deleter)�rmdirrrr)r0rWrHs   r3rS�LockDir._remove_pending_dir0sj��	
���K��)�	@��N�N�!�!�'�,<�,<�"<�=��N�N� � ��)���	@���:�;�Q�?�?��	@�s�AA�
B�!A;�;Bc��SRUR[S55nURR	U5 [RUR5nURUlURRXR-UR55 U$![
aH UR
S5 URURS9 URR	U5 N�f=f)Nz	{}/{}.tmp�
z*lock directory does not exist, creating itrD)r8r$rr#rGrrFrIr,�LockHeldInfo�for_this_processr.rU�put_bytes_non_atomicr)�to_bytes)r0rWrYs   r3rN�LockDir._create_pending_dir=s����$�$�T�Y�Y�
�2��?��		*��N�N� � ��)��,�,�T�-C�-C�D���Z�Z��
�
	
���+�+�G�6F�6F�,F��
�
��X�����	*�
�K�K�D�E��K�K�T�/�/�K�0��N�N� � ��)�	*�s�B*�*AC<�;C<c���UR(aSUlgUR(d[R"U5$UR(aSUlSUlgUR
n[R"5nURS5 SRUR[S55nUR5 URRURU5 SUlURRX0R -5 URR#U5 URS[R"5U-
S-5 [R("URR+UR5U5nUR,S	HnU"U5 M
 g![$a0 URSU5 URR'U5 N�f=f)
zRelease a held lock.FN�	unlockingz{}/releasing.{}.tmp�z2doing recursive deletion of non-empty directory %sz... unlock succeeded after %dmsrL�
lock_released)r'r%r�cant_unlock_not_heldr&rUrMrFr8r$r�confirmr#rOr(rjr)rkr�delete_tree�
LockResult�abspath�hooks)r0�	old_noncerVrW�result�hooks      r3�unlock�LockDir.unlockRsy�����#(�D� ������,�,�T�2�2��!�!�%*�D�"�#�D�O��
�
�I�����J��K�K��$�+�2�2�4�9�9�j��n�M�G��L�L�N��N�N�!�!�$�.�.�'�:�#�D�O��N�N�!�!�'�,<�,<�"<�=�

4����$�$�W�-�
�K�K�1�D�I�I�K�*�4L�PT�3T�
��_�_�T�^�^�%;�%;�D�I�I�%F�	�R�F��
�
�?�3���V��4��%�
4�
���H�'�����*�*�7�3�
4�s�F<�<7G6�5G6c��UR5 UR5nUb|[RRSSS[U505(aJURU5n[RRSR
UR55 ggg![aXn[RRSR
U55(aURUR5 SnAgSnAff=f)a,Break a lock not held by this instance of LockDir.

This is a UI centric function: it uses the ui.ui_factory to
prompt for input if a lock is detected and there is any doubt about
it possibly being still active.  force_break is the non-interactive
version.

:returns: LockResult for the broken lock.
zBreak (corrupt {!r})NzBreak %(lock_info)szbreezy.lockdir.break�	lock_infoz
Broke lock {})�_check_not_lockedrPrr	rc�get_booleanr8�force_break_corrupt�	file_data�confirm_actionrfrg�show_messager^)r0�holder_inforHrs    r3�
break_lock�LockDir.break_lock{s���	
��� �	��)�)�+�K��"��}�}�+�+�%�&��c�+�.�/���
�)�)�+�6���
�
�*�*�?�+A�+A�&�/�/�+R�S�
�#���	��}�}�(�(�)?�)F�)F�t�)L�M�M��(�(����5���		�s�B"�"
D�,AC?�?Dc���[U[5(d[SRU55eUR	5 UR5nUcgX!:wa[
XU5eSRUR[S55nURRURU5 X0R-nURU5nXQ:wa[
XU5eURRU5 URRU5 [ R""URR%UR5UR&5nUR(SHnU"U5 M
 U$)a�Release a lock held by another process.

WARNING: This should only be used when the other process is dead; if
it still thinks it has the lock there will be two concurrent writers.
In general the user's approval should be sought for lock breaks.

After the lock is broken it will not be held by any process.
It is possible that another process may sneak in and take the
lock before the breaking process acquires it.

:param dead_holder_info:
    Must be the result of a previous LockDir.peek() call; this is used
    to check that it's still held by the same process that the user
    decided was dead.  If this is not the current holder,
    LockBreakMismatch is raised.

:returns: LockResult for the broken lock.
zdead_holder_info: {!r}N�{}/broken.{}.tmprv�lock_broken)�
isinstancero�
ValueErrorr8r�rPr
r$rr#rOr(r)�_read_info_filerjrkrr{r|rUr})r0�dead_holder_info�current_inforW�broken_info_path�broken_inforr�s        r3rg�LockDir.force_break�s3��&�*�L�9�9��5�<�<�=M�N�O�O���� ��y�y�{������+�#�D�8H�I�I�$�+�+�D�I�I�z�"�~�F�������d�n�n�g�6�#�%5�%5�5���*�*�+;�<���*�#�D�7G�H�H������.�/������W�%�������!7�!7��	�	�!B�L�DV�DV�W���J�J�}�-�D���L�.��
r6c�t�UR5 SRUR[S55nURRURU5 X R-nURRU5n[R"U5nXQ:wa[XU5eURRU5 URRU5 [R"URR!UR55nUR"SHnU"U5 M
 g)aCRelease a lock that has been corrupted.

This is very similar to force_break, it except it doesn't assume that
self.peek() can work.

:param corrupt_info_lines: the lines of the corrupted info file, used
    to check that the lock hasn't changed between reading the (corrupt)
    info file and calling force_break_corrupt.
r�rvr�N)r�r8r$rr#rOr(r)�	get_bytesr�split_linesr
rjrkrr{r|r})r0�corrupt_info_linesrWr��broken_content�broken_linesrr�s        r3r��LockDir.force_break_corrupt�s���	
��� �$�+�+�D�I�I�z�"�~�F�������d�n�n�g�6�#�%5�%5�5�����1�1�2B�C���*�*�>�:���-�#�D�8J�K�K������.�/������W�%�������!7�!7��	�	�!B�C���J�J�}�-�D���L�.r6c�Z�UR(a[SRU55eg)z5If the lock is held by this instance, raise an error.zcan't break own lock: {!r}N)r%�AssertionErrorr8r<s r3r��LockDir._check_not_locked�s%���?�?� �!=�!D�!D�T�!J�K�K�r6c���UR(d[U5eUR5nUc[U5eURUR:wa[U5eg)a,Make sure that the lock is still held by this locker.

This should only fail if the lock was broken by user intervention,
or if the lock has been affected by a bug.

If the lock is not thought to be held, raises LockNotHeld.  If
the lock is thought to be held but has been broken, raises
LockBroken.
N)r%rrPrrU�r0rYs  r3ry�LockDir.confirm�sQ������d�#�#��y�y�{���<��T�"�"��:�:����#��T�"�"�$r6c�^�[RURRU55$)zRRead one given info file.

peek() reads the info file of the lock holder, if any.
)ro�from_info_file_bytesr#r�)r0r$s  r3r��LockDir._read_info_file�s$��
�0�0����1I�1I�$�1O�P�Pr6c��URUR5nURS5 U$![a URS5 gf=f)z�Check if the lock is held by anyone.

If it is held, this returns the lock info structure as a dict
which contains some information about the current lock holder.
Otherwise returns None.
zpeek -> heldzpeek -> not heldN)r�r*rFrr�s  r3rP�LockDir.peek�sJ��	,��'�'��(<�(<�=�D��K�K��'��K���	,��K�K�*�+�	,�s�-0�A�
Ac��g)z;Write information about a pending lock to a temporary file.N�r<s r3�
_prepare_info�LockDir._prepare_info
s�r6c�"�UR(a[U5eUR5n[R"UR
R
UR5UR5nURSHnU"U5 M
 U$)z�Take the lock; fail if it's already held.

If you wish to block until the lock can be obtained, call wait_lock()
instead.

:return: The lock token.
:raises LockContention: if the lock is held by someone else.
�
lock_acquired)
r'rrZrr{r#r|r$rUr})r0r�hook_resultr�s    r3�attempt_lock�LockDir.attempt_locksm����� ��&�&��#�#�%���o�o�d�n�n�&<�&<�T�Y�Y�&G����T���J�J��/�D����0��
r6c��URRUR5nURS5(aUR	S5SnU$SnU$)z?Give a nicely-printable representation of the URL of this lock.zfile://z.bzr/r�)r#r|r$�
startswith�split)r0r^s  r3�lock_url_for_display�LockDir.lock_url_for_display!sS���>�>�)�)�$�)�)�4�����y�)�)��~�~�g�.�q�1�H����H��r6c�V�Uc[nUc[n[R"5U-nSnSnSnUR5nUS-
nUR	5$![
a Of=fUR
5n	U	b�X�:wa�Uc[S5n
O[S5n
U	n[S5RX�U	5nUc+[R"S[R"U55nUS:�aUS[S	5U---
nUS[S
5--
nURU5 Ub!Xs:�aURS5 [U5e[R"5U-U:a)URSU5 [R"U5 OURS
U5 [SU5eGMi)a%Wait a certain period for a lock.

If the lock can be acquired within the bounded time, it
is taken and this returns.  Otherwise, LockContention
is raised.  Either way, this function should return within
approximately `timeout` seconds.  (It may be a bit more if
a transport operation takes a long time to complete.)

:param timeout: Approximate maximum amount of time to wait for the
lock, in seconds.

:param poll: Delay in seconds between retrying the lock.

:param max_attempts: Maximum number of times to try to lock.

:return: The lock token.
NrrzUnable to obtainzLock owner changed forz{0} lock {1} {2}.z%H:%M:%S�
z7Will continue to try until %s, unless you press Ctrl-C.z#See "brz help break-lock" for more.zexceeded %d attemptszwaiting %ssztimeout after waiting %ssz(local))�_DEFAULT_TIMEOUT_SECONDS�_DEFAULT_POLL_SECONDSrMr�r�rrPrr8�strftime�	localtimer-rF�sleep)r0�timeout�poll�max_attempts�deadline�deadline_str�	last_info�
attempt_countr^�new_info�start�msgs            r3�	wait_lock�LockDir.wait_lock,s���$�?�.�G��<�(�D��9�9�;��(�����	��
��,�,�.����Q��M�
��(�(�*�*��!�
��
���y�y�{�H��#��(=��$�#�$6�7�E�#�$<�=�E�$�	��1�2�9�9�%�8�T���'�#'�=�=��T�^�^�H�=U�#V�L��Q�;���!�U��'�'�'��C��t�g�&K�L�L�L���%�%�c�*��(�}�/L����2�3�$�T�*�*��y�y�{�T�!�H�,����M�4�0��
�
�4� �
���7��A�$�Y��9�9�Ys�A�
A%�$A%c��SUlg)NT�r&r<s r3�leave_in_place�LockDir.leave_in_placexs
��!%��r6c��SUlg)NFr�r<s r3�dont_leave_in_place�LockDir.dont_leave_in_place{s
��!&��r6c�v�Ub'URU5 XlSUlSUlU$UR	5$)ayWait for and acquire the lock.

:param token: if this is already locked, then lock_write will fail
    unless the token matches the existing lock.
:returns: a token if this instance supports tokens, otherwise None.
:raises TokenLockingNotSupported: when a token is given but this
    instance doesn't support using token locks.
:raises MismatchedToken: if the specified token doesn't match the token
    of the existing lock.

A token should be passed in if you know that you have locked the object
some other way, and need to synchronise this object's state with that
fact.

XXX: docstring duplicated from LockableFiles.lock_write.
T)�validate_tokenrUr%r&r�)r0�tokens  r3�
lock_write�LockDir.lock_write~s>��"������&��J�"�D�O�%)�D�"��L��>�>�#�#r6c�l�UR(dUR(a[U5eSUlg)z�Compatibility-mode shared lock.

LockDir doesn't support shared read-only locks, so this
just pretends that the lock is taken but really does nothing.
TN)r%r'rr<s r3�	lock_read�LockDir.lock_read�s&���?�?�d�2�2� ��&�&�#��r6c��UbPUR5nUcSnOURnX:wa[R"X5eUR	SU5 gg)Nzrevalidated by token %r)rPrUr�
TokenMismatchrF)r0r�rY�
lock_tokens    r3r��LockDir.validate_token�sQ�����9�9�;�D��|�!�
�!�Z�Z�
��"��*�*�5�=�=����5�u�=�r6c�f�S[R;ag[[U5S-X--5 g)Nrz: )r�debug_flagsrrf)r0r8�argss   r3rF�LockDir._trace�s+����*�*�*���s�4�y�4��6�=�1�2r6c�,�[R"5$)z0Get the configuration that governs this lockdir.)r�GlobalStackr<s r3ra�LockDir.get_config�s��
�!�!�#�#r6)
r,r'r+r(r*r%r&r-r/r.rUr$r#)i�i�Nr@)NNN)&r:�
__module__�__qualname__�__firstlineno__�__doc__r)r4r=�property�is_heldrIrZrQrSrNrrrr�r�rgr�r�ryr�rPr�r�r�r�r�r�r�r�r�rFra�__static_attributes__r�r6r3r r �s���-��K����
 .�D
�
�3�4�G�
&�A�F#�4@��*��j�)�&�*�&�PT�6*�X�:L�
#�(Q�,�J��"	�J:�X&�'�$�4
$�>�3�
$r6r c��\rSrSrSrSrSrSrSr\	S5r
Sr\S	5r
S
r\S5rSrS
rSrSrSrSrg)roi�a+The information recorded about a held lock.

This information is recorded into the lock when it's taken, and it can be
read back by any process with access to the lockdir.  It can be used, for
example, to tell the user who holds the lock, or to try to detect whether
the lock holder is still alive.
c��Xlgr@��	info_dict)r0r�s  r3r4�LockHeldInfo.__init__�s��"�r6c�b�SRURRUR5$)z1Return a debugging representation of this object.z{}({!r}))r8r9r:r�r<s r3r=�LockHeldInfo.__repr__�s#��� � ����!8�!8�$�.�.�I�Ir6c�>�UR5n[S5U-$)z2Return a user-oriented description of this object.zJheld by %(user)s on %(hostname)s (process #%(pid)s), acquired %(time_ago)s)�to_readable_dictr)r0�ds  r3�__str__�LockHeldInfo.__str__�s,���!�!�#���(�
��	
�	
r6c�R�URRS5nUcSnO.[[R"5URS-
5nURRSS5nURRSS5nURRSS5nX4XRS.$)z�Turn the holder info into a dict of human-readable attributes.

For example, the start time is presented relative to the current time,
rather than as seconds since the epoch.

Returns a list of [user, hostname, pid, time_ago] all as readable
strings.
rVz	(unknown)�userz	<unknown>�hostname�pid)r�r�r��time_ago)r�rbrrM)r0rVr�r�r�r�s      r3r��LockHeldInfo.to_readable_dict�s����^�^�'�'��5�
���"�H�#�D�I�I�K�$�.�.��2N�$N�O�H��~�~�!�!�&�+�6���>�>�%�%�j�+�>���n�n� � ���4���3�U�Ur6c�X�URS5nU(aURS5$S$)NrU�ascii)rb�encode)r0rUs  r3rU�LockHeldInfo.nonce�s&������!��(-�u�|�|�G�$�7�4�7r6c�8�URRU5$)z;Return the contents of a field from the lock info, or None.)r�rb)r0�
field_names  r3rb�LockHeldInfo.get�s���~�~�!�!�*�-�-r6c���[5[R"5[S5[	[
R
"55[
5S.nUbURU5 U"U5$)z;Return a new LockHeldInfo for a lock taken by this process.rv)r�r�rUrVr�)r�os�getpidr�intrM�get_username_for_lock_info�update)�clsr.rYs   r3rp�LockHeldInfo.for_this_process�sS��&���9�9�;���^��d�i�i�k�*�.�0�
���(��K�K�)�*��4�y�r6c�`�[R"UR5RS5$)Nzutf-8)�yaml�dumpr�rr<s r3rr�LockHeldInfo.to_bytess ���y�y����(�/�/��8�8r6c��[R"U5nUcU"05$U"U5$![RRa?n[R
"U5n[
SU5 [S[U5-U5eSnAff=f)z-Construct from the contents of the held file.zCorrupt lock info file: %rz could not parse lock info file: N)	r�	safe_load�reader�ReaderErrorrr�rrrf)r
�info_file_bytes�retrH�liness     r3r��!LockHeldInfo.from_info_file_bytes	s���	R��.�.��1�C�
�;��r�7�N��s�8�O���{�{�&�&�	R��'�'��8�E��/��7��@�3�q�6�I�5�Q�Q��	R�s�+�B�	:B�Bc��[U5$r@)�idr<s r3�__hash__�LockHeldInfo.__hash__s���$�x�r6c�j�[U[U55(dgURUR:H$)z Equality check for lock holders.F)r��typer��r0�others  r3�__eq__�LockHeldInfo.__eq__s)���$��U��,�,���~�~����0�0r6c��X:X+$r@r�r!s  r3�__ne__�LockHeldInfo.__ne__#s��� � r6c���URS5[5:H=(aJ URS5[R"5:H=(a URS5[	5:H$)z9True if this process seems to be the current lock holder.r�r�r�)rbrrr	rr<s r3�is_locked_by_this_process�&LockHeldInfo.is_locked_by_this_process&sS��
�H�H�Z� �M�O�3�
A������2�9�9�;�.�
A����� �$>�$@�@�	
r6c��URS5[5:wagURS5S:XagURS5[5:wagURRSS5nU(d[	SRU55 g[
U5n[R"U5$![a [	SRX55 gf=f)	a�True if the lock holder process is known to be dead.

False if it's either known to be still alive, or if we just can't tell.

We can be fairly sure the lock holder is dead if it declared the same
hostname and there is no process with the given pid alive.  If people
have multiple machines with the same hostname this may cause trouble.

This doesn't check whether the lock holder is in fact the same process
calling this method.  (In that case it will return true.)
r�F�	localhostr�r�Nzno pid recorded in {!r}zcan't parse pid {!r} from {!r})
rbrrr�rr8r
r�r�is_local_pid_dead)r0�pid_strr�s   r3r`�&LockHeldInfo.is_lock_holder_known_dead.s����8�8�J��=�?�2���8�8�J��;�.���8�8�F��9�;�;���.�.�$�$�U�D�1����,�3�3�D�9�:��	��g�,�C��(�(��-�-���	��3�:�:�7�I�J��	�s�B3�3$C�Cr�N)r:r�r�r�r�r4r=r�r�r�rUrb�classmethodrprrr�rr#r&r)r`r�r�r6r3roro�s|���#�J�	
�V�&�8��8�.�����9����� �1�!�
�.r6roc��[R"5RS5$![Ra [
R"5s$f=f)z�Get a username suitable for putting into a lock.

It's ok if what's written here is not a proper email address as long
as it gives some clue who the user is.
�email)rr�rbr�NoWhoamir�getuser_unicoder�r6r3rrOsC��)��!�!�#�'�'��0�0���?�?�)��&�&�(�(�)�s�#&�)A�A))r�rrMrr�rrrrrr	r
�
decoratorsrrr
rrrrrrrr�i18nrrrr�tracerrr#rrr�r��Lockr rorr�r6r3�<module>r9sv��"R�z
���@�@�@�#�����<�<��-�"����e$�d�i�i�e$�PK.�K.�\	)r6

Youez - 2016 - github.com/yon3zu
LinuXploit