| Server IP : 216.92.14.13 / Your IP : 216.73.217.126 Web Server : Apache System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 User : rmlac2fmr ( 1040637) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/python2.7/dist-packages/ |
Upload File : |
�
~��Ic @ s d Z d d l m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l
Z
e e d � s� e j e _
n e e j d � s� e j j e j _ n d d d d d
d d d
d d d g Z d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d
e f d � � YZ d e f d � � YZ d e f d � � YZ d
e f d � � YZ d d d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ e e d � r�e Z n e Z d S( s�
lockfile.py - Platform-independent advisory file locks.
Requires Python 2.5 unless you apply 2.4.diff
Locking is done on a per-thread basis instead of a per-process basis.
Usage:
>>> lock = FileLock('somefile')
>>> try:
... lock.acquire()
... except AlreadyLocked:
... print 'somefile', 'is locked already.'
... except LockFailed:
... print 'somefile', 'can\'t be locked.'
... else:
... print 'got lock'
got lock
>>> print lock.is_locked()
True
>>> lock.release()
>>> lock = FileLock('somefile')
>>> print lock.is_locked()
False
>>> with lock:
... print lock.is_locked()
True
>>> print lock.is_locked()
False
>>> # It is okay to lock twice from the same thread...
>>> with lock:
... lock.acquire()
...
>>> # Though no counter is kept, so you can't unlock multiple times...
>>> print lock.is_locked()
False
Exceptions:
Error - base class for other exceptions
LockError - base class for all locking exceptions
AlreadyLocked - Another thread or process already holds the lock
LockFailed - Lock failed for some other reason
UnlockError - base class for all unlocking exceptions
AlreadyUnlocked - File was not locked.
NotMyLock - File was locked but not by the current thread/process
i����( t divisionNt current_threadt get_namet Errort LockErrort LockTimeoutt
AlreadyLockedt
LockFailedt UnlockErrort NotLockedt NotMyLockt LinkFileLockt
MkdirFileLockt SQLiteFileLockc B s e Z d Z RS( sw
Base class for other exceptions.
>>> try:
... raise Error
... except Exception:
... pass
( t __name__t
__module__t __doc__( ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyR H s c B s e Z d Z RS( s�
Base class for error arising from attempts to acquire the lock.
>>> try:
... raise LockError
... except Error:
... pass
( R R R ( ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyR S s c B s e Z d Z RS( s� Raised when lock creation fails within a user-defined period of time.
>>> try:
... raise LockTimeout
... except LockError:
... pass
( R R R ( ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyR ^ s c B s e Z d Z RS( s� Some other thread/process is locking the file.
>>> try:
... raise AlreadyLocked
... except LockError:
... pass
( R R R ( ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyR h s c B s e Z d Z RS( s� Lock file creation failed for some other reason.
>>> try:
... raise LockFailed
... except LockError:
... pass
( R R R ( ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyR r s c B s e Z d Z RS( s�
Base class for errors arising from attempts to release the lock.
>>> try:
... raise UnlockError
... except Error:
... pass
( R R R ( ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyR | s c B s e Z d Z RS( s� Raised when an attempt is made to unlock an unlocked file.
>>> try:
... raise NotLocked
... except UnlockError:
... pass
( R R R ( ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyR � s c B s e Z d Z RS( s� Raised when an attempt is made to unlock a file someone else locked.
>>> try:
... raise NotMyLock
... except UnlockError:
... pass
( R R R ( ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyR
� s t LockBasec B s\ e Z d Z e d � Z d d � Z d � Z d � Z d � Z d � Z
d � Z d � Z RS(
s. Base class for platform-specific lock classes.c C s� | | _ t j j | � d | _ t j � | _ t j � | _ | rt t j
� j � } d t j
| d d �} n d } t j j | j � } t j j | d | j | | j f � | _ d S( si
>>> lock = LockBase('somefile')
>>> lock = LockBase('somefile', threaded=False)
s .locks %s-t safet s %s.%s%sN( t patht ost abspatht lock_filet sockett gethostnamet hostnamet getpidt pidt threadingR R t urllibt quotet dirnamet joint unique_name( t selfR t threadedt namet tnameR ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyt __init__� s c C s t d � � d S( s�
Acquire the lock.
* If timeout is omitted (or None), wait forever trying to lock the
file.
* If timeout > 0, try to acquire the lock for that many seconds. If
the lock period expires and the file is still locked, raise
LockTimeout.
* If timeout <= 0, raise AlreadyLocked immediately if the file is
already locked.
s implement in subclassN( t NotImplemented( R# t timeout( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyt acquire� s c C s t d � � d S( sX
Release the lock.
If the file is not locked, raise NotLocked.
s implement in subclassN( R( ( R# ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyt release� s c C s t d � � d S( s9
Tell whether or not the file is locked.
s implement in subclassN( R( ( R# ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyt is_locked� s c C s t d � � d S( sA
Return True if this object is locking the file.
s implement in subclassN( R( ( R# ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyt i_am_locking� s c C s t d � � d S( sN
Remove a lock. Useful if a locking thread failed to unlock.
s implement in subclassN( R( ( R# ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyt
break_lock� s c C s | j � | S( s*
Context manager support.
( R* ( R# ( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyt __enter__� s
c G s | j � d S( s*
Context manager support.
N( R+ ( R# t _exc( ( s, /usr/lib/python2.7/dist-packages/lockfile.pyt __exit__� s N(
R R R t TrueR'