This will improve code execution because nested loops are slower than list/dictionary comprehensions.
Signed-off-by: nothingbutlucas <69118979+nothingbutlucas@users.noreply.github.com>
This may seems like a lot, but the only think that I change here was the if/else block. I move the else statement at the beginning and if that condition is true, will exit the function. This is just for code clarity, I think that this change should not improve the speed or performance of the code.
Signed-off-by: nothingbutlucas <69118979+nothingbutlucas@users.noreply.github.com>
This will remove the unnecesary import of time, and a little bit of format
Signed-off-by: nothingbutlucas <69118979+nothingbutlucas@users.noreply.github.com>
This will make it easier for us to maintain and understand the main function. Also deleting duplicated code
Signed-off-by: nothingbutlucas <69118979+nothingbutlucas@users.noreply.github.com>
Strings in Python are immutable so, the "+" operation means that we need to create the string again and attaching the old content. Per "+". We can replace this by using join() or built-in functions or arguments of functions, like "sep" in print()
Signed-off-by: nothingbutlucas <69118979+nothingbutlucas@users.noreply.github.com>
According PEP8 this is the recommended way to do it. I'm 99% sure that this does not speed up the code, but we are comparing identity, not equality, so "is" and "is not" must be used.
Signed-off-by: nothingbutlucas <69118979+nothingbutlucas@users.noreply.github.com>
Required version info was not being downloaded when alternate (not latest)
version is selected rsulting in the error "Could not read locally cached
release information."
New command line option `--fw-url` accepts an alternate URL to use for
downloading firmware images.
Note this feature is moderately opinionated when it comes to directory
structure. The intent is to be compatible with GitHub releases, so the
latest version info is expected to be found at
"{fw-url}latest/download/release.json" and firmware images at
"{fw-url}download/{version}/{firmware_file.zip}".