diff --git a/src/probeinterface/neuropixels_tools.py b/src/probeinterface/neuropixels_tools.py index ed80069..2472206 100644 --- a/src/probeinterface/neuropixels_tools.py +++ b/src/probeinterface/neuropixels_tools.py @@ -28,7 +28,8 @@ def _load_np_probe_features(): global _np_probe_features if _np_probe_features is None: probe_features_filepath = Path(__file__).absolute().parent / Path("resources/neuropixels_probe_features.json") - _np_probe_features = json.load(open(probe_features_filepath, "r")) + with open(probe_features_filepath, "r") as f: + _np_probe_features = json.load(f) return _np_probe_features diff --git a/src/probeinterface/testing.py b/src/probeinterface/testing.py index 34111da..f247ace 100644 --- a/src/probeinterface/testing.py +++ b/src/probeinterface/testing.py @@ -4,7 +4,8 @@ from probeinterface import __version__ as version json_schema_file = Path(__file__).absolute().parent / "schema" / "probe.json.schema" -schema = json.load(open(json_schema_file, "r")) +with open(json_schema_file, "r") as f: + schema = json.load(f) def validate_probe_dict(probe_dict):