-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MNT: Use importlib_resources for Python < 3.9
- Loading branch information
Showing
2 changed files
with
7 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
"""A Python package for working with the BIDS schema.""" | ||
from . import render, schema, utils | ||
|
||
from importlib import resources as ilr | ||
try: | ||
from importlib.resources import as_file, files | ||
except ImportError: # PY<3.9 | ||
from importlib_resources import as_file, files | ||
|
||
__all__ = [ | ||
"render", | ||
"schema", | ||
"utils", | ||
] | ||
|
||
version_file = ilr.files("schemacode.data") / "schema" / "SCHEMA_VERSION" | ||
with ilr.as_file(version_file) as path: | ||
version_file = files("schemacode.data") / "schema" / "SCHEMA_VERSION" | ||
with as_file(version_file) as path: | ||
__version__ = path.read_text().strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters