-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Cli download commands aleph & ipfs #165
Conversation
src/aleph_client/commands/files.py
Outdated
if not use_ipfs: | ||
file_content = client.download_file(item_hash) | ||
else: | ||
file_content = client.download_file_ipfs(item_hash) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can now use download_file_to_buffer
to reduce memory usage.
src/aleph_client/commands/utils.py
Outdated
write content of file download to byte into a path | ||
""" | ||
file_path = Path(path) | ||
file_path.write_bytes(content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function will be useless once you use download_file_to_buffer
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only minor formating issues, use isort, flake8 & black
@@ -7,6 +7,7 @@ | |||
from pygments.lexers import JsonLexer | |||
from typer import echo | |||
from datetime import datetime | |||
from pathlib import Path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unneeded import
@@ -122,3 +123,4 @@ def str_to_datetime(date: Optional[str]) -> Optional[datetime]: | |||
except ValueError: | |||
pass | |||
return datetime.fromisoformat(date) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can revert this file
@@ -15,4 +15,4 @@ def test_get_message_type_value(): | |||
assert get_message_type_value(AggregateMessage) == MessageType.aggregate | |||
assert get_message_type_value(StoreMessage) == MessageType.store | |||
assert get_message_type_value(ProgramMessage) == MessageType.program | |||
assert get_message_type_value(ForgetMessage) == MessageType.forget | |||
assert get_message_type_value(ForgetMessage) == MessageType.forget |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems also unneeded? Maybe it's due to auto formatting
if path is None: | ||
path = item_hash | ||
|
||
with AlephClient(api_server=sdk_settings.API_HOST) as client: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the wrong import, try using async with AlephHttpClient
Closing this PR and will be superseded by a fresh branch. GH seems to not handle some of the rebases/force-pushes well that happened here |
Solutions: