Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/tox-dev/filelock
/ functions
Functions
1,605 in github.com/tox-dev/filelock
⨍
Functions
1,605
◇
Types & classes
114
↳
Endpoints
9
↓ 321 callers
Method
acquire
Try to acquire the file lock. :param timeout: maximum wait time for acquiring the lock, ``None`` means use the default :attr:`~timeo
src/filelock/_api.py:983
↓ 214 callers
Method
release
Release the file lock. The lock is only completely released when the lock counter reaches 0. The lock file itself may be deleted auto
src/filelock/_api.py:1099
↓ 117 callers
Method
close
Release the lock (if held) and close the underlying SQLite connection. After calling this method, the lock instance is no longer usa
src/filelock/_read_write.py:428
↓ 73 callers
Method
join
(self, timeout: float | None = None)
tests/test_filelock.py:281
↓ 42 callers
Method
acquire_write
Acquire an exclusive write lock. If this instance already holds a write lock from the same thread, the lock level is incremented (re
src/filelock/_read_write.py:348
↓ 40 callers
Method
run
(self)
tests/test_filelock.py:275
↓ 35 callers
Function
_make_lock
( path: str, *, heartbeat_interval: float = 0.1, stale_threshold: float = 0.5, poll_interv
tests/soft_rw/test_soft_rw_sync.py:1056
↓ 33 callers
Method
cancel
(self, msg: object | None = None)
tests/test_async_filelock_runner_shutdown.py:41
↓ 29 callers
Method
acquire_read
Acquire a shared read lock. If this instance already holds a read lock, the lock level is incremented (reentrant). Attempting to acq
src/filelock/_read_write.py:330
↓ 26 callers
Method
close
Release any held lock and release internal filesystem resources. Idempotent. After calling this method the instance can no longer ac
src/filelock/_soft_rw/_sync.py:335
↓ 25 callers
Function
_initialize_protocol
(lock_path: Path)
tests/test_strict_soft_failures.py:954
↓ 25 callers
Function
cleanup_processes
Reap every process on the way out, whatever the block did.
tests/process_helpers.py:15
↓ 25 callers
Method
write_lock
Context manager that acquires and releases an exclusive write lock. Falls back to instance defaults for *timeout* and *blocking* whe
src/filelock/_read_write.py:390
↓ 24 callers
Method
close
Release the lock (if held) and close the underlying SQLite connection. After calling this method, the lock instance is no longer usa
src/filelock/_async_read_write.py:223
↓ 23 callers
Method
release
Release one level of the current lock. When the lock level reaches zero the underlying SQLite transaction is rolled back, releasing
src/filelock/_read_write.py:410
↓ 22 callers
Function
_lease
( marker: Path, *, lease_duration: float = _DURATION, timeout: float = 0.3, on_compromise:
tests/test_soft_lease.py:44
↓ 20 callers
Method
read_lock
Context manager that acquires and releases a shared read lock. Falls back to instance defaults for *timeout* and *blocking* when ``N
src/filelock/_read_write.py:369
↓ 18 callers
Function
_fork_transition
(descriptor_owner: _ForkDescriptorOwner | None = None)
src/filelock/_api.py:1565
↓ 18 callers
Method
release
Release one level of the current lock. See :meth:`ReadWriteLock.release` for full semantics. :param force: if ``True``, rel
src/filelock/_async_read_write.py:207
↓ 17 callers
Function
_holder
(pid: int, *, host: str = _HOST, start: int | None = None)
tests/test_soft_stale.py:45
↓ 17 callers
Function
assert_file_lock_state
(lock_file: str, *, available: bool)
tests/async_filelock_cancellation_helpers.py:32
↓ 17 callers
Function
process_start_token
The process creation FILETIME as a 100ns tick count, or ``None`` when it cannot be read.
src/filelock/_identity.py:88
↓ 15 callers
Function
host_name
The hostname recorded alongside an owner, so a marker written on another machine is never probed here. Marker formats here hold the field to
src/filelock/_identity.py:16
↓ 13 callers
Function
_assert_times_out
(lock_path: Path, *, timeout: float = 0.1)
tests/test_soft_stale.py:384
↓ 13 callers
Function
_ensure_current_process
()
src/filelock/_api.py:1672
↓ 13 callers
Function
_make
( tmp_path: Path, name: str = "foo.lock", *, timeout: float = -1, blocking: bool = True,
tests/soft_rw/test_soft_rw_async.py:32
↓ 13 callers
Function
fork_process
(child: Callable[[], NoReturn] | None = None)
tests/fork_helpers.py:30
↓ 13 callers
Method
release
Release one level of the current lock. When the lock level reaches zero the heartbeat thread is stopped and the held marker file is
src/filelock/_soft_rw/_sync.py:358
↓ 12 callers
Function
_raise_cleanup_errors
( message: str, primary_error: BaseException, *cleanup_errors: BaseException | None, )
src/filelock/_api.py:296
↓ 11 callers
Function
_drain_future
(future: asyncio.Future[_BackendOutcome[_T]])
src/filelock/_async.py:113
↓ 11 callers
Function
_run_fork_script
(script: str, arguments: list[str], *, timeout: float)
tests/test_read_write_fork.py:307
↓ 11 callers
Function
acquire
()
tests/test_filelock.py:2235
↓ 11 callers
Function
lock_descriptor
Take the native OS lock on *fd*, a file descriptor the caller opened and owns. This is the same one-byte exclusive lock :class:`FileLock` us
src/filelock/_descriptor.py:16
↓ 10 callers
Method
acquire_write
Acquire an exclusive write lock. See :meth:`ReadWriteLock.acquire_write` for full semantics. :param timeout: maximum wait t
src/filelock/_async_read_write.py:188
↓ 10 callers
Method
acquire_write
Acquire an exclusive write lock. If this instance already holds a write lock from the same thread, the lock level is incremented (re
src/filelock/_soft_rw/_sync.py:286
↓ 10 callers
Function
assert_read_write_lock_state
(lock_file: str, mode: Literal["read", "write"], *, available: bool)
tests/read_write_helpers.py:12
↓ 10 callers
Method
force_break
Remove one named claim, allowing overlap if its owner still holds the protected resource.
src/filelock/_strict.py:203
↓ 9 callers
Function
_exception_group_cls
()
src/filelock/_api.py:101
↓ 9 callers
Method
_mark_descriptor_released
(self)
src/filelock/_api.py:1146
↓ 9 callers
Function
_raise_grouped_errors
( message: str, first_error: BaseException, second_error: BaseException, *additional_errors: B
src/filelock/_api.py:114
↓ 9 callers
Function
_wait_until_done
(future: asyncio.Future[_T])
src/filelock/_async.py:120
↓ 9 callers
Function
assert_cancellation_message
(error: asyncio.CancelledError, message: str)
tests/async_filelock_cancellation_helpers.py:23
↓ 9 callers
Function
break_lock_file
Atomically break a stale lock file judged stale at modification time *mtime_before*. Rename the file to a process-private name before unlink
src/filelock/_util.py:75
↓ 9 callers
Function
exit_child
(status: int)
tests/fork_helpers.py:40
↓ 9 callers
Function
timeout_for_sqlite
(timeout: float, *, blocking: bool, already_waited: float)
src/filelock/_read_write.py:754
↓ 8 callers
Function
_assert_self_heals
(lock_path: Path)
tests/test_soft_stale.py:378
↓ 8 callers
Function
_fork_descriptor_probe
( # pragma: needs fork descriptor: int, stat_descriptor: Callable[[int], os.stat_result] )
tests/test_fork_backends.py:502
↓ 8 callers
Function
_future_result
(future: asyncio.Future[_BackendOutcome[_T]])
src/filelock/_async.py:125
↓ 8 callers
Function
owner_is_stale
Whether the recorded owner is provably gone, so reclaiming its marker cannot detach a live holder. Fail closed: return ``True`` only when th
src/filelock/_identity.py:37
↓ 8 callers
Function
raise_on_not_writable_file
Raise an exception if attempting to open the file for writing would fail. Separates files that can never be written from files that are writ
src/filelock/_util.py:33
↓ 8 callers
Function
unlock_descriptor
Release the native OS lock on *fd* without touching the descriptor. :param fd: the descriptor a prior :func:`lock_descriptor` locked; the ca
src/filelock/_descriptor.py:53
↓ 7 callers
Function
_close_after_commit
(mocker: MockerFixture, lock: SoftFileLock)
tests/test_soft_stale.py:645
↓ 7 callers
Function
_error_details
(group: BaseExceptionGroup)
tests/test_fork_backends.py:498
↓ 7 callers
Function
assert_mode_held
(lock_file: str, mode: Literal["read", "write"])
tests/test_async_read_write.py:291
↓ 6 callers
Function
_append_exception_context
(error: BaseException, context: BaseException)
src/filelock/_api.py:192
↓ 6 callers
Method
_open_mode
Mode for ``os.open``: 0o666 when unset so umask and ACLs decide, otherwise the explicit mode.
src/filelock/_api.py:921
↓ 6 callers
Function
_register_fork_object
(instance: _ForkResettable)
src/filelock/_api.py:1579
↓ 6 callers
Function
_sqlite_transition
()
src/filelock/_read_write.py:736
↓ 6 callers
Method
_start_tracked_release
(self)
src/filelock/asyncio.py:520
↓ 6 callers
Method
acquire_read
Acquire a shared read lock. See :meth:`ReadWriteLock.acquire_read` for full semantics. :param timeout: maximum wait time in
src/filelock/_async_read_write.py:169
↓ 6 callers
Method
acquire_read
Acquire a shared read lock. If this instance already holds a read lock, the lock level is incremented (reentrant). Attempting to acq
src/filelock/_soft_rw/_sync.py:263
↓ 5 callers
Function
_canonical
Return one stable key for *path*, collapsing equivalent spellings without following a final symlink. Relative, absolute, and ``./`` spelling
src/filelock/_api.py:313
↓ 5 callers
Function
_close_after_commit
(mocker: MockerFixture, lock: AsyncSoftFileLock)
tests/test_async_filelock.py:769
↓ 5 callers
Method
_close_released_fd
(self, fd: int, *, default_suppresses: bool)
src/filelock/_api.py:771
↓ 5 callers
Function
_fail_close_of
(mocker: MockerFixture, lock: BaseFileLock, error: OSError)
tests/test_filelock.py:1881
↓ 5 callers
Function
_file_identity
(st: os.stat_result)
src/filelock/_soft.py:206
↓ 5 callers
Function
_initialize_protocol
(lock_path: Path)
tests/test_strict_soft_races.py:302
↓ 5 callers
Function
_join_threads
(*threads: threading.Thread)
tests/test_strict_soft_races.py:307
↓ 5 callers
Method
_mark_descriptor_owned
(self, fd: int, identity: tuple[int, int] | None = None)
src/filelock/_api.py:1136
↓ 5 callers
Function
_private_claim_path
(lock_path: Path, token: str)
tests/test_strict_soft_failures.py:959
↓ 5 callers
Function
_raise_cancelled_error
(cancellation: asyncio.CancelledError, error: BaseException)
src/filelock/_async.py:144
↓ 5 callers
Function
_raise_chained_errors
(first_error: BaseException, second_error: BaseException | None = None)
src/filelock/_api.py:246
↓ 5 callers
Function
_read_lock_file
(path: str)
src/filelock/_soft.py:212
↓ 5 callers
Function
_unlink
(name: str, *, dir_fd: int | None = None)
src/filelock/_soft_rw/_sync.py:841
↓ 5 callers
Function
_write_held_claim
(claims: Path)
tests/test_strict_soft_failures.py:879
↓ 5 callers
Function
ensure_directory_exists
Ensure the directory containing the file exists (create it if necessary). :param filename: file.
src/filelock/_util.py:65
↓ 5 callers
Function
process_alive
Whether a process with this PID exists, treating an access denial as proof it does.
src/filelock/_identity.py:80
↓ 5 callers
Method
read_lock
Async context manager that acquires and releases a shared read lock. Falls back to instance defaults for *timeout* and *blocking* wh
src/filelock/_async_read_write.py:112
↓ 4 callers
Method
__init__
(self, lock_file: str, *, marker: int = 0)
tests/test_subclass_options.py:334
↓ 4 callers
Method
__init__
(self, target: Callable[[], None], name: str)
tests/test_filelock.py:271
↓ 4 callers
Function
_file_identity
(st: os.stat_result)
src/filelock/_strict.py:866
↓ 4 callers
Method
_finish_connection
(self)
src/filelock/_read_write.py:653
↓ 4 callers
Function
_fork_process
( # pragma: needs fork target: Callable[..., object], args: tuple[object, ...] = () )
tests/soft_rw/test_soft_rw_sync.py:1210
↓ 4 callers
Function
_patch_async_connection
( mocker: MockerFixture, *, executescript: Callable[[sqlite3.Connection, str], sqlite3.Cursor] | N
tests/test_async_read_write_cancellation.py:469
↓ 4 callers
Function
_raise_body_and_release
(body_error: BaseException, release_error: BaseException)
src/filelock/_api.py:288
↓ 4 callers
Method
_raise_if_inherited
(self)
src/filelock/_api.py:1131
↓ 4 callers
Method
_register_context_descriptor
(self)
src/filelock/_api.py:1342
↓ 4 callers
Function
_register_fork_class
(cls: _ForkResettableClass)
src/filelock/_api.py:1587
↓ 4 callers
Method
_register_unverified_context_descriptor
(self)
src/filelock/_api.py:1349
↓ 4 callers
Method
_release_with_fork_tracking
(self)
src/filelock/_api.py:1335
↓ 4 callers
Method
get_lock
Return the singleton :class:`ReadWriteLock` for *lock_file*. :param lock_file: path to the SQLite database file used as the lock
src/filelock/_read_write.py:283
↓ 4 callers
Method
hold
(self)
src/filelock/_async.py:37
↓ 4 callers
Method
is_thread_local
:returns: a flag indicating if this lock is thread local or not
src/filelock/_api.py:737
↓ 4 callers
Method
resume
(self)
tests/soft_rw/test_soft_rw_async.py:86
↓ 4 callers
Function
write_all
Write the whole buffer to *fd*, looping over the short writes ``os.write`` is allowed to make. A marker written with a bare ``os.write`` can
src/filelock/_util.py:12
↓ 4 callers
Method
write_lock
Async context manager that acquires and releases an exclusive write lock. Falls back to instance defaults for *timeout* and *blockin
src/filelock/_async_read_write.py:137
↓ 3 callers
Function
_break_stale_marker
( # ruff:ignore[too-many-return-statements] # each return is a distinct abort/commit point in the break prot
src/filelock/_soft_rw/_sync.py:850
↓ 3 callers
Method
_claim_writer_marker
(self, token: str)
src/filelock/_soft_rw/_sync.py:553
↓ 3 callers
Method
_commit_acquire
Record this instance as the holder once the first acquire succeeds, so peers can detect the deadlock.
src/filelock/_api.py:1367
↓ 3 callers
Method
_commit_release
Record the lock as fully released: reset the recursion counter and drop the deadlock-registry entry.
src/filelock/_api.py:1382
next →
1–100 of 1,605, ranked by callers