Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 27, 2023
1 parent 0738a14 commit 526820d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
9 changes: 6 additions & 3 deletions apps/dc_tools/odc/apps/dc_tools/s3_to_dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,18 @@ def cli(
is_glob = False
for url in uri:
if "*" in url:
logging.warning("A list of uris is assumed to include only absolute URLs. "
"Any wildcard characters will be escaped.")
logging.warning(
"A list of uris is assumed to include only absolute URLs. "
"Any wildcard characters will be escaped."
)

# Get a generator from supplied S3 Uri for candidate documents
fetcher = S3Fetcher(aws_unsigned=no_sign_request)
# Grab the URL from the resulting S3 item
if is_glob:
document_stream = (
url.url for url in s3_find_glob(uri[0], skip_check=skip_check, s3=fetcher, **opts)
url.url
for url in s3_find_glob(uri[0], skip_check=skip_check, s3=fetcher, **opts)
)
else:
# if working with absolute URLs, no need for all the globbing logic
Expand Down
11 changes: 4 additions & 7 deletions apps/dc_tools/tests/test_s3_to_dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ def test_s3_to_dc_partially_succeeds_when_given_invalid_and_valid_dataset_yamls(
)


def test_s3_to_dc_list_absolute_urls(
mocked_s3_datasets, odc_test_db_with_products
):
def test_s3_to_dc_list_absolute_urls(mocked_s3_datasets, odc_test_db_with_products):
# provide mulitple uris, as absolute URLs
runner = CliRunner()
result = runner.invoke(
Expand All @@ -154,9 +152,7 @@ def test_s3_to_dc_list_absolute_urls(
)


def test_s3_to_dc_no_product(
mocked_s3_datasets, odc_test_db_with_products
):
def test_s3_to_dc_no_product(mocked_s3_datasets, odc_test_db_with_products):
# product should not need to be specified
runner = CliRunner()
result = runner.invoke(
Expand Down Expand Up @@ -184,5 +180,6 @@ def test_s3_to_dc_no_product(
)
assert result2.exit_code == 0
assert (
result2.output == "Added 1 datasets, skipped 0 datasets and failed 0 datasets.\n"
result2.output
== "Added 1 datasets, skipped 0 datasets and failed 0 datasets.\n"
)

0 comments on commit 526820d

Please sign in to comment.