+ def _get_bucket_details(self, label_formatter: str) -> BucketDetails:
+ """Get the details about one bucket."""
+ details = BucketDetails()
+ for (start, end), pop in sorted(self.buckets.items(), key=lambda x: x[0]):
+ if pop > 0:
+ details.num_populated_buckets += 1
+ details.last_bucket_start = start
+ if details.max_population is None or pop > details.max_population:
+ details.max_population = pop
+ if details.lowest_start is None or start < details.lowest_start:
+ details.lowest_start = start
+ if details.highest_end is None or end > details.highest_end:
+ details.highest_end = end
+ label = f'[{label_formatter}..{label_formatter}): ' % (start, end)
+ label_width = len(label)
+ if details.max_label_width is None or label_width > details.max_label_width:
+ details.max_label_width = label_width
+ return details
+