From 7823759cf8432d6646abf39673b48e7607fac920 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 28 Sep 2022 19:38:01 +0530 Subject: [PATCH] Island: delete_files_by_pattern -> delete_files_by_regex --- .../cc/repository/file_repository_caching_decorator.py | 4 ++-- .../cc/repository/file_repository_locking_decorator.py | 4 ++-- .../cc/repository/file_repository_logging_decorator.py | 6 +++--- monkey/monkey_island/cc/repository/i_file_repository.py | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/monkey/monkey_island/cc/repository/file_repository_caching_decorator.py b/monkey/monkey_island/cc/repository/file_repository_caching_decorator.py index 07bee5258..fbb26deaa 100644 --- a/monkey/monkey_island/cc/repository/file_repository_caching_decorator.py +++ b/monkey/monkey_island/cc/repository/file_repository_caching_decorator.py @@ -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() diff --git a/monkey/monkey_island/cc/repository/file_repository_locking_decorator.py b/monkey/monkey_island/cc/repository/file_repository_locking_decorator.py index 602d0122a..d1f772cbc 100644 --- a/monkey/monkey_island/cc/repository/file_repository_locking_decorator.py +++ b/monkey/monkey_island/cc/repository/file_repository_locking_decorator.py @@ -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(): diff --git a/monkey/monkey_island/cc/repository/file_repository_logging_decorator.py b/monkey/monkey_island/cc/repository/file_repository_logging_decorator.py index 099b79106..b4b0522b4 100644 --- a/monkey/monkey_island/cc/repository/file_repository_logging_decorator.py +++ b/monkey/monkey_island/cc/repository/file_repository_logging_decorator.py @@ -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") diff --git a/monkey/monkey_island/cc/repository/i_file_repository.py b/monkey/monkey_island/cc/repository/i_file_repository.py index 5d44a8b4a..877079dd3 100644 --- a/monkey/monkey_island/cc/repository/i_file_repository.py +++ b/monkey/monkey_island/cc/repository/i_file_repository.py @@ -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