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