File tree 1 file changed +26
-1
lines changed
1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
import h5py
2
- import pynwb
2
+ import re
3
3
import warnings
4
+ from distutils .version import LooseVersion
4
5
6
+ import pynwb
5
7
from pynwb import NWBHDF5IO
6
8
7
9
from . import get_logger
@@ -95,6 +97,29 @@ def validate(path):
95
97
errors = pynwb .validate (reader )
96
98
except Exception as exc :
97
99
errors = [f"Failed to validate { path } : { exc } " ]
100
+
101
+ # To overcome
102
+ # https://github.com/NeurodataWithoutBorders/pynwb/issues/1090
103
+ # https://github.com/NeurodataWithoutBorders/pynwb/issues/1091
104
+ re_ok_prior_210 = re .compile (
105
+ "general/(experimenter|related_publications)\): "
106
+ "incorrect shape - expected an array of shape .\[None\]."
107
+ )
108
+ try :
109
+ version = get_nwb_version (path )
110
+ except :
111
+ # we just will not remove any errors
112
+ pass
113
+ else :
114
+ if version and LooseVersion (version ) < "2.1.0" :
115
+ errors_ = errors [:]
116
+ errors = [e for e in errors if not re_ok_prior_210 .search (str (e ))]
117
+ if errors != errors_ :
118
+ lgr .debug (
119
+ "Filtered out %d validation errors on %s" ,
120
+ len (errors_ ) - len (errors ),
121
+ path ,
122
+ )
98
123
return errors
99
124
100
125
You can’t perform that action at this time.
0 commit comments