Found 2026-07-30 while adding type annotations to Histogram.plot
(ImageWholeFeatures.py:1200). The docstring says type accepts
'frequency' [default], 'cdf', or 'ncdf'. The actual dispatch logic
in the method body accepts a different, larger set:
'frequency', 'pdf'/'probability', 'cf'/'cumulative',
'cdf'/'normalized' — and does not handle 'ncdf' at all (it
would fall through to the else: raise ValueError("unknown type")
branch). Left type annotated as plain str rather than a Literal
enum for this reason — using Literal would mean either copying the
stale docstring's wrong values or silently fixing behavior/docs as a
drive-by, both out of scope for an annotations-only pass.
Fix
Reconcile the docstring with the real accepted values (or vice versa,
if 'ncdf' was meant to work and was dropped by accident — check git
blame). Once settled, type can become
Literal["frequency", "pdf", "probability", "cf", "cumulative", "cdf", "normalized"].
Found 2026-07-30 while adding type annotations to
Histogram.plot(
ImageWholeFeatures.py:1200). The docstring saystypeaccepts'frequency'[default],'cdf', or'ncdf'. The actual dispatch logicin the method body accepts a different, larger set:
'frequency','pdf'/'probability','cf'/'cumulative','cdf'/'normalized'— and does not handle'ncdf'at all (itwould fall through to the
else: raise ValueError("unknown type")branch). Left
typeannotated as plainstrrather than aLiteralenum for this reason — using
Literalwould mean either copying thestale docstring's wrong values or silently fixing behavior/docs as a
drive-by, both out of scope for an annotations-only pass.
Fix
Reconcile the docstring with the real accepted values (or vice versa,
if
'ncdf'was meant to work and was dropped by accident — check gitblame). Once settled,
typecan becomeLiteral["frequency", "pdf", "probability", "cf", "cumulative", "cdf", "normalized"].