From 232642370095969859df7f433a279af798184075 Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Tue, 19 May 2026 22:18:49 +0200 Subject: [PATCH] Fix some undefined names --- neo/rawio/axographrawio.py | 1 + neo/rawio/baserawio.py | 5 ++++- neo/rawio/neuralynxrawio/neuralynxrawio.py | 1 + neo/test/iotest/test_neuralynxio.py | 3 +-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/neo/rawio/axographrawio.py b/neo/rawio/axographrawio.py index e11151ab1..b3d735d6f 100644 --- a/neo/rawio/axographrawio.py +++ b/neo/rawio/axographrawio.py @@ -162,6 +162,7 @@ _spike_channel_dtype, _event_channel_dtype, ) +from neo.core import NeoReadWriteError import os from datetime import datetime diff --git a/neo/rawio/baserawio.py b/neo/rawio/baserawio.py index f68931504..4207f3c03 100644 --- a/neo/rawio/baserawio.py +++ b/neo/rawio/baserawio.py @@ -74,6 +74,7 @@ import numpy as np import os import sys +from typing import Literal from neo import logging_handler @@ -1387,7 +1388,7 @@ def rescale_epoch_duration( """ return self._rescale_epoch_duration(raw_duration, dtype, event_channel_index) - def setup_cache(self, cache_path: "home" | "same_as_resource", **init_kargs): + def setup_cache(self, cache_path: Literal["home", "same_as_resource"], **init_kargs): try: import joblib except ImportError: @@ -1444,6 +1445,8 @@ def add_in_cache(self, **kargs): def dump_cache(self): if not self.use_cache: raise ValueError("Can not use dump_cache if not using cache") + import joblib + joblib.dump(self._cache, self.cache_filename) ################## diff --git a/neo/rawio/neuralynxrawio/neuralynxrawio.py b/neo/rawio/neuralynxrawio/neuralynxrawio.py index 9dcc6c846..64c1bdc6d 100644 --- a/neo/rawio/neuralynxrawio/neuralynxrawio.py +++ b/neo/rawio/neuralynxrawio/neuralynxrawio.py @@ -909,6 +909,7 @@ def scan_stream_ncs_files(self, ncs_filenames): # Build dictionary of chan_uid to associated NcsSections, memmap and NlxHeaders. Only # construct new NcsSections when it is different from that for the preceding file. chanSectMap = dict() + chan_ncs_sections = None sig_length = [] for ncs_filename in ncs_filenames: diff --git a/neo/test/iotest/test_neuralynxio.py b/neo/test/iotest/test_neuralynxio.py index ebfbde4f0..d916df30d 100644 --- a/neo/test/iotest/test_neuralynxio.py +++ b/neo/test/iotest/test_neuralynxio.py @@ -11,10 +11,9 @@ import quantities as pq from neo.test.iotest.common_io_test import BaseTestIO -from neo.core import * +from neo.core import AnalogSignal, Epoch, Event, Segment, SpikeTrain from neo.io.neuralynxio import NeuralynxIO -from neo import AnalogSignal from neo.test.rawiotest.test_neuralynxrawio import TestNeuralynxRawIO