Help on package fasteners: NAME fasteners - # -*- coding: utf-8 -*- PACKAGE CONTENTS _utils lock process_lock process_mechanism pywin32 (package) version CLASSES builtins.object fasteners.lock.ReaderWriterLock fasteners.process_lock.InterProcessLock fasteners.process_lock.InterProcessReaderWriterLock class InterProcessLock(builtins.object) | InterProcessLock(path: Union[pathlib.Path, str], sleep_func: Callable[[float], NoneType] = <built-in function sleep>, logger: Optional[logging.Logger] = None) | | An interprocess lock. | | Methods defined here: | | __enter__(self) | | __exit__(self, exc_type, exc_val, exc_tb) | | __init__(self, path: Union[pathlib.Path, str], sleep_func: Callable[[float], NoneType] = <built-in function sleep>, logger: Optional[logging.Logger] = None) | args: | path: | Path to the file that will be used for locking. | sleep_func: | Optional function to use for sleeping. | logger: | Optional logger to use for logging. | | acquire(self, blocking: bool = True, delay: float = 0.01, max_delay: float = 0.1, timeout: Optional[float] = None) -> bool | Attempt to acquire the lock. | | Args: | blocking: | Whether to wait to try to acquire the lock. | delay: | When `blocking`, starting delay as well as the delay increment | (in seconds). | max_delay: | When `blocking` the maximum delay in between attempts to | acquire (in seconds). | timeout: | When `blocking`, maximal waiting time (in seconds). | | Returns: | whether or not the acquisition succeeded | | exists(self) | | release(self) | Release the previously acquired lock. | | trylock(self) | | unlock(self) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | DELAY_INCREMENT = 0.01 | | MAX_DELAY = 0.1 class InterProcessReaderWriterLock(builtins.object) | InterProcessReaderWriterLock(path: Union[pathlib.Path, str], sleep_func: Callable[[float], NoneType] = <built-in function sleep>, logger: Optional[logging.Logger] = None) | | An interprocess readers writer lock. | | Methods defined here: | | __init__(self, path: Union[pathlib.Path, str], sleep_func: Callable[[float], NoneType] = <built-in function sleep>, logger: Optional[logging.Logger] = None) | Args: | path: | Path to the file that will be used for locking. | sleep_func: | Optional function to use for sleeping. | logger: | Optional logger to use for logging. | | acquire_read_lock(self, blocking: bool = True, delay: float = 0.01, max_delay: float = 0.1, timeout: float = None) -> bool | Attempt to acquire a reader's lock. | | Args: | blocking: | Whether to wait to try to acquire the lock. | delay: | When `blocking`, starting delay as well as the delay increment | (in seconds). | max_delay: | When `blocking` the maximum delay in between attempts to | acquire (in seconds). | timeout: | When `blocking`, maximal waiting time (in seconds). | | Returns: | whether or not the acquisition succeeded | | acquire_write_lock(self, blocking: bool = True, delay: float = 0.01, max_delay: float = 0.1, timeout: float = None) -> bool | Attempt to acquire a writer's lock. | | Args: | blocking: | Whether to wait to try to acquire the lock. | delay: | When `blocking`, starting delay as well as the delay increment | (in seconds). | max_delay: | When `blocking` the maximum delay in between attempts to | acquire (in seconds). | timeout: | When `blocking`, maximal waiting time (in seconds). | | Returns: | whether or not the acquisition succeeded | | read_lock(self, delay=0.01, max_delay=0.1) | Context manager that grans a read lock | | release_read_lock(self) | Release the reader's lock. | | release_write_lock(self) | Release the writer's lock. | | write_lock(self, delay=0.01, max_delay=0.1) | Context manager that grans a write lock | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | DELAY_INCREMENT = 0.01 | | MAX_DELAY = 0.1 class ReaderWriterLock(builtins.object) | ReaderWriterLock(condition_cls=<class 'threading.Condition'>, current_thread_functor=<function current_thread at 0x7f56f3f04fe0>) | | An inter-thread readers writer lock. | | Methods defined here: | | __init__(self, condition_cls=<class 'threading.Condition'>, current_thread_functor=<function current_thread at 0x7f56f3f04fe0>) | Args: | condition_cls: | Optional custom `Condition` primitive used for synchronization. | current_thread_functor: | Optional function that returns the identity of the thread in case | threads are not properly identified by threading.current_thread | | is_reader(self) -> bool | Check if caller is a reader. | | Returns: | Whether the caller is an active reader. | | is_writer(self, check_pending: bool = True) -> bool | Check if caller is a writer (optionally pending writer). | | Args: | check_pending: | Whether to check for pending writer status. | | Returns: | Whether the caller is the active (or optionally pending) writer. | | read_lock(self) | Context manager that grants a read lock. | | Will wait until no active or pending writers. | | Raises: | RuntimeError: if a pending writer tries to acquire a read lock. | | write_lock(self) | Context manager that grants a write lock. | | Will wait until no active readers. Blocks readers after acquiring. | | Guaranteed for locks to be processed in fair order (FIFO). | | Raises: | RuntimeError: if an active reader attempts to acquire a lock. | | ---------------------------------------------------------------------- | Readonly properties defined here: | | has_pending_writers | Check if there pending writers | | Returns: | Whether there are pending writers. | | owner | Caller ownership (if any) of the lock | | Returns: | `'w'` if caller is a writer, `'r'` if caller is a reader, None otherwise. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | READER = 'r' | | WRITER = 'w' FUNCTIONS interprocess_locked(path: Union[pathlib.Path, str]) Acquires & releases an interprocess lock around the call to the decorated function. Args: path: Path to the file used for locking. interprocess_read_locked(path: Union[pathlib.Path, str]) Acquires & releases an interprocess **read** lock around the call into the decorated function Args: path: Path to the file used for locking. interprocess_write_locked(path: Union[pathlib.Path, str]) Acquires & releases an interprocess **write** lock around the call into the decorated function Args: path: Path to the file used for locking. locked(*args, **kwargs) A locking **method** decorator. It will look for a provided attribute (typically a lock or a list of locks) on the first argument of the function decorated (typically this is the 'self' object) and before executing the decorated function it activates the given lock or list of locks as a context manager, automatically releasing that lock on exit. NOTE(harlowja): if no attribute name is provided then by default the attribute named '_lock' is looked for (this attribute is expected to be the lock/list of locks object/s) in the instance object this decorator is attached to. NOTE(harlowja): a custom logger (which will be used if lock release failures happen) can be provided by passing a logger instance for keyword argument ``logger``. NOTE(paulius): This function is DEPRECATED and will be kept until the end of time. It is potentially used by oslo, but too specific to be recommended for other projects read_locked(*args, **kwargs) Acquires & releases a read lock around call into decorated method. NOTE(harlowja): if no attribute name is provided then by default the attribute named '_lock' is looked for (this attribute is expected to be a :py:class:`.ReaderWriterLock`) in the instance object this decorator is attached to. NOTE(paulius): This function is DEPRECATED and will be kept until the end of time. It is potentially used by oslo, but too specific to be recommended for other projects try_lock(lock: <built-in function allocate_lock>) -> bool Context manager that attempts to acquire a lock without a timeout, and releases it on exit (if acquired). Args: lock: A lock to try to acquire. Returns: Whether the lock was acquired. # NOTE(harlowja): the keyword argument for 'blocking' does not work # in py2.x and only is fixed in py3.x (this adjustment is documented # and/or debated in http://bugs.python.org/issue10789); so we'll just # stick to the format that works in both (oddly the keyword argument # works in py2.x but only with reentrant locks). NOTE(paulius): This function is DEPRECATED and will be kept until the end of time. It is potentially used by oslo, but too specific to be recommended for other projects write_locked(*args, **kwargs) Acquires & releases a write lock around call into decorated method. NOTE(harlowja): if no attribute name is provided then by default the attribute named '_lock' is looked for (this attribute is expected to be a :py:class:`.ReaderWriterLock` object) in the instance object this decorator is attached to. NOTE(paulius): This function is DEPRECATED and will be kept until the end of time. It is potentially used by oslo, but too specific to be recommended for other projects DATA __all__ = ['__version__', 'locked', 'read_locked', 'ReaderWriterLock',... VERSION 0.18 FILE /usr/lib/python3/dist-packages/fasteners/__init__.py
Generated by phpman v4.12.29 · Markdown · JSON Author: Che Dong Under GNU General Public License
2026-12-02 00:47 @216.73.216.10
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)