forked from p15670423/monkey
Island: delete_files_by_pattern -> delete_files_by_regex
This commit is contained in:
parent
2707605622
commit
7823759cf8
|
@ -36,9 +36,9 @@ class FileRepositoryCachingDecorator(IFileRepository):
|
||||||
self._open_file.cache_clear()
|
self._open_file.cache_clear()
|
||||||
return self._file_repository.delete_file(unsafe_file_name)
|
return self._file_repository.delete_file(unsafe_file_name)
|
||||||
|
|
||||||
def delete_files_by_pattern(self, file_name_pattern: str):
|
def delete_files_by_regex(self, file_name_regex: str):
|
||||||
self._open_file.cache_clear()
|
self._open_file.cache_clear()
|
||||||
return self._file_repository.delete_files_by_pattern(file_name_pattern)
|
return self._file_repository.delete_files_by_regex(file_name_regex)
|
||||||
|
|
||||||
def delete_all_files(self):
|
def delete_all_files(self):
|
||||||
self._open_file.cache_clear()
|
self._open_file.cache_clear()
|
||||||
|
|
|
@ -26,9 +26,9 @@ class FileRepositoryLockingDecorator(IFileRepository):
|
||||||
with self._rwlock.gen_wlock():
|
with self._rwlock.gen_wlock():
|
||||||
return self._file_repository.delete_file(unsafe_file_name)
|
return self._file_repository.delete_file(unsafe_file_name)
|
||||||
|
|
||||||
def delete_files_by_pattern(self, file_name_pattern: str):
|
def delete_files_by_regex(self, file_name_regex: str):
|
||||||
with self._rwlock.gen_wlock():
|
with self._rwlock.gen_wlock():
|
||||||
return self._file_repository.delete_files_by_pattern(file_name_pattern)
|
return self._file_repository.delete_files_by_regex(file_name_regex)
|
||||||
|
|
||||||
def delete_all_files(self):
|
def delete_all_files(self):
|
||||||
with self._rwlock.gen_wlock():
|
with self._rwlock.gen_wlock():
|
||||||
|
|
|
@ -26,9 +26,9 @@ class FileRepositoryLoggingDecorator(IFileRepository):
|
||||||
logger.debug(f"Deleting file {unsafe_file_name}")
|
logger.debug(f"Deleting file {unsafe_file_name}")
|
||||||
return self._file_repository.delete_file(unsafe_file_name)
|
return self._file_repository.delete_file(unsafe_file_name)
|
||||||
|
|
||||||
def delete_files_by_pattern(self, file_name_pattern: str):
|
def delete_files_by_regex(self, file_name_regex: str):
|
||||||
logger.debug(f'Deleting files whose names match the pattern "{file_name_pattern}"')
|
logger.debug(f'Deleting files whose names match the regex "{file_name_regex}"')
|
||||||
return self._file_repository.delete_files_by_pattern(file_name_pattern)
|
return self._file_repository.delete_files_by_regex(file_name_regex)
|
||||||
|
|
||||||
def delete_all_files(self):
|
def delete_all_files(self):
|
||||||
logger.debug("Deleting all files in the repository")
|
logger.debug("Deleting all files in the repository")
|
||||||
|
|
|
@ -50,13 +50,13 @@ class IFileRepository(metaclass=abc.ABCMeta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def delete_files_by_pattern(self, file_name_pattern: str):
|
def delete_files_by_regex(self, file_name_regex: str):
|
||||||
"""
|
"""
|
||||||
Delete files whose names match a particular pattern
|
Delete files whose names match a particular regex
|
||||||
|
|
||||||
This method matches relevant files and deletes them using `delete_file()`.
|
This method matches relevant files and deletes them using `delete_file()`.
|
||||||
|
|
||||||
:param file_name_pattern: A file name pattern that should be matched to delete files
|
:param file_name_regex: A regex with which a file's name should match before deleting it
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue