Remove callback_exclusion.

This commit is contained in:
voussoir 2021-01-25 14:44:31 -08:00
parent 0b7eda1e36
commit 2bb71c6ac2
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -44,12 +44,6 @@ class SpinalError(SpinalException):
class ValidationError(SpinalException): class ValidationError(SpinalException):
pass pass
def callback_exclusion_v1(name, path_type):
'''
Example of an exclusion callback function.
'''
print('Excluding', path_type, name)
def callback_progress_v1(fpobj, written_bytes, total_bytes): def callback_progress_v1(fpobj, written_bytes, total_bytes):
''' '''
Example of a copy callback function. Example of a copy callback function.
@ -92,7 +86,6 @@ def copy_dir(
*, *,
bytes_per_second=None, bytes_per_second=None,
callback_directory_progress=None, callback_directory_progress=None,
callback_exclusion=None,
callback_file_progress=None, callback_file_progress=None,
callback_permission_denied=None, callback_permission_denied=None,
callback_pre_directory=None, callback_pre_directory=None,
@ -130,9 +123,6 @@ def copy_dir(
If `precalcsize` is False, this function will receive written bytes If `precalcsize` is False, this function will receive written bytes
for both written and total, showing 100% always. for both written and total, showing 100% always.
callback_exclusion:
Passed directly into `walk_generator`.
callback_file_progress: callback_file_progress:
Passed into each `copy_file` as `callback_progress`. Passed into each `copy_file` as `callback_progress`.
@ -235,7 +225,6 @@ def copy_dir(
# Copy # Copy
walker = walk_generator( walker = walk_generator(
source, source,
callback_exclusion=callback_exclusion,
exclude_directories=exclude_directories, exclude_directories=exclude_directories,
exclude_filenames=exclude_filenames, exclude_filenames=exclude_filenames,
yield_style='nested', yield_style='nested',
@ -654,7 +643,6 @@ def verify_hash(
def walk_generator( def walk_generator(
path='.', path='.',
*, *,
callback_exclusion=None,
callback_permission_denied=None, callback_permission_denied=None,
exclude_directories=None, exclude_directories=None,
exclude_filenames=None, exclude_filenames=None,
@ -666,10 +654,6 @@ def walk_generator(
''' '''
Yield Path objects for files in the file tree, similar to os.walk. Yield Path objects for files in the file tree, similar to os.walk.
callback_exclusion:
This function will be called when a file or directory is excluded with
two parameters: the path, and 'file' or 'directory'.
exclude_filenames: exclude_filenames:
A set of filenames that will not be copied. Entries can be absolute A set of filenames that will not be copied. Entries can be absolute
paths to exclude that particular file, or plain names to exclude paths to exclude that particular file, or plain names to exclude
@ -708,7 +692,6 @@ def walk_generator(
if exclude_filenames is None: if exclude_filenames is None:
exclude_filenames = set() exclude_filenames = set()
callback_exclusion = callback_exclusion or do_nothing
callback_permission_denied = callback_permission_denied or do_nothing callback_permission_denied = callback_permission_denied or do_nothing
_callback_permission_denied = callback_permission_denied _callback_permission_denied = callback_permission_denied
def callback_permission_denied(error): def callback_permission_denied(error):
@ -726,7 +709,6 @@ def walk_generator(
) )
if exclude: if exclude:
callback_exclusion(path, 'directory')
return return
def handle_exclusion(blacklist, basename, abspath, kind): def handle_exclusion(blacklist, basename, abspath, kind):
@ -735,7 +717,6 @@ def walk_generator(
normalize(abspath) in blacklist normalize(abspath) in blacklist
) )
if exclude: if exclude:
callback_exclusion(abspath, kind)
return 1 return 1
# In the following loops, I found joining the os.sep with fstrings to be # In the following loops, I found joining the os.sep with fstrings to be