Skip to content

Commit

Permalink
linters fix
Browse files Browse the repository at this point in the history
  • Loading branch information
matveyvarg committed Apr 16, 2024
1 parent ffc4dea commit 3f15040
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions deker/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@


def _get_lock_filename(id_: str, lock_ext: LocksExtensions) -> str:
"""Get filename for lockfile
"""Get filename for lockfile.
:param id_: ID of array
:param lock_ext: Extension of lock
Expand All @@ -70,6 +70,7 @@ def _check_write_locks(dir_path: Path, id_: str) -> bool:
"""Checks write locks from VArrays that differs from current.
:param dir_path: Dir where locks are stored (the one with hdf file)
:param id_: Id of array
"""
for file in dir_path.iterdir():
# Skip lock from current process.
Expand Down Expand Up @@ -113,12 +114,15 @@ def dir_path(self) -> Path:
return get_main_path(self.array_id, self.instance.collection_path / self.instance.data_dir)


def wait_for_unlock(check_func: Callable, check_func_args: tuple, timeout, interval: float) -> bool:
def wait_for_unlock(
check_func: Callable, check_func_args: tuple, timeout: int, interval: float
) -> bool:
"""Waiting while there is no locks
:param instance:
:param check_func:
:param check_func_args:
:param check_func: Func that check if lock has been releases
:param check_func_args: Args for func
:param timeout: For how long we should wait lock release
:param interval: How often we check locks
:return:
"""
start_time = time.monotonic()
Expand All @@ -138,10 +142,7 @@ def get_path(self) -> Path:
"""Get path to read-lock file.
It's only the case for arrays, varrays don't have read locks.
:param func_args: arguments of method call
:param func_kwargs: keyword arguments of method call
"""

# Get file directory
filename = _get_lock_filename(self.array_id, LocksExtensions.array_read_lock)

Expand Down

0 comments on commit 3f15040

Please sign in to comment.