MCPcopy Create free account
hub / github.com/tox-dev/filelock / __init__

Method __init__

src/filelock/_sqlite/_async.py:46–65  ·  view source on GitHub ↗
(  # ruff:ignore[too-many-arguments]  # public constructor: one parameter per documented lock option
        self,
        lock_file: str | os.PathLike[str],
        timeout: float = -1,
        *,
        blocking: bool = True,
        is_singleton: bool = True,
        loop: asyncio.AbstractEventLoop | None = None,
        executor: futures.Executor | None = None,
    )

Source from the content-addressed store, hash-verified

44 """
45
46 def __init__( # ruff:ignore[too-many-arguments] # public constructor: one parameter per documented lock option
47 self,
48 lock_file: str | os.PathLike[str],
49 timeout: float = -1,
50 *,
51 blocking: bool = True,
52 is_singleton: bool = True,
53 loop: asyncio.AbstractEventLoop | None = None,
54 executor: futures.Executor | None = None,
55 ) -> None:
56 super().__init__(is_singleton=is_singleton)
57 self._fork_invalidated = False
58 with fork_transition():
59 self._bind(ReadWriteLock(lock_file, timeout, blocking=blocking, is_singleton=is_singleton), loop, executor)
60 self._executor = executor or ThreadPoolExecutor(max_workers=1)
61 # The child reset needs a fully initialized executor.
62 register_fork_object(self)
63 if os.getpid() != self._creator_pid: # pragma: forked child
64 msg = "AsyncReadWriteLock construction cannot continue after fork"
65 raise RuntimeError(msg)
66
67 @asynccontextmanager
68 async def read_lock(self, timeout: float | None = None, *, blocking: bool | None = None) -> AsyncGenerator[None]:

Callers 1

__init__Method · 0.45

Calls 4

fork_transitionFunction · 0.90
register_fork_objectFunction · 0.90
ReadWriteLockClass · 0.85
_bindMethod · 0.80

Tested by

no test coverage detected