Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before submitting a pull request (PR), please read the contributing guide.
Please fill out as much of this template as you can, but if you have any problems or questions, just leave a comment and we will help out :)
Description
What is this PR
Why is this PR needed?
Outputs appropriate error messages when user tries to load atlas with no Internet connection.
What does this PR do?
In
bg_atlas.BrainGlobeAtlas
:utils.check_internet_connection()
checks for Internet connection, and also checks if GIN is down. If there is no Internet connection, code checks to see if the atlas they want is cached and available locally. If so, continues as normal.In
list_atlases.get_all_atlases_lastversions()
:utils.check_internet_connection()
checks for Internet connection, and also checks if GIN is down. If there is an Internet connection,get_all_atlases_lastversions()
performs as before and returns the updated list of available atlases fromlast_versions.conf
from GIN.get_all_atlases_lastversions()
warns user that they are offline. If user has a local copy oflast_versions.conf
in/.brainglobe/
,get_all_atlases_lastversions()
will call a new functionutils.conf_from_file
to return the list of available atlases based on this local conf file, but will also warn the user that this list could be outdated and that they should connect to the Internet for an updated list.last_versions.conf
in/.brainglobe/
,get_all_atlases_lastversions()
will tell user that they must connect to the Internet to fetch atlas list.References
Issue #142
How has this PR been tested?
Tested locally with different situations:
In
bg_atlas.BrainGlobeAtlas
:[Works as expected, no output]
In
get_all_atlases_lastversions()
:last_versions.conf
does not exist in local/.brainglobe/
:last_versions.conf
does exist in local/.brainglobe/
(but could be outdated):(Note: I am explicitly printing the list here)
(Works as expected and gets
last_versions.conf
from GIN with no error messages. Again, I am explicitly printing the list here)Is this a breaking change?
No.
Does this PR require an update to the documentation?
N/A
Checklist: