Skip to content

Commit fd86983

Browse files
jjmckeeDescartes Labs Build
authored andcommitted
Core-255 (#12478)
GitOrigin-RevId: 49522bb6cee32080ed4d37ecf4e93892f4648476
1 parent d0248a3 commit fd86983

File tree

2 files changed

+854
-8
lines changed

2 files changed

+854
-8
lines changed

descarteslabs/core/catalog/blob.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def get(
394394
raise TypeError("Must specify exactly one of id or name parameters")
395395
if not id:
396396
id = f"{storage_type}/{Blob.namespace_id(namespace)}/{name}"
397-
return super(cls, Blob).get(id)
397+
return super(cls, Blob).get(id, client=client)
398398

399399
@classmethod
400400
def get_or_create(
@@ -660,7 +660,7 @@ def download(self, file, range=None):
660660
Parameters
661661
----------
662662
file : str or io.IOBase
663-
File or files to be uploaded. Can be string with path to the file in the
663+
Where to write the downloaded blob. Can be string with path to the file in the
664664
local filesystem, or an file opened for writing (``io.IOBase``). If a file like
665665
object and already open, must be binary mode and writable. Open file-like
666666
objects remain open on return and must be closed by the caller.
@@ -689,7 +689,6 @@ def download(self, file, range=None):
689689

690690
if isinstance(file, str):
691691
file = io.open(file, "wb")
692-
close = True
693692
elif isinstance(file, io.IOBase):
694693
close = file.closed
695694
if close:
@@ -942,9 +941,6 @@ def delete_many(cls, ids, client=None):
942941
:ref:`Spurious exception <network_exceptions>` that can occur during a
943942
network request.
944943
"""
945-
if client is None:
946-
client = CatalogClient.get_default_client()
947-
948944
blob_delete = BlobDelete(ids=ids, client=client)
949945

950946
blob_delete.save()
@@ -973,9 +969,9 @@ def _do_download(self, dest=None, range=None):
973969
elif len(range) == 2:
974970
range_str = f"bytes={range[0]}-{range[1]}"
975971
else:
976-
ValueError("invalid range value")
972+
raise ValueError("invalid range value")
977973
else:
978-
ValueError("invalid range value")
974+
raise ValueError("invalid range value")
979975

980976
headers["range"] = range_str
981977

0 commit comments

Comments
 (0)