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

Method acquire_write

src/filelock/_sqlite/_async.py:154–171  ·  view source on GitHub ↗

Acquire an exclusive write lock for the current task. :param timeout: seconds to wait, or ``None`` for the instance default :param blocking: wait on contention, or ``None`` for the instance default :returns: an async context manager that releases the lock on exit

(
        self, timeout: float | None = None, *, blocking: bool | None = None
    )

Source from the content-addressed store, hash-verified

152 await self._release_in_context(body_error)
153
154 async def acquire_write(
155 self, timeout: float | None = None, *, blocking: bool | None = None
156 ) -> AsyncAcquireReadWriteReturnProxy:
157 """
158 Acquire an exclusive write lock for the current task.
159
160 :param timeout: seconds to wait, or ``None`` for the instance default
161 :param blocking: wait on contention, or ``None`` for the instance default
162 :returns: an async context manager that releases the lock on exit
163 :raises RuntimeError: the task already holds the read lock or inherited the wrapper after fork
164 :raises sqlite3.ProgrammingError: the wrapper is closed
165 :raises Timeout: the deadline expired
166 :raises TypeError: timeout is a boolean or not a real number, or blocking is not a boolean
167 :raises ValueError: a blocking call received NaN or a negative timeout other than -1
168 """
169 self._raise_if_unusable()
170 await self._acquire("write", timeout, blocking=blocking)
171 return AsyncAcquireReadWriteReturnProxy(lock=self)
172
173 @override
174 def _reset_after_fork_in_child(self) -> None: # pragma: forked child

Calls 3

_raise_if_unusableMethod · 0.95
_acquireMethod · 0.95