Current Path: > > usr > lib > python2.7 > site-packages > pip > _vendor > lockfile >
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__init__.py | File | 9371 bytes | April 21 2022 18:08:21. | |
__init__.pyc | File | 12112 bytes | April 21 2022 18:08:34. | |
__init__.pyo | File | 12112 bytes | April 21 2022 18:08:34. | |
linklockfile.py | File | 2652 bytes | April 21 2022 18:08:21. | |
linklockfile.pyc | File | 2909 bytes | April 21 2022 18:08:34. | |
linklockfile.pyo | File | 2909 bytes | April 21 2022 18:08:34. | |
mkdirlockfile.py | File | 3096 bytes | April 21 2022 18:08:21. | |
mkdirlockfile.pyc | File | 3426 bytes | April 21 2022 18:08:34. | |
mkdirlockfile.pyo | File | 3426 bytes | April 21 2022 18:08:34. | |
pidlockfile.py | File | 6090 bytes | April 21 2022 18:08:21. | |
pidlockfile.pyc | File | 5909 bytes | April 21 2022 18:08:34. | |
pidlockfile.pyo | File | 5909 bytes | April 21 2022 18:08:34. | |
sqlitelockfile.py | File | 5506 bytes | April 21 2022 18:08:21. | |
sqlitelockfile.pyc | File | 4703 bytes | April 21 2022 18:08:34. | |
sqlitelockfile.pyo | File | 4703 bytes | April 21 2022 18:08:34. | |
symlinklockfile.py | File | 2616 bytes | April 21 2022 18:08:21. | |
symlinklockfile.pyc | File | 2825 bytes | April 21 2022 18:08:34. | |
symlinklockfile.pyo | File | 2825 bytes | April 21 2022 18:08:34. |
from __future__ import absolute_import import time import os from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout, AlreadyLocked) class LinkLockFile(LockBase): """Lock access to a file using atomic property of link(2). >>> lock = LinkLockFile('somefile') >>> lock = LinkLockFile('somefile', threaded=False) """ def acquire(self, timeout=None): try: open(self.unique_name, "wb").close() except IOError: raise LockFailed("failed to create %s" % self.unique_name) timeout = timeout if timeout is not None else self.timeout end_time = time.time() if timeout is not None and timeout > 0: end_time += timeout while True: # Try and create a hard link to it. try: os.link(self.unique_name, self.lock_file) except OSError: # Link creation failed. Maybe we've double-locked? nlinks = os.stat(self.unique_name).st_nlink if nlinks == 2: # The original link plus the one I created == 2. We're # good to go. return else: # Otherwise the lock creation failed. if timeout is not None and time.time() > end_time: os.unlink(self.unique_name) if timeout > 0: raise LockTimeout("Timeout waiting to acquire" " lock for %s" % self.path) else: raise AlreadyLocked("%s is already locked" % self.path) time.sleep(timeout is not None and timeout / 10 or 0.1) else: # Link creation succeeded. We're good to go. return def release(self): if not self.is_locked(): raise NotLocked("%s is not locked" % self.path) elif not os.path.exists(self.unique_name): raise NotMyLock("%s is locked, but not by me" % self.path) os.unlink(self.unique_name) os.unlink(self.lock_file) def is_locked(self): return os.path.exists(self.lock_file) def i_am_locking(self): return (self.is_locked() and os.path.exists(self.unique_name) and os.stat(self.unique_name).st_nlink == 2) def break_lock(self): if os.path.exists(self.lock_file): os.unlink(self.lock_file)
SILENT KILLER Tool