Skip to content

Commit

Permalink
file: raise error (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry authored Jan 15, 2025
1 parent 57899d2 commit 973f742
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/datachain/lib/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ def get_vtype(cls) -> str:
def open(cls, file: "File", location: list[dict]):
"""Stream file from tar archive based on location in archive."""
if len(location) > 1:
VFileError(file, "multiple 'location's are not supported yet")
raise VFileError(file, "multiple 'location's are not supported yet")

loc = location[0]

if (offset := loc.get("offset", None)) is None:
VFileError(file, "'offset' is not specified")
raise VFileError(file, "'offset' is not specified")

if (size := loc.get("size", None)) is None:
VFileError(file, "'size' is not specified")
raise VFileError(file, "'size' is not specified")

if (parent := loc.get("parent", None)) is None:
VFileError(file, "'parent' is not specified")
raise VFileError(file, "'parent' is not specified")

tar_file = File(**parent)
tar_file._set_stream(file._catalog)
Expand Down

0 comments on commit 973f742

Please sign in to comment.