codekingpro/portable-devtools
114k
1from . import __about__, constants, exceptions, portalocker, utils2 3try: # pragma: no cover4 from .redis import RedisLock5except ImportError: # pragma: no cover6 RedisLock = None # type: ignore7 8 9#: The package name on Pypi10__package_name__ = __about__.__package_name__11#: Current author and maintainer, view the git history for the previous ones12__author__ = __about__.__author__13#: Current author's email address14__email__ = __about__.__email__15#: Version number16__version__ = '2.8.2'17#: Package description for Pypi18__description__ = __about__.__description__19#: Package homepage20__url__ = __about__.__url__21 22 23#: Exception thrown when the file is already locked by someone else24AlreadyLocked = exceptions.AlreadyLocked25#: Exception thrown if an error occurred during locking26LockException = exceptions.LockException27 28 29#: Lock a file. Note that this is an advisory lock on Linux/Unix systems30lock = portalocker.lock31#: Unlock a file32unlock = portalocker.unlock33 34#: Place an exclusive lock.35#: Only one process may hold an exclusive lock for a given file at a given36#: time.37LOCK_EX: constants.LockFlags = constants.LockFlags.EXCLUSIVE38 39#: Place a shared lock.40#: More than one process may hold a shared lock for a given file at a given41#: time.42LOCK_SH: constants.LockFlags = constants.LockFlags.SHARED43 44#: Acquire the lock in a non-blocking fashion.45LOCK_NB: constants.LockFlags = constants.LockFlags.NON_BLOCKING46 47#: Remove an existing lock held by this process.48LOCK_UN: constants.LockFlags = constants.LockFlags.UNBLOCK49 50#: Locking flags enum51LockFlags = constants.LockFlags52 53#: Locking utility class to automatically handle opening with timeouts and54#: context wrappers55Lock = utils.Lock56RLock = utils.RLock57BoundedSemaphore = utils.BoundedSemaphore58TemporaryFileLock = utils.TemporaryFileLock59open_atomic = utils.open_atomic60 61__all__ = [62 'lock',63 'unlock',64 'LOCK_EX',65 'LOCK_SH',66 'LOCK_NB',67 'LOCK_UN',68 'LockFlags',69 'LockException',70 'Lock',71 'RLock',72 'AlreadyLocked',73 'BoundedSemaphore',74 'open_atomic',75 'RedisLock',76]77 