brainglobe-atlasapi icon indicating copy to clipboard operation
brainglobe-atlasapi copied to clipboard

[Feature] Make `get_local_atlas_version` return `None` for not-available atlases.

Open alessandrofelder opened this issue 6 months ago • 0 comments

Is your feature request related to a problem? Please describe. We currently need an extra check for whether the atlas is locally available or not before confidently calling get_local_atlas_version - see e.g. https://github.com/brainglobe/brainrender-napari/pull/123/files#r1432674067 - because calling this function with a remote atlas name causes a list index out of range error.

Describe the solution you'd like get_local_atlas_version should return None for not locally available atlases, so we can have expressive checks like:

if not get_local_atlas_version:
    # download the atlas, or do something else...

Describe alternatives you've considered Could also error more expressively, or return a string like "n/a", but the suggested solution seems more elegant to me, because it can be used in conditionals.

alessandrofelder avatar Dec 20 '23 16:12 alessandrofelder