MCPcopy Create free account
hub / github.com/cdgriffith/Box / _from_csv

Function _from_csv

box/converters.py:391–405  ·  view source on GitHub ↗
(
    csv_string: str | None = None,
    filename: str | PathLike | None = None,
    encoding: str = "utf-8",
    errors: str = "strict",
    **kwargs,
)

Source from the content-addressed store, hash-verified

389
390
391def _from_csv(
392 csv_string: str | None = None,
393 filename: str | PathLike | None = None,
394 encoding: str = "utf-8",
395 errors: str = "strict",
396 **kwargs,
397):
398 if csv_string:
399 with StringIO(csv_string) as cs:
400 reader = csv.DictReader(cs)
401 return [row for row in reader]
402 _exists(filename) # type: ignore
403 with open(filename, "r", encoding=encoding, errors=errors, newline="") as f: # type: ignore
404 reader = csv.DictReader(f, **kwargs)
405 return [row for row in reader]

Callers 1

from_csvMethod · 0.90

Calls 1

_existsFunction · 0.85

Tested by

no test coverage detected