Skip to content

Commit 57537f2

Browse files
committed
fix typing and merge conflicts
1 parent ff55062 commit 57537f2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

probeinterface/io.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def write_probeinterface(file: Union[str, Path], probe_or_probegroup: Union[Prob
103103
tsv_label_map_to_probeinterface = {v: k for k, v in tsv_label_map_to_BIDS.items()}
104104

105105

106-
def read_BIDS_probe(folder: Union[str, Path], prefix: bool = None) -> ProbeGroup:
106+
def read_BIDS_probe(folder: Union[str, Path], prefix: Optional[str] = None) -> ProbeGroup:
107107
"""
108108
Read to BIDS probe format.
109109
@@ -114,7 +114,7 @@ def read_BIDS_probe(folder: Union[str, Path], prefix: bool = None) -> ProbeGroup
114114
----------
115115
folder: Path or str
116116
The folder to scan for probes and contacts files
117-
prefix : None or str
117+
prefix : str
118118
Prefix of the probes and contacts files
119119
120120
Returns
@@ -140,8 +140,8 @@ def read_BIDS_probe(folder: Union[str, Path], prefix: bool = None) -> ProbeGroup
140140
probes_file = probes_files[0]
141141
contacts_file = contacts_files[0]
142142
else:
143-
probes_file = folder / prefix + "_probes.tsv"
144-
contacts_file = folder / prefix + "_contacts.tsv"
143+
probes_file = folder / f"{prefix}_probes.tsv"
144+
contacts_file = folder / f"{prefix}_contacts.tsv"
145145
for file in [probes_file, contacts_file]:
146146
if not file.exists():
147147
raise ValueError(f"Source file does not exist ({file})")
@@ -955,7 +955,7 @@ def read_imro(file_path: Union[str, Path]) -> Probe:
955955
return _read_imro_string(imro_str)
956956

957957

958-
def _read_imro_string(imro_str: str, imDatPrb_pn: str = None) -> Probe:
958+
def _read_imro_string(imro_str: str, imDatPrb_pn: Optional[str] = None) -> Probe:
959959
"""
960960
Parse the IMRO table when presented as a string and create a Probe object.
961961
@@ -986,7 +986,7 @@ def _read_imro_string(imro_str: str, imDatPrb_pn: str = None) -> Probe:
986986
elif len(imro_table_header) == 2:
987987
imDatPrb_type, num_contact = imro_table_header
988988
else:
989-
raise RuntimeError(f'read_imro error, the header has a strange length: {imro_table_header}')
989+
raise ValueError(f'read_imro error, the header has a strange length: {imro_table_header}')
990990

991991

992992
if imDatPrb_type in [0, None]:

0 commit comments

Comments
 (0)