File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -207,8 +207,8 @@ def recursive_cleanup(dirpath: str | Path):
207207 if entry .is_dir ():
208208 # Recursively delete directories with blacklisted substrings
209209 if any (
210- char in entry .name
211- for char in self ._substrings_blacklist .get ("directories" , [])
210+ pattern in entry .name
211+ for pattern in self ._substrings_blacklist .get ("directories" , [])
212212 ):
213213 logger .debug (f"Deleting blacklisted directory { entry .path } " )
214214 shutil .rmtree (entry .path )
@@ -218,8 +218,8 @@ def recursive_cleanup(dirpath: str | Path):
218218 elif entry .is_file ():
219219 # Delete blacklisted files
220220 if any (
221- char in entry .name
222- for char in self ._substrings_blacklist .get ("files" , [])
221+ pattern in entry .name
222+ for pattern in self ._substrings_blacklist .get ("files" , [])
223223 ):
224224 logger .debug (f"Deleting blacklisted file { entry .path } " )
225225 Path (entry .path ).unlink ()
Original file line number Diff line number Diff line change @@ -247,8 +247,8 @@ def _scan_directory(
247247 entry_name = os .path .join (path , entry .name )
248248 # Skip any directories with matching blacklisted substrings
249249 if entry .is_dir () and any (
250- char in entry .name
251- for char in self ._substrings_blacklist .get ("directories" , [])
250+ pattern in entry .name
251+ for pattern in self ._substrings_blacklist .get ("directories" , [])
252252 ):
253253 log .debug (f"Skipping blacklisted directory { str (entry .name )!r} " )
254254 continue
@@ -262,8 +262,8 @@ def _scan_directory(
262262 continue
263263 # Exclude files with blacklisted substrings
264264 if any (
265- char in entry .name
266- for char in self ._substrings_blacklist .get ("files" , [])
265+ pattern in entry .name
266+ for pattern in self ._substrings_blacklist .get ("files" , [])
267267 ):
268268 log .debug (f"Skipping blacklisted file { str (entry .name )!r} " )
269269 continue
You can’t perform that action at this time.
0 commit comments