Skip to content

Commit

Permalink
fix(download): add sub-directories support
Browse files Browse the repository at this point in the history
  • Loading branch information
Caceresenzo committed Oct 24, 2024
1 parent 2cbac1e commit 488bec1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions crunch/api/domain/data_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __repr__(self):
@dataclasses.dataclass(frozen=True)
class DataFile:

name: str
url: str
size: int
signed: bool
Expand Down
6 changes: 3 additions & 3 deletions crunch/command/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
@dataclasses.dataclass
class DataFile:

url: str
path: str
url: str
size: int
signed: bool

Expand Down Expand Up @@ -53,12 +53,12 @@ def get_file(data_file: api.DataFile) -> DataFile:
url = data_file.url
path = os.path.join(
data_directory,
utils.get_name(url)
data_file.name
)

return DataFile(
url,
path,
url,
data_file.size,
data_file.signed
)
Expand Down
6 changes: 0 additions & 6 deletions crunch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,6 @@ def get_extension(url: str):
raise click.Abort()


def get_name(url: str):
url = cut_url(url)

return os.path.basename(url)


def _download_head(
session: requests.Session,
url: str,
Expand Down

0 comments on commit 488bec1

Please sign in to comment.