From 477e48f207b786f2022a465bdc1d3ec08382e1fa Mon Sep 17 00:00:00 2001 From: Dobatymo Date: Wed, 3 Jun 2020 10:55:17 +0800 Subject: [PATCH] removed obsolete recursive_file_count --- internetarchive/item.py | 2 +- internetarchive/utils.py | 31 ------------------------------- 2 files changed, 1 insertion(+), 32 deletions(-) diff --git a/internetarchive/item.py b/internetarchive/item.py index 83a5f722..92210328 100644 --- a/internetarchive/item.py +++ b/internetarchive/item.py @@ -49,7 +49,7 @@ from requests.exceptions import HTTPError from internetarchive.utils import IdentifierListAsItems, get_md5, chunk_generator, \ - IterableToFileAdapter, iter_directory, recursive_file_count, norm_filepath + IterableToFileAdapter, iter_directory, norm_filepath from internetarchive.files import File from internetarchive.iarequest import MetadataRequest, S3Request from internetarchive.auth import S3Auth diff --git a/internetarchive/utils.py b/internetarchive/utils.py index 9db61f26..5dadc1bd 100644 --- a/internetarchive/utils.py +++ b/internetarchive/utils.py @@ -207,37 +207,6 @@ def iter_directory(directory): yield (filepath, key) -def recursive_file_count(files): - """Given a filepath or list of filepaths, return the total number of files.""" - if not isinstance(files, (list, set)): - files = [files] - total_files = 0 - - if isinstance(files, dict): - # make sure to use local filenames. - _files = files.values() - else: - if isinstance(files[0], tuple): - _files = dict(files).values() - else: - _files = files - for f in _files: - try: - is_dir = os.path.isdir(f) - except TypeError: - try: - f = f[0] - is_dir = os.path.isdir(f) - except (AttributeError, TypeError): - is_dir = False - if is_dir: - for x, _ in iter_directory(f): - total_files += 1 - else: - total_files += 1 - return total_files - - def is_dir(obj): """Special is_dir function to handle file-like object cases that cannot be stat'd"""