Skip to content

Commit

Permalink
i/o base: remove left-over on_error parameters, use self.errors instead
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Jan 3, 2025
1 parent 4940a1e commit 5be8f96
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions navis/io/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,6 @@ def read_tar(
Limit the number of files read from this directory.
attrs : dict or None
Arbitrary attributes to include in the TreeNeuron.
on_error : 'ignore' | 'raise'
What do do when error is encountered.
Returns
-------
Expand Down Expand Up @@ -618,8 +616,7 @@ def read_ftp(
url,
parallel="auto",
limit: Optional[int] = None,
attrs: Optional[Dict[str, Any]] = None,
on_error: Union[Literal["ignore", Literal["raise"]]] = "ignore",
attrs: Optional[Dict[str, Any]] = None
) -> "core.NeuronList":
"""Read files from an FTP server.
Expand All @@ -633,8 +630,6 @@ def read_ftp(
Limit the number of files read from this directory.
attrs : dict or None
Arbitrary attributes to include in the TreeNeuron.
on_error : 'ignore' | 'raise'
What do do when error is encountered.
Returns
-------
Expand All @@ -654,7 +649,7 @@ def read_ftp(
else:
port = 21 # default port

read_fn = partial(self.read_from_ftp, attrs=attrs, on_error=on_error)
read_fn = partial(self.read_from_ftp, attrs=attrs)
neurons = parallel_read_ftp(
read_fn=read_fn,
server=server,
Expand All @@ -670,8 +665,7 @@ def read_from_ftp(
self,
files: Union[str, List[str]],
ftp: FTP,
attrs: Optional[Dict[str, Any]] = None,
on_error: Union[Literal["ignore", Literal["raise"]]] = "ignore",
attrs: Optional[Dict[str, Any]] = None
) -> "core.NeuronList":
"""Read given files from an FTP server into a NeuronList.
Expand All @@ -687,8 +681,6 @@ def read_from_ftp(
`_FTP` global variable.
attrs : dict or None
Arbitrary attributes to include in the TreeNeuron.
on_error : 'ignore' | 'raise'
What do do when error is encountered.
Returns
-------
Expand Down Expand Up @@ -716,7 +708,7 @@ def read_from_ftp(
n = self.read_buffer(f, attrs=merge_dicts(props, attrs))
neurons.append(n)
except BaseException:
if on_error == "ignore":
if self.errors == "ignore":
logger.warning(f'Failed to read "{file}" from FTP.')
else:
raise
Expand Down

0 comments on commit 5be8f96

Please sign in to comment.