-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
default load_namespaces=True #1748
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
0345a46
default load_namespaces=True
bendichter 792451d
Update CHANGELOG.md
bendichter 382f0fb
change logic around to ignore load_namespaces when it cannot be used
bendichter acb1c8d
Merge remote-tracking branch 'origin/load_namespaces_true' into load_…
bendichter 26faa0c
flake8
bendichter 955fb8d
Merge branch 'dev' into load_namespaces_true
bendichter 2c6a415
Update __init__.py
rly 7f1a1e3
Merge branch 'dev' into load_namespaces_true
bendichter 9d5ab33
fix back-compatibility test
bendichter 41ba0db
Merge remote-tracking branch 'origin/load_namespaces_true' into load_…
bendichter 6c941a0
flake8
bendichter f8e35d3
flake8
bendichter df2a32e
remove warning from test
bendichter e7023c2
Merge branch 'dev' into load_namespaces_true
oruebel 8087153
rmv useless test
bendichter 8a95beb
Merge remote-tracking branch 'origin/load_namespaces_true' into load_…
bendichter 28ba0d1
Merge branch 'dev' into load_namespaces_true
bendichter 6c4d772
Merge branch 'dev' into load_namespaces_true
rly a833c9e
Merge branch 'dev' into load_namespaces_true
rly 8b86a20
Update tests, validate script for default load ns
rly ac71956
Update CHANGELOG.md
rly 2384a69
Update docs/gallery/advanced_io/linking_data.py
rly a0daffa
Update docs/gallery/advanced_io/linking_data.py
rly 930eef6
Update test_file.py
rly a8cf307
Merge branch 'dev' into load_namespaces_true
rly ad0e08f
Merge branch 'dev' into load_namespaces_true
rly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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 |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
import os.path | ||
from pathlib import Path | ||
from copy import deepcopy | ||
from warnings import warn | ||
import h5py | ||
|
||
from hdmf.spec import NamespaceCatalog | ||
|
@@ -244,8 +243,9 @@ def can_read(path: str): | |
'doc': 'the mode to open the HDF5 file with, one of ("w", "r", "r+", "a", "w-", "x")', | ||
'default': 'r'}, | ||
{'name': 'load_namespaces', 'type': bool, | ||
'doc': 'whether or not to load cached namespaces from given path - not applicable in write mode', | ||
'default': False}, | ||
'doc': ('whether or not to load cached namespaces from given path - not applicable in write mode ' | ||
'or when `manager` is not None or when `extensions` is not None'), | ||
'default': True}, | ||
{'name': 'manager', 'type': BuildManager, 'doc': 'the BuildManager to use for I/O', 'default': None}, | ||
{'name': 'extensions', 'type': (str, TypeMap, list), | ||
'doc': 'a path to a namespace, a TypeMap, or a list consisting paths to namespaces and TypeMaps', | ||
|
@@ -261,15 +261,10 @@ def __init__(self, **kwargs): | |
popargs('path', 'mode', 'manager', 'extensions', 'load_namespaces', | ||
'file', 'comm', 'driver', 'herd_path', kwargs) | ||
# Define the BuildManager to use | ||
if load_namespaces: | ||
if manager is not None: | ||
warn("loading namespaces from file - ignoring 'manager'") | ||
if extensions is not None: | ||
warn("loading namespaces from file - ignoring 'extensions' argument") | ||
# namespaces are not loaded when creating an NWBHDF5IO object in write mode | ||
if 'w' in mode or mode == 'x': | ||
raise ValueError("cannot load namespaces from file when writing to it") | ||
if mode in 'wx' or manager is not None or extensions is not None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this introduced a bug. |
||
load_namespaces = False | ||
|
||
if load_namespaces: | ||
tm = get_type_map() | ||
super().load_namespaces(tm, path, file=file_obj, driver=driver) | ||
manager = BuildManager(tm) | ||
|
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
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here was correct.