(
self,
f: IO[str] | ReadCsvBuffer[str],
colspecs: list[tuple[int, int]] | Literal["infer"],
delimiter: str | None,
comment: str | None,
skiprows: set[int] | None = None,
infer_nrows: int = 100,
)
| 1380 | """ |
| 1381 | |
| 1382 | def __init__( |
| 1383 | self, |
| 1384 | f: IO[str] | ReadCsvBuffer[str], |
| 1385 | colspecs: list[tuple[int, int]] | Literal["infer"], |
| 1386 | delimiter: str | None, |
| 1387 | comment: str | None, |
| 1388 | skiprows: set[int] | None = None, |
| 1389 | infer_nrows: int = 100, |
| 1390 | ) -> None: |
| 1391 | self.f = f |
| 1392 | self.buffer: Iterator | None = None |
| 1393 | self.delimiter = "\r\n" + delimiter if delimiter else "\n\r\t " |
| 1394 | self.comment = comment |
| 1395 | if colspecs == "infer": |
| 1396 | self.colspecs = self.detect_colspecs( |
| 1397 | infer_nrows=infer_nrows, skiprows=skiprows |
| 1398 | ) |
| 1399 | else: |
| 1400 | self.colspecs = colspecs |
| 1401 | |
| 1402 | if not isinstance(self.colspecs, (tuple, list)): |
| 1403 | raise TypeError( |
| 1404 | "column specifications must be a list or tuple, " |
| 1405 | f"input was a {type(colspecs).__name__}" |
| 1406 | ) |
| 1407 | |
| 1408 | for colspec in self.colspecs: |
| 1409 | if not ( |
| 1410 | isinstance(colspec, (tuple, list)) |
| 1411 | and len(colspec) == 2 |
| 1412 | and isinstance(colspec[0], (int, np.integer, type(None))) |
| 1413 | and isinstance(colspec[1], (int, np.integer, type(None))) |
| 1414 | ): |
| 1415 | raise TypeError( |
| 1416 | "Each column specification must be " |
| 1417 | "2 element tuple or list of integers" |
| 1418 | ) |
| 1419 | |
| 1420 | def get_rows(self, infer_nrows: int, skiprows: set[int] | None = None) -> list[str]: |
| 1421 | """ |
nothing calls this directly
no test coverage detected