14 lines
401 B
Python
14 lines
401 B
Python
"""Geometry checks shared by correction and annotation rendering."""
|
|
|
|
import math
|
|
from numbers import Real
|
|
|
|
|
|
def valid_feedback_box(box) -> bool:
|
|
return (
|
|
isinstance(box, (list, tuple)) and len(box) == 4
|
|
and all(isinstance(value, Real) and not isinstance(value, bool)
|
|
and math.isfinite(value) for value in box)
|
|
and box[0] < box[2] and box[1] < box[3]
|
|
)
|