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

Function _from_csv

box/converters.py:416–430  ·  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

414
415
416def _from_csv(
417 csv_string: str | None = None,
418 filename: str | PathLike | None = None,
419 encoding: str = "utf-8",
420 errors: str = "strict",
421 **kwargs,
422):
423 if csv_string:
424 with StringIO(csv_string) as cs:
425 reader = csv.DictReader(cs)
426 return [row for row in reader]
427 _exists(filename) # type: ignore
428 with open(filename, "r", encoding=encoding, errors=errors, newline="") as f: # type: ignore
429 reader = csv.DictReader(f, **kwargs)
430 return [row for row in reader]

Callers 1

from_csvMethod · 0.90

Calls 1

_existsFunction · 0.85

Tested by

no test coverage detected