File tree Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change 11"""Checks specific to the Images neurodata type."""
2- from ..register_checks import register_check , Importance , InspectorMessage
3-
4- try : # The Images neurodata type was unavailable prior to PyNWB v.2.1.0
5- from pynwb .base import Images
6-
7- HAVE_IMAGES = True
8- except ImportError :
9- HAVE_IMAGES = False
2+ from packaging .version import Version
103
114from pynwb .image import IndexSeries
125
13- if HAVE_IMAGES :
6+ from ..register_checks import register_check , Importance , InspectorMessage
7+ from ..utils import get_package_version
8+
9+ # The Images neurodata type was unavailable prior to PyNWB v.2.1.0
10+ if get_package_version (name = "pynwb" ) >= Version ("2.1.0" ):
11+ from pynwb .base import Images
1412
1513 @register_check (importance = Importance .BEST_PRACTICE_VIOLATION , neurodata_type = Images )
1614 def check_order_of_images_unique (images : Images ):
Original file line number Diff line number Diff line change 33import numpy as np
44from pynwb import TimeSeries
55from pynwb .image import GrayscaleImage , IndexSeries
6+ from packaging .version import Version
67
78from nwbinspector import InspectorMessage , Importance
89from nwbinspector .checks .images import (
910 check_order_of_images_unique ,
1011 check_order_of_images_len ,
1112 check_index_series_points_to_image ,
1213)
14+ from nwbinspector .utils import get_package_version
1315
14- try :
15- from pynwb .base import Images , ImageReferences
16-
17- HAVE_IMAGES = True
18- except ImportError :
19- HAVE_IMAGES = False
16+ HAVE_IMAGES = get_package_version (name = "pynwb" ) >= Version ("2.1.0" )
2017skip_reason = "You must have PyNWB>=v2.1.0 to run these tests!"
18+ if HAVE_IMAGES :
19+ from pynwb .base import Images , ImageReferences
2120
2221
2322@pytest .mark .skipif (not HAVE_IMAGES , reason = skip_reason )
You can’t perform that action at this time.
0 commit comments