diff options
author | Ross Barnowski <rossbar@berkeley.edu> | 2020-11-18 22:56:16 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-19 08:56:16 +0200 |
commit | b88b2c0c19851810d4ee07f03a7734b6e19dbdaa (patch) | |
tree | bf9a51c10252b66d27983a59a28103fdf2a8269e /numpy/lib/_iotools.py | |
parent | 8fee756d8c9d2f5fe211fd9feb999c0da8a89821 (diff) | |
download | numpy-b88b2c0c19851810d4ee07f03a7734b6e19dbdaa.tar.gz |
MAINT: Minor touchups in npyio (#17796)
* Simplify logic for encoding kwarg in _decode_line.
* Remove unnecessary else branch from split_line.
* MAINT: rm else branch from loadtxt.
* MAINT: re-nest encoding parsing.
Co-Authored-By: mattip <matti.picus@gmail.com>
* condense return statement.
Co-authored-by: mattip <matti.picus@gmail.com>
Diffstat (limited to 'numpy/lib/_iotools.py')
-rw-r--r-- | numpy/lib/_iotools.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py index f5368526d..a576925d6 100644 --- a/numpy/lib/_iotools.py +++ b/numpy/lib/_iotools.py @@ -18,6 +18,8 @@ def _decode_line(line, encoding=None): ---------- line : str or bytes Line to be decoded. + encoding : str + Encoding used to decode `line`. Returns ------- @@ -27,9 +29,8 @@ def _decode_line(line, encoding=None): """ if type(line) is bytes: if encoding is None: - line = line.decode('latin1') - else: - line = line.decode(encoding) + encoding = "latin1" + line = line.decode(encoding) return line |