File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed
tools/schemacode/src/bidsschematools Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change 44.. autodata:: __bids_version__
55"""
66
7- try : # Prefer backport to leave consistency to dependency spec
8- from importlib_resources import files
9- except ImportError :
10- from importlib .resources import files # type: ignore
7+ global __version__
8+ global __bids_version__
119
12- version_file = files ("bidsschematools.data" ) / "schema" / "SCHEMA_VERSION"
13- __version__ = version_file .read_text ().strip ()
14- "Schema version"
10+ __all__ = ("__version__" , "__bids_version__" )
1511
16- bids_version_file = files ("bidsschematools.data" ) / "schema" / "BIDS_VERSION"
17- __bids_version__ = bids_version_file .read_text ().strip ()
18- "BIDS specification version"
12+
13+ def __getattr__ (attr ):
14+ from .data import load_resource
15+
16+ if attr == "__version__" :
17+ global __version__
18+ __version__ = load_resource ("schema/SCHEMA_VERSION" ).read_text ().strip ()
19+ __version__ .__doc__ = "Schema version"
20+ return __version__
21+ elif attr == "__bids_version__" :
22+ global __bids_version__
23+ __bids_version__ = load_resource ("schema/BIDS_VERSION" ).read_text ().strip ()
24+ __bids_version__ .__doc__ = "BIDS specification version"
25+ return __bids_version__
26+
27+ raise AttributeError (f"module { __spec__ .name !r} has no attribute { attr !r} " )
You can’t perform that action at this time.
0 commit comments