(path: pathlib.Path, *, ceiling: int, label: str)
| 110 | |
| 111 | |
| 112 | def regular_status(path: pathlib.Path, *, ceiling: int, label: str) -> os.stat_result: |
| 113 | try: |
| 114 | status = path.lstat() |
| 115 | except FileNotFoundError as error: |
| 116 | raise ContractError(f"missing {label}: {path}") from error |
| 117 | if not stat.S_ISREG(status.st_mode): |
| 118 | raise ContractError(f"{label} is not a regular non-symlink file: {path}") |
| 119 | if status.st_size > ceiling: |
| 120 | raise ContractError(f"{label} exceeds the {ceiling}-byte ceiling: {path}") |
| 121 | return status |
| 122 | |
| 123 | |
| 124 | def parse_tsv( |
no test coverage detected