Skip to content

Commit 52354eb

Browse files
committed
Fix verbose bug
1 parent 4b569e7 commit 52354eb

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

earthpy/api/appeears.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def download_files(self, cache=True):
316316

317317
files = bundle_response.json()['files']
318318

319-
'{} files available for download'.format(len(files))
319+
logging.info('{} files available for download'.format(len(files)))
320320

321321
# Download files
322322
for file_info in files:

earthpy/io.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Data(object):
3535
The Figshare token to use for data uploads.
3636
"""
3737

38-
def __init__(self, project=None):
38+
def __init__(self, project=None, verbose=False):
3939
self.project = project
4040

4141
if project is not None:
@@ -406,22 +406,22 @@ def _download_and_extract(self, path, r, kind, verbose):
406406
if verbose is True:
407407
print("Extracted output to {}".format(path))
408408

409-
def _zip_dir(self, dir_path, zip_home, zipf):
409+
def _zip_dir(self, dir_path, zip_home, zipf, verbose=False):
410410
"""Zip a directory and return the zip file path."""
411411
for subfile in dir_path.rglob("*"):
412-
if (subfile.name in DVCIGNORE) and self.verbose:
412+
if (subfile.name in DVCIGNORE) and verbose:
413413
print(f"Skipping {subfile} as it is in DVCIGNORE.")
414414
continue
415415
if subfile.is_file():
416416
dest_path = subfile.relative_to(zip_home)
417-
if self.verbose:
417+
if verbose:
418418
print(f" Zipping {subfile} to {dest_path}")
419419
zipf.write(subfile, dest_path)
420420
if subfile.is_dir():
421421
# Ensure directories are included in the zip
422422
self._zip_dir(subfile, zip_home, zipf)
423423

424-
def prepare_for_upload(self):
424+
def prepare_for_upload(self, verbose=False):
425425
"""
426426
Prepare files for upload to Figshare.
427427
@@ -449,15 +449,15 @@ def prepare_for_upload(self):
449449
if path.is_file():
450450
# If it's a file, just copy it to the output path
451451
dest_file = output_path / path.name
452-
if self.verbose:
452+
if verbose:
453453
print(f"Copying file: {path} to {dest_file}")
454454
dest_file.write_bytes(path.read_bytes())
455455
if path.is_dir():
456456
zipfile_name = output_path / f"{path.name}.zip"
457457
with zipfile.ZipFile(zipfile_name, "w") as zipf:
458-
if self.verbose:
458+
if verbose:
459459
print(f"Zipping directory: {path} to {zipfile_name}")
460460
self._zip_dir(path, path, zipf)
461-
if self.verbose:
461+
if verbose:
462462
print(f"Prepared files for upload in {output_path}")
463463
return output_path

0 commit comments

Comments
 (0)