From 914a84612b9ed280498574304bbb5cc1e7a4654b Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Tue, 15 Nov 2022 17:55:48 -0500 Subject: [PATCH] docs: improve comment --- chord_metadata_service/restapi/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chord_metadata_service/restapi/utils.py b/chord_metadata_service/restapi/utils.py index 7c0951e60..c3967bea1 100644 --- a/chord_metadata_service/restapi/utils.py +++ b/chord_metadata_service/restapi/utils.py @@ -171,14 +171,16 @@ def custom_binning_generator(field_props) -> Generator[Tuple[int, int, str], Non yield minimum, bins[0], f"< {bins[0]}" # Generate interstitial bins for the range. - # Range is semi-open: [1, len(bins)) + # range() is semi-open: [1, len(bins)) + # – so in terms of indices, we skip the first bin (we access it via i-1 for lhs) + # and generate [lhs, rhs) pairs for each pair of bins until the end. # Values beyond the last bin gets handled separately. for i in range(1, len(bins)): lhs = bins[i - 1] rhs = bins[i] yield lhs, rhs, f"{lhs}-{rhs}" - # Then, handle values which surpass the last bin + # Then, handle values beyond the value of the last bin if maximum is None or maximum != bins[-1]: yield bins[-1], maximum, f"≥ {bins[-1]}"