MCPcopy Index your code
hub / github.com/numpy/numpy / _decode_line

Function _decode_line

numpy/lib/_iotools.py:13–35  ·  view source on GitHub ↗

Decode bytes from binary input streams. Defaults to decoding from 'latin1'. Parameters ---------- line : str or bytes Line to be decoded. encoding : str Encoding used to decode `line`. Returns ------- decoded_line : str

(line, encoding=None)

Source from the content-addressed store, hash-verified

11
12
13def _decode_line(line, encoding=None):
14 """Decode bytes from binary input streams.
15
16 Defaults to decoding from 'latin1'.
17
18 Parameters
19 ----------
20 line : str or bytes
21 Line to be decoded.
22 encoding : str
23 Encoding used to decode `line`.
24
25 Returns
26 -------
27 decoded_line : str
28
29 """
30 if type(line) is bytes:
31 if encoding is None:
32 encoding = "latin1"
33 line = line.decode(encoding)
34
35 return line
36
37
38def _is_string_like(obj):

Callers 3

genfromtxtFunction · 0.85
__init__Method · 0.85
__call__Method · 0.85

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…