-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Refactor code and optimize imports in bot.py.
- Loading branch information
1 parent
61eab62
commit ea678bb
Showing
5 changed files
with
83 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import os | ||
from sentry_sdk import capture_exception | ||
|
||
|
||
def clean_cache(directory: str, ext: str) -> bool: | ||
files_in_directory = os.listdir(directory) | ||
filtered_files = [file for file in files_in_directory if file.endswith(ext)] | ||
for file in filtered_files: | ||
path_to_file = os.path.join(directory, file) | ||
os.remove(path_to_file) | ||
try: | ||
os.remove(path_to_file) | ||
except Exception as e: | ||
capture_exception(e) | ||
return False | ||
return True |