(
csv_string: str | None = None,
filename: str | PathLike | None = None,
encoding: str = "utf-8",
errors: str = "strict",
**kwargs,
)
| 389 | |
| 390 | |
| 391 | def _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] |