Skip to content

Commit

Permalink
Merge branch 'dandi:master' into expose_number_of_jobs_to_organize
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD authored Nov 1, 2023
2 parents bef13dd + e99ee62 commit d6fbe67
Show file tree
Hide file tree
Showing 12 changed files with 1,037 additions and 709 deletions.
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
# 0.57.0 (Wed Nov 01 2023)

#### 🚀 Enhancement

- `?location` parameter in URLs can only point to a folder [#1305](https://github.com/dandi/dandi-cli/pull/1305) ([@yarikoptic](https://github.com/yarikoptic) [@jwodder](https://github.com/jwodder))

#### 🐛 Bug Fix

- Add missing term in ETA calculation [#1340](https://github.com/dandi/dandi-cli/pull/1340) ([@sneakers-the-rat](https://github.com/sneakers-the-rat))

#### 🏠 Internal

- typing: Account for the fact that requests.HTTPError .response migth be None now [#1336](https://github.com/dandi/dandi-cli/pull/1336) ([@yarikoptic](https://github.com/yarikoptic))
- [gh-actions](deps): Bump actions/checkout from 3 to 4 [#1326](https://github.com/dandi/dandi-cli/pull/1326) ([@dependabot[bot]](https://github.com/dependabot[bot]))
- codespell: tuneup of config and some new typos detected fixes [#1334](https://github.com/dandi/dandi-cli/pull/1334) ([@yarikoptic](https://github.com/yarikoptic))

#### 📝 Documentation

- Minor documentation tune up [#1338](https://github.com/dandi/dandi-cli/pull/1338) ([@yarikoptic](https://github.com/yarikoptic))

#### 🧪 Tests

- Re-record VCR tapes using newer versions of libraries [#1337](https://github.com/dandi/dandi-cli/pull/1337) ([@yarikoptic](https://github.com/yarikoptic))
- Ignore unclosed connection resource warning from VCR [#1333](https://github.com/dandi/dandi-cli/pull/1333) ([@yarikoptic](https://github.com/yarikoptic))

#### Authors: 4

- [@dependabot[bot]](https://github.com/dependabot[bot])
- John T. Wodder II ([@jwodder](https://github.com/jwodder))
- Jonny Saunders ([@sneakers-the-rat](https://github.com/sneakers-the-rat))
- Yaroslav Halchenko ([@yarikoptic](https://github.com/yarikoptic))

---

# 0.56.2 (Fri Sep 29 2023)

#### 🐛 Bug Fix
Expand Down
244 changes: 129 additions & 115 deletions dandi/cli/tests/data/update_dandiset_from_doi/biorxiv.vcr.yaml

Large diffs are not rendered by default.

417 changes: 252 additions & 165 deletions dandi/cli/tests/data/update_dandiset_from_doi/elife.vcr.yaml

Large diffs are not rendered by default.

115 changes: 52 additions & 63 deletions dandi/cli/tests/data/update_dandiset_from_doi/jneurosci.vcr.yaml

Large diffs are not rendered by default.

516 changes: 325 additions & 191 deletions dandi/cli/tests/data/update_dandiset_from_doi/nature.vcr.yaml

Large diffs are not rendered by default.

383 changes: 218 additions & 165 deletions dandi/cli/tests/data/update_dandiset_from_doi/neuron.vcr.yaml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions dandi/cli/tests/test_service_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
from pathlib import Path
import re
import sys

import anys
from click.testing import CliRunner
Expand Down Expand Up @@ -48,6 +49,10 @@ def record_only_doi_requests(request):
return None


@pytest.mark.xfail(
sys.version_info < (3, 10),
reason="Some difference in VCR tape: https://github.com/dandi/dandi-cli/pull/1337",
)
@pytest.mark.parametrize(
"doi,name",
[
Expand Down
4 changes: 2 additions & 2 deletions dandi/dandiapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ def request(
if isinstance(e, requests.HTTPError):
lgr.error(
"HTTP request failed repeatedly: Error %d while sending %s request to %s: %s",
e.response.status_code,
e.response.status_code if e.response is not None else "?",
method,
url,
e.response.text,
e.response.text if e.response is not None else "?",
)
else:
lgr.exception("HTTP connection failed")
Expand Down
12 changes: 10 additions & 2 deletions dandi/dandiarchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ def navigate(
try:
dandiset = self.get_dandiset(client, lazy=not strict)
except requests.HTTPError as e:
if e.response.status_code == 401 and authenticate is not False:
if (
e.response is not None
and e.response.status_code == 401
and authenticate is not False
):
lgr.info("Resource requires authentication; authenticating ...")
client.dandi_authenticate()
dandiset = self.get_dandiset(client, lazy=not strict)
Expand Down Expand Up @@ -293,7 +297,11 @@ def navigate(
try:
assets = list(self.get_assets(client, strict=strict))
except requests.HTTPError as e:
if e.response.status_code == 401 and authenticate is not False:
if (
e.response is not None
and e.response.status_code == 401
and authenticate is not False
):
lgr.info("Resource requires authentication; authenticating ...")
client.dandi_authenticate()
assets = list(self.get_assets(client, strict=strict))
Expand Down
12 changes: 8 additions & 4 deletions dandi/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,10 +700,14 @@ def _download_file(
except requests.exceptions.HTTPError as exc:
# TODO: actually we should probably retry only on selected codes, and also
# respect Retry-After
if attempt >= 2 or exc.response.status_code not in (
400, # Bad Request, but happened with gider:
# https://github.com/dandi/dandi-cli/issues/87
*RETRY_STATUSES,
if attempt >= 2 or (
exc.response is not None
and exc.response.status_code
not in (
400, # Bad Request, but happened with gider:
# https://github.com/dandi/dandi-cli/issues/87
*RETRY_STATUSES,
)
):
lgr.debug("Download failed: %s", exc)
yield {"status": "error", "message": str(exc)}
Expand Down
2 changes: 1 addition & 1 deletion dandi/files/bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def iter_upload(
},
)
except requests.HTTPError as e:
if e.response.status_code == 409:
if e.response is not None and e.response.status_code == 409:
lgr.debug("%s: Blob already exists on server", asset_path)
blob_id = e.response.headers["Location"]
else:
Expand Down
2 changes: 1 addition & 1 deletion dandi/files/zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def mkzarr() -> str:
json={"name": asset_path, "dandiset": dandiset.identifier},
)
except requests.HTTPError as e:
if "Zarr already exists" in e.response.text:
if e.response is not None and "Zarr already exists" in e.response.text:
lgr.warning(
"%s: Found pre-existing Zarr at same path not"
" associated with any asset; reusing",
Expand Down

0 comments on commit d6fbe67

Please sign in to comment.