All records whose covered range ends closest to (but not after) gap_start.
(records: List[CovRecord], gap_start: int)
| 146 | |
| 147 | |
| 148 | def adjacent_before(records: List[CovRecord], gap_start: int) -> List[CovRecord]: |
| 149 | """All records whose covered range ends closest to (but not after) gap_start.""" |
| 150 | candidates = [r for r in records if r[2] <= gap_start] |
| 151 | if not candidates: |
| 152 | return [] |
| 153 | max_end = max(r[2] for r in candidates) |
| 154 | return [r for r in candidates if r[2] == max_end] |
| 155 | |
| 156 | |
| 157 | def adjacent_after(records: List[CovRecord], gap_end: int) -> List[CovRecord]: |