Island: delete_files_by_pattern -> delete_files_by_regex

This commit is contained in:
Shreya Malviya 2022-09-28 19:38:01 +05:30
parent 2707605622
commit 7823759cf8
4 changed files with 10 additions and 10 deletions

View File

@ -36,9 +36,9 @@ class FileRepositoryCachingDecorator(IFileRepository):
self._open_file.cache_clear()
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()
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):
self._open_file.cache_clear()

View File

@ -26,9 +26,9 @@ class FileRepositoryLockingDecorator(IFileRepository):
with self._rwlock.gen_wlock():
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():
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):
with self._rwlock.gen_wlock():

View File

@ -26,9 +26,9 @@ class FileRepositoryLoggingDecorator(IFileRepository):
logger.debug(f"Deleting file {unsafe_file_name}")
return self._file_repository.delete_file(unsafe_file_name)
def delete_files_by_pattern(self, file_name_pattern: str):
logger.debug(f'Deleting files whose names match the pattern "{file_name_pattern}"')
return self._file_repository.delete_files_by_pattern(file_name_pattern)
def delete_files_by_regex(self, file_name_regex: str):
logger.debug(f'Deleting files whose names match the regex "{file_name_regex}"')
return self._file_repository.delete_files_by_regex(file_name_regex)
def delete_all_files(self):
logger.debug("Deleting all files in the repository")

View File

@ -50,13 +50,13 @@ class IFileRepository(metaclass=abc.ABCMeta):
pass
@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()`.
: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