Skip to content

Commit

Permalink
removed obsolete recursive_file_count
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobatymo committed Jun 3, 2020
1 parent ec6a327 commit 9945ec8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
2 changes: 1 addition & 1 deletion internetarchive/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,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.utils import get_s3_xml_text, get_file_size, is_dir
Expand Down
31 changes: 0 additions & 31 deletions internetarchive/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down

0 comments on commit 9945ec8

Please sign in to comment.