Skip to content

Commit cb92315

Browse files
authored
remove redundant logging
1 parent c594d41 commit cb92315

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

platform.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,12 @@ def safe_remove_directory_pattern(base_path: str, pattern: str) -> bool:
123123
"""Safely remove directories matching a pattern with error handling."""
124124
if not os.path.exists(base_path):
125125
return True
126-
127-
try:
128-
# Find all directories matching the pattern in the base directory
129-
for item in os.listdir(base_path):
130-
item_path = os.path.join(base_path, item)
131-
if os.path.isdir(item_path) and fnmatch.fnmatch(item, pattern):
132-
shutil.rmtree(item_path)
133-
logger.debug(f"Directory removed: {item_path}")
134-
except OSError as e:
135-
logger.error(f"Error removing directories with pattern {pattern}: {e}")
136-
return False
126+
# Find all directories matching the pattern in the base directory
127+
for item in os.listdir(base_path):
128+
item_path = os.path.join(base_path, item)
129+
if os.path.isdir(item_path) and fnmatch.fnmatch(item, pattern):
130+
shutil.rmtree(item_path)
131+
logger.debug(f"Directory removed: {item_path}")
137132
return True
138133

139134

0 commit comments

Comments
 (0)