From c98a11fd706b615bd7987e1214f7dd52232c0dc1 Mon Sep 17 00:00:00 2001 From: Valerij Talagayev <82884038+talagayev@users.noreply.github.com> Date: Sat, 23 Nov 2024 00:41:25 +0100 Subject: [PATCH] Update XDR.py changed fasteners to filelock --- package/MDAnalysis/coordinates/XDR.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package/MDAnalysis/coordinates/XDR.py b/package/MDAnalysis/coordinates/XDR.py index 6fe75982cc..0596241533 100644 --- a/package/MDAnalysis/coordinates/XDR.py +++ b/package/MDAnalysis/coordinates/XDR.py @@ -38,7 +38,7 @@ import numpy as np from os.path import getctime, getsize, isfile, split, join import warnings -import fasteners +from filelock import FileLock from . import base from ..lib.mdamath import triclinic_box @@ -121,6 +121,8 @@ class XDRBaseReader(base.ReaderBase): Add a InterProcessLock when generating offsets .. versionchanged:: 2.4.0 Use a direct read into ts attributes + .. versionchanged:: 2.9.0 + Changed fasteners.InterProcessLock() to filelock.FileLock """ @store_init_arguments def __init__(self, filename, convert_units=True, sub=None, @@ -195,7 +197,7 @@ def _load_offsets(self): # check if the location of the lock is writable. try: - with fasteners.InterProcessLock(lock_name) as filelock: + with FileLock(lock_name) as filelock: pass except OSError as e: if isinstance(e, PermissionError) or e.errno == errno.EROFS: @@ -206,7 +208,7 @@ def _load_offsets(self): else: raise - with fasteners.InterProcessLock(lock_name) as filelock: + with FileLock(lock_name) as filelock: if not isfile(fname): self._read_offsets(store=True) return