Chiusura fase di ristrutturazione e modularizzazione del workflow per favorire sviluppo modulare
This commit is contained in:
@@ -9,6 +9,7 @@ import re
|
||||
import stat
|
||||
from pathlib import Path
|
||||
from types import TracebackType
|
||||
from typing import Self
|
||||
|
||||
|
||||
class JobAlreadyRunningError(RuntimeError):
|
||||
@@ -34,7 +35,7 @@ class WorkspaceJobLock:
|
||||
)
|
||||
self._fd: int | None = None
|
||||
|
||||
def acquire(self) -> "WorkspaceJobLock":
|
||||
def acquire(self) -> WorkspaceJobLock:
|
||||
if self._fd is not None:
|
||||
raise RuntimeError("job lock is already held by this object")
|
||||
root_fd = os.open(self.path.parents[2], os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW)
|
||||
@@ -85,7 +86,7 @@ class WorkspaceJobLock:
|
||||
finally:
|
||||
os.close(fd)
|
||||
|
||||
def __enter__(self) -> "WorkspaceJobLock":
|
||||
def __enter__(self) -> Self:
|
||||
return self.acquire()
|
||||
|
||||
def __exit__(
|
||||
|
||||
Reference in New Issue
Block a user