MCPcopy Create free account
hub / github.com/dask/dask / decode

Function decode

dask/bag/text.py:186–199  ·  view source on GitHub ↗
(block, encoding, errors, line_delimiter)

Source from the content-addressed store, hash-verified

184
185
186def decode(block, encoding, errors, line_delimiter):
187 # blocksize is not None branch
188 text = block.decode(encoding, errors)
189 if line_delimiter in [None, "", "\n", "\r", "\r\n"]:
190 lines = io.StringIO(text, newline=line_delimiter)
191 return list(lines)
192 else:
193 if not text:
194 return []
195 parts = text.split(line_delimiter)
196 out = [t + line_delimiter for t in parts[:-1]] + (
197 parts[-1:] if not text.endswith(line_delimiter) else []
198 )
199 return out

Callers

nothing calls this directly

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected