Skip to content
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

Show progress bar when uploading image #15

Merged
merged 3 commits into from
Oct 20, 2021

Conversation

exjobo
Copy link
Contributor

@exjobo exjobo commented Sep 10, 2021

Enhancement For #14

bar = '#' * filled_len + '-' * (length - filled_len)
raw_elapsed = time.time() - start_time
elapsed = time.strftime("[%H:%M:%S]", time.gmtime(raw_elapsed))
sys.stdout.write(f'\r |{bar}| {cur}/{total} {percent}% {elapsed}')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refactor to remove F-strings. We need to maintain older Python compat.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review. it's been fixed.

import requests

import pytest
import requests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need requests twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed unused import pytest too.

from virl2_client.models import NodeImageDefinitions

def test_upload_image_files(requests_mock):
adapter = requests_mock.post('mock://images/upload')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format your code with black.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/test_definitions.py has been formatted by black.

@rschmied
Copy link
Member

Thanks for the contribution, @exjobo , I'll merge this soon. Just need to figure out how to ideally integrate this into our dev branch. Should be no big deal.

@rschmied rschmied self-requested a review October 20, 2021 10:03
Copy link
Member

@rschmied rschmied left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, except for the cosmetic stuff... will merge.

bar = '#' * filled_len + '-' * (length - filled_len)
raw_elapsed = time.time() - start_time
elapsed = time.strftime("[%H:%M:%S]", time.gmtime(raw_elapsed))
sys.stdout.write('\r |{}| {}/{} {}% {}'.format(bar, cur, total, percent, elapsed))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be print, really. You can do the same thing with print("something", end="", flush=True).

there's also a couple of single quotes for strings instead of double quotes and trailing whitespace. Ideally, pip install black and run black over the code base to get consistent formatting.

this is no big deal, though... I'm going to merge this. we will incorporate this change into our dev branch and make the additional changes there so that they can be included into the 2.3 release.

@rschmied rschmied merged commit 2520f60 into CiscoDevNet:master Oct 20, 2021
rschmied pushed a commit that referenced this pull request Jul 18, 2022
…de-tags-are-overwritten-when-adding-new-tags-via-pcl to dev

* commit '2128d14b8f299e9612e0b11cf3d849bb58791810':
  SIMPLE-3713 - Fix client node tag addition
rschmied added a commit that referenced this pull request Jul 18, 2022
* show progress bar when uploading image

* fixup! show progress bar when uploading image

* fixup! show progress bar when uploading image

Co-authored-by: Yoshitaka Nagami <ynagami@cisco.com>

release 2.3.0 (#19)

2.4.0 release

cherry pick changes from bb/dev

- changed some documentation (use of CML vs VIRL) in the README.md
- added a CHANGES.md
- updated dependencies
- removed "deprecation" warning in lab.is_active()
- reverted the pytest configuration changes so that GH actions will pass
- pre-commit black version constraint bumped to 22.3
  see https://stackoverflow.com/questions/71673404/importerror-cannot-import-name-unicodefun-from-click
- run GH actions also on the dev branch
- removed "asyncio_mode = auto" from pytest.ini (we're not depending on
  pytest-asyncio)
- updated requirements.txt for venv installation via GitHub Actions

sphinx and pytest config changes

format long lines

addressing comments
rschmied added a commit that referenced this pull request Jul 18, 2022
…l-from-github-repo-and-improve-deprecation-warnings to dev

* commit '331422e2e783c4fc801ec0ae46da74673d91b3f5':
  Show progress bar when uploading image (#15)
rschmied added a commit that referenced this pull request Oct 5, 2022
* show progress bar when uploading image

* fixup! show progress bar when uploading image

* fixup! show progress bar when uploading image

Co-authored-by: Yoshitaka Nagami <ynagami@cisco.com>
minor changes

- added .vscode to .gitignore
- Makefile updates
- replace sys.stdout.write with print
- dependency update

bumped version to 2.21.post2

updated requirements.txt
rschmied pushed a commit that referenced this pull request Oct 5, 2022
…_with_gh to master

* commit '4dee82c2587e2df09db08fa8fb80899b7daccf22':
  Show progress bar when uploading image (#15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants