Introduce option to define timeout for time-consuming file operations

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
This commit is contained in:
Robert Baldyga
2024-10-02 21:52:08 +02:00
parent 9344c16b7c
commit cfd1b30de4
2 changed files with 12 additions and 14 deletions

View File

@@ -14,14 +14,14 @@ class File(FsItem):
def __init__(self, full_path):
FsItem.__init__(self, full_path)
def compare(self, other_file):
return fs_utils.compare(str(self), str(other_file))
def compare(self, other_file, timeout: timedelta = timedelta(minutes=30)):
return fs_utils.compare(str(self), str(other_file), timeout)
def diff(self, other_file):
return fs_utils.diff(str(self), str(other_file))
def diff(self, other_file, timeout: timedelta = timedelta(minutes=30)):
return fs_utils.diff(str(self), str(other_file), timeout)
def md5sum(self, binary=True):
return fs_utils.md5sum(str(self), binary)
def md5sum(self, binary=True, timeout: timedelta = timedelta(minutes=30)):
return fs_utils.md5sum(str(self), binary, timeout)
def read(self):
return fs_utils.read_file(str(self))