Skip to content

Commit ad495c8

Browse files
committed
deprecate filename and include_filename
1 parent 4be2098 commit ad495c8

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

neo/io/neuralynxio.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ class NeuralynxIO(NeuralynxRawIO, BaseFromRaw):
2929

3030
def __init__(
3131
self,
32-
dirname="",
32+
dirname,
3333
use_cache=False,
3434
cache_path="same_as_resource",
3535
include_filenames=None,
3636
exclude_filenames=None,
3737
keep_original_times=False,
38+
filename=None,
39+
exclude_filename=None,
3840
):
3941
"""
4042
Initialise IO instance
@@ -63,7 +65,8 @@ def __init__(
6365
"""
6466

6567
NeuralynxRawIO.__init__(
66-
self, dirname=dirname,
68+
self,
69+
dirname=dirname,
6770
include_filenames=include_filenames,
6871
exclude_filenames=exclude_filenames,
6972
keep_original_times=keep_original_times,

neo/rawio/neuralynxrawio/neuralynxrawio.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,24 @@ class NeuralynxRawIO(BaseRawIO):
136136

137137
def __init__(
138138
self,
139-
dirname="",
139+
dirname,
140140
include_filenames=None,
141141
exclude_filenames=None,
142142
keep_original_times=False,
143143
strict_gap_mode=True,
144+
filename=None,
145+
exclude_filename=None,
144146
**kargs
145147
):
146148

149+
if filename:
150+
include_filenames = filename
151+
raise DeprecationWarning("`filename` is deprecated and will be removed. Please use `include_filenames` instead")
152+
153+
if exclude_filename:
154+
exclude_filenames = exclude_filename
155+
raise DeprecationWarning("`exclude_filename` is deprecated and will be removed. Please use `exclude_filenames` instead")
156+
147157
if include_filenames is None:
148158
include_filenames = []
149159
elif not isinstance(include_filenames, (list, set, np.ndarray)):
@@ -159,9 +169,6 @@ def __init__(
159169
if len(include_filepath) > 1:
160170
raise ValueError("Files in include_filename must be in a single path!")
161171

162-
if (include_filenames is None) and (dirname == ""):
163-
raise ValueError("One of dirname or include_filenames must be provided.")
164-
165172
if dirname and include_filenames:
166173
dirname = os.path.join(dirname, os.path.dirname(include_filenames[0]))
167174
include_filenames = [os.path.basename(f) for f in include_filenames]

0 commit comments

Comments
 (0)