File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 88from contextlib import contextmanager
99from pathlib import Path
1010
11- import filelock
12-
1311from pytensor .configdefaults import config
1412
1513
@@ -35,8 +33,9 @@ def force_unlock(lock_dir: os.PathLike):
3533 lock_dir : os.PathLike
3634 Path to a directory that was locked with `lock_ctx`.
3735 """
36+ from filelock import FileLock
3837
39- fl = filelock . FileLock (Path (lock_dir ) / ".lock" )
38+ fl = FileLock (Path (lock_dir ) / ".lock" )
4039 fl .release (force = True )
4140
4241 dir_key = f"{ lock_dir } -{ os .getpid ()} "
@@ -62,6 +61,8 @@ def lock_ctx(
6261 Timeout in seconds for waiting in lock acquisition.
6362 Defaults to `pytensor.config.compile__timeout`.
6463 """
64+ from filelock import FileLock
65+
6566 if lock_dir is None :
6667 lock_dir = config .compiledir
6768
@@ -73,7 +74,7 @@ def lock_ctx(
7374
7475 if dir_key not in local_mem ._locks :
7576 local_mem ._locks [dir_key ] = True
76- fl = filelock . FileLock (Path (lock_dir ) / ".lock" )
77+ fl = FileLock (Path (lock_dir ) / ".lock" )
7778 fl .acquire (timeout = timeout )
7879 try :
7980 yield
You can’t perform that action at this time.
0 commit comments