(path: pathlib.Path, *, ceiling: int, label: str)
| 100 | |
| 101 | |
| 102 | def regular_status(path: pathlib.Path, *, ceiling: int, label: str) -> os.stat_result: |
| 103 | try: |
| 104 | status = path.lstat() |
| 105 | except FileNotFoundError as error: |
| 106 | raise ContractError(f"missing {label}: {path}") from error |
| 107 | if not stat.S_ISREG(status.st_mode): |
| 108 | raise ContractError(f"{label} is not a regular non-symlink file: {path}") |
| 109 | if status.st_size > ceiling: |
| 110 | raise ContractError(f"{label} exceeds the {ceiling}-byte ceiling: {path}") |
| 111 | return status |
| 112 | |
| 113 | |
| 114 | def load_selection( |
no test coverage detected