Skip to content

Commit

Permalink
Merge pull request #82 from ImageMarkup/lowercase-jpg
Browse files Browse the repository at this point in the history
Download images to lowercase jpg
  • Loading branch information
danlamanna committed May 24, 2024
2 parents 38a1f37 + 4e5291d commit c42aae6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion isic_cli/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _sentry_setup():
@click.option("-v", "--verbose", is_flag=True, help="Enable verbose mode.")
@click.version_option()
@click.pass_context
def cli(ctx, verbose: bool, guest: bool, sandbox: bool, dev: bool, no_version_check: bool): # noqa: FBT001, C901, PLR0912, PLR0913
def cli(ctx, verbose: bool, guest: bool, sandbox: bool, dev: bool, no_version_check: bool): # noqa: FBT001, C901, PLR0913
logger.addHandler(logging.StreamHandler(sys.stderr))
logger.setLevel(logging.WARNING)

Expand Down
2 changes: 1 addition & 1 deletion isic_cli/io/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def get_license(session: IsicCliSession, license_type: str) -> str:
before_sleep=before_sleep_log(logger, logging.DEBUG),
)
def download_image(image: dict, to: Path, progress, task) -> None:
dest_path = to / f'{image["isic_id"]}.JPG'
dest_path = to / f'{image["isic_id"]}.jpg'

# Avoid re downloading the image if one of the same name/size exists. This is a decent
# enough proxy for detecting file differences without going through a hashing mechanism.
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def outdir():
@pytest.fixture()
def _mock_images(mocker, _isolated_filesystem, outdir):
def _download_image_side_effect(*args, **kwargs):
with (Path(outdir) / "ISIC_0000000.JPG").open("wb") as f:
with (Path(outdir) / "ISIC_0000000.jpg").open("wb") as f:
f.write(b"12345")

mocker.patch("isic_cli.cli.image.get_num_images", return_value=1)
Expand Down Expand Up @@ -41,7 +41,7 @@ def test_image_download(cli_run, outdir):
result = cli_run(["image", "download", outdir])

assert result.exit_code == 0, result.exception
assert Path(f"{outdir}/ISIC_0000000.JPG").exists()
assert Path(f"{outdir}/ISIC_0000000.jpg").exists()
assert Path(f"{outdir}/metadata.csv").exists()
assert Path(f"{outdir}/attribution.txt").exists()
assert Path(f"{outdir}/licenses/CC-0.txt").exists()
Expand Down

0 comments on commit c42aae6

Please sign in to comment.