From e4b5a8e0f925ea01bae061e915c0cb397610933d Mon Sep 17 00:00:00 2001 From: AI-Hao <2865467769@qq.com> Date: Thu, 9 Jan 2025 20:00:32 +0800 Subject: [PATCH 001/110] ### feat(detection): Support for IOS Matching Metric** - Added the `match_metric` parameter to the `with_nms` and `with_nmm` methods in the `Detections` class. - Modified the `box_non_max_suppression` and `box_non_max_merge` functions to support IOS calculation. - Introduced the `mask_non_max_merge` function for handling non-maximum merging of masks. - Updated the `box_iou_batch` and `mask_iou_batch` functions to support both IOU and IOS calculations. - Enhanced the `InferenceSlicer` class to accommodate the IOS matching metric. ### Notes - IOS (Intersection over Smaller): A variation of IOU that compares intersection over the smaller area, useful in scenarios with varying object sizes. - Refinements: Improved terminology for clarity and consistency, ensuring technical accuracy. --- supervision/detection/core.py | 36 +++-- supervision/detection/overlap_filter.py | 128 +++++++++++++++++- .../detection/tools/inference_slicer.py | 8 +- supervision/detection/utils.py | 64 +++++++-- 4 files changed, 204 insertions(+), 32 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index c61728b9..ad012a9d 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -17,6 +17,7 @@ from supervision.detection.lmm import ( ) from supervision.detection.overlap_filter import ( box_non_max_merge, + mask_non_max_merge, box_non_max_suppression, mask_non_max_suppression, ) @@ -27,6 +28,7 @@ from supervision.detection.tools.transformers import ( ) from supervision.detection.utils import ( box_iou_batch, + mask_iou_batch, calculate_masks_centroids, extract_ultralytics_masks, get_data_item, @@ -1281,7 +1283,7 @@ class Detections: return (self.xyxy[:, 3] - self.xyxy[:, 1]) * (self.xyxy[:, 2] - self.xyxy[:, 0]) def with_nms( - self, threshold: float = 0.5, class_agnostic: bool = False + self, threshold: float = 0.5, class_agnostic: bool = False, match_metric: str = "IOU" ) -> Detections: """ Performs non-max suppression on detection set. If the detections result @@ -1294,6 +1296,8 @@ class Detections: class_agnostic (bool): Whether to perform class-agnostic non-maximum suppression. If True, the class_id of each detection will be ignored. Defaults to False. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: Detections: A new Detections object containing the subset of detections @@ -1327,17 +1331,17 @@ class Detections: if self.mask is not None: indices = mask_non_max_suppression( - predictions=predictions, masks=self.mask, iou_threshold=threshold + predictions=predictions, masks=self.mask, iou_threshold=threshold, match_metric=match_metric ) else: indices = box_non_max_suppression( - predictions=predictions, iou_threshold=threshold + predictions=predictions, iou_threshold=threshold, match_metric=match_metric ) return self[indices] def with_nmm( - self, threshold: float = 0.5, class_agnostic: bool = False + self, threshold: float = 0.5, class_agnostic: bool = False, match_metric: str = "IOU" ) -> Detections: """ Perform non-maximum merging on the current set of object detections. @@ -1348,6 +1352,8 @@ class Detections: class_agnostic (bool): Whether to perform class-agnostic non-maximum merging. If True, the class_id of each detection will be ignored. Defaults to False. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: Detections: A new Detections object containing the subset of detections @@ -1381,15 +1387,20 @@ class Detections: ) ) - merge_groups = box_non_max_merge( - predictions=predictions, iou_threshold=threshold - ) + if self.mask is not None: + merge_groups = mask_non_max_merge( + predictions=predictions, masks=self.mask, iou_threshold=threshold, match_metric=match_metric + ) + else: + merge_groups = box_non_max_merge( + predictions=predictions, iou_threshold=threshold, match_metric=match_metric + ) result = [] for merge_group in merge_groups: unmerged_detections = [self[i] for i in merge_group] merged_detections = merge_inner_detections_objects( - unmerged_detections, threshold + unmerged_detections, threshold, match_metric ) result.append(merged_detections) @@ -1489,7 +1500,7 @@ def merge_inner_detection_object_pair( def merge_inner_detections_objects( - detections: List[Detections], threshold=0.5 + detections: List[Detections], threshold=0.5, match_metric: str = "IOU" ) -> Detections: """ Given N detections each of length 1 (exactly one object inside), combine them into a @@ -1501,8 +1512,11 @@ def merge_inner_detections_objects( """ detections_1 = detections[0] for detections_2 in detections[1:]: - box_iou = box_iou_batch(detections_1.xyxy, detections_2.xyxy)[0] - if box_iou < threshold: + if detections_1.mask is not None and detections_2.mask is not None: + iou = mask_iou_batch(detections_1.mask, detections_2.mask, match_metric)[0] + else: + iou = box_iou_batch(detections_1.xyxy, detections_2.xyxy, match_metric)[0] + if iou < threshold: break detections_1 = merge_inner_detection_object_pair(detections_1, detections_2) return detections_1 diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index 4c59295f..935be236 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -42,6 +42,7 @@ def mask_non_max_suppression( predictions: np.ndarray, masks: np.ndarray, iou_threshold: float = 0.5, + match_metric: str = "IOU", mask_dimension: int = 640, ) -> np.ndarray: """ @@ -57,6 +58,8 @@ def mask_non_max_suppression( dimensions of each mask. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". mask_dimension (int): The dimension to which the masks should be resized before computing IOU values. Defaults to 640. @@ -81,7 +84,7 @@ def mask_non_max_suppression( predictions = predictions[sort_index] masks = masks[sort_index] masks_resized = resize_masks(masks, mask_dimension) - ious = mask_iou_batch(masks_resized, masks_resized) + ious = mask_iou_batch(masks_resized, masks_resized, match_metric) categories = predictions[:, 5] keep = np.ones(rows, dtype=bool) @@ -94,7 +97,7 @@ def mask_non_max_suppression( def box_non_max_suppression( - predictions: np.ndarray, iou_threshold: float = 0.5 + predictions: np.ndarray, iou_threshold: float = 0.5, match_metric: str = "IOU" ) -> np.ndarray: """ Perform Non-Maximum Suppression (NMS) on object detection predictions. @@ -105,6 +108,8 @@ def box_non_max_suppression( or `(x_min, y_min, x_max, y_max, score, class)`. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: np.ndarray: A boolean array indicating which predictions to keep after n @@ -130,7 +135,7 @@ def box_non_max_suppression( boxes = predictions[:, :4] categories = predictions[:, 5] - ious = box_iou_batch(boxes, boxes) + ious = box_iou_batch(boxes, boxes, match_metric) ious = ious - np.eye(rows) keep = np.ones(rows, dtype=bool) @@ -148,7 +153,7 @@ def box_non_max_suppression( def group_overlapping_boxes( - predictions: npt.NDArray[np.float64], iou_threshold: float = 0.5 + predictions: npt.NDArray[np.float64], iou_threshold: float = 0.5, match_metric: str = "IOU" ) -> List[List[int]]: """ Apply greedy version of non-maximum merging to avoid detecting too many @@ -160,6 +165,8 @@ def group_overlapping_boxes( and the confidence scores. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. Defaults to 0.5. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: List[List[int]]: Groups of prediction indices be merged. @@ -179,7 +186,7 @@ def group_overlapping_boxes( break merge_candidate = np.expand_dims(predictions[idx], axis=0) - ious = box_iou_batch(predictions[order][:, :4], merge_candidate[:, :4]) + ious = box_iou_batch(predictions[order][:, :4], merge_candidate[:, :4], match_metric) ious = ious.flatten() above_threshold = ious >= iou_threshold @@ -189,9 +196,67 @@ def group_overlapping_boxes( return merge_groups +def mask_non_max_merge( + predictions: np.ndarray, + masks: np.ndarray, + iou_threshold: float = 0.5, + mask_dimension: int = 640, + match_metric: str = "IOU", +) -> np.ndarray: + """ + Perform Non-Maximum Merging (NMM) on segmentation predictions. + + Args: + predictions (np.ndarray): A 2D array of object detection predictions in + the format of `(x_min, y_min, x_max, y_max, score)` + or `(x_min, y_min, x_max, y_max, score, class)`. Shape: `(N, 5)` or + `(N, 6)`, where N is the number of predictions. + masks (np.ndarray): A 3D array of binary masks corresponding to the predictions. + Shape: `(N, H, W)`, where N is the number of predictions, and H, W are the + dimensions of each mask. + iou_threshold (float): The intersection-over-union threshold + to use for non-maximum suppression. + mask_dimension (int): The dimension to which the masks should be + resized before computing IOU values. Defaults to 640. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". + + Returns: + np.ndarray: A boolean array indicating which predictions to keep after + non-maximum suppression. + + Raises: + AssertionError: If `iou_threshold` is not within the closed + range from `0` to `1`. + """ + masks_resized = resize_masks(masks, mask_dimension) + if predictions.shape[1] == 5: + return group_overlapping_masks(predictions, masks_resized, iou_threshold, match_metric) + + category_ids = predictions[:, 5] + merge_groups = [] + for category_id in np.unique(category_ids): + curr_indices = np.where(category_ids == category_id)[0] + merge_class_groups = group_overlapping_masks( + predictions[curr_indices], masks_resized[curr_indices], iou_threshold, match_metric + ) + + for merge_class_group in merge_class_groups: + merge_groups.append(curr_indices[merge_class_group].tolist()) + + for merge_group in merge_groups: + if len(merge_group) == 0: + raise ValueError( + f"Empty group detected when non-max-merging " + f"detections: {merge_groups}" + ) + return merge_groups + + def box_non_max_merge( predictions: npt.NDArray[np.float64], iou_threshold: float = 0.5, + match_metric: str = "IOU", ) -> List[List[int]]: """ Apply greedy version of non-maximum merging per category to avoid detecting @@ -204,20 +269,22 @@ def box_non_max_merge( detections of different classes to be merged. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. Defaults to 0.5. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: List[List[int]]: Groups of prediction indices be merged. Each group may have 1 or more elements. """ if predictions.shape[1] == 5: - return group_overlapping_boxes(predictions, iou_threshold) + return group_overlapping_boxes(predictions, iou_threshold, match_metric) category_ids = predictions[:, 5] merge_groups = [] for category_id in np.unique(category_ids): curr_indices = np.where(category_ids == category_id)[0] merge_class_groups = group_overlapping_boxes( - predictions[curr_indices], iou_threshold + predictions[curr_indices], iou_threshold, match_metric ) for merge_class_group in merge_class_groups: @@ -232,6 +299,53 @@ def box_non_max_merge( return merge_groups +def group_overlapping_masks( + predictions: npt.NDArray[np.float64], + masks: npt.NDArray[np.float64], + iou_threshold: float = 0.5, + match_metric: str = "IOU", +) -> List[List[int]]: + """ + Apply greedy version of non-maximum merging to avoid detecting too many + + Args: + predictions (npt.NDArray[np.float64]): An array of shape `(n, 5)` containing + the bounding boxes coordinates in format `[x1, y1, x2, y2]` + and the confidence scores. + masks (npt.NDArray[np.float64]): A 3D array of binary masks corresponding to the predictions. + iou_threshold (float): The intersection-over-union threshold + to use for non-maximum suppression. Defaults to 0.5. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". + + Returns: + List[List[int]]: Groups of prediction indices be merged. + Each group may have 1 or more elements. + """ + merge_groups: List[List[int]] = [] + + scores = predictions[:, 4] + order = scores.argsort() + + while len(order) > 0: + idx = int(order[-1]) + + order = order[:-1] + if len(order) == 0: + merge_groups.append([idx]) + break + + merge_candidate = np.expand_dims(masks[idx], axis=0) + ious = mask_iou_batch(masks[order], merge_candidate, match_metric) + ious = ious.flatten() + + above_threshold = ious >= iou_threshold + merge_group = [idx, *np.flip(order[above_threshold]).tolist()] + merge_groups.append(merge_group) + order = order[~above_threshold] + return merge_groups + + class OverlapFilter(Enum): """ Enum specifying the strategy for filtering overlapping detections. diff --git a/supervision/detection/tools/inference_slicer.py b/supervision/detection/tools/inference_slicer.py index 05469dd6..7babaf68 100644 --- a/supervision/detection/tools/inference_slicer.py +++ b/supervision/detection/tools/inference_slicer.py @@ -72,6 +72,8 @@ class InferenceSlicer: filtering or merging overlapping detections in slices. iou_threshold (float): Intersection over Union (IoU) threshold used when filtering by overlap. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". callback (Callable): A function that performs inference on a given image slice and returns detections. thread_workers (int): Number of threads for parallel execution. @@ -91,6 +93,7 @@ class InferenceSlicer: overlap_wh: Optional[Tuple[int, int]] = None, overlap_filter: Union[OverlapFilter, str] = OverlapFilter.NON_MAX_SUPPRESSION, iou_threshold: float = 0.5, + match_metric: str = "IOU", thread_workers: int = 1, ): if overlap_ratio_wh is not None: @@ -106,6 +109,7 @@ class InferenceSlicer: self.slice_wh = slice_wh self.iou_threshold = iou_threshold + self.match_metric = match_metric self.overlap_filter = OverlapFilter.from_value(overlap_filter) self.callback = callback self.thread_workers = thread_workers @@ -165,9 +169,9 @@ class InferenceSlicer: if self.overlap_filter == OverlapFilter.NONE: return merged elif self.overlap_filter == OverlapFilter.NON_MAX_SUPPRESSION: - return merged.with_nms(threshold=self.iou_threshold) + return merged.with_nms(threshold=self.iou_threshold, match_metric=self.match_metric) elif self.overlap_filter == OverlapFilter.NON_MAX_MERGE: - return merged.with_nmm(threshold=self.iou_threshold) + return merged.with_nmm(threshold=self.iou_threshold, match_metric=self.match_metric) else: warnings.warn( f"Invalid overlap filter strategy: {self.overlap_filter}", diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 0d5ec475..19cddca4 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -48,7 +48,7 @@ def polygon_to_mask(polygon: np.ndarray, resolution_wh: Tuple[int, int]) -> np.n return mask -def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray) -> np.ndarray: +def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray, match_metric: str = "IOU") -> np.ndarray: """ Compute Intersection over Union (IoU) of two sets of bounding boxes - `boxes_true` and `boxes_detection`. Both sets @@ -59,6 +59,8 @@ def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray) -> np.nda `shape = (N, 4)` where `N` is number of true objects. boxes_detection (np.ndarray): 2D `np.ndarray` representing detection boxes. `shape = (M, 4)` where `M` is number of detected objects. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: np.ndarray: Pairwise IoU of boxes from `boxes_true` and `boxes_detection`. @@ -76,13 +78,32 @@ def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray) -> np.nda bottom_right = np.minimum(boxes_true[:, None, 2:], boxes_detection[:, 2:]) area_inter = np.prod(np.clip(bottom_right - top_left, a_min=0, a_max=None), 2) - ious = area_inter / (area_true[:, None] + area_detection - area_inter) + + if match_metric.upper() == "IOU": + union_area = area_true[:, None] + area_detection - area_inter + ious = np.divide( + area_inter, + union_area, + out=np.zeros_like(area_inter, dtype=float), + where=union_area != 0, + ) + elif match_metric.upper() == "IOS": + small_area = np.minimum(area_true[:, None], area_detection) + ious = np.divide( + area_inter, + small_area, + out=np.zeros_like(area_inter, dtype=float), + where=small_area != 0, + ) + else: + raise ValueError(f"match_metric {match_metric} is not supported, only 'IOU' and 'IOS' are supported") + ious = np.nan_to_num(ious) return ious def _mask_iou_batch_split( - masks_true: np.ndarray, masks_detection: np.ndarray + masks_true: np.ndarray, masks_detection: np.ndarray, match_metric: str = "IOU" ) -> np.ndarray: """ Internal function. @@ -92,6 +113,8 @@ def _mask_iou_batch_split( Args: masks_true (np.ndarray): 3D `np.ndarray` representing ground-truth masks. masks_detection (np.ndarray): 3D `np.ndarray` representing detection masks. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: np.ndarray: Pairwise IoU of masks from `masks_true` and `masks_detection`. @@ -102,19 +125,34 @@ def _mask_iou_batch_split( masks_true_area = masks_true.sum(axis=(1, 2)) masks_detection_area = masks_detection.sum(axis=(1, 2)) - union_area = masks_true_area[:, None] + masks_detection_area - intersection_area - return np.divide( - intersection_area, - union_area, - out=np.zeros_like(intersection_area, dtype=float), - where=union_area != 0, - ) + if match_metric.upper() == "IOU": + union_area = masks_true_area[:, None] + masks_detection_area - intersection_area + ious = np.divide( + intersection_area, + union_area, + out=np.zeros_like(intersection_area, dtype=float), + where=union_area != 0, + ) + elif match_metric.upper() == "IOS": + small_area = np.minimum(intersection_area, masks_detection_area) + ious = np.divide( + intersection_area, + small_area, + out=np.zeros_like(intersection_area, dtype=float), + where=small_area != 0, + ) + else: + raise ValueError(f"match_metric {match_metric} is not supported, only 'IOU' and 'IOS' are supported") + + ious = np.nan_to_num(ious) + return ious def mask_iou_batch( masks_true: np.ndarray, masks_detection: np.ndarray, + match_metric: str = "IOU", memory_limit: int = 1024 * 5, ) -> np.ndarray: """ @@ -124,6 +162,8 @@ def mask_iou_batch( Args: masks_true (np.ndarray): 3D `np.ndarray` representing ground-truth masks. masks_detection (np.ndarray): 3D `np.ndarray` representing detection masks. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". memory_limit (int): memory limit in MB, default is 1024 * 5 MB (5GB). Returns: @@ -138,7 +178,7 @@ def mask_iou_batch( / 1024 ) if memory <= memory_limit: - return _mask_iou_batch_split(masks_true, masks_detection) + return _mask_iou_batch_split(masks_true, masks_detection, match_metric) ious = [] step = max( @@ -153,7 +193,7 @@ def mask_iou_batch( 1, ) for i in range(0, masks_true.shape[0], step): - ious.append(_mask_iou_batch_split(masks_true[i : i + step], masks_detection)) + ious.append(_mask_iou_batch_split(masks_true[i : i + step], masks_detection, match_metric)) return np.vstack(ious) From 9cd6549cdc064e67f85392f1fabd9caaccb0c7f7 Mon Sep 17 00:00:00 2001 From: AI-Hao <2865467769@qq.com> Date: Thu, 9 Jan 2025 20:03:31 +0800 Subject: [PATCH 002/110] feat(detection): Support for IOS Matching Metric - Added the `match_metric` parameter to the `with_nms` and `with_nmm` methods in the `Detections` class. - Modified the `box_non_max_suppression` and `box_non_max_merge` functions to support IOS calculation. - Introduced the `mask_non_max_merge` function for handling non-maximum merging of masks. - Updated the `box_iou_batch` and `mask_iou_batch` functions to support both IOU and IOS calculations. - Enhanced the `InferenceSlicer` class to accommodate the IOS matching metric. Notes - IOS (Intersection over Smaller): A variation of IOU that compares intersection over the smaller area, useful in scenarios with varying object sizes. - Refinements: Improved terminology for clarity and consistency, ensuring technical accuracy. --- supervision/detection/core.py | 36 +++-- supervision/detection/overlap_filter.py | 128 +++++++++++++++++- .../detection/tools/inference_slicer.py | 8 +- supervision/detection/utils.py | 64 +++++++-- 4 files changed, 204 insertions(+), 32 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index c61728b9..ad012a9d 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -17,6 +17,7 @@ from supervision.detection.lmm import ( ) from supervision.detection.overlap_filter import ( box_non_max_merge, + mask_non_max_merge, box_non_max_suppression, mask_non_max_suppression, ) @@ -27,6 +28,7 @@ from supervision.detection.tools.transformers import ( ) from supervision.detection.utils import ( box_iou_batch, + mask_iou_batch, calculate_masks_centroids, extract_ultralytics_masks, get_data_item, @@ -1281,7 +1283,7 @@ class Detections: return (self.xyxy[:, 3] - self.xyxy[:, 1]) * (self.xyxy[:, 2] - self.xyxy[:, 0]) def with_nms( - self, threshold: float = 0.5, class_agnostic: bool = False + self, threshold: float = 0.5, class_agnostic: bool = False, match_metric: str = "IOU" ) -> Detections: """ Performs non-max suppression on detection set. If the detections result @@ -1294,6 +1296,8 @@ class Detections: class_agnostic (bool): Whether to perform class-agnostic non-maximum suppression. If True, the class_id of each detection will be ignored. Defaults to False. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: Detections: A new Detections object containing the subset of detections @@ -1327,17 +1331,17 @@ class Detections: if self.mask is not None: indices = mask_non_max_suppression( - predictions=predictions, masks=self.mask, iou_threshold=threshold + predictions=predictions, masks=self.mask, iou_threshold=threshold, match_metric=match_metric ) else: indices = box_non_max_suppression( - predictions=predictions, iou_threshold=threshold + predictions=predictions, iou_threshold=threshold, match_metric=match_metric ) return self[indices] def with_nmm( - self, threshold: float = 0.5, class_agnostic: bool = False + self, threshold: float = 0.5, class_agnostic: bool = False, match_metric: str = "IOU" ) -> Detections: """ Perform non-maximum merging on the current set of object detections. @@ -1348,6 +1352,8 @@ class Detections: class_agnostic (bool): Whether to perform class-agnostic non-maximum merging. If True, the class_id of each detection will be ignored. Defaults to False. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: Detections: A new Detections object containing the subset of detections @@ -1381,15 +1387,20 @@ class Detections: ) ) - merge_groups = box_non_max_merge( - predictions=predictions, iou_threshold=threshold - ) + if self.mask is not None: + merge_groups = mask_non_max_merge( + predictions=predictions, masks=self.mask, iou_threshold=threshold, match_metric=match_metric + ) + else: + merge_groups = box_non_max_merge( + predictions=predictions, iou_threshold=threshold, match_metric=match_metric + ) result = [] for merge_group in merge_groups: unmerged_detections = [self[i] for i in merge_group] merged_detections = merge_inner_detections_objects( - unmerged_detections, threshold + unmerged_detections, threshold, match_metric ) result.append(merged_detections) @@ -1489,7 +1500,7 @@ def merge_inner_detection_object_pair( def merge_inner_detections_objects( - detections: List[Detections], threshold=0.5 + detections: List[Detections], threshold=0.5, match_metric: str = "IOU" ) -> Detections: """ Given N detections each of length 1 (exactly one object inside), combine them into a @@ -1501,8 +1512,11 @@ def merge_inner_detections_objects( """ detections_1 = detections[0] for detections_2 in detections[1:]: - box_iou = box_iou_batch(detections_1.xyxy, detections_2.xyxy)[0] - if box_iou < threshold: + if detections_1.mask is not None and detections_2.mask is not None: + iou = mask_iou_batch(detections_1.mask, detections_2.mask, match_metric)[0] + else: + iou = box_iou_batch(detections_1.xyxy, detections_2.xyxy, match_metric)[0] + if iou < threshold: break detections_1 = merge_inner_detection_object_pair(detections_1, detections_2) return detections_1 diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index 4c59295f..935be236 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -42,6 +42,7 @@ def mask_non_max_suppression( predictions: np.ndarray, masks: np.ndarray, iou_threshold: float = 0.5, + match_metric: str = "IOU", mask_dimension: int = 640, ) -> np.ndarray: """ @@ -57,6 +58,8 @@ def mask_non_max_suppression( dimensions of each mask. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". mask_dimension (int): The dimension to which the masks should be resized before computing IOU values. Defaults to 640. @@ -81,7 +84,7 @@ def mask_non_max_suppression( predictions = predictions[sort_index] masks = masks[sort_index] masks_resized = resize_masks(masks, mask_dimension) - ious = mask_iou_batch(masks_resized, masks_resized) + ious = mask_iou_batch(masks_resized, masks_resized, match_metric) categories = predictions[:, 5] keep = np.ones(rows, dtype=bool) @@ -94,7 +97,7 @@ def mask_non_max_suppression( def box_non_max_suppression( - predictions: np.ndarray, iou_threshold: float = 0.5 + predictions: np.ndarray, iou_threshold: float = 0.5, match_metric: str = "IOU" ) -> np.ndarray: """ Perform Non-Maximum Suppression (NMS) on object detection predictions. @@ -105,6 +108,8 @@ def box_non_max_suppression( or `(x_min, y_min, x_max, y_max, score, class)`. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: np.ndarray: A boolean array indicating which predictions to keep after n @@ -130,7 +135,7 @@ def box_non_max_suppression( boxes = predictions[:, :4] categories = predictions[:, 5] - ious = box_iou_batch(boxes, boxes) + ious = box_iou_batch(boxes, boxes, match_metric) ious = ious - np.eye(rows) keep = np.ones(rows, dtype=bool) @@ -148,7 +153,7 @@ def box_non_max_suppression( def group_overlapping_boxes( - predictions: npt.NDArray[np.float64], iou_threshold: float = 0.5 + predictions: npt.NDArray[np.float64], iou_threshold: float = 0.5, match_metric: str = "IOU" ) -> List[List[int]]: """ Apply greedy version of non-maximum merging to avoid detecting too many @@ -160,6 +165,8 @@ def group_overlapping_boxes( and the confidence scores. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. Defaults to 0.5. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: List[List[int]]: Groups of prediction indices be merged. @@ -179,7 +186,7 @@ def group_overlapping_boxes( break merge_candidate = np.expand_dims(predictions[idx], axis=0) - ious = box_iou_batch(predictions[order][:, :4], merge_candidate[:, :4]) + ious = box_iou_batch(predictions[order][:, :4], merge_candidate[:, :4], match_metric) ious = ious.flatten() above_threshold = ious >= iou_threshold @@ -189,9 +196,67 @@ def group_overlapping_boxes( return merge_groups +def mask_non_max_merge( + predictions: np.ndarray, + masks: np.ndarray, + iou_threshold: float = 0.5, + mask_dimension: int = 640, + match_metric: str = "IOU", +) -> np.ndarray: + """ + Perform Non-Maximum Merging (NMM) on segmentation predictions. + + Args: + predictions (np.ndarray): A 2D array of object detection predictions in + the format of `(x_min, y_min, x_max, y_max, score)` + or `(x_min, y_min, x_max, y_max, score, class)`. Shape: `(N, 5)` or + `(N, 6)`, where N is the number of predictions. + masks (np.ndarray): A 3D array of binary masks corresponding to the predictions. + Shape: `(N, H, W)`, where N is the number of predictions, and H, W are the + dimensions of each mask. + iou_threshold (float): The intersection-over-union threshold + to use for non-maximum suppression. + mask_dimension (int): The dimension to which the masks should be + resized before computing IOU values. Defaults to 640. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". + + Returns: + np.ndarray: A boolean array indicating which predictions to keep after + non-maximum suppression. + + Raises: + AssertionError: If `iou_threshold` is not within the closed + range from `0` to `1`. + """ + masks_resized = resize_masks(masks, mask_dimension) + if predictions.shape[1] == 5: + return group_overlapping_masks(predictions, masks_resized, iou_threshold, match_metric) + + category_ids = predictions[:, 5] + merge_groups = [] + for category_id in np.unique(category_ids): + curr_indices = np.where(category_ids == category_id)[0] + merge_class_groups = group_overlapping_masks( + predictions[curr_indices], masks_resized[curr_indices], iou_threshold, match_metric + ) + + for merge_class_group in merge_class_groups: + merge_groups.append(curr_indices[merge_class_group].tolist()) + + for merge_group in merge_groups: + if len(merge_group) == 0: + raise ValueError( + f"Empty group detected when non-max-merging " + f"detections: {merge_groups}" + ) + return merge_groups + + def box_non_max_merge( predictions: npt.NDArray[np.float64], iou_threshold: float = 0.5, + match_metric: str = "IOU", ) -> List[List[int]]: """ Apply greedy version of non-maximum merging per category to avoid detecting @@ -204,20 +269,22 @@ def box_non_max_merge( detections of different classes to be merged. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. Defaults to 0.5. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: List[List[int]]: Groups of prediction indices be merged. Each group may have 1 or more elements. """ if predictions.shape[1] == 5: - return group_overlapping_boxes(predictions, iou_threshold) + return group_overlapping_boxes(predictions, iou_threshold, match_metric) category_ids = predictions[:, 5] merge_groups = [] for category_id in np.unique(category_ids): curr_indices = np.where(category_ids == category_id)[0] merge_class_groups = group_overlapping_boxes( - predictions[curr_indices], iou_threshold + predictions[curr_indices], iou_threshold, match_metric ) for merge_class_group in merge_class_groups: @@ -232,6 +299,53 @@ def box_non_max_merge( return merge_groups +def group_overlapping_masks( + predictions: npt.NDArray[np.float64], + masks: npt.NDArray[np.float64], + iou_threshold: float = 0.5, + match_metric: str = "IOU", +) -> List[List[int]]: + """ + Apply greedy version of non-maximum merging to avoid detecting too many + + Args: + predictions (npt.NDArray[np.float64]): An array of shape `(n, 5)` containing + the bounding boxes coordinates in format `[x1, y1, x2, y2]` + and the confidence scores. + masks (npt.NDArray[np.float64]): A 3D array of binary masks corresponding to the predictions. + iou_threshold (float): The intersection-over-union threshold + to use for non-maximum suppression. Defaults to 0.5. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". + + Returns: + List[List[int]]: Groups of prediction indices be merged. + Each group may have 1 or more elements. + """ + merge_groups: List[List[int]] = [] + + scores = predictions[:, 4] + order = scores.argsort() + + while len(order) > 0: + idx = int(order[-1]) + + order = order[:-1] + if len(order) == 0: + merge_groups.append([idx]) + break + + merge_candidate = np.expand_dims(masks[idx], axis=0) + ious = mask_iou_batch(masks[order], merge_candidate, match_metric) + ious = ious.flatten() + + above_threshold = ious >= iou_threshold + merge_group = [idx, *np.flip(order[above_threshold]).tolist()] + merge_groups.append(merge_group) + order = order[~above_threshold] + return merge_groups + + class OverlapFilter(Enum): """ Enum specifying the strategy for filtering overlapping detections. diff --git a/supervision/detection/tools/inference_slicer.py b/supervision/detection/tools/inference_slicer.py index 05469dd6..7babaf68 100644 --- a/supervision/detection/tools/inference_slicer.py +++ b/supervision/detection/tools/inference_slicer.py @@ -72,6 +72,8 @@ class InferenceSlicer: filtering or merging overlapping detections in slices. iou_threshold (float): Intersection over Union (IoU) threshold used when filtering by overlap. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". callback (Callable): A function that performs inference on a given image slice and returns detections. thread_workers (int): Number of threads for parallel execution. @@ -91,6 +93,7 @@ class InferenceSlicer: overlap_wh: Optional[Tuple[int, int]] = None, overlap_filter: Union[OverlapFilter, str] = OverlapFilter.NON_MAX_SUPPRESSION, iou_threshold: float = 0.5, + match_metric: str = "IOU", thread_workers: int = 1, ): if overlap_ratio_wh is not None: @@ -106,6 +109,7 @@ class InferenceSlicer: self.slice_wh = slice_wh self.iou_threshold = iou_threshold + self.match_metric = match_metric self.overlap_filter = OverlapFilter.from_value(overlap_filter) self.callback = callback self.thread_workers = thread_workers @@ -165,9 +169,9 @@ class InferenceSlicer: if self.overlap_filter == OverlapFilter.NONE: return merged elif self.overlap_filter == OverlapFilter.NON_MAX_SUPPRESSION: - return merged.with_nms(threshold=self.iou_threshold) + return merged.with_nms(threshold=self.iou_threshold, match_metric=self.match_metric) elif self.overlap_filter == OverlapFilter.NON_MAX_MERGE: - return merged.with_nmm(threshold=self.iou_threshold) + return merged.with_nmm(threshold=self.iou_threshold, match_metric=self.match_metric) else: warnings.warn( f"Invalid overlap filter strategy: {self.overlap_filter}", diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 0d5ec475..19cddca4 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -48,7 +48,7 @@ def polygon_to_mask(polygon: np.ndarray, resolution_wh: Tuple[int, int]) -> np.n return mask -def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray) -> np.ndarray: +def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray, match_metric: str = "IOU") -> np.ndarray: """ Compute Intersection over Union (IoU) of two sets of bounding boxes - `boxes_true` and `boxes_detection`. Both sets @@ -59,6 +59,8 @@ def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray) -> np.nda `shape = (N, 4)` where `N` is number of true objects. boxes_detection (np.ndarray): 2D `np.ndarray` representing detection boxes. `shape = (M, 4)` where `M` is number of detected objects. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: np.ndarray: Pairwise IoU of boxes from `boxes_true` and `boxes_detection`. @@ -76,13 +78,32 @@ def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray) -> np.nda bottom_right = np.minimum(boxes_true[:, None, 2:], boxes_detection[:, 2:]) area_inter = np.prod(np.clip(bottom_right - top_left, a_min=0, a_max=None), 2) - ious = area_inter / (area_true[:, None] + area_detection - area_inter) + + if match_metric.upper() == "IOU": + union_area = area_true[:, None] + area_detection - area_inter + ious = np.divide( + area_inter, + union_area, + out=np.zeros_like(area_inter, dtype=float), + where=union_area != 0, + ) + elif match_metric.upper() == "IOS": + small_area = np.minimum(area_true[:, None], area_detection) + ious = np.divide( + area_inter, + small_area, + out=np.zeros_like(area_inter, dtype=float), + where=small_area != 0, + ) + else: + raise ValueError(f"match_metric {match_metric} is not supported, only 'IOU' and 'IOS' are supported") + ious = np.nan_to_num(ious) return ious def _mask_iou_batch_split( - masks_true: np.ndarray, masks_detection: np.ndarray + masks_true: np.ndarray, masks_detection: np.ndarray, match_metric: str = "IOU" ) -> np.ndarray: """ Internal function. @@ -92,6 +113,8 @@ def _mask_iou_batch_split( Args: masks_true (np.ndarray): 3D `np.ndarray` representing ground-truth masks. masks_detection (np.ndarray): 3D `np.ndarray` representing detection masks. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". Returns: np.ndarray: Pairwise IoU of masks from `masks_true` and `masks_detection`. @@ -102,19 +125,34 @@ def _mask_iou_batch_split( masks_true_area = masks_true.sum(axis=(1, 2)) masks_detection_area = masks_detection.sum(axis=(1, 2)) - union_area = masks_true_area[:, None] + masks_detection_area - intersection_area - return np.divide( - intersection_area, - union_area, - out=np.zeros_like(intersection_area, dtype=float), - where=union_area != 0, - ) + if match_metric.upper() == "IOU": + union_area = masks_true_area[:, None] + masks_detection_area - intersection_area + ious = np.divide( + intersection_area, + union_area, + out=np.zeros_like(intersection_area, dtype=float), + where=union_area != 0, + ) + elif match_metric.upper() == "IOS": + small_area = np.minimum(intersection_area, masks_detection_area) + ious = np.divide( + intersection_area, + small_area, + out=np.zeros_like(intersection_area, dtype=float), + where=small_area != 0, + ) + else: + raise ValueError(f"match_metric {match_metric} is not supported, only 'IOU' and 'IOS' are supported") + + ious = np.nan_to_num(ious) + return ious def mask_iou_batch( masks_true: np.ndarray, masks_detection: np.ndarray, + match_metric: str = "IOU", memory_limit: int = 1024 * 5, ) -> np.ndarray: """ @@ -124,6 +162,8 @@ def mask_iou_batch( Args: masks_true (np.ndarray): 3D `np.ndarray` representing ground-truth masks. masks_detection (np.ndarray): 3D `np.ndarray` representing detection masks. + match_metric (str): Metric used for matching detections in slices. + "IOU" or "IOS". Defaults "IOU". memory_limit (int): memory limit in MB, default is 1024 * 5 MB (5GB). Returns: @@ -138,7 +178,7 @@ def mask_iou_batch( / 1024 ) if memory <= memory_limit: - return _mask_iou_batch_split(masks_true, masks_detection) + return _mask_iou_batch_split(masks_true, masks_detection, match_metric) ious = [] step = max( @@ -153,7 +193,7 @@ def mask_iou_batch( 1, ) for i in range(0, masks_true.shape[0], step): - ious.append(_mask_iou_batch_split(masks_true[i : i + step], masks_detection)) + ious.append(_mask_iou_batch_split(masks_true[i : i + step], masks_detection, match_metric)) return np.vstack(ious) From 4679334d86220d465eaff2646a52886992ed63fd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 12:22:15 +0000 Subject: [PATCH 003/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 32 ++++++++++++++----- supervision/detection/overlap_filter.py | 17 +++++++--- .../detection/tools/inference_slicer.py | 8 +++-- supervision/detection/utils.py | 18 ++++++++--- 4 files changed, 57 insertions(+), 18 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index ad012a9d..45478973 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -17,8 +17,8 @@ from supervision.detection.lmm import ( ) from supervision.detection.overlap_filter import ( box_non_max_merge, - mask_non_max_merge, box_non_max_suppression, + mask_non_max_merge, mask_non_max_suppression, ) from supervision.detection.tools.transformers import ( @@ -28,12 +28,12 @@ from supervision.detection.tools.transformers import ( ) from supervision.detection.utils import ( box_iou_batch, - mask_iou_batch, calculate_masks_centroids, extract_ultralytics_masks, get_data_item, is_data_equal, is_metadata_equal, + mask_iou_batch, mask_to_xyxy, merge_data, merge_metadata, @@ -1283,7 +1283,10 @@ class Detections: return (self.xyxy[:, 3] - self.xyxy[:, 1]) * (self.xyxy[:, 2] - self.xyxy[:, 0]) def with_nms( - self, threshold: float = 0.5, class_agnostic: bool = False, match_metric: str = "IOU" + self, + threshold: float = 0.5, + class_agnostic: bool = False, + match_metric: str = "IOU", ) -> Detections: """ Performs non-max suppression on detection set. If the detections result @@ -1331,17 +1334,25 @@ class Detections: if self.mask is not None: indices = mask_non_max_suppression( - predictions=predictions, masks=self.mask, iou_threshold=threshold, match_metric=match_metric + predictions=predictions, + masks=self.mask, + iou_threshold=threshold, + match_metric=match_metric, ) else: indices = box_non_max_suppression( - predictions=predictions, iou_threshold=threshold, match_metric=match_metric + predictions=predictions, + iou_threshold=threshold, + match_metric=match_metric, ) return self[indices] def with_nmm( - self, threshold: float = 0.5, class_agnostic: bool = False, match_metric: str = "IOU" + self, + threshold: float = 0.5, + class_agnostic: bool = False, + match_metric: str = "IOU", ) -> Detections: """ Perform non-maximum merging on the current set of object detections. @@ -1389,11 +1400,16 @@ class Detections: if self.mask is not None: merge_groups = mask_non_max_merge( - predictions=predictions, masks=self.mask, iou_threshold=threshold, match_metric=match_metric + predictions=predictions, + masks=self.mask, + iou_threshold=threshold, + match_metric=match_metric, ) else: merge_groups = box_non_max_merge( - predictions=predictions, iou_threshold=threshold, match_metric=match_metric + predictions=predictions, + iou_threshold=threshold, + match_metric=match_metric, ) result = [] diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index 935be236..608216e2 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -153,7 +153,9 @@ def box_non_max_suppression( def group_overlapping_boxes( - predictions: npt.NDArray[np.float64], iou_threshold: float = 0.5, match_metric: str = "IOU" + predictions: npt.NDArray[np.float64], + iou_threshold: float = 0.5, + match_metric: str = "IOU", ) -> List[List[int]]: """ Apply greedy version of non-maximum merging to avoid detecting too many @@ -186,7 +188,9 @@ def group_overlapping_boxes( break merge_candidate = np.expand_dims(predictions[idx], axis=0) - ious = box_iou_batch(predictions[order][:, :4], merge_candidate[:, :4], match_metric) + ious = box_iou_batch( + predictions[order][:, :4], merge_candidate[:, :4], match_metric + ) ious = ious.flatten() above_threshold = ious >= iou_threshold @@ -231,14 +235,19 @@ def mask_non_max_merge( """ masks_resized = resize_masks(masks, mask_dimension) if predictions.shape[1] == 5: - return group_overlapping_masks(predictions, masks_resized, iou_threshold, match_metric) + return group_overlapping_masks( + predictions, masks_resized, iou_threshold, match_metric + ) category_ids = predictions[:, 5] merge_groups = [] for category_id in np.unique(category_ids): curr_indices = np.where(category_ids == category_id)[0] merge_class_groups = group_overlapping_masks( - predictions[curr_indices], masks_resized[curr_indices], iou_threshold, match_metric + predictions[curr_indices], + masks_resized[curr_indices], + iou_threshold, + match_metric, ) for merge_class_group in merge_class_groups: diff --git a/supervision/detection/tools/inference_slicer.py b/supervision/detection/tools/inference_slicer.py index 7babaf68..324d26e3 100644 --- a/supervision/detection/tools/inference_slicer.py +++ b/supervision/detection/tools/inference_slicer.py @@ -169,9 +169,13 @@ class InferenceSlicer: if self.overlap_filter == OverlapFilter.NONE: return merged elif self.overlap_filter == OverlapFilter.NON_MAX_SUPPRESSION: - return merged.with_nms(threshold=self.iou_threshold, match_metric=self.match_metric) + return merged.with_nms( + threshold=self.iou_threshold, match_metric=self.match_metric + ) elif self.overlap_filter == OverlapFilter.NON_MAX_MERGE: - return merged.with_nmm(threshold=self.iou_threshold, match_metric=self.match_metric) + return merged.with_nmm( + threshold=self.iou_threshold, match_metric=self.match_metric + ) else: warnings.warn( f"Invalid overlap filter strategy: {self.overlap_filter}", diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 19cddca4..3c427d21 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -48,7 +48,9 @@ def polygon_to_mask(polygon: np.ndarray, resolution_wh: Tuple[int, int]) -> np.n return mask -def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray, match_metric: str = "IOU") -> np.ndarray: +def box_iou_batch( + boxes_true: np.ndarray, boxes_detection: np.ndarray, match_metric: str = "IOU" +) -> np.ndarray: """ Compute Intersection over Union (IoU) of two sets of bounding boxes - `boxes_true` and `boxes_detection`. Both sets @@ -96,7 +98,9 @@ def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray, match_met where=small_area != 0, ) else: - raise ValueError(f"match_metric {match_metric} is not supported, only 'IOU' and 'IOS' are supported") + raise ValueError( + f"match_metric {match_metric} is not supported, only 'IOU' and 'IOS' are supported" + ) ious = np.nan_to_num(ious) return ious @@ -143,7 +147,9 @@ def _mask_iou_batch_split( where=small_area != 0, ) else: - raise ValueError(f"match_metric {match_metric} is not supported, only 'IOU' and 'IOS' are supported") + raise ValueError( + f"match_metric {match_metric} is not supported, only 'IOU' and 'IOS' are supported" + ) ious = np.nan_to_num(ious) return ious @@ -193,7 +199,11 @@ def mask_iou_batch( 1, ) for i in range(0, masks_true.shape[0], step): - ious.append(_mask_iou_batch_split(masks_true[i : i + step], masks_detection, match_metric)) + ious.append( + _mask_iou_batch_split( + masks_true[i : i + step], masks_detection, match_metric + ) + ) return np.vstack(ious) From f2e900171ee09b2ff6024896e69e5394a8806007 Mon Sep 17 00:00:00 2001 From: hidara2000 Date: Tue, 15 Apr 2025 18:09:08 +1000 Subject: [PATCH 004/110] feat(annotators): enhance label annotators with frame boundary adjustments and new base class - ensures labels are within frame - May have a few overlaps at edges,in very busy frames, when smart_pos is enabled. but running smart_pos first yields better results --- supervision/annotators/core.py | 478 ++++++++++++++++++--------------- 1 file changed, 262 insertions(+), 216 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 1b5b9bee..c145229c 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1,6 +1,6 @@ from functools import lru_cache from math import sqrt -from typing import List, Optional, Tuple, Union +from typing import Callable, List, Optional, Tuple, Union import cv2 import numpy as np @@ -40,6 +40,199 @@ from supervision.utils.image import ( CV2_FONT = cv2.FONT_HERSHEY_SIMPLEX +class _BaseLabelAnnotator(BaseAnnotator): + """ + Base class for annotators that add labels to detections. + + Attributes: + color (Union[Color, ColorPalette]): The color to use for the label background. + text_color (Union[Color, ColorPalette]): The color to use for the label text. + text_padding (int): The padding around the label text, in pixels. + text_anchor (Position): The position of the text relative to the detection + bounding box. + color_lookup (ColorLookup): The method used to determine the color of the label. + border_radius (int): The radius of the label background corners, in pixels. + smart_position (bool): Whether to intelligently adjust the label position to + avoid overlapping with other elements. + ensure_in_frame (bool): Whether to ensure the label stays within the frame + boundaries. + """ + + def __init__( + self, + color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + text_color: Union[Color, ColorPalette] = Color.WHITE, + text_padding: int = 10, + text_position: Position = Position.TOP_LEFT, + color_lookup: ColorLookup = ColorLookup.CLASS, + border_radius: int = 0, + smart_position: bool = False, + ensure_in_frame: bool = True, # New parameter + ): + """ + Initializes the _BaseLabelAnnotator. + + Args: + color (Union[Color, ColorPalette], optional): The color to use for the label + background. Defaults to ColorPalette.DEFAULT. + text_color (Union[Color, ColorPalette], optional): The color to use for the + label text. Defaults to Color.WHITE. + text_padding (int, optional): The padding around the label text, in pixels. + Defaults to 10. + text_position (Position, optional): The position of the text relative to the + detection bounding box. Defaults to Position.TOP_LEFT. + color_lookup (ColorLookup, optional): The method used to determine the color + of the label. Defaults to ColorLookup.CLASS. + border_radius (int, optional): The radius of the label background corners, + in pixels. Defaults to 0. + smart_position (bool, optional): Whether to intelligently adjust the label + position to avoid overlapping with other elements. + Defaults to False. + ensure_in_frame (bool, optional): Whether to ensure the label stays within + the frame boundaries. Defaults to True. + """ + self.color: Union[Color, ColorPalette] = color + self.text_color: Union[Color, ColorPalette] = text_color + self.text_padding: int = text_padding + self.text_anchor: Position = text_position + self.color_lookup: ColorLookup = color_lookup + self.border_radius: int = border_radius + self.smart_position = smart_position + self.ensure_in_frame = ensure_in_frame # Store the new parameter + + def _validate_labels(self, labels: Optional[List[str]], detections: Detections): + """ + Validates that the number of provided labels matches the number of detections. + + Args: + labels (Optional[List[str]]): A list of labels, one for each detection. Can + be None. + detections (Detections): The detections to be labeled. + + Raises: + ValueError: If `labels` is not None and its length does not match the number + of detections. + """ + if labels is not None and len(labels) != len(detections): + raise ValueError( + f"The number of labels ({len(labels)}) does not match the " + f"number of detections ({len(detections)}). Each detection " + f"should have exactly 1 label." + ) + + @staticmethod + def _get_labels_text( + detections: Detections, custom_labels: Optional[List[str]] + ) -> List[str]: + """ + Retrieves the text labels for the detections. + + If `custom_labels` are provided, they are used. Otherwise, the labels are + extracted from the `detections` object, prioritizing the 'class_name' field, + then the `class_id`, and finally using the detection index as a string. + + Args: + detections (Detections): The detections to get labels for. + custom_labels (Optional[List[str]]): An optional list of custom labels. + + Returns: + List[str]: A list of text labels for each detection. + """ + if custom_labels is not None: + return custom_labels + + labels = [] + for idx in range(len(detections)): + if CLASS_NAME_DATA_FIELD in detections.data: + labels.append(detections.data[CLASS_NAME_DATA_FIELD][idx]) + elif detections.class_id is not None: + labels.append(str(detections.class_id[idx])) + else: + labels.append(str(idx)) + return labels + + def _adjust_labels_in_frame( + self, + frame_width: int, + frame_height: int, + labels: List[str], + label_properties: np.ndarray, + get_text_width_fn: Callable[[str], int], + ) -> np.ndarray: + """ + Adjusts the position of labels to ensure they stay within the frame boundaries. + + Args: + frame_width (int): The width of the frame. + frame_height (int): The height of the frame. + labels (List[str]): The list of text labels. + label_properties (np.ndarray): An array of label properties, where each row + contains [x1, y1, x2, y2, text_height, ...]. + get_text_width_fn (Callable[[str], int]): A function that takes a label + string and returns its width in pixels. + + Returns: + np.ndarray: The adjusted label properties. + """ + adjusted_properties = label_properties.copy() + for i in range(len(labels)): + x1, y1, x2, y2, text_height = adjusted_properties[i][ + :5 + ] # Handle different property lengths + label_h = text_height + 2 * self.text_padding + + # Adjust x-coordinate + if x1 < 0: + adjusted_properties[i, 0] -= x1 + adjusted_properties[i, 2] -= x1 + elif x2 > frame_width: + adjusted_properties[i, 0] -= x2 - frame_width + adjusted_properties[i, 2] -= x2 - frame_width + + # Adjust y-coordinate + if y1 < 0: + adjusted_properties[i, 1] -= y1 + adjusted_properties[i, 3] -= y1 + elif y2 > frame_height: + adjusted_properties[i, 1] -= y2 - frame_height + adjusted_properties[i, 3] -= y2 - frame_height + # Optionally, if the label is below the box, try to move it above + anchor_y = self._get_anchor_y_for_adjustment( + adjusted_properties[i, 1:3], self.text_anchor + ) + if anchor_y - label_h >= 0: + adjusted_properties[i, 1] -= label_h + adjusted_properties[i, 3] -= label_h + + return adjusted_properties + + @staticmethod + def _get_anchor_y_for_adjustment(bbox_y: np.ndarray, anchor: Position) -> float: + """ + Calculates the anchor y-coordinate for label adjustment based on the text anchor + position. + + Args: + bbox_y (np.ndarray): An array containing the y1 and y2 coordinates of the + bounding box. + anchor (Position): The desired text anchor position. + + Returns: + float: The anchor y-coordinate. + """ + y1, y2 = bbox_y + if anchor in [Position.TOP_LEFT, Position.TOP_CENTER, Position.TOP_RIGHT]: + return y1 + elif anchor in [ + Position.BOTTOM_LEFT, + Position.BOTTOM_CENTER, + Position.BOTTOM_RIGHT, + ]: + return y2 + else: # CENTER, CENTER_LEFT, CENTER_RIGHT + return (y1 + y2) / 2 + + class BoxAnnotator(BaseAnnotator): """ A class for drawing bounding boxes on an image using provided detections. @@ -960,7 +1153,7 @@ class DotAnnotator(BaseAnnotator): return scene -class LabelAnnotator(BaseAnnotator): +class LabelAnnotator(_BaseLabelAnnotator): """ A class for annotating labels on an image using provided detections. """ @@ -976,94 +1169,53 @@ class LabelAnnotator(BaseAnnotator): color_lookup: ColorLookup = ColorLookup.CLASS, border_radius: int = 0, smart_position: bool = False, + ensure_in_frame: bool = False, # Inherited ): - """ - Args: - color (Union[Color, ColorPalette]): The color or color palette to use for - annotating the text background. - text_color (Union[Color, ColorPalette]): The color or color palette to use - for the text. - text_scale (float): Font scale for the text. - text_thickness (int): Thickness of the text characters. - text_padding (int): Padding around the text within its background box. - text_position (Position): Position of the text relative to the detection. - Possible values are defined in the `Position` enum. - color_lookup (ColorLookup): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACK`. - border_radius (int): The radius to apply round edges. If the selected - value is higher than the lower dimension, width or height, is clipped. - smart_position (bool): Spread out the labels to avoid overlapping. - """ - self.border_radius: int = border_radius - self.color: Union[Color, ColorPalette] = color - self.text_color: Union[Color, ColorPalette] = text_color self.text_scale: float = text_scale self.text_thickness: int = text_thickness - self.text_padding: int = text_padding - self.text_anchor: Position = text_position - self.color_lookup: ColorLookup = color_lookup - self.smart_position = smart_position + super().__init__( + color=color, + text_color=text_color, + text_padding=text_padding, + text_position=text_position, + color_lookup=color_lookup, + border_radius=border_radius, + smart_position=smart_position, + ensure_in_frame=ensure_in_frame, + ) @ensure_cv2_image_for_annotation def annotate( self, - scene: ImageType, + scene: np.ndarray, # Ensure scene is initially a NumPy array here detections: Detections, labels: Optional[List[str]] = None, custom_color_lookup: Optional[np.ndarray] = None, - ) -> ImageType: - """ - Annotates the given scene with labels based on the provided detections. - - Args: - scene (ImageType): The image where labels will be drawn. - `ImageType` is a flexible type, accepting either `numpy.ndarray` - or `PIL.Image.Image`. - detections (Detections): Object detections to annotate. - labels (Optional[List[str]]): Custom labels for each detection. - custom_color_lookup (Optional[np.ndarray]): Custom color lookup array. - Allows to override the default color mapping strategy. - - Returns: - The annotated image, matching the type of `scene` (`numpy.ndarray` - or `PIL.Image.Image`) - - Example: - ```python - import supervision as sv - - image = ... - detections = sv.Detections(...) - - labels = [ - f"{class_name} {confidence:.2f}" - for class_name, confidence - in zip(detections['class_name'], detections.confidence) - ] - - label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) - annotated_frame = label_annotator.annotate( - scene=image.copy(), - detections=detections, - labels=labels - ) - ``` - - ![label-annotator-example](https://media.roboflow.com/ - supervision-annotator-examples/label-annotator-example-purple.png) - """ - + ) -> np.ndarray: assert isinstance(scene, np.ndarray) self._validate_labels(labels, detections) labels = self._get_labels_text(detections, labels) - label_properties = self._get_label_properties(detections, labels) + label_properties = self._get_label_properties( + scene, detections, labels + ) # Pass scene if self.smart_position: xyxy = label_properties[:, :4] xyxy = spread_out_boxes(xyxy) label_properties[:, :4] = xyxy + if self.ensure_in_frame: + label_properties = self._adjust_labels_in_frame( + scene.shape[1], + scene.shape[0], + labels, + label_properties, + lambda text: cv2.getTextSize( + text, CV2_FONT, self.text_scale, self.text_thickness + )[0][0], + ) + self._draw_labels( scene=scene, labels=labels, @@ -1074,26 +1226,12 @@ class LabelAnnotator(BaseAnnotator): return scene - def _validate_labels(self, labels: Optional[List[str]], detections: Detections): - if labels is not None and len(labels) != len(detections): - raise ValueError( - f"The number of labels ({len(labels)}) does not match the " - f"number of detections ({len(detections)}). Each detection " - f"should have exactly 1 label." - ) - def _get_label_properties( self, + scene: np.ndarray, # Receive scene detections: Detections, labels: List[str], ) -> np.ndarray: - """ - Calculate the numerical properties required to draw the labels on the image. - - Returns: - (np.ndarray): An array of label properties, containing columns: - `min_x`, `min_y`, `max_x`, `max_y`, `padded_text_height`. - """ label_properties = [] anchors_coordinates = detections.get_anchors_coordinates( anchor=self.text_anchor @@ -1116,32 +1254,12 @@ class LabelAnnotator(BaseAnnotator): position=self.text_anchor, ) - label_properties.append( - [ - *text_background_xyxy, - text_h, - ] - ) - + label_properties.append([ + *text_background_xyxy, + text_h, + ]) return np.array(label_properties).reshape(-1, 5) - @staticmethod - def _get_labels_text( - detections: Detections, custom_labels: Optional[List[str]] - ) -> List[str]: - if custom_labels is not None: - return custom_labels - - labels = [] - for idx in range(len(detections)): - if CLASS_NAME_DATA_FIELD in detections.data: - labels.append(detections.data[CLASS_NAME_DATA_FIELD][idx]) - elif detections.class_id is not None: - labels.append(str(detections.class_id[idx])) - else: - labels.append(str(idx)) - return labels - def _draw_labels( self, scene: np.ndarray, @@ -1176,7 +1294,7 @@ class LabelAnnotator(BaseAnnotator): color_lookup=color_lookup, ) - box_xyxy = label_property[:4] + box_xyxy = label_property[:4].astype(int) text_height_padded = label_property[4] self.draw_rounded_rectangle( scene=scene, @@ -1186,7 +1304,7 @@ class LabelAnnotator(BaseAnnotator): ) text_x = box_xyxy[0] + self.text_padding - text_y = box_xyxy[1] + self.text_padding + text_height_padded + text_y = box_xyxy[1] + self.text_padding + int(text_height_padded) cv2.putText( img=scene, text=labels[idx], @@ -1241,7 +1359,7 @@ class LabelAnnotator(BaseAnnotator): return scene -class RichLabelAnnotator(BaseAnnotator): +class RichLabelAnnotator(_BaseLabelAnnotator): """ A class for annotating labels on an image using provided detections, with support for Unicode characters by using a custom font. @@ -1258,80 +1376,30 @@ class RichLabelAnnotator(BaseAnnotator): color_lookup: ColorLookup = ColorLookup.CLASS, border_radius: int = 0, smart_position: bool = False, + ensure_in_frame: bool = False, # Inherited ): - """ - Args: - color (Union[Color, ColorPalette]): The color or color palette to use for - annotating the text background. - text_color (Union[Color, ColorPalette]): The color to use for the text. - font_path (Optional[str]): Path to the font file (e.g., ".ttf" or ".otf") - to use for rendering text. If `None`, the default PIL font will be used. - font_size (int): Font size for the text. - text_padding (int): Padding around the text within its background box. - text_position (Position): Position of the text relative to the detection. - Possible values are defined in the `Position` enum. - color_lookup (ColorLookup): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACK`. - border_radius (int): The radius to apply round edges. If the selected - value is higher than the lower dimension, width or height, is clipped. - smart_position (bool): Spread out the labels to avoid overlapping. - """ - self.color = color - self.text_color = text_color - self.text_padding = text_padding - self.text_anchor = text_position - self.color_lookup = color_lookup - self.border_radius = border_radius - self.smart_position = smart_position + self.font_path = font_path + self.font_size = font_size self.font = self._load_font(font_size, font_path) + super().__init__( + color=color, + text_color=text_color, + text_padding=text_padding, + text_position=text_position, + color_lookup=color_lookup, + border_radius=border_radius, + smart_position=smart_position, + ensure_in_frame=ensure_in_frame, + ) @ensure_pil_image_for_annotation def annotate( self, - scene: ImageType, + scene: Image.Image, detections: Detections, labels: Optional[List[str]] = None, custom_color_lookup: Optional[np.ndarray] = None, - ) -> ImageType: - """ - Annotates the given scene with labels based on the provided - detections, with support for Unicode characters. - - Args: - scene (ImageType): The image where labels will be drawn. - `ImageType` is a flexible type, accepting either `numpy.ndarray` - or `PIL.Image.Image`. - detections (Detections): Object detections to annotate. - labels (Optional[List[str]]): Custom labels for each detection. - custom_color_lookup (Optional[np.ndarray]): Custom color lookup array. - Allows to override the default color mapping strategy. - - Returns: - The annotated image, matching the type of `scene` (`numpy.ndarray` - or `PIL.Image.Image`) - - Example: - ```python - import supervision as sv - - image = ... - detections = sv.Detections(...) - - labels = [ - f"{class_name} {confidence:.2f}" - for class_name, confidence - in zip(detections['class_name'], detections.confidence) - ] - - rich_label_annotator = sv.RichLabelAnnotator(font_path="path/to/font.ttf") - annotated_frame = label_annotator.annotate( - scene=image.copy(), - detections=detections, - labels=labels - ) - ``` - - """ + ) -> Image.Image: assert isinstance(scene, Image.Image) self._validate_labels(labels, detections) @@ -1344,6 +1412,18 @@ class RichLabelAnnotator(BaseAnnotator): xyxy = spread_out_boxes(xyxy) label_properties[:, :4] = xyxy + if self.ensure_in_frame: + label_properties = self._adjust_labels_in_frame( + scene.width, + scene.height, + labels, + label_properties, + lambda text: int( + draw.textbbox((0, 0), text, font=self.font)[2] + - draw.textbbox((0, 0), text, font=self.font)[0] + ), + ) + self._draw_labels( draw=draw, labels=labels, @@ -1354,26 +1434,9 @@ class RichLabelAnnotator(BaseAnnotator): return scene - def _validate_labels(self, labels: Optional[List[str]], detections: Detections): - if labels is not None and len(labels) != len(detections): - raise ValueError( - f"The number of labels ({len(labels)}) does not match the " - f"number of detections ({len(detections)}). Each detection " - f"should have exactly 1 label." - ) - def _get_label_properties( - self, draw, detections: Detections, labels: List[str] + self, draw: ImageDraw.ImageDraw, detections: Detections, labels: List[str] ) -> np.ndarray: - """ - Calculate the numerical properties required to draw the labels on the image. - - Returns: - (np.ndarray): An array of label properties, containing columns: - `min_x`, `min_y`, `max_x`, `max_y`, `text_left_coordinate`, - `text_top_coordinate`. The first 4 values are already padded - with `text_padding`. - """ label_properties = [] anchor_coordinates = detections.get_anchors_coordinates( @@ -1386,8 +1449,8 @@ class RichLabelAnnotator(BaseAnnotator): ) text_width = text_right - text_left text_height = text_bottom - text_top - width_padded = text_width + 2 * self.text_padding - height_padded = text_height + 2 * self.text_padding + width_padded = int(text_width + 2 * self.text_padding) + height_padded = int(text_height + 2 * self.text_padding) text_background_xyxy = resolve_text_background_xyxy( center_coordinates=tuple(center_coords), @@ -1399,26 +1462,9 @@ class RichLabelAnnotator(BaseAnnotator): return np.array(label_properties).reshape(-1, 6) - @staticmethod - def _get_labels_text( - detections: Detections, custom_labels: Optional[List[str]] - ) -> List[str]: - if custom_labels is not None: - return custom_labels - - labels = [] - for idx in range(len(detections)): - if CLASS_NAME_DATA_FIELD in detections.data: - labels.append(detections.data[CLASS_NAME_DATA_FIELD][idx]) - elif detections.class_id is not None: - labels.append(str(detections.class_id[idx])) - else: - labels.append(str(idx)) - return labels - def _draw_labels( self, - draw, + draw: ImageDraw.ImageDraw, labels: List[str], label_properties: np.ndarray, detections: Detections, @@ -1449,7 +1495,7 @@ class RichLabelAnnotator(BaseAnnotator): color_lookup=color_lookup, ) - box_xyxy = label_property[:4] + box_xyxy = label_property[:4].astype(int) text_left = label_property[4] text_top = label_property[5] label_x_position = box_xyxy[0] + self.text_padding - text_left From ca5596ceb2d87346f0661fcd8eee593a7ff22be9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 08:30:24 +0000 Subject: [PATCH 005/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index c145229c..d35a1eba 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1254,10 +1254,12 @@ class LabelAnnotator(_BaseLabelAnnotator): position=self.text_anchor, ) - label_properties.append([ - *text_background_xyxy, - text_h, - ]) + label_properties.append( + [ + *text_background_xyxy, + text_h, + ] + ) return np.array(label_properties).reshape(-1, 5) def _draw_labels( From a1e43f8e933052896d5eb7987c30bdd3b626fd3f Mon Sep 17 00:00:00 2001 From: hidara2000 <15170494+hidara2000@users.noreply.github.com> Date: Tue, 15 Apr 2025 21:58:06 +1000 Subject: [PATCH 006/110] Update supervision/annotators/core.py Co-authored-by: Onuralp SEZER --- supervision/annotators/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index d35a1eba..4f261888 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1187,7 +1187,7 @@ class LabelAnnotator(_BaseLabelAnnotator): @ensure_cv2_image_for_annotation def annotate( self, - scene: np.ndarray, # Ensure scene is initially a NumPy array here + scene: ImageType, # Ensure scene is initially a NumPy array here detections: Detections, labels: Optional[List[str]] = None, custom_color_lookup: Optional[np.ndarray] = None, From a5c833b80f163dfceab7f304c9e4f435139ec53d Mon Sep 17 00:00:00 2001 From: hidara2000 <15170494+hidara2000@users.noreply.github.com> Date: Tue, 15 Apr 2025 21:58:20 +1000 Subject: [PATCH 007/110] Update supervision/annotators/core.py Co-authored-by: Onuralp SEZER --- supervision/annotators/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 4f261888..99c23ed7 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1397,7 +1397,7 @@ class RichLabelAnnotator(_BaseLabelAnnotator): @ensure_pil_image_for_annotation def annotate( self, - scene: Image.Image, + scene: ImageType detections: Detections, labels: Optional[List[str]] = None, custom_color_lookup: Optional[np.ndarray] = None, From 474c8bc478c7a09b009072f0db9fff4c3a4508c6 Mon Sep 17 00:00:00 2001 From: hidara2000 <15170494+hidara2000@users.noreply.github.com> Date: Tue, 15 Apr 2025 21:58:31 +1000 Subject: [PATCH 008/110] Update supervision/annotators/core.py Co-authored-by: Onuralp SEZER --- supervision/annotators/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 99c23ed7..0fee71d1 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1401,7 +1401,7 @@ class RichLabelAnnotator(_BaseLabelAnnotator): detections: Detections, labels: Optional[List[str]] = None, custom_color_lookup: Optional[np.ndarray] = None, - ) -> Image.Image: + ) -> ImageType: assert isinstance(scene, Image.Image) self._validate_labels(labels, detections) From c4dce2752d2479404abfed241196ad1e5e0a2117 Mon Sep 17 00:00:00 2001 From: hidara2000 Date: Tue, 15 Apr 2025 22:09:51 +1000 Subject: [PATCH 009/110] fix(annotators): add missing comma in annotate method signature --- supervision/annotators/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 0fee71d1..f6e71e2e 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1397,7 +1397,7 @@ class RichLabelAnnotator(_BaseLabelAnnotator): @ensure_pil_image_for_annotation def annotate( self, - scene: ImageType + scene: ImageType, detections: Detections, labels: Optional[List[str]] = None, custom_color_lookup: Optional[np.ndarray] = None, From 0539ec9d1f63e1b87f8e5e370ba9949f00747cdf Mon Sep 17 00:00:00 2001 From: hidara2000 Date: Thu, 17 Apr 2025 10:48:02 +1000 Subject: [PATCH 010/110] feat(annotators): add max_line_length parameter and text wrapping functionality --- supervision/annotators/core.py | 327 +++++++++++++++++++++++++-------- supervision/detection/utils.py | 65 +++++-- 2 files changed, 302 insertions(+), 90 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index f6e71e2e..254c55e0 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -54,8 +54,8 @@ class _BaseLabelAnnotator(BaseAnnotator): border_radius (int): The radius of the label background corners, in pixels. smart_position (bool): Whether to intelligently adjust the label position to avoid overlapping with other elements. - ensure_in_frame (bool): Whether to ensure the label stays within the frame - boundaries. + max_line_length (Optional[int]): Maximum number of characters per line before + wrapping the text. None means no wrapping. """ def __init__( @@ -67,7 +67,7 @@ class _BaseLabelAnnotator(BaseAnnotator): color_lookup: ColorLookup = ColorLookup.CLASS, border_radius: int = 0, smart_position: bool = False, - ensure_in_frame: bool = True, # New parameter + max_line_length: Optional[int] = None, ): """ Initializes the _BaseLabelAnnotator. @@ -88,8 +88,9 @@ class _BaseLabelAnnotator(BaseAnnotator): smart_position (bool, optional): Whether to intelligently adjust the label position to avoid overlapping with other elements. Defaults to False. - ensure_in_frame (bool, optional): Whether to ensure the label stays within - the frame boundaries. Defaults to True. + max_line_length (Optional[int], optional): Maximum number of characters per + line before wrapping the text. None means no wrapping. + Defaults to None. """ self.color: Union[Color, ColorPalette] = color self.text_color: Union[Color, ColorPalette] = text_color @@ -98,7 +99,7 @@ class _BaseLabelAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup self.border_radius: int = border_radius self.smart_position = smart_position - self.ensure_in_frame = ensure_in_frame # Store the new parameter + self.max_line_length: Optional[int] = max_line_length def _validate_labels(self, labels: Optional[List[str]], detections: Detections): """ @@ -151,6 +152,67 @@ class _BaseLabelAnnotator(BaseAnnotator): labels.append(str(idx)) return labels + def _ensure_box_in_frame( + self, + box: np.ndarray, + frame_width: int, + frame_height: int, + check_flip_label: bool = False, + text_anchor: Optional[Position] = None, + ) -> np.ndarray: + """ + Adjusts a box to ensure it stays within frame boundaries. + + Args: + box: Box coordinates [x1, y1, x2, y2] + frame_width: Width of the frame + frame_height: Height of the frame + check_flip_label: Whether to check if label should be flipped + text_anchor: Text anchor position for flip check + + Returns: + Adjusted box coordinates + """ + x1, y1, x2, y2 = box + + # Adjust x-coordinate to stay within frame + if x1 < 0: + shift = -x1 + x1 += shift + x2 += shift + elif x2 > frame_width: + shift = frame_width - x2 + x1 += shift + x2 += shift + + # Adjust y-coordinate to stay within frame + if y1 < 0: + shift = -y1 + y1 += shift + y2 += shift + elif y2 > frame_height: + shift = frame_height - y2 + y1 += shift + y2 += shift + + # Check if label should be flipped to above the box + if check_flip_label and text_anchor is not None: + box_height = y2 - y1 + + # Check anchor position to see if we can flip it + anchor_y = self._get_anchor_y_for_adjustment( + np.array([y1, y2]), text_anchor + ) + + # If we're at the bottom, try moving to the top + if anchor_y >= y2 - 5: # Near bottom edge + # Check if there's room at the top + if y1 - box_height >= 0: + y2 = y1 + y1 = y2 - box_height + + return np.array([x1, y1, x2, y2]) + def _adjust_labels_in_frame( self, frame_width: int, @@ -175,34 +237,33 @@ class _BaseLabelAnnotator(BaseAnnotator): np.ndarray: The adjusted label properties. """ adjusted_properties = label_properties.copy() + + # First, make sure the boxes don't go outside the frame for i in range(len(labels)): - x1, y1, x2, y2, text_height = adjusted_properties[i][ - :5 - ] # Handle different property lengths - label_h = text_height + 2 * self.text_padding + # Adjust box to stay within frame + adjusted_properties[i, :4] = self._ensure_box_in_frame( + adjusted_properties[i, :4], + frame_width, + frame_height, + check_flip_label=True, + text_anchor=self.text_anchor, + ) - # Adjust x-coordinate - if x1 < 0: - adjusted_properties[i, 0] -= x1 - adjusted_properties[i, 2] -= x1 - elif x2 > frame_width: - adjusted_properties[i, 0] -= x2 - frame_width - adjusted_properties[i, 2] -= x2 - frame_width + # Apply the spread out algorithm to avoid box overlaps + if len(labels) > 1: + # Extract the box coordinates + boxes = adjusted_properties[:, :4] + # Use the spread_out_boxes function to adjust overlapping boxes + spread_boxes = spread_out_boxes(boxes) + # Update the properties with the spread out boxes + adjusted_properties[:, :4] = spread_boxes - # Adjust y-coordinate - if y1 < 0: - adjusted_properties[i, 1] -= y1 - adjusted_properties[i, 3] -= y1 - elif y2 > frame_height: - adjusted_properties[i, 1] -= y2 - frame_height - adjusted_properties[i, 3] -= y2 - frame_height - # Optionally, if the label is below the box, try to move it above - anchor_y = self._get_anchor_y_for_adjustment( - adjusted_properties[i, 1:3], self.text_anchor + # Additional check to ensure boxes are still within frame after spreading + for i in range(len(labels)): + # Adjust box to stay within frame (without flipping) + adjusted_properties[i, :4] = self._ensure_box_in_frame( + adjusted_properties[i, :4], frame_width, frame_height ) - if anchor_y - label_h >= 0: - adjusted_properties[i, 1] -= label_h - adjusted_properties[i, 3] -= label_h return adjusted_properties @@ -232,6 +293,53 @@ class _BaseLabelAnnotator(BaseAnnotator): else: # CENTER, CENTER_LEFT, CENTER_RIGHT return (y1 + y2) / 2 + def _wrap_text(self, text: str) -> List[str]: + """ + Wraps text to the specified maximum line length, respecting existing newlines. + Uses the textwrap library for robust text wrapping. + + Args: + text (str): The text to wrap. + + Returns: + List[str]: A list of text lines after wrapping. + """ + import textwrap + + if not text: + return [""] + + if self.max_line_length is None: + return text.splitlines() or [""] + + # Split the text by existing newlines first + paragraphs = text.split("\n") + all_lines = [] + + for paragraph in paragraphs: + if not paragraph: + # Keep empty lines + all_lines.append("") + continue + + # Wrap each paragraph separately + wrapped = textwrap.wrap( + paragraph, + width=self.max_line_length, + break_long_words=True, # Break words longer than max_line_length + replace_whitespace=False, # Preserve existing spaces + drop_whitespace=True, # Drop leading/trailing whitespace on wrapped lines + ) + + # Add the wrapped lines for this paragraph + if wrapped: + all_lines.extend(wrapped) + else: + # If wrap returns an empty list (e.g., for whitespace-only input) + all_lines.append("") + + return all_lines if all_lines else [""] + class BoxAnnotator(BaseAnnotator): """ @@ -1169,7 +1277,7 @@ class LabelAnnotator(_BaseLabelAnnotator): color_lookup: ColorLookup = ColorLookup.CLASS, border_radius: int = 0, smart_position: bool = False, - ensure_in_frame: bool = False, # Inherited + max_line_length: Optional[int] = None, ): self.text_scale: float = text_scale self.text_thickness: int = text_thickness @@ -1181,7 +1289,7 @@ class LabelAnnotator(_BaseLabelAnnotator): color_lookup=color_lookup, border_radius=border_radius, smart_position=smart_position, - ensure_in_frame=ensure_in_frame, + max_line_length=max_line_length, ) @ensure_cv2_image_for_annotation @@ -1205,7 +1313,6 @@ class LabelAnnotator(_BaseLabelAnnotator): xyxy = spread_out_boxes(xyxy) label_properties[:, :4] = xyxy - if self.ensure_in_frame: label_properties = self._adjust_labels_in_frame( scene.shape[1], scene.shape[0], @@ -1238,15 +1345,29 @@ class LabelAnnotator(_BaseLabelAnnotator): ).astype(int) for label, center_coords in zip(labels, anchors_coordinates): - (text_w, text_h) = cv2.getTextSize( - text=label, - fontFace=CV2_FONT, - fontScale=self.text_scale, - thickness=self.text_thickness, - )[0] + wrapped_lines = self._wrap_text(label) + line_heights = [] + line_widths = [] - width_padded = text_w + 2 * self.text_padding - height_padded = text_h + 2 * self.text_padding + for line in wrapped_lines: + (text_w, text_h) = cv2.getTextSize( + text=line, + fontFace=CV2_FONT, + fontScale=self.text_scale, + thickness=self.text_thickness, + )[0] + line_heights.append(text_h) + line_widths.append(text_w) + + # Get the maximum width and total height + max_width = max(line_widths) if line_widths else 0 + total_height = ( + sum(line_heights) + (len(line_heights) - 1) * self.text_padding + ) + + # Add padding around all sides + width_padded = max_width + 2 * self.text_padding + height_padded = total_height + 2 * self.text_padding text_background_xyxy = resolve_text_background_xyxy( center_coordinates=tuple(center_coords), @@ -1254,12 +1375,10 @@ class LabelAnnotator(_BaseLabelAnnotator): position=self.text_anchor, ) - label_properties.append( - [ - *text_background_xyxy, - text_h, - ] - ) + label_properties.append([ + *text_background_xyxy, + total_height, + ]) return np.array(label_properties).reshape(-1, 5) def _draw_labels( @@ -1297,7 +1416,7 @@ class LabelAnnotator(_BaseLabelAnnotator): ) box_xyxy = label_property[:4].astype(int) - text_height_padded = label_property[4] + self.draw_rounded_rectangle( scene=scene, xyxy=box_xyxy, @@ -1305,18 +1424,43 @@ class LabelAnnotator(_BaseLabelAnnotator): border_radius=self.border_radius, ) - text_x = box_xyxy[0] + self.text_padding - text_y = box_xyxy[1] + self.text_padding + int(text_height_padded) - cv2.putText( - img=scene, - text=labels[idx], - org=(text_x, text_y), - fontFace=CV2_FONT, - fontScale=self.text_scale, - color=text_color.as_bgr(), - thickness=self.text_thickness, - lineType=cv2.LINE_AA, - ) + # Handle multiline text + wrapped_lines = self._wrap_text(labels[idx]) + current_y = box_xyxy[1] + self.text_padding # Start y position + + for line in wrapped_lines: + if not line: # Skip empty lines + (_, text_h) = cv2.getTextSize( + text="Tg", # Use a character with ascenders and descenders as height reference + fontFace=CV2_FONT, + fontScale=self.text_scale, + thickness=self.text_thickness, + )[0] + current_y += text_h + self.text_padding + continue + + (_, text_h) = cv2.getTextSize( + text=line, + fontFace=CV2_FONT, + fontScale=self.text_scale, + thickness=self.text_thickness, + )[0] + + text_x = box_xyxy[0] + self.text_padding + text_y = current_y + text_h # Add height to get to text baseline + + cv2.putText( + img=scene, + text=line, + org=(text_x, text_y), + fontFace=CV2_FONT, + fontScale=self.text_scale, + color=text_color.as_bgr(), + thickness=self.text_thickness, + lineType=cv2.LINE_AA, + ) + + current_y += text_h + self.text_padding # Move to next line position @staticmethod def draw_rounded_rectangle( @@ -1378,7 +1522,7 @@ class RichLabelAnnotator(_BaseLabelAnnotator): color_lookup: ColorLookup = ColorLookup.CLASS, border_radius: int = 0, smart_position: bool = False, - ensure_in_frame: bool = False, # Inherited + max_line_length: Optional[int] = None, ): self.font_path = font_path self.font_size = font_size @@ -1391,7 +1535,7 @@ class RichLabelAnnotator(_BaseLabelAnnotator): color_lookup=color_lookup, border_radius=border_radius, smart_position=smart_position, - ensure_in_frame=ensure_in_frame, + max_line_length=max_line_length, ) @ensure_pil_image_for_annotation @@ -1414,7 +1558,6 @@ class RichLabelAnnotator(_BaseLabelAnnotator): xyxy = spread_out_boxes(xyxy) label_properties[:, :4] = xyxy - if self.ensure_in_frame: label_properties = self._adjust_labels_in_frame( scene.width, scene.height, @@ -1446,13 +1589,26 @@ class RichLabelAnnotator(_BaseLabelAnnotator): ).astype(int) for label, center_coords in zip(labels, anchor_coordinates): - text_left, text_top, text_right, text_bottom = draw.textbbox( - (0, 0), label, font=self.font - ) - text_width = text_right - text_left - text_height = text_bottom - text_top - width_padded = int(text_width + 2 * self.text_padding) - height_padded = int(text_height + 2 * self.text_padding) + wrapped_lines = self._wrap_text(label) + + # Calculate the total text height and maximum width + max_width = 0 + total_height = 0 + + for line in wrapped_lines: + left, top, right, bottom = draw.textbbox((0, 0), line, font=self.font) + line_width = right - left + line_height = bottom - top + + max_width = max(max_width, line_width) + total_height += line_height + + # Add inter-line spacing + if len(wrapped_lines) > 1: + total_height += (len(wrapped_lines) - 1) * self.text_padding + + width_padded = int(max_width + 2 * self.text_padding) + height_padded = int(total_height + 2 * self.text_padding) text_background_xyxy = resolve_text_background_xyxy( center_coordinates=tuple(center_coords), @@ -1460,6 +1616,9 @@ class RichLabelAnnotator(_BaseLabelAnnotator): position=self.text_anchor, ) + # Get the text origin offsets + text_left, text_top, _, _ = draw.textbbox((0, 0), "Tg", font=self.font) + label_properties.append([*text_background_xyxy, text_left, text_top]) return np.array(label_properties).reshape(-1, 6) @@ -1500,21 +1659,32 @@ class RichLabelAnnotator(_BaseLabelAnnotator): box_xyxy = label_property[:4].astype(int) text_left = label_property[4] text_top = label_property[5] - label_x_position = box_xyxy[0] + self.text_padding - text_left - label_y_position = box_xyxy[1] + self.text_padding - text_top + # Draw the rounded rectangle background draw.rounded_rectangle( tuple(box_xyxy), radius=self.border_radius, fill=background_color.as_rgb(), outline=None, ) - draw.text( - xy=(label_x_position, label_y_position), - text=labels[idx], - font=self.font, - fill=text_color.as_rgb(), - ) + + # Draw each line of text + wrapped_lines = self._wrap_text(labels[idx]) + x_position = box_xyxy[0] + self.text_padding - text_left + y_position = box_xyxy[1] + self.text_padding - text_top + + for line in wrapped_lines: + draw.text( + xy=(x_position, y_position), + text=line, + font=self.font, + fill=text_color.as_rgb(), + ) + + # Move to the next line position + left, top, right, bottom = draw.textbbox((0, 0), line, font=self.font) + line_height = bottom - top + y_position += line_height + self.text_padding @staticmethod def _load_font(font_size: int, font_path: Optional[str]): @@ -1534,6 +1704,7 @@ class RichLabelAnnotator(_BaseLabelAnnotator): return load_default_font(font_size) + class IconAnnotator(BaseAnnotator): """ A class for drawing an icon on an image, using provided detections. diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 61d0c0cb..d2191c9f 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -1214,9 +1214,10 @@ def cross_product(anchors: np.ndarray, vector: Vector) -> np.ndarray: Returns: Array of cross products of shape (number of anchors, detections) """ - vector_at_zero = np.array( - [vector.end.x - vector.start.x, vector.end.y - vector.start.y] - ) + vector_at_zero = np.array([ + vector.end.x - vector.start.x, + vector.end.y - vector.start.y, + ]) vector_start = np.array([vector.start.x, vector.start.y]) return np.cross(vector_at_zero, anchors - vector_start) @@ -1224,6 +1225,8 @@ def cross_product(anchors: np.ndarray, vector: Vector) -> np.ndarray: def spread_out_boxes( xyxy: np.ndarray, max_iterations: int = 100, + force_scale: float = 10.0, + consider_size: bool = True, ) -> np.ndarray: """ Spread out boxes that overlap with each other. @@ -1231,29 +1234,50 @@ def spread_out_boxes( Args: xyxy: Numpy array of shape (N, 4) where N is the number of boxes. max_iterations: Maximum number of iterations to run the algorithm for. + force_scale: Scale factor for the repulsion forces. + consider_size: Whether to consider box size when calculating forces. """ if len(xyxy) == 0: return xyxy xyxy_padded = pad_boxes(xyxy, px=1) + + # Calculate box areas if we're considering size + if consider_size: + box_areas = (xyxy_padded[:, 2] - xyxy_padded[:, 0]) * ( + xyxy_padded[:, 3] - xyxy_padded[:, 1] + ) + # Calculate the size factors (normalize by mean size) + size_factors = ( + np.sqrt(box_areas) / np.mean(np.sqrt(box_areas)) + if len(box_areas) > 0 + else np.ones(len(xyxy_padded)) + ) + size_factors = np.clip(size_factors, 0.5, 2.0) # Clip to avoid extreme values + else: + size_factors = np.ones(len(xyxy_padded)) + for _ in range(max_iterations): - # NxN + # NxN matrix of IoU values iou = box_iou_batch(xyxy_padded, xyxy_padded) - np.fill_diagonal(iou, 0) + np.fill_diagonal(iou, 0) # Eliminate self-interactions + if np.all(iou == 0): - break + break # No more overlaps overlap_mask = iou > 0 - # Nx2 + # Nx2 array of box centers centers = (xyxy_padded[:, :2] + xyxy_padded[:, 2:]) / 2 - # NxNx2 + # NxNx2 array of differences between centers delta_centers = centers[:, np.newaxis, :] - centers[np.newaxis, :, :] delta_centers *= overlap_mask[:, :, np.newaxis] - # Nx2 + # Nx2 array of total delta vectors delta_sum = np.sum(delta_centers, axis=1) + + # Normalize to unit vectors delta_magnitude = np.linalg.norm(delta_sum, axis=1, keepdims=True) direction_vectors = np.divide( delta_sum, @@ -1262,15 +1286,32 @@ def spread_out_boxes( where=delta_magnitude != 0, ) + # Calculate force based on IoU values force_vectors = np.sum(iou, axis=1) force_vectors = force_vectors[:, np.newaxis] * direction_vectors - force_vectors *= 10 - force_vectors[(force_vectors > 0) & (force_vectors < 2)] = 2 - force_vectors[(force_vectors < 0) & (force_vectors > -2)] = -2 + # Apply size-based scaling if enabled + if consider_size: + force_vectors *= size_factors[:, np.newaxis] + # Scale forces + force_vectors *= force_scale + + # Ensure minimum force for small overlaps + force_magnitudes = np.linalg.norm(force_vectors, axis=1, keepdims=True) + small_force_mask = (force_magnitudes > 0) & (force_magnitudes < 2) + if np.any(small_force_mask): + force_directions = force_vectors / np.where( + force_magnitudes > 0, force_magnitudes, 1 + ) + force_vectors = np.where( + small_force_mask, force_directions * 2, force_vectors + ) + + # Convert to integer displacements force_vectors = force_vectors.astype(int) + # Apply forces to update box positions xyxy_padded[:, [0, 1]] += force_vectors xyxy_padded[:, [2, 3]] += force_vectors From c68218a07ef3c97c73bd12843af9ef9ebb6025b1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 00:48:21 +0000 Subject: [PATCH 011/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 11 ++++++----- supervision/detection/utils.py | 10 ++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 254c55e0..b78b3b17 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1375,10 +1375,12 @@ class LabelAnnotator(_BaseLabelAnnotator): position=self.text_anchor, ) - label_properties.append([ - *text_background_xyxy, - total_height, - ]) + label_properties.append( + [ + *text_background_xyxy, + total_height, + ] + ) return np.array(label_properties).reshape(-1, 5) def _draw_labels( @@ -1704,7 +1706,6 @@ class RichLabelAnnotator(_BaseLabelAnnotator): return load_default_font(font_size) - class IconAnnotator(BaseAnnotator): """ A class for drawing an icon on an image, using provided detections. diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index d2191c9f..40275831 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -1214,10 +1214,12 @@ def cross_product(anchors: np.ndarray, vector: Vector) -> np.ndarray: Returns: Array of cross products of shape (number of anchors, detections) """ - vector_at_zero = np.array([ - vector.end.x - vector.start.x, - vector.end.y - vector.start.y, - ]) + vector_at_zero = np.array( + [ + vector.end.x - vector.start.x, + vector.end.y - vector.start.y, + ] + ) vector_start = np.array([vector.start.x, vector.start.y]) return np.cross(vector_at_zero, anchors - vector_start) From 5c35af99d00f29a6cef05e705251c525ea771190 Mon Sep 17 00:00:00 2001 From: hidara2000 Date: Thu, 17 Apr 2025 11:02:25 +1000 Subject: [PATCH 012/110] fix long comment lines --- supervision/annotators/core.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index b78b3b17..85269821 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -326,9 +326,9 @@ class _BaseLabelAnnotator(BaseAnnotator): wrapped = textwrap.wrap( paragraph, width=self.max_line_length, - break_long_words=True, # Break words longer than max_line_length - replace_whitespace=False, # Preserve existing spaces - drop_whitespace=True, # Drop leading/trailing whitespace on wrapped lines + break_long_words=True, + replace_whitespace=False, + drop_whitespace=True, ) # Add the wrapped lines for this paragraph @@ -1375,12 +1375,10 @@ class LabelAnnotator(_BaseLabelAnnotator): position=self.text_anchor, ) - label_properties.append( - [ - *text_background_xyxy, - total_height, - ] - ) + label_properties.append([ + *text_background_xyxy, + total_height, + ]) return np.array(label_properties).reshape(-1, 5) def _draw_labels( @@ -1431,9 +1429,10 @@ class LabelAnnotator(_BaseLabelAnnotator): current_y = box_xyxy[1] + self.text_padding # Start y position for line in wrapped_lines: - if not line: # Skip empty lines + if not line: + # Use a character with ascenders and descenders as height reference (_, text_h) = cv2.getTextSize( - text="Tg", # Use a character with ascenders and descenders as height reference + text="Tg", fontFace=CV2_FONT, fontScale=self.text_scale, thickness=self.text_thickness, From 95a2ecc49b3a3a229dc8d25edb075d6772d14de4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 01:02:42 +0000 Subject: [PATCH 013/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 85269821..1fd85a71 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1375,10 +1375,12 @@ class LabelAnnotator(_BaseLabelAnnotator): position=self.text_anchor, ) - label_properties.append([ - *text_background_xyxy, - total_height, - ]) + label_properties.append( + [ + *text_background_xyxy, + total_height, + ] + ) return np.array(label_properties).reshape(-1, 5) def _draw_labels( From 29695055d298ff2be67c657040c1aefd7111d7be Mon Sep 17 00:00:00 2001 From: hidara2000 Date: Fri, 25 Apr 2025 09:32:54 +1000 Subject: [PATCH 014/110] refactor(annotators): streamline label handling and improve box snapping logic --- supervision/annotators/core.py | 280 +++++--------------------------- supervision/annotators/utils.py | 181 ++++++++++++++++++++- supervision/detection/utils.py | 68 ++------ 3 files changed, 228 insertions(+), 301 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 882b50ca..5190fa21 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1,6 +1,6 @@ from functools import lru_cache from math import sqrt -from typing import Callable, List, Optional, Tuple, Union +from typing import List, Optional, Tuple, Union import cv2 import numpy as np @@ -11,10 +11,14 @@ from supervision.annotators.base import BaseAnnotator, ImageType from supervision.annotators.utils import ( ColorLookup, Trace, + get_labels_text, resolve_color, resolve_text_background_xyxy, + snap_boxes, + validate_labels, + wrap_text, ) -from supervision.config import CLASS_NAME_DATA_FIELD, ORIENTED_BOX_COORDINATES +from supervision.config import ORIENTED_BOX_COORDINATES from supervision.detection.core import Detections from supervision.detection.utils import ( clip_boxes, @@ -74,23 +78,21 @@ class _BaseLabelAnnotator(BaseAnnotator): Args: color (Union[Color, ColorPalette], optional): The color to use for the label - background. Defaults to ColorPalette.DEFAULT. + background. text_color (Union[Color, ColorPalette], optional): The color to use for the - label text. Defaults to Color.WHITE. + label text. text_padding (int, optional): The padding around the label text, in pixels. - Defaults to 10. text_position (Position, optional): The position of the text relative to the - detection bounding box. Defaults to Position.TOP_LEFT. + detection bounding box. color_lookup (ColorLookup, optional): The method used to determine the color - of the label. Defaults to ColorLookup.CLASS. + of the label border_radius (int, optional): The radius of the label background corners, - in pixels. Defaults to 0. + in pixels. smart_position (bool, optional): Whether to intelligently adjust the label position to avoid overlapping with other elements. - Defaults to False. max_line_length (Optional[int], optional): Maximum number of characters per line before wrapping the text. None means no wrapping. - Defaults to None. + """ self.color: Union[Color, ColorPalette] = color self.text_color: Union[Color, ColorPalette] = text_color @@ -101,137 +103,21 @@ class _BaseLabelAnnotator(BaseAnnotator): self.smart_position = smart_position self.max_line_length: Optional[int] = max_line_length - def _validate_labels(self, labels: Optional[List[str]], detections: Detections): - """ - Validates that the number of provided labels matches the number of detections. - - Args: - labels (Optional[List[str]]): A list of labels, one for each detection. Can - be None. - detections (Detections): The detections to be labeled. - - Raises: - ValueError: If `labels` is not None and its length does not match the number - of detections. - """ - if labels is not None and len(labels) != len(detections): - raise ValueError( - f"The number of labels ({len(labels)}) does not match the " - f"number of detections ({len(detections)}). Each detection " - f"should have exactly 1 label." - ) - - @staticmethod - def _get_labels_text( - detections: Detections, custom_labels: Optional[List[str]] - ) -> List[str]: - """ - Retrieves the text labels for the detections. - - If `custom_labels` are provided, they are used. Otherwise, the labels are - extracted from the `detections` object, prioritizing the 'class_name' field, - then the `class_id`, and finally using the detection index as a string. - - Args: - detections (Detections): The detections to get labels for. - custom_labels (Optional[List[str]]): An optional list of custom labels. - - Returns: - List[str]: A list of text labels for each detection. - """ - if custom_labels is not None: - return [str(label) for label in custom_labels] - - labels = [] - for idx in range(len(detections)): - if CLASS_NAME_DATA_FIELD in detections.data: - labels.append(detections.data[CLASS_NAME_DATA_FIELD][idx]) - elif detections.class_id is not None: - labels.append(str(detections.class_id[idx])) - else: - labels.append(str(idx)) - return labels - - def _ensure_box_in_frame( - self, - box: np.ndarray, - frame_width: int, - frame_height: int, - check_flip_label: bool = False, - text_anchor: Optional[Position] = None, - ) -> np.ndarray: - """ - Adjusts a box to ensure it stays within frame boundaries. - - Args: - box: Box coordinates [x1, y1, x2, y2] - frame_width: Width of the frame - frame_height: Height of the frame - check_flip_label: Whether to check if label should be flipped - text_anchor: Text anchor position for flip check - - Returns: - Adjusted box coordinates - """ - x1, y1, x2, y2 = box - - # Adjust x-coordinate to stay within frame - if x1 < 0: - shift = -x1 - x1 += shift - x2 += shift - elif x2 > frame_width: - shift = frame_width - x2 - x1 += shift - x2 += shift - - # Adjust y-coordinate to stay within frame - if y1 < 0: - shift = -y1 - y1 += shift - y2 += shift - elif y2 > frame_height: - shift = frame_height - y2 - y1 += shift - y2 += shift - - # Check if label should be flipped to above the box - if check_flip_label and text_anchor is not None: - box_height = y2 - y1 - - # Check anchor position to see if we can flip it - anchor_y = self._get_anchor_y_for_adjustment( - np.array([y1, y2]), text_anchor - ) - - # If we're at the bottom, try moving to the top - if anchor_y >= y2 - 5: # Near bottom edge - # Check if there's room at the top - if y1 - box_height >= 0: - y2 = y1 - y1 = y2 - box_height - - return np.array([x1, y1, x2, y2]) - def _adjust_labels_in_frame( self, - frame_width: int, - frame_height: int, + resolution_wh: Tuple[int, int], labels: List[str], label_properties: np.ndarray, - get_text_width_fn: Callable[[str], int], ) -> np.ndarray: """ Adjusts the position of labels to ensure they stay within the frame boundaries. Args: frame_width (int): The width of the frame. - frame_height (int): The height of the frame. + resolution_wh (int, int): The width and height of the frame. labels (List[str]): The list of text labels. label_properties (np.ndarray): An array of label properties, where each row contains [x1, y1, x2, y2, text_height, ...]. - get_text_width_fn (Callable[[str], int]): A function that takes a label - string and returns its width in pixels. Returns: np.ndarray: The adjusted label properties. @@ -239,15 +125,10 @@ class _BaseLabelAnnotator(BaseAnnotator): adjusted_properties = label_properties.copy() # First, make sure the boxes don't go outside the frame - for i in range(len(labels)): - # Adjust box to stay within frame - adjusted_properties[i, :4] = self._ensure_box_in_frame( - adjusted_properties[i, :4], - frame_width, - frame_height, - check_flip_label=True, - text_anchor=self.text_anchor, - ) + adjusted_properties[:, :4] = snap_boxes( + adjusted_properties[:, :4], + resolution_wh, + ) # Apply the spread out algorithm to avoid box overlaps if len(labels) > 1: @@ -259,86 +140,11 @@ class _BaseLabelAnnotator(BaseAnnotator): adjusted_properties[:, :4] = spread_boxes # Additional check to ensure boxes are still within frame after spreading - for i in range(len(labels)): - # Adjust box to stay within frame (without flipping) - adjusted_properties[i, :4] = self._ensure_box_in_frame( - adjusted_properties[i, :4], frame_width, frame_height - ) - - return adjusted_properties - - @staticmethod - def _get_anchor_y_for_adjustment(bbox_y: np.ndarray, anchor: Position) -> float: - """ - Calculates the anchor y-coordinate for label adjustment based on the text anchor - position. - - Args: - bbox_y (np.ndarray): An array containing the y1 and y2 coordinates of the - bounding box. - anchor (Position): The desired text anchor position. - - Returns: - float: The anchor y-coordinate. - """ - y1, y2 = bbox_y - if anchor in [Position.TOP_LEFT, Position.TOP_CENTER, Position.TOP_RIGHT]: - return y1 - elif anchor in [ - Position.BOTTOM_LEFT, - Position.BOTTOM_CENTER, - Position.BOTTOM_RIGHT, - ]: - return y2 - else: # CENTER, CENTER_LEFT, CENTER_RIGHT - return (y1 + y2) / 2 - - def _wrap_text(self, text: str) -> List[str]: - """ - Wraps text to the specified maximum line length, respecting existing newlines. - Uses the textwrap library for robust text wrapping. - - Args: - text (str): The text to wrap. - - Returns: - List[str]: A list of text lines after wrapping. - """ - import textwrap - - if not text: - return [""] - - if self.max_line_length is None: - return text.splitlines() or [""] - - # Split the text by existing newlines first - paragraphs = text.split("\n") - all_lines = [] - - for paragraph in paragraphs: - if not paragraph: - # Keep empty lines - all_lines.append("") - continue - - # Wrap each paragraph separately - wrapped = textwrap.wrap( - paragraph, - width=self.max_line_length, - break_long_words=True, - replace_whitespace=False, - drop_whitespace=True, + adjusted_properties[:, :4] = snap_boxes( + adjusted_properties[:, :4], resolution_wh ) - # Add the wrapped lines for this paragraph - if wrapped: - all_lines.extend(wrapped) - else: - # If wrap returns an empty list (e.g., for whitespace-only input) - all_lines.append("") - - return all_lines if all_lines else [""] + return adjusted_properties class BoxAnnotator(BaseAnnotator): @@ -1301,12 +1107,12 @@ class LabelAnnotator(_BaseLabelAnnotator): custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: assert isinstance(scene, np.ndarray) - self._validate_labels(labels, detections) + validate_labels(labels, detections) - labels = self._get_labels_text(detections, labels) + labels = get_labels_text(detections, labels) label_properties = self._get_label_properties( - scene, detections, labels - ) # Pass scene + detections, labels + ) if self.smart_position: xyxy = label_properties[:, :4] @@ -1314,13 +1120,9 @@ class LabelAnnotator(_BaseLabelAnnotator): label_properties[:, :4] = xyxy label_properties = self._adjust_labels_in_frame( - scene.shape[1], - scene.shape[0], + (scene.shape[1], scene.shape[0]), labels, label_properties, - lambda text: cv2.getTextSize( - text, CV2_FONT, self.text_scale, self.text_thickness - )[0][0], ) self._draw_labels( @@ -1335,7 +1137,6 @@ class LabelAnnotator(_BaseLabelAnnotator): def _get_label_properties( self, - scene: np.ndarray, # Receive scene detections: Detections, labels: List[str], ) -> np.ndarray: @@ -1345,7 +1146,7 @@ class LabelAnnotator(_BaseLabelAnnotator): ).astype(int) for label, center_coords in zip(labels, anchors_coordinates): - wrapped_lines = self._wrap_text(label) + wrapped_lines = wrap_text(label, self.max_line_length) line_heights = [] line_widths = [] @@ -1375,12 +1176,10 @@ class LabelAnnotator(_BaseLabelAnnotator): position=self.text_anchor, ) - label_properties.append( - [ - *text_background_xyxy, - total_height, - ] - ) + label_properties.append([ + *text_background_xyxy, + total_height, + ]) return np.array(label_properties).reshape(-1, 5) def _draw_labels( @@ -1427,7 +1226,7 @@ class LabelAnnotator(_BaseLabelAnnotator): ) # Handle multiline text - wrapped_lines = self._wrap_text(labels[idx]) + wrapped_lines = wrap_text(labels[idx], self.max_line_length) current_y = box_xyxy[1] + self.text_padding # Start y position for line in wrapped_lines: @@ -1550,10 +1349,10 @@ class RichLabelAnnotator(_BaseLabelAnnotator): custom_color_lookup: Optional[np.ndarray] = None, ) -> ImageType: assert isinstance(scene, Image.Image) - self._validate_labels(labels, detections) + validate_labels(labels, detections) draw = ImageDraw.Draw(scene) - labels = self._get_labels_text(detections, labels) + labels = get_labels_text(detections, labels) label_properties = self._get_label_properties(draw, detections, labels) if self.smart_position: @@ -1562,14 +1361,9 @@ class RichLabelAnnotator(_BaseLabelAnnotator): label_properties[:, :4] = xyxy label_properties = self._adjust_labels_in_frame( - scene.width, - scene.height, + (scene.width, scene.height), labels, label_properties, - lambda text: int( - draw.textbbox((0, 0), text, font=self.font)[2] - - draw.textbbox((0, 0), text, font=self.font)[0] - ), ) self._draw_labels( @@ -1592,7 +1386,7 @@ class RichLabelAnnotator(_BaseLabelAnnotator): ).astype(int) for label, center_coords in zip(labels, anchor_coordinates): - wrapped_lines = self._wrap_text(label) + wrapped_lines = wrap_text(label, self.max_line_length) # Calculate the total text height and maximum width max_width = 0 @@ -1672,7 +1466,7 @@ class RichLabelAnnotator(_BaseLabelAnnotator): ) # Draw each line of text - wrapped_lines = self._wrap_text(labels[idx]) + wrapped_lines = wrap_text(labels[idx], self.max_line_length) x_position = box_xyxy[0] + self.text_padding - text_left y_position = box_xyxy[1] + self.text_padding - text_top diff --git a/supervision/annotators/utils.py b/supervision/annotators/utils.py index ae4f8cdc..48ee1ecb 100644 --- a/supervision/annotators/utils.py +++ b/supervision/annotators/utils.py @@ -1,8 +1,10 @@ +import textwrap from enum import Enum from typing import Optional, Tuple, Union import numpy as np +from supervision.config import CLASS_NAME_DATA_FIELD from supervision.detection.core import Detections from supervision.draw.color import Color, ColorPalette from supervision.geometry.core import Position @@ -139,6 +141,178 @@ def resolve_color( return get_color_by_index(color=color, idx=idx) +def wrap_text(text: str, max_line_length=None) -> list[str]: + """ + Wraps text to the specified maximum line length, respecting existing newlines. + Uses the textwrap library for robust text wrapping. + + Args: + text (str): The text to wrap. + + Returns: + List[str]: A list of text lines after wrapping. + """ + + if not text: + return [""] + + if max_line_length is None: + return text.splitlines() or [""] + + paragraphs = text.split("\n") + all_lines = [] + + for paragraph in paragraphs: + if not paragraph: + # Keep empty lines + all_lines.append("") + continue + + wrapped = textwrap.wrap( + paragraph, + width=max_line_length, + break_long_words=True, + replace_whitespace=False, + drop_whitespace=True, + ) + + if wrapped: + all_lines.extend(wrapped) + else: + all_lines.append("") + + return all_lines if all_lines else [""] + + +def validate_labels(labels: Optional[list[str]], detections: Detections): + """ + Validates that the number of provided labels matches the number of detections. + + Args: + labels (Optional[List[str]]): A list of labels, one for each detection. Can + be None. + detections (Detections): The detections to be labeled. + + Raises: + ValueError: If `labels` is not None and its length does not match the number + of detections. + """ + if labels is not None and len(labels) != len(detections): + raise ValueError( + f"The number of labels ({len(labels)}) does not match the " + f"number of detections ({len(detections)}). Each detection " + f"should have exactly 1 label." + ) + + +def get_labels_text( + detections: Detections, custom_labels: Optional[list[str]] +) -> list[str]: + """ + Retrieves the text labels for the detections. + + If `custom_labels` are provided, they are used. Otherwise, the labels are + extracted from the `detections` object, prioritizing the 'class_name' field, + then the `class_id`, and finally using the detection index as a string. + + Args: + detections (Detections): The detections to get labels for. + custom_labels (Optional[List[str]]): An optional list of custom labels. + + Returns: + List[str]: A list of text labels for each detection. + """ + if custom_labels is not None: + return custom_labels + + labels = [] + for idx in range(len(detections)): + if CLASS_NAME_DATA_FIELD in detections.data: + labels.append(detections.data[CLASS_NAME_DATA_FIELD][idx]) + elif detections.class_id is not None: + labels.append(str(detections.class_id[idx])) + else: + labels.append(str(idx)) + return labels + + +def snap_boxes(xyxy: np.ndarray, resolution_wh: Tuple[int, int]) -> np.ndarray: + """ + Shifts bounding boxes into the frame so that they are fully contained + within the given resolution, prioritizing the top/left edge. + Unlike `clip_boxes`, this function does not crop boxes. + It moves them entirely if they exceed the frame boundaries. + + Args: + xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each + row corresponds to a bounding box in the format + `(x_min, y_min, x_max, y_max)`. + resolution_wh (Tuple[int, int]): A tuple `(width, height)` + representing the resolution of the frame. + + Returns: + np.ndarray: A numpy array of shape `(N, 4)` with boxes shifted into frame. + + Examples: + ```python + import numpy as np + # Assuming this function is part of a library like supervision (sv) + # import supervision as sv # or just use the function directly + + xyxy = np.array([ + [-10, 10, 30, 50], # Off left + [310, 200, 350, 250], # Off right + [100, -20, 150, 30], # Off top + [200, 220, 250, 270], # Off bottom + [-20, 10, 350, 50], # Wider than frame, (width = 370 vs 320) + [10, -20, 30, 260] # Taller than frame, (height = 280 vs 240) + ]) + + resolution_wh = (320, 240) + + # Expected output for the new cases: + # [-20, 10, 350, 50] (wider) -> shifted right by -(-20) = 20 -> [0, 10, 370, 50] + # [10, -20, 30, 260] (taller) -> shifted down by -(-20) = 20 -> [10, 0, 30, 280] + # Note: Oversized boxes still won't be fully contained without cropping + # but this logic ensures the primary (top/left) boundary is corrected. + + snapped_boxes = snap_boxes(xyxy=xyxy, resolution_wh=resolution_wh) + print(snapped_boxes) + # Expected output (including original examples and new ones): + # [[ 0 10 40 50] # Original example 1 snapped + # [280 200 320 250] # Original example 2 snapped + # [100 0 150 50] # Original example 3 snapped + # [200 190 250 240] # Original example 4 snapped + # [ 0 10 370 50] # New example (wider) snapped by left edge priority + # [ 10 0 30 280]] # New example (taller) snapped by top edge priority + ``` + """ + result = np.copy(xyxy) + width, height = resolution_wh + + shift_if_left_out = -result[:, 0] + shift_if_right_out = width - result[:, 2] + + shift_x = np.where(result[:, 0] < 0, shift_if_left_out, + np.where(result[:, 2] > width, shift_if_right_out, 0)) + + result[:, 0] += shift_x + result[:, 2] += shift_x + + + shift_if_top_out = -result[:, 1] + shift_if_bottom_out = height - result[:, 3] + + shift_y = np.where(result[:, 1] < 0, shift_if_top_out, + np.where(result[:, 3] > height, shift_if_bottom_out, 0)) + + + result[:, 1] += shift_y + result[:, 3] += shift_y + + return result + + class Trace: def __init__( self, @@ -157,9 +331,10 @@ class Trace: def put(self, detections: Detections) -> None: frame_id = np.full(len(detections), self.current_frame_id, dtype=int) self.frame_id = np.concatenate([self.frame_id, frame_id]) - self.xy = np.concatenate( - [self.xy, detections.get_anchors_coordinates(self.anchor)] - ) + self.xy = np.concatenate([ + self.xy, + detections.get_anchors_coordinates(self.anchor), + ]) self.tracker_id = np.concatenate([self.tracker_id, detections.tracker_id]) unique_frame_id = np.unique(self.frame_id) diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 3df4fad2..8949537e 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -1264,12 +1264,10 @@ def cross_product(anchors: np.ndarray, vector: Vector) -> np.ndarray: Returns: Array of cross products of shape (number of anchors, detections) """ - vector_at_zero = np.array( - [ - vector.end.x - vector.start.x, - vector.end.y - vector.start.y, - ] - ) + vector_at_zero = np.array([ + vector.end.x - vector.start.x, + vector.end.y - vector.start.y, + ]) vector_start = np.array([vector.start.x, vector.start.y]) return np.cross(vector_at_zero, anchors - vector_start) @@ -1277,8 +1275,6 @@ def cross_product(anchors: np.ndarray, vector: Vector) -> np.ndarray: def spread_out_boxes( xyxy: np.ndarray, max_iterations: int = 100, - force_scale: float = 10.0, - consider_size: bool = True, ) -> np.ndarray: """ Spread out boxes that overlap with each other. @@ -1286,50 +1282,29 @@ def spread_out_boxes( Args: xyxy: Numpy array of shape (N, 4) where N is the number of boxes. max_iterations: Maximum number of iterations to run the algorithm for. - force_scale: Scale factor for the repulsion forces. - consider_size: Whether to consider box size when calculating forces. """ if len(xyxy) == 0: return xyxy xyxy_padded = pad_boxes(xyxy, px=1) - - # Calculate box areas if we're considering size - if consider_size: - box_areas = (xyxy_padded[:, 2] - xyxy_padded[:, 0]) * ( - xyxy_padded[:, 3] - xyxy_padded[:, 1] - ) - # Calculate the size factors (normalize by mean size) - size_factors = ( - np.sqrt(box_areas) / np.mean(np.sqrt(box_areas)) - if len(box_areas) > 0 - else np.ones(len(xyxy_padded)) - ) - size_factors = np.clip(size_factors, 0.5, 2.0) # Clip to avoid extreme values - else: - size_factors = np.ones(len(xyxy_padded)) - for _ in range(max_iterations): - # NxN matrix of IoU values + # NxN iou = box_iou_batch(xyxy_padded, xyxy_padded) - np.fill_diagonal(iou, 0) # Eliminate self-interactions - + np.fill_diagonal(iou, 0) if np.all(iou == 0): - break # No more overlaps + break overlap_mask = iou > 0 - # Nx2 array of box centers + # Nx2 centers = (xyxy_padded[:, :2] + xyxy_padded[:, 2:]) / 2 - # NxNx2 array of differences between centers + # NxNx2 delta_centers = centers[:, np.newaxis, :] - centers[np.newaxis, :, :] delta_centers *= overlap_mask[:, :, np.newaxis] - # Nx2 array of total delta vectors + # Nx2 delta_sum = np.sum(delta_centers, axis=1) - - # Normalize to unit vectors delta_magnitude = np.linalg.norm(delta_sum, axis=1, keepdims=True) direction_vectors = np.divide( delta_sum, @@ -1338,32 +1313,15 @@ def spread_out_boxes( where=delta_magnitude != 0, ) - # Calculate force based on IoU values force_vectors = np.sum(iou, axis=1) force_vectors = force_vectors[:, np.newaxis] * direction_vectors - # Apply size-based scaling if enabled - if consider_size: - force_vectors *= size_factors[:, np.newaxis] + force_vectors *= 10 + force_vectors[(force_vectors > 0) & (force_vectors < 2)] = 2 + force_vectors[(force_vectors < 0) & (force_vectors > -2)] = -2 - # Scale forces - force_vectors *= force_scale - - # Ensure minimum force for small overlaps - force_magnitudes = np.linalg.norm(force_vectors, axis=1, keepdims=True) - small_force_mask = (force_magnitudes > 0) & (force_magnitudes < 2) - if np.any(small_force_mask): - force_directions = force_vectors / np.where( - force_magnitudes > 0, force_magnitudes, 1 - ) - force_vectors = np.where( - small_force_mask, force_directions * 2, force_vectors - ) - - # Convert to integer displacements force_vectors = force_vectors.astype(int) - # Apply forces to update box positions xyxy_padded[:, [0, 1]] += force_vectors xyxy_padded[:, [2, 3]] += force_vectors From a6aa9b7d3be8099c158a95a7a9324412d86ef059 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 23:33:11 +0000 Subject: [PATCH 015/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 14 +++++++------- supervision/annotators/utils.py | 26 ++++++++++++++++---------- supervision/detection/utils.py | 10 ++++++---- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 5190fa21..f10491ff 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1110,9 +1110,7 @@ class LabelAnnotator(_BaseLabelAnnotator): validate_labels(labels, detections) labels = get_labels_text(detections, labels) - label_properties = self._get_label_properties( - detections, labels - ) + label_properties = self._get_label_properties(detections, labels) if self.smart_position: xyxy = label_properties[:, :4] @@ -1176,10 +1174,12 @@ class LabelAnnotator(_BaseLabelAnnotator): position=self.text_anchor, ) - label_properties.append([ - *text_background_xyxy, - total_height, - ]) + label_properties.append( + [ + *text_background_xyxy, + total_height, + ] + ) return np.array(label_properties).reshape(-1, 5) def _draw_labels( diff --git a/supervision/annotators/utils.py b/supervision/annotators/utils.py index 48ee1ecb..8406bb5d 100644 --- a/supervision/annotators/utils.py +++ b/supervision/annotators/utils.py @@ -293,19 +293,23 @@ def snap_boxes(xyxy: np.ndarray, resolution_wh: Tuple[int, int]) -> np.ndarray: shift_if_left_out = -result[:, 0] shift_if_right_out = width - result[:, 2] - shift_x = np.where(result[:, 0] < 0, shift_if_left_out, - np.where(result[:, 2] > width, shift_if_right_out, 0)) + shift_x = np.where( + result[:, 0] < 0, + shift_if_left_out, + np.where(result[:, 2] > width, shift_if_right_out, 0), + ) result[:, 0] += shift_x result[:, 2] += shift_x - shift_if_top_out = -result[:, 1] shift_if_bottom_out = height - result[:, 3] - shift_y = np.where(result[:, 1] < 0, shift_if_top_out, - np.where(result[:, 3] > height, shift_if_bottom_out, 0)) - + shift_y = np.where( + result[:, 1] < 0, + shift_if_top_out, + np.where(result[:, 3] > height, shift_if_bottom_out, 0), + ) result[:, 1] += shift_y result[:, 3] += shift_y @@ -331,10 +335,12 @@ class Trace: def put(self, detections: Detections) -> None: frame_id = np.full(len(detections), self.current_frame_id, dtype=int) self.frame_id = np.concatenate([self.frame_id, frame_id]) - self.xy = np.concatenate([ - self.xy, - detections.get_anchors_coordinates(self.anchor), - ]) + self.xy = np.concatenate( + [ + self.xy, + detections.get_anchors_coordinates(self.anchor), + ] + ) self.tracker_id = np.concatenate([self.tracker_id, detections.tracker_id]) unique_frame_id = np.unique(self.frame_id) diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 8949537e..8f1019e9 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -1264,10 +1264,12 @@ def cross_product(anchors: np.ndarray, vector: Vector) -> np.ndarray: Returns: Array of cross products of shape (number of anchors, detections) """ - vector_at_zero = np.array([ - vector.end.x - vector.start.x, - vector.end.y - vector.start.y, - ]) + vector_at_zero = np.array( + [ + vector.end.x - vector.start.x, + vector.end.y - vector.start.y, + ] + ) vector_start = np.array([vector.start.x, vector.start.y]) return np.cross(vector_at_zero, anchors - vector_start) From 0c2aae6bd2721f473fe2ae34a3ba02c456aba1d6 Mon Sep 17 00:00:00 2001 From: hidara2000 Date: Fri, 25 Apr 2025 09:48:47 +1000 Subject: [PATCH 016/110] refactor(snap_boxes): enhance docstring and improve bounding box shifting logic --- supervision/annotators/utils.py | 84 +++++++++++++-------------------- 1 file changed, 34 insertions(+), 50 deletions(-) diff --git a/supervision/annotators/utils.py b/supervision/annotators/utils.py index 8406bb5d..37967520 100644 --- a/supervision/annotators/utils.py +++ b/supervision/annotators/utils.py @@ -238,7 +238,7 @@ def get_labels_text( def snap_boxes(xyxy: np.ndarray, resolution_wh: Tuple[int, int]) -> np.ndarray: """ - Shifts bounding boxes into the frame so that they are fully contained + Shifts `label` bounding boxes into the frame so that they are fully contained within the given resolution, prioritizing the top/left edge. Unlike `clip_boxes`, this function does not crop boxes. It moves them entirely if they exceed the frame boundaries. @@ -254,65 +254,49 @@ def snap_boxes(xyxy: np.ndarray, resolution_wh: Tuple[int, int]) -> np.ndarray: np.ndarray: A numpy array of shape `(N, 4)` with boxes shifted into frame. Examples: - ```python - import numpy as np - # Assuming this function is part of a library like supervision (sv) - # import supervision as sv # or just use the function directly + ```python + import numpy as np - xyxy = np.array([ - [-10, 10, 30, 50], # Off left - [310, 200, 350, 250], # Off right - [100, -20, 150, 30], # Off top - [200, 220, 250, 270], # Off bottom - [-20, 10, 350, 50], # Wider than frame, (width = 370 vs 320) - [10, -20, 30, 260] # Taller than frame, (height = 280 vs 240) - ]) + # Example boxes: + xyxy = np.array([ + [-10, 10, 30, 50], # Off left edge + [310, 200, 350, 250], # Off right edge + [100, -20, 150, 30], # Off top edge + [200, 220, 250, 270], # Off bottom edge + [-20, 10, 350, 50], # Wider than frame (370 vs 320) + [10, -20, 30, 260] # Taller than frame (280 vs 240) + ]) - resolution_wh = (320, 240) + resolution_wh = (320, 240) + snapped_boxes = snap_boxes(xyxy=xyxy, resolution_wh=resolution_wh) - # Expected output for the new cases: - # [-20, 10, 350, 50] (wider) -> shifted right by -(-20) = 20 -> [0, 10, 370, 50] - # [10, -20, 30, 260] (taller) -> shifted down by -(-20) = 20 -> [10, 0, 30, 280] - # Note: Oversized boxes still won't be fully contained without cropping - # but this logic ensures the primary (top/left) boundary is corrected. - - snapped_boxes = snap_boxes(xyxy=xyxy, resolution_wh=resolution_wh) - print(snapped_boxes) - # Expected output (including original examples and new ones): - # [[ 0 10 40 50] # Original example 1 snapped - # [280 200 320 250] # Original example 2 snapped - # [100 0 150 50] # Original example 3 snapped - # [200 190 250 240] # Original example 4 snapped - # [ 0 10 370 50] # New example (wider) snapped by left edge priority - # [ 10 0 30 280]] # New example (taller) snapped by top edge priority - ``` + # Results: + # [[ 0 10 40 50] # Left edge shifted right + # [280 200 320 250] # Right edge shifted left + # [100 0 150 50] # Top edge shifted down + # [200 190 250 240] # Bottom edge shifted up + # [ 0 10 370 50] # Wide box aligned to left edge + # [ 10 0 30 280]] # Tall box aligned to top edge + ``` """ result = np.copy(xyxy) width, height = resolution_wh - shift_if_left_out = -result[:, 0] - shift_if_right_out = width - result[:, 2] + # X-axis (prioritize left edge) + left_overflow = result[:, 0] < 0 + result[left_overflow, 0:3:2] -= result[left_overflow, 0:1] - shift_x = np.where( - result[:, 0] < 0, - shift_if_left_out, - np.where(result[:, 2] > width, shift_if_right_out, 0), - ) + right_overflow = (~left_overflow) & (result[:, 2] > width) + right_shift = width - result[right_overflow, 2] + result[right_overflow, 0:3:2] += right_shift[:, np.newaxis] - result[:, 0] += shift_x - result[:, 2] += shift_x + # Y-axis (prioritize top edge) + top_overflow = result[:, 1] < 0 + result[top_overflow, 1:4:2] -= result[top_overflow, 1:2] - shift_if_top_out = -result[:, 1] - shift_if_bottom_out = height - result[:, 3] - - shift_y = np.where( - result[:, 1] < 0, - shift_if_top_out, - np.where(result[:, 3] > height, shift_if_bottom_out, 0), - ) - - result[:, 1] += shift_y - result[:, 3] += shift_y + bottom_overflow = (~top_overflow) & (result[:, 3] > height) + bottom_shift = height - result[bottom_overflow, 3] + result[bottom_overflow, 1:4:2] += bottom_shift[:, np.newaxis] return result From 646ac83bef70ee04a8161eacf0cfe686aba89027 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 25 Jun 2025 01:04:54 +0000 Subject: [PATCH 017/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/overlap_filter.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index f59926a4..dbe1159a 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -256,8 +256,7 @@ def mask_non_max_merge( for merge_group in merge_groups: if len(merge_group) == 0: raise ValueError( - f"Empty group detected when non-max-merging " - f"detections: {merge_groups}" + f"Empty group detected when non-max-merging detections: {merge_groups}" ) return merge_groups From d0028581696010e6b85c89592745b5ad5f21ce88 Mon Sep 17 00:00:00 2001 From: AI-Hao <2865467769@qq.com> Date: Wed, 25 Jun 2025 10:56:50 +0800 Subject: [PATCH 018/110] =?UTF-8?q?ci:=20=E6=B3=A8=E9=87=8A=E6=8E=89?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=20GitHub=20App=20token=20=E7=9A=84=E6=AD=A5?= =?UTF-8?q?=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 暂时注释掉创建 GitHub App token 的步骤,可能是因为该步骤不再需要或出现了问题。这个修改不影响其他功能,只是减少了工作流中的一个步骤。 --- .github/workflows/publish-docs.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 10b8c659..d0f26aad 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -38,14 +38,14 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: 🔑 Create GitHub App token (mkdocs) - id: mkdocs_token - uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 - with: - app-id: ${{ secrets.MKDOCS_APP_ID }} - private-key: ${{ secrets.MKDOCS_PEM }} - owner: roboflow - repositories: mkdocs-material-insiders +# - name: 🔑 Create GitHub App token (mkdocs) +# id: mkdocs_token +# uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 +# with: +# app-id: ${{ secrets.MKDOCS_APP_ID }} +# private-key: ${{ secrets.MKDOCS_PEM }} +# owner: roboflow +# repositories: mkdocs-material-insiders - name: 🏗️ Install dependencies run: | From eb170bc393b65850c653b985fc52e2de85918c6d Mon Sep 17 00:00:00 2001 From: AI-Hao <2865467769@qq.com> Date: Wed, 25 Jun 2025 11:02:17 +0800 Subject: [PATCH 019/110] =?UTF-8?q?ci:=E5=8F=96=E6=B6=88=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=20GitHub=20App=20token=20=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 取消注释了 publish-docs.yml 文件中的 Create GitHub App token (mkdocs) 步骤。这个步骤现在将作为工作流程的一部分正常运行,不再被跳过。 --- .github/workflows/publish-docs.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index d0f26aad..10b8c659 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -38,14 +38,14 @@ jobs: with: python-version: ${{ matrix.python-version }} -# - name: 🔑 Create GitHub App token (mkdocs) -# id: mkdocs_token -# uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 -# with: -# app-id: ${{ secrets.MKDOCS_APP_ID }} -# private-key: ${{ secrets.MKDOCS_PEM }} -# owner: roboflow -# repositories: mkdocs-material-insiders + - name: 🔑 Create GitHub App token (mkdocs) + id: mkdocs_token + uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 + with: + app-id: ${{ secrets.MKDOCS_APP_ID }} + private-key: ${{ secrets.MKDOCS_PEM }} + owner: roboflow + repositories: mkdocs-material-insiders - name: 🏗️ Install dependencies run: | From 13e857cf0010eb2d1e7274101bc429e37647befd Mon Sep 17 00:00:00 2001 From: AI-Hao <2865467769@qq.com> Date: Mon, 7 Jul 2025 15:21:28 +0800 Subject: [PATCH 020/110] =?UTF-8?q?refactor(detection):=20=E9=87=8D?= =?UTF-8?q?=E6=9E=84=E5=90=88=E5=B9=B6=E6=A3=80=E6=B5=8B=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 merge_inner_detections_objects 函数中的 threshold 和 match_metric 参数 - 新增 merge_inner_detections_objects_without_iou 函数,用于合并检测对象 - 优化非最大值抑制(NMM)的逻辑,提高效率 - 调整 mask_iou_batch 函数的实现,简化代码 --- supervision/detection/core.py | 17 ++++++-- supervision/detection/overlap_filter.py | 30 +++++++++----- supervision/detection/utils.py | 53 +++++++++++++------------ 3 files changed, 63 insertions(+), 37 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 5dcb46ea..ab9bddbb 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -2,6 +2,7 @@ from __future__ import annotations from dataclasses import dataclass, field from enum import Enum +from functools import reduce from typing import Any, Dict, Iterator, List, Optional, Tuple, Union import numpy as np @@ -1455,9 +1456,7 @@ class Detections: result = [] for merge_group in merge_groups: unmerged_detections = [self[i] for i in merge_group] - merged_detections = merge_inner_detections_objects( - unmerged_detections, threshold, match_metric - ) + merged_detections = merge_inner_detections_objects_without_iou(unmerged_detections) result.append(merged_detections) return Detections.merge(result) @@ -1577,6 +1576,18 @@ def merge_inner_detections_objects( detections_1 = merge_inner_detection_object_pair(detections_1, detections_2) return detections_1 +def merge_inner_detections_objects_without_iou( + detections: List[Detections] +) -> Detections: + """ + Given N detections each of length 1 (exactly one object inside), combine them into a + single detection object of length 1. The contained inner object will be the merged + result of all the input detections. + + For example, this lets you merge N boxes into one big box, N masks into one mask, + etc. + """ + return reduce(merge_inner_detection_object_pair, detections) def validate_fields_both_defined_or_none( detections_1: Detections, detections_2: Detections diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index dbe1159a..b5aecbe2 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -91,7 +91,7 @@ def mask_non_max_suppression( for i in range(rows): if keep[i]: condition = (ious[i] > iou_threshold) & (categories[i] == categories) - keep[i + 1 :] = np.where(condition[i + 1 :], False, keep[i + 1 :]) + keep[i + 1:] = np.where(condition[i + 1:], False, keep[i + 1:]) return keep[sort_index.argsort()] @@ -206,7 +206,7 @@ def mask_non_max_merge( iou_threshold: float = 0.5, mask_dimension: int = 640, match_metric: str = "IOU", -) -> np.ndarray: +) -> List[List[int]]: """ Perform Non-Maximum Merging (NMM) on segmentation predictions. @@ -342,14 +342,26 @@ def group_overlapping_masks( merge_groups.append([idx]) break - merge_candidate = np.expand_dims(masks[idx], axis=0) - ious = mask_iou_batch(masks[order], merge_candidate, match_metric) - ious = ious.flatten() + # calculate mask + merge_candidate = masks[idx][None, ...] + candidate_groups = [idx] + while len(order) > 0: + # 'IOU or IOS' of the calculate mask and the remaining mask + ious = mask_iou_batch(masks[order], merge_candidate, match_metric) + above_threshold: np.ndarray = ious.flatten() >= iou_threshold + # if no mask is above threshold, break + if not above_threshold.any(): + break + # get indexes that meet the threshold + above_idx = order[above_threshold] + # update merge_candidate + merge_candidate = np.logical_or.reduce(np.concatenate([masks[above_idx], merge_candidate]), axis=0, keepdims=True) + # add indexes that meet the criteria to the candidate_groups + candidate_groups.extend(np.flip(above_idx).tolist()) + # update order, masks + order = order[~above_threshold] - above_threshold = ious >= iou_threshold - merge_group = [idx, *np.flip(order[above_threshold]).tolist()] - merge_groups.append(merge_group) - order = order[~above_threshold] + merge_groups.append(candidate_groups) return merge_groups diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index a915c96d..8bfdce84 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -49,7 +49,9 @@ def polygon_to_mask(polygon: np.ndarray, resolution_wh: Tuple[int, int]) -> np.n def box_iou_batch( - boxes_true: np.ndarray, boxes_detection: np.ndarray, match_metric: str = "IOU" + boxes_true: np.ndarray, + boxes_detection: np.ndarray, + match_metric: str = "IOU", ) -> np.ndarray: """ Compute Intersection over Union (IoU) of two sets of bounding boxes - @@ -107,7 +109,9 @@ def box_iou_batch( def _mask_iou_batch_split( - masks_true: np.ndarray, masks_detection: np.ndarray, match_metric: str = "IOU" + masks_true: np.ndarray, + masks_detection: np.ndarray, + match_metric: str = "IOU", ) -> np.ndarray: """ Internal function. @@ -123,12 +127,10 @@ def _mask_iou_batch_split( Returns: np.ndarray: Pairwise IoU of masks from `masks_true` and `masks_detection`. """ - intersection_area = np.logical_and(masks_true[:, None], masks_detection).sum( - axis=(2, 3) - ) + intersection_area = np.logical_and(masks_true[:, None], masks_detection).sum(axis=(2, 3)) - masks_true_area = masks_true.sum(axis=(1, 2)) - masks_detection_area = masks_detection.sum(axis=(1, 2)) + masks_true_area = masks_true.sum(axis=(1, 2)) # (area1, area2, ...) + masks_detection_area = masks_detection.sum(axis=(1, 2)) # (area1) if match_metric.upper() == "IOU": union_area = masks_true_area[:, None] + masks_detection_area - intersection_area @@ -139,7 +141,8 @@ def _mask_iou_batch_split( where=union_area != 0, ) elif match_metric.upper() == "IOS": - small_area = np.minimum(intersection_area, masks_detection_area) + # ios = intersection_area / min(area1, area2) + small_area = np.minimum(masks_true_area[:, None], masks_detection_area) ious = np.divide( intersection_area, small_area, @@ -176,12 +179,12 @@ def mask_iou_batch( np.ndarray: Pairwise IoU of masks from `masks_true` and `masks_detection`. """ memory = ( - masks_true.shape[0] - * masks_true.shape[1] - * masks_true.shape[2] - * masks_detection.shape[0] - / 1024 - / 1024 + masks_true.shape[0] + * masks_true.shape[1] + * masks_true.shape[2] + * masks_detection.shape[0] + / 1024 + / 1024 ) if memory <= memory_limit: return _mask_iou_batch_split(masks_true, masks_detection, match_metric) @@ -192,16 +195,16 @@ def mask_iou_batch( * 1024 * 1024 // ( - masks_detection.shape[0] - * masks_detection.shape[1] - * masks_detection.shape[2] + masks_detection.shape[0] + * masks_detection.shape[1] + * masks_detection.shape[2] ), 1, ) for i in range(0, masks_true.shape[0], step): ious.append( _mask_iou_batch_split( - masks_true[i : i + step], masks_detection, match_metric + masks_true[i: i + step], masks_detection, match_metric ) ) @@ -581,7 +584,7 @@ def filter_polygons_by_area( polygon for polygon, area in zip(polygons, ares) if (min_area is None or area >= min_area) - and (max_area is None or area <= max_area) + and (max_area is None or area <= max_area) ] @@ -918,9 +921,9 @@ def move_masks( if source_x_end > source_x_start and source_y_end > source_y_start: mask_array[ - :, - destination_y_start:destination_y_end, - destination_x_start:destination_x_end, + :, + destination_y_start:destination_y_end, + destination_x_start:destination_x_end, ] = masks[:, source_y_start:source_y_end, source_x_start:source_x_end] return mask_array @@ -1022,11 +1025,11 @@ def is_metadata_equal(metadata_a: Dict[str, Any], metadata_b: Dict[str, Any]) -> return set(metadata_a.keys()) == set(metadata_b.keys()) and all( np.array_equal(metadata_a[key], metadata_b[key]) if ( - isinstance(metadata_a[key], np.ndarray) - and isinstance(metadata_b[key], np.ndarray) + isinstance(metadata_a[key], np.ndarray) + and isinstance(metadata_b[key], np.ndarray) ) else metadata_a[key] == metadata_b[key] - for key in metadata_a + for key in metadata_a ) From 0b120f174879e394f3a1ffe1f4d702ab867fda08 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Jul 2025 07:21:52 +0000 Subject: [PATCH 021/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 8 ++++-- supervision/detection/overlap_filter.py | 8 ++++-- supervision/detection/utils.py | 38 +++++++++++++------------ 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index ab9bddbb..72ebc8ee 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -1456,7 +1456,9 @@ class Detections: result = [] for merge_group in merge_groups: unmerged_detections = [self[i] for i in merge_group] - merged_detections = merge_inner_detections_objects_without_iou(unmerged_detections) + merged_detections = merge_inner_detections_objects_without_iou( + unmerged_detections + ) result.append(merged_detections) return Detections.merge(result) @@ -1576,8 +1578,9 @@ def merge_inner_detections_objects( detections_1 = merge_inner_detection_object_pair(detections_1, detections_2) return detections_1 + def merge_inner_detections_objects_without_iou( - detections: List[Detections] + detections: List[Detections], ) -> Detections: """ Given N detections each of length 1 (exactly one object inside), combine them into a @@ -1589,6 +1592,7 @@ def merge_inner_detections_objects_without_iou( """ return reduce(merge_inner_detection_object_pair, detections) + def validate_fields_both_defined_or_none( detections_1: Detections, detections_2: Detections ) -> None: diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index b5aecbe2..b763cf2c 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -91,7 +91,7 @@ def mask_non_max_suppression( for i in range(rows): if keep[i]: condition = (ious[i] > iou_threshold) & (categories[i] == categories) - keep[i + 1:] = np.where(condition[i + 1:], False, keep[i + 1:]) + keep[i + 1 :] = np.where(condition[i + 1 :], False, keep[i + 1 :]) return keep[sort_index.argsort()] @@ -355,7 +355,11 @@ def group_overlapping_masks( # get indexes that meet the threshold above_idx = order[above_threshold] # update merge_candidate - merge_candidate = np.logical_or.reduce(np.concatenate([masks[above_idx], merge_candidate]), axis=0, keepdims=True) + merge_candidate = np.logical_or.reduce( + np.concatenate([masks[above_idx], merge_candidate]), + axis=0, + keepdims=True, + ) # add indexes that meet the criteria to the candidate_groups candidate_groups.extend(np.flip(above_idx).tolist()) # update order, masks diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 8bfdce84..b7adbcd2 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -127,7 +127,9 @@ def _mask_iou_batch_split( Returns: np.ndarray: Pairwise IoU of masks from `masks_true` and `masks_detection`. """ - intersection_area = np.logical_and(masks_true[:, None], masks_detection).sum(axis=(2, 3)) + intersection_area = np.logical_and(masks_true[:, None], masks_detection).sum( + axis=(2, 3) + ) masks_true_area = masks_true.sum(axis=(1, 2)) # (area1, area2, ...) masks_detection_area = masks_detection.sum(axis=(1, 2)) # (area1) @@ -179,12 +181,12 @@ def mask_iou_batch( np.ndarray: Pairwise IoU of masks from `masks_true` and `masks_detection`. """ memory = ( - masks_true.shape[0] - * masks_true.shape[1] - * masks_true.shape[2] - * masks_detection.shape[0] - / 1024 - / 1024 + masks_true.shape[0] + * masks_true.shape[1] + * masks_true.shape[2] + * masks_detection.shape[0] + / 1024 + / 1024 ) if memory <= memory_limit: return _mask_iou_batch_split(masks_true, masks_detection, match_metric) @@ -195,16 +197,16 @@ def mask_iou_batch( * 1024 * 1024 // ( - masks_detection.shape[0] - * masks_detection.shape[1] - * masks_detection.shape[2] + masks_detection.shape[0] + * masks_detection.shape[1] + * masks_detection.shape[2] ), 1, ) for i in range(0, masks_true.shape[0], step): ious.append( _mask_iou_batch_split( - masks_true[i: i + step], masks_detection, match_metric + masks_true[i : i + step], masks_detection, match_metric ) ) @@ -584,7 +586,7 @@ def filter_polygons_by_area( polygon for polygon, area in zip(polygons, ares) if (min_area is None or area >= min_area) - and (max_area is None or area <= max_area) + and (max_area is None or area <= max_area) ] @@ -921,9 +923,9 @@ def move_masks( if source_x_end > source_x_start and source_y_end > source_y_start: mask_array[ - :, - destination_y_start:destination_y_end, - destination_x_start:destination_x_end, + :, + destination_y_start:destination_y_end, + destination_x_start:destination_x_end, ] = masks[:, source_y_start:source_y_end, source_x_start:source_x_end] return mask_array @@ -1025,11 +1027,11 @@ def is_metadata_equal(metadata_a: Dict[str, Any], metadata_b: Dict[str, Any]) -> return set(metadata_a.keys()) == set(metadata_b.keys()) and all( np.array_equal(metadata_a[key], metadata_b[key]) if ( - isinstance(metadata_a[key], np.ndarray) - and isinstance(metadata_b[key], np.ndarray) + isinstance(metadata_a[key], np.ndarray) + and isinstance(metadata_b[key], np.ndarray) ) else metadata_a[key] == metadata_b[key] - for key in metadata_a + for key in metadata_a ) From 7ca52da7768b9d8cbb3aa8627bb054be0ee309ae Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Thu, 10 Jul 2025 19:38:35 +0300 Subject: [PATCH 022/110] =?UTF-8?q?feat:=20=F0=9F=9A=80=20add=20support=20?= =?UTF-8?q?for=20Google=20Gemini=202.5=20bounding=20box=20and=20mask=20par?= =?UTF-8?q?sing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/vlm.py | 104 ++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 0f254868..6711459b 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -2,7 +2,10 @@ import json import re from enum import Enum from typing import Any, Dict, List, Optional, Tuple, Union - +import base64 +import io +from PIL import Image +from typing import Union, Optional, Tuple import numpy as np from supervision.detection.utils import ( @@ -406,3 +409,102 @@ def from_google_gemini( return np.empty((0, 4)), np.empty((0,), dtype=str) return np.array(xyxy), np.array(labels) + +def from_google_gemini_2_5( + result: str, + resolution_wh: Tuple[int, int], +) -> Tuple[np.ndarray, np.ndarray, np.ndarray, Optional[np.ndarray]]: + """ + Parse and scale bounding boxes and masks from Google Gemini 2.5 style JSON output. + https://aistudio.google.com/ + https://ai.google.dev/gemini-api/docs/vision?lang=python + + Args: + result: String containing the JSON snippet enclosed by triple backticks. + resolution_wh: (output_width, output_height) to which we rescale the boxes. + + Returns: + xyxy (np.ndarray): An array of shape `(n, 4)` containing + the bounding boxes coordinates in format `[x1, y1, x2, y2]` + class_name: (np.ndarray): An array of shape `(n,)` containing + the class labels for each bounding box + class_id [np.ndarray]: An array of shape `(n,)` containing + the class indices for each bounding box + masks: Optional[np.ndarray]: An array of shape `(n, h, w)` containing + the segmentation masks for each bounding box + """ + w, h = resolution_wh + if w <= 0 or h <= 0: + raise ValueError( + f"Both dimensions in resolution_wh must be positive. Got ({w}, {h})." + ) + + lines = result.splitlines() + for i, line in enumerate(lines): + if line == "```json": + result = "\n".join(lines[i + 1 :]) + result = result.split("```")[0] + break + + try: + data = json.loads(result) + except json.JSONDecodeError: + return np.empty((0, 4)), np.empty((0,), dtype=str), np.empty((0,), dtype=int), None + + class_name: list = [] + class_id: list = [] + xyxy: list = [] + masks: Optional[list] = [] + + for item in data: + if "box_2d" not in item or "label" not in item: + continue + class_name.append(item["label"]) + box = item["box_2d"] + # Gemini bbox order is [y_min, x_min, y_max, x_max] + absolute_bbox = denormalize_boxes( + np.array([box[1], box[0], box[3], box[2]]).astype(np.float64), + resolution_wh=(w, h), + normalization_factor=1000, + ) + xyxy.append(absolute_bbox) + + if "mask" in item: + png_str = item["mask"] + if not png_str.startswith("data:image/png;base64,"): + masks.append(np.zeros((h, w), dtype=bool)) + continue + + png_str = png_str.removeprefix("data:image/png;base64,") + png_str = base64.b64decode(png_str) + mask_img = Image.open(io.BytesIO(png_str)) + + y_min, y_max = int(absolute_bbox[1]), int(absolute_bbox[3]) + x_min, x_max = int(absolute_bbox[0]), int(absolute_bbox[2]) + + bbox_height = y_max - y_min + bbox_width = x_max - x_min + + if bbox_height > 0 and bbox_width > 0: + mask_img = mask_img.resize( + (bbox_width, bbox_height), resample=Image.Resampling.BILINEAR + ) + np_mask = np.zeros((h, w), dtype=bool) + np_mask[y_min:y_max, x_min:x_max] = np.array(mask_img) > 0 + masks.append(np_mask) + else: + masks.append(np.zeros((h, w), dtype=bool)) + else: + masks.append(np.zeros((h, w), dtype=bool)) + + if not xyxy: + return np.empty((0, 4)), np.empty((0,), dtype=str), np.empty((0,), dtype=int), None + + mask = np.array(masks) if masks is not None else None + + unique_labels = list(set(class_name)) + for label in class_name: + class_id.append(unique_labels.index(label)) + + return np.array(xyxy), np.array(class_id), np.array(class_name), mask + From 0e8ec18c20cd90f62f14be6888de5b37763318c2 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Thu, 10 Jul 2025 19:39:00 +0300 Subject: [PATCH 023/110] =?UTF-8?q?fix:=20=F0=9F=90=9E=20remove=20not=20ex?= =?UTF-8?q?ist=20Google=20Gemini=202.0=20and=202.5=20flash=20preview=20map?= =?UTF-8?q?pings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index af91dc5d..eaba9991 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -899,10 +899,7 @@ class Detections: LMM.FLORENCE_2: VLM.FLORENCE_2, LMM.QWEN_2_5_VL: VLM.QWEN_2_5_VL, LMM.GOOGLE_GEMINI_2_0: VLM.GOOGLE_GEMINI_2_0, - LMM.GOOGLE_GEMINI_2_0_FLASH: VLM.GOOGLE_GEMINI_2_0_FLASH, LMM.GOOGLE_GEMINI_2_5: VLM.GOOGLE_GEMINI_2_5, - LMM.GOOGLE_GEMINI_2_5_FLASH_PREVIEW: VLM.GOOGLE_GEMINI_2_5_FLASH_PREVIEW, - LMM.GOOGLE_GEMINI_2_5_PRO_PREVIEW: VLM.GOOGLE_GEMINI_2_5_PRO_PREVIEW, } # (this works even if the LMM enum is wrapped by @deprecated) From 74ba99479c88b174cacd5010db1e7a7a334aee16 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Thu, 10 Jul 2025 19:44:48 +0300 Subject: [PATCH 024/110] =?UTF-8?q?chore:=20=F0=9F=A7=B9=20clean=20up=20im?= =?UTF-8?q?ports=20and=20improve=20formatting=20in=20Google=20Gemini=20fun?= =?UTF-8?q?ctions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/vlm.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 6711459b..6cfdb047 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -1,12 +1,12 @@ +import base64 +import io import json import re from enum import Enum from typing import Any, Dict, List, Optional, Tuple, Union -import base64 -import io -from PIL import Image -from typing import Union, Optional, Tuple + import numpy as np +from PIL import Image from supervision.detection.utils import ( denormalize_boxes, @@ -410,6 +410,7 @@ def from_google_gemini( return np.array(xyxy), np.array(labels) + def from_google_gemini_2_5( result: str, resolution_wh: Tuple[int, int], @@ -449,7 +450,12 @@ def from_google_gemini_2_5( try: data = json.loads(result) except json.JSONDecodeError: - return np.empty((0, 4)), np.empty((0,), dtype=str), np.empty((0,), dtype=int), None + return ( + np.empty((0, 4)), + np.empty((0,), dtype=str), + np.empty((0,), dtype=int), + None, + ) class_name: list = [] class_id: list = [] @@ -463,10 +469,10 @@ def from_google_gemini_2_5( box = item["box_2d"] # Gemini bbox order is [y_min, x_min, y_max, x_max] absolute_bbox = denormalize_boxes( - np.array([box[1], box[0], box[3], box[2]]).astype(np.float64), - resolution_wh=(w, h), - normalization_factor=1000, - ) + np.array([box[1], box[0], box[3], box[2]]).astype(np.float64), + resolution_wh=(w, h), + normalization_factor=1000, + ) xyxy.append(absolute_bbox) if "mask" in item: @@ -498,7 +504,12 @@ def from_google_gemini_2_5( masks.append(np.zeros((h, w), dtype=bool)) if not xyxy: - return np.empty((0, 4)), np.empty((0,), dtype=str), np.empty((0,), dtype=int), None + return ( + np.empty((0, 4)), + np.empty((0,), dtype=str), + np.empty((0,), dtype=int), + None, + ) mask = np.array(masks) if masks is not None else None @@ -507,4 +518,3 @@ def from_google_gemini_2_5( class_id.append(unique_labels.index(label)) return np.array(xyxy), np.array(class_id), np.array(class_name), mask - From 5d2616093d34f2f19c8b95bca5b14adb4a2efdef Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Thu, 10 Jul 2025 19:45:02 +0300 Subject: [PATCH 025/110] =?UTF-8?q?feat:=20=F0=9F=9A=80=20add=20support=20?= =?UTF-8?q?for=20Google=20Gemini=202.5=20detection=20processing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index eaba9991..ddcf125e 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -38,6 +38,7 @@ from supervision.detection.vlm import ( VLM, from_florence_2, from_google_gemini, + from_google_gemini_2_5, from_paligemma, from_qwen_2_5_vl, validate_vlm_parameters, @@ -1034,16 +1035,16 @@ class Detections: return cls(xyxy=xyxy, mask=mask, data=data) - if ( - vlm == VLM.GOOGLE_GEMINI_2_0 - or vlm == VLM.GOOGLE_GEMINI_2_5 - or vlm == VLM.GOOGLE_GEMINI_2_5_FLASH_PREVIEW - or vlm == VLM.GOOGLE_GEMINI_2_5_PRO_PREVIEW - ): + if vlm == VLM.GOOGLE_GEMINI_2_0: xyxy, class_name = from_google_gemini(result, **kwargs) data = {CLASS_NAME_DATA_FIELD: class_name} return cls(xyxy=xyxy, data=data) + if vlm == VLM.GOOGLE_GEMINI_2_5: + xyxy, class_id, class_name, mask = from_google_gemini_2_5(result, **kwargs) + data = {CLASS_NAME_DATA_FIELD: class_name} + return cls(xyxy=xyxy, class_id=class_id, mask=mask, data=data) + return cls.empty() @classmethod From d7e0dedf74c0556693dc8c059a181111edb8ea89 Mon Sep 17 00:00:00 2001 From: hidara2000 Date: Fri, 11 Jul 2025 09:57:06 +1000 Subject: [PATCH 026/110] pull from main --- supervision/annotators/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index f10491ff..b56208f4 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -139,10 +139,10 @@ class _BaseLabelAnnotator(BaseAnnotator): # Update the properties with the spread out boxes adjusted_properties[:, :4] = spread_boxes - # Additional check to ensure boxes are still within frame after spreading - adjusted_properties[:, :4] = snap_boxes( - adjusted_properties[:, :4], resolution_wh - ) + # Additional check to ensure boxes are still within frame after spreading + adjusted_properties[:, :4] = snap_boxes( + adjusted_properties[:, :4], resolution_wh + ) return adjusted_properties From 0b00edc526ba43369e36b98456e5dbb2d07dd5c6 Mon Sep 17 00:00:00 2001 From: hidara2000 Date: Fri, 11 Jul 2025 10:14:07 +1000 Subject: [PATCH 027/110] Remove redundant duplicated calls to spread_out_boxes --- supervision/annotators/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index b56208f4..f10491ff 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -139,10 +139,10 @@ class _BaseLabelAnnotator(BaseAnnotator): # Update the properties with the spread out boxes adjusted_properties[:, :4] = spread_boxes - # Additional check to ensure boxes are still within frame after spreading - adjusted_properties[:, :4] = snap_boxes( - adjusted_properties[:, :4], resolution_wh - ) + # Additional check to ensure boxes are still within frame after spreading + adjusted_properties[:, :4] = snap_boxes( + adjusted_properties[:, :4], resolution_wh + ) return adjusted_properties From fd1bb5b4b2c5fe505a32b7ba0612fa76c478e917 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Fri, 11 Jul 2025 16:49:58 +0300 Subject: [PATCH 028/110] Update supervision/detection/vlm.py Co-authored-by: Soumik Rakshit <19soumik.rakshit96@gmail.com> --- supervision/detection/vlm.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 6cfdb047..1267ca74 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -416,9 +416,19 @@ def from_google_gemini_2_5( resolution_wh: Tuple[int, int], ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, Optional[np.ndarray]]: """ - Parse and scale bounding boxes and masks from Google Gemini 2.5 style JSON output. - https://aistudio.google.com/ - https://ai.google.dev/gemini-api/docs/vision?lang=python + Parse and scale bounding boxes and masks from Google Gemini 2.5 style + [JSON output](https://ai.google.dev/gemini-api/docs/vision?lang=python). + + The JSON is expected to be enclosed in triple backticks with the format: + ```json + [ + { + "box_2d": [x1, y1, x2, y2], + "mask": "data:image/png;base64,...", + "label": "some class name"}, + ... + ] + ``` Args: result: String containing the JSON snippet enclosed by triple backticks. From a6d9550a9a5bed4e0020efde64b6054407af7ddf Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 13:51:19 +0000 Subject: [PATCH 029/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/vlm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 1267ca74..193c52ef 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -418,7 +418,7 @@ def from_google_gemini_2_5( """ Parse and scale bounding boxes and masks from Google Gemini 2.5 style [JSON output](https://ai.google.dev/gemini-api/docs/vision?lang=python). - + The JSON is expected to be enclosed in triple backticks with the format: ```json [ From d34f0506425e7dd3caeb0384d12b98a4e6165835 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Fri, 11 Jul 2025 17:40:25 +0300 Subject: [PATCH 030/110] =?UTF-8?q?feat:=20=F0=9F=9A=80=20implement=20reso?= =?UTF-8?q?lution=20validation=20function=20and=20refactor=20related=20cod?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/vlm.py | 30 +++++++----------------------- supervision/validators/__init__.py | 10 ++++++++++ 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 193c52ef..ed62a449 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -14,6 +14,7 @@ from supervision.detection.utils import ( polygon_to_xyxy, ) from supervision.utils.internal import deprecated +from supervision.validators import validate_resolution @deprecated( @@ -126,11 +127,7 @@ def from_paligemma( the class labels for each bounding box. """ - w, h = resolution_wh - if w <= 0 or h <= 0: - raise ValueError( - f"Both dimensions in resolution_wh must be positive. Got ({w}, {h})." - ) + w, h = validate_resolution(resolution_wh) pattern = re.compile( r"(?) ([\w\s\-]+)" @@ -189,14 +186,9 @@ def from_qwen_2_5_vl( class_name (np.ndarray): An array of shape `(n,)` containing the class labels for each bounding box """ - in_w, in_h = input_wh - out_w, out_h = resolution_wh - if in_w <= 0 or in_h <= 0 or out_w <= 0 or out_h <= 0: - raise ValueError( - f"Both input and resolution dimensions must be positive. " - f"Got input_wh=({in_w}, {in_h}), resolution_wh=({out_w}, {out_h})." - ) + in_w, in_h = validate_resolution(input_wh) + out_w, out_h = validate_resolution(resolution_wh) pattern = re.compile(r"```json\s*(.*?)\s*```", re.DOTALL) @@ -325,7 +317,7 @@ def from_florence_2( f"Expected string to end in location tags, but got {result}" ) - w, h = resolution_wh + w, h = validate_resolution(resolution_wh) xyxy = np.array([match.groups()], dtype=np.float32) xyxy *= np.array([w, h, w, h]) / 1000 result_string = result[: match.start()] @@ -371,11 +363,7 @@ def from_google_gemini( """ - w, h = resolution_wh - if w <= 0 or h <= 0: - raise ValueError( - f"Both dimensions in resolution_wh must be positive. Got ({w}, {h})." - ) + w, h = validate_resolution(resolution_wh) lines = result.splitlines() for i, line in enumerate(lines): @@ -444,11 +432,7 @@ def from_google_gemini_2_5( masks: Optional[np.ndarray]: An array of shape `(n, h, w)` containing the segmentation masks for each bounding box """ - w, h = resolution_wh - if w <= 0 or h <= 0: - raise ValueError( - f"Both dimensions in resolution_wh must be positive. Got ({w}, {h})." - ) + w, h = validate_resolution(resolution_wh) lines = result.splitlines() for i, line in enumerate(lines): diff --git a/supervision/validators/__init__.py b/supervision/validators/__init__.py index 29ac0da9..7b1f00eb 100644 --- a/supervision/validators/__init__.py +++ b/supervision/validators/__init__.py @@ -138,3 +138,13 @@ def validate_keypoints_fields( validate_class_id(class_id, n) validate_keypoint_confidence(confidence, n, m) validate_data(data, n) + + +def validate_resolution(resolution): + w, h = resolution + if w <= 0 or h <= 0: + raise ValueError( + f"Both dimensions in resolution must be positive. Got ({w}, {h})." + ) + + return w, h From c7ebfeb4bc72f1e601525526e2c2793d69cb34b2 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 10:58:59 +0300 Subject: [PATCH 031/110] =?UTF-8?q?feat:=20=F0=9F=9A=80=20enhance=20Google?= =?UTF-8?q?=20Gemini=202.5=20integration=20to=20include=20confidence=20sco?= =?UTF-8?q?res=20in=20detection=20results?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 4 ++-- supervision/detection/vlm.py | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index ddcf125e..d3d593a6 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -1041,9 +1041,9 @@ class Detections: return cls(xyxy=xyxy, data=data) if vlm == VLM.GOOGLE_GEMINI_2_5: - xyxy, class_id, class_name, mask = from_google_gemini_2_5(result, **kwargs) + xyxy, class_id, class_name, mask, confidence = from_google_gemini_2_5(result, **kwargs) data = {CLASS_NAME_DATA_FIELD: class_name} - return cls(xyxy=xyxy, class_id=class_id, mask=mask, data=data) + return cls(xyxy=xyxy, class_id=class_id, mask=mask, confidence=confidence, data=data) return cls.empty() diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index ed62a449..3d8a3238 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -402,7 +402,7 @@ def from_google_gemini( def from_google_gemini_2_5( result: str, resolution_wh: Tuple[int, int], -) -> Tuple[np.ndarray, np.ndarray, np.ndarray, Optional[np.ndarray]]: +) -> Tuple[np.ndarray, np.ndarray, np.ndarray, Optional[np.ndarray], Optional[np.ndarray]]: """ Parse and scale bounding boxes and masks from Google Gemini 2.5 style [JSON output](https://ai.google.dev/gemini-api/docs/vision?lang=python). @@ -454,7 +454,8 @@ def from_google_gemini_2_5( class_name: list = [] class_id: list = [] xyxy: list = [] - masks: Optional[list] = [] + masks: list = [] + confidence: list = [] for item in data: if "box_2d" not in item or "label" not in item: @@ -497,6 +498,14 @@ def from_google_gemini_2_5( else: masks.append(np.zeros((h, w), dtype=bool)) + + if "confidence" in item: + # if confidence is provided + confidence.append(item["confidence"]) + else: + # if confidence is not provided, we assume 0 + confidence.append(0.0) + if not xyxy: return ( np.empty((0, 4)), @@ -511,4 +520,4 @@ def from_google_gemini_2_5( for label in class_name: class_id.append(unique_labels.index(label)) - return np.array(xyxy), np.array(class_id), np.array(class_name), mask + return np.array(xyxy), np.array(class_id), np.array(class_name), mask, np.array(confidence) From 3152f5f0ea6ff399f3c2f4a361fc0fc82c65cfed Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 10:59:49 +0300 Subject: [PATCH 032/110] =?UTF-8?q?docs:=20=F0=9F=93=9D=20add=20docs=20to?= =?UTF-8?q?=20confidence=20scores=20parameter=20to=20from=5Fgoogle=5Fgemin?= =?UTF-8?q?i=5F2=5F5=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/vlm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 3d8a3238..80335cec 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -431,6 +431,9 @@ def from_google_gemini_2_5( the class indices for each bounding box masks: Optional[np.ndarray]: An array of shape `(n, h, w)` containing the segmentation masks for each bounding box + confidence: Optional[np.ndarray]: An array of shape `(n,)` containing + the confidence scores for each bounding box. If not provided, + it defaults to 0.0 for each box. """ w, h = validate_resolution(resolution_wh) From 6bae8bc6e60d540a520635e9413090314496b4c2 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 11:02:19 +0300 Subject: [PATCH 033/110] =?UTF-8?q?formatting:=20=20=F0=9F=A7=B9=20code=20?= =?UTF-8?q?readability=20by=20formatting=20return=20statements=20and=20fun?= =?UTF-8?q?ction=20signatures=20in=20Google=20Gemini=202.5=20integration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 12 ++++++++++-- supervision/detection/vlm.py | 13 ++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index d3d593a6..d030d853 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -1041,9 +1041,17 @@ class Detections: return cls(xyxy=xyxy, data=data) if vlm == VLM.GOOGLE_GEMINI_2_5: - xyxy, class_id, class_name, mask, confidence = from_google_gemini_2_5(result, **kwargs) + xyxy, class_id, class_name, mask, confidence = from_google_gemini_2_5( + result, **kwargs + ) data = {CLASS_NAME_DATA_FIELD: class_name} - return cls(xyxy=xyxy, class_id=class_id, mask=mask, confidence=confidence, data=data) + return cls( + xyxy=xyxy, + class_id=class_id, + mask=mask, + confidence=confidence, + data=data, + ) return cls.empty() diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 80335cec..bd9c5399 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -402,7 +402,9 @@ def from_google_gemini( def from_google_gemini_2_5( result: str, resolution_wh: Tuple[int, int], -) -> Tuple[np.ndarray, np.ndarray, np.ndarray, Optional[np.ndarray], Optional[np.ndarray]]: +) -> Tuple[ + np.ndarray, np.ndarray, np.ndarray, Optional[np.ndarray], Optional[np.ndarray] +]: """ Parse and scale bounding boxes and masks from Google Gemini 2.5 style [JSON output](https://ai.google.dev/gemini-api/docs/vision?lang=python). @@ -501,7 +503,6 @@ def from_google_gemini_2_5( else: masks.append(np.zeros((h, w), dtype=bool)) - if "confidence" in item: # if confidence is provided confidence.append(item["confidence"]) @@ -523,4 +524,10 @@ def from_google_gemini_2_5( for label in class_name: class_id.append(unique_labels.index(label)) - return np.array(xyxy), np.array(class_id), np.array(class_name), mask, np.array(confidence) + return ( + np.array(xyxy), + np.array(class_id), + np.array(class_name), + mask, + np.array(confidence), + ) From 5d866fd8a190368a765783581b344df536ec49aa Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 14:14:03 +0300 Subject: [PATCH 034/110] =?UTF-8?q?refactor:=20=20=E2=9C=A8=20=20improve?= =?UTF-8?q?=20validate=5Fresolution=20function=20to=20have=20type,value=20?= =?UTF-8?q?check=20similar=20to=20other=20validate=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/validators/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/supervision/validators/__init__.py b/supervision/validators/__init__.py index 7b1f00eb..4d21493b 100644 --- a/supervision/validators/__init__.py +++ b/supervision/validators/__init__.py @@ -1,4 +1,4 @@ -from typing import Any, Dict +from typing import Any, Dict, Tuple import numpy as np @@ -140,11 +140,18 @@ def validate_keypoints_fields( validate_data(data, n) -def validate_resolution(resolution): +def validate_resolution(resolution: Any) -> Tuple[int, int]: + if not (isinstance(resolution, tuple) and len(resolution) == 2): + raise ValueError( + f"resolution must be a tuple of two integers, got {type(resolution)} with value {resolution}" + ) w, h = resolution + if not (isinstance(w, int) and isinstance(h, int)): + raise ValueError( + f"Both elements in resolution must be integers. Got types ({type(w)}, {type(h)})" + ) if w <= 0 or h <= 0: raise ValueError( f"Both dimensions in resolution must be positive. Got ({w}, {h})." ) - return w, h From 4ed667da88fed7dfaef43ae3239f43af0985e6ba Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 14:24:37 +0300 Subject: [PATCH 035/110] =?UTF-8?q?fix:=20=F0=9F=90=9E=20rename=20from=5Fg?= =?UTF-8?q?oogle=5Fgemini=20to=20from=5Fgoogle=5Fgemini=5F2=5F0=20keep=20n?= =?UTF-8?q?ames=20consistent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 4 ++-- supervision/detection/vlm.py | 2 +- supervision/validators/__init__.py | 10 ++++++++-- test/detection/test_vlm.py | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 07cb2618..b0a4fe63 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -37,7 +37,7 @@ from supervision.detection.vlm import ( LMM, VLM, from_florence_2, - from_google_gemini, + from_google_gemini_2_0, from_google_gemini_2_5, from_moondream, from_paligemma, @@ -1137,7 +1137,7 @@ class Detections: return cls(xyxy=xyxy, mask=mask, data=data) if vlm == VLM.GOOGLE_GEMINI_2_0 or vlm == VLM.GOOGLE_GEMINI_2_5: - xyxy, class_id, class_name = from_google_gemini(result, **kwargs) + xyxy, class_id, class_name = from_google_gemini_2_0(result, **kwargs) data = {CLASS_NAME_DATA_FIELD: class_name} return cls(xyxy=xyxy, class_id=class_id, data=data) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 4be54be5..a9f6e781 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -330,7 +330,7 @@ def from_florence_2( assert False, f"Unimplemented task: {task}" -def from_google_gemini( +def from_google_gemini_2_0( result: str, resolution_wh: Tuple[int, int], classes: Optional[List[str]] = None, diff --git a/supervision/validators/__init__.py b/supervision/validators/__init__.py index 4d21493b..f40b6f83 100644 --- a/supervision/validators/__init__.py +++ b/supervision/validators/__init__.py @@ -143,12 +143,18 @@ def validate_keypoints_fields( def validate_resolution(resolution: Any) -> Tuple[int, int]: if not (isinstance(resolution, tuple) and len(resolution) == 2): raise ValueError( - f"resolution must be a tuple of two integers, got {type(resolution)} with value {resolution}" + f""" + resolution must be a tuple of two integers, got + {type(resolution)} with value {resolution} + """ ) w, h = resolution if not (isinstance(w, int) and isinstance(h, int)): raise ValueError( - f"Both elements in resolution must be integers. Got types ({type(w)}, {type(h)})" + f""" + Both elements in resolution must be integers. + Got types ({type(w)}, {type(h)}) + """ ) if w <= 0 or h <= 0: raise ValueError( diff --git a/test/detection/test_vlm.py b/test/detection/test_vlm.py index 7b9acb0c..c2762f5d 100644 --- a/test/detection/test_vlm.py +++ b/test/detection/test_vlm.py @@ -7,7 +7,7 @@ import pytest from supervision.detection.vlm import ( from_florence_2, - from_google_gemini, + from_google_gemini_2_0, from_moondream, from_paligemma, from_qwen_2_5_vl, @@ -492,7 +492,7 @@ def test_from_google_gemini( expected_results: Tuple[np.ndarray, Optional[np.ndarray], np.ndarray], ) -> None: with exception: - xyxy, class_id, class_name = from_google_gemini( + xyxy, class_id, class_name = from_google_gemini_2_0( result=result, resolution_wh=resolution_wh, classes=classes ) if expected_results is not None: From 3b112ffb46b82b7750f999d74333fd69ba98ec58 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 15:11:12 +0300 Subject: [PATCH 036/110] =?UTF-8?q?refactor:=20=E2=9C=A8=20update=20from?= =?UTF-8?q?=5Fgoogle=5Fgemini=5F2=5F5=20function=20to=20include=20optional?= =?UTF-8?q?=20classes=20parameter=20and=20adjust=20return=20values?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 2 +- supervision/detection/vlm.py | 51 ++++++++++++++++++++--------------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index b0a4fe63..2478721b 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -1146,7 +1146,7 @@ class Detections: return cls(xyxy=xyxy) if vlm == VLM.GOOGLE_GEMINI_2_5: - xyxy, class_id, class_name, mask, confidence = from_google_gemini_2_5( + xyxy, class_id, class_name, confidence, mask = from_google_gemini_2_5( result, **kwargs ) data = {CLASS_NAME_DATA_FIELD: class_name} diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index a9f6e781..bc9e6f6b 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -421,6 +421,7 @@ def from_google_gemini_2_0( def from_google_gemini_2_5( result: str, resolution_wh: Tuple[int, int], + classes: Optional[List[str]] = None ) -> Tuple[ np.ndarray, np.ndarray, np.ndarray, Optional[np.ndarray], Optional[np.ndarray] ]: @@ -445,15 +446,15 @@ def from_google_gemini_2_5( Returns: xyxy (np.ndarray): An array of shape `(n, 4)` containing the bounding boxes coordinates in format `[x1, y1, x2, y2]` - class_name: (np.ndarray): An array of shape `(n,)` containing - the class labels for each bounding box - class_id [np.ndarray]: An array of shape `(n,)` containing + class_id (np.ndarray): An array of shape `(n,)` containing the class indices for each bounding box - masks: Optional[np.ndarray]: An array of shape `(n, h, w)` containing - the segmentation masks for each bounding box + class_name (np.ndarray): An array of shape `(n,)` containing + the class labels for each bounding box confidence: Optional[np.ndarray]: An array of shape `(n,)` containing the confidence scores for each bounding box. If not provided, it defaults to 0.0 for each box. + masks (Optional[np.ndarray]): An array of shape `(n, h, w)` containing + the segmentation masks for each bounding box """ w, h = validate_resolution(resolution_wh) @@ -472,13 +473,14 @@ def from_google_gemini_2_5( np.empty((0,), dtype=str), np.empty((0,), dtype=int), None, + ) - class_name: list = [] - class_id: list = [] xyxy: list = [] - masks: list = [] + class_id: list = [] + class_name: list = [] confidence: list = [] + masks: list = [] for item in data: if "box_2d" not in item or "label" not in item: @@ -522,32 +524,34 @@ def from_google_gemini_2_5( masks.append(np.zeros((h, w), dtype=bool)) if "confidence" in item: - # if confidence is provided confidence.append(item["confidence"]) else: - # if confidence is not provided, we assume 0 confidence.append(0.0) if not xyxy: return ( np.empty((0, 4)), - np.empty((0,), dtype=str), - np.empty((0,), dtype=int), + np.array([], dtype=int), + np.array([], dtype=str), + np.array([], dtype=np.float32), None, ) - mask = np.array(masks) if masks is not None else None - unique_labels = list(set(class_name)) - for label in class_name: - class_id.append(unique_labels.index(label)) + if classes is not None: + mask = np.array([name in classes for name in class_name], dtype=bool) + xyxy = xyxy[mask] + class_name = class_name[mask] + class_id = np.array([classes.index(name) for name in class_name], dtype=int) + masks = [masks[i] for i in range(len(masks)) if mask[i]] + return ( - np.array(xyxy), - np.array(class_id), - np.array(class_name), - mask, - np.array(confidence), + np.array(xyxy, dtype=float), + np.array(class_id, dtype=int), + np.array(class_name, dtype=str), + np.array(confidence, dtype=float), + np.array(masks) if masks is not None else None, ) @@ -574,10 +578,13 @@ def from_moondream( ] } - Args: result: Dictionary containing the JSON output from the model. resolution_wh: (output_width, output_height) to which we rescale the boxes. + + Returns: + xyxy (np.ndarray): An array of shape `(n, 4)` containing + the bounding boxes coordinates in format `[x1, y1, x2, y2]` """ w, h = resolution_wh From 377f7db0ad3b20eb04e625e6868216ef5fbf5137 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 15:22:10 +0300 Subject: [PATCH 037/110] =?UTF-8?q?feat:=20=E2=9C=A8=20add=20confidence=20?= =?UTF-8?q?field=20to=20the=20result=20of=20from=5Fgoogle=5Fgemini=5F2=5F5?= =?UTF-8?q?=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/vlm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index bc9e6f6b..acee6826 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -435,7 +435,9 @@ def from_google_gemini_2_5( { "box_2d": [x1, y1, x2, y2], "mask": "data:image/png;base64,...", - "label": "some class name"}, + "label": "some class name", + "confidence": 0.95, + }, ... ] ``` From 74d5f0f9a6fccca44b0f0ab8f1d622bbb261318d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 14 Jul 2025 13:07:17 +0000 Subject: [PATCH 038/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 87b58ad2..c700aeb0 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -108,7 +108,9 @@ def box_iou( return inter_area / union_area + 1e-6 -def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray, match_metric: str = "IOU") -> np.ndarray: +def box_iou_batch( + boxes_true: np.ndarray, boxes_detection: np.ndarray, match_metric: str = "IOU" +) -> np.ndarray: """ Compute Intersection over Union (IoU) of two sets of bounding boxes - `boxes_true` and `boxes_detection`. Both sets From 6c4a2a8d44efb624d5e2467ac729b9d9c8e70109 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 16:50:41 +0300 Subject: [PATCH 039/110] =?UTF-8?q?test:=20=F0=9F=A7=AA=20add=20gemini=5F2?= =?UTF-8?q?=5F5=20test=20and=20fix=20failed=20cases=20in=20gemini=5F2=5F5?= =?UTF-8?q?=20function=20for=20better=20to=20handle=20different=20cases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- supervision/detection/vlm.py | 118 ++++++++++++-------- test/detection/test_vlm.py | 202 +++++++++++++++++++++++++++++++++++ 2 files changed, 273 insertions(+), 47 deletions(-) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index acee6826..1294b1d4 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -421,9 +421,13 @@ def from_google_gemini_2_0( def from_google_gemini_2_5( result: str, resolution_wh: Tuple[int, int], - classes: Optional[List[str]] = None + classes: Optional[List[str]] = None, ) -> Tuple[ - np.ndarray, np.ndarray, np.ndarray, Optional[np.ndarray], Optional[np.ndarray] + np.ndarray, + Optional[np.ndarray], + np.ndarray, + Optional[np.ndarray], + Optional[np.ndarray], ]: """ Parse and scale bounding boxes and masks from Google Gemini 2.5 style @@ -444,6 +448,9 @@ def from_google_gemini_2_5( Args: result: String containing the JSON snippet enclosed by triple backticks. + resolution_wh: (output_width, output_height) to which we rescale the boxes. + classes: Optional list of valid class names. If provided, returned boxes/labels + are filtered to only those classes found here. Returns: xyxy (np.ndarray): An array of shape `(n, 4)` containing @@ -472,22 +479,21 @@ def from_google_gemini_2_5( except json.JSONDecodeError: return ( np.empty((0, 4)), - np.empty((0,), dtype=str), - np.empty((0,), dtype=int), + np.array([], dtype=int), + np.array([], dtype=str), + np.array([], dtype=float), None, - ) - xyxy: list = [] - class_id: list = [] - class_name: list = [] - confidence: list = [] - masks: list = [] + xyxy_list: list = [] + labels_list: list = [] + confidence_list: Optional[list] = [] + masks_list: Optional[list] = [] for item in data: if "box_2d" not in item or "label" not in item: continue - class_name.append(item["label"]) + labels_list.append(item["label"]) box = item["box_2d"] # Gemini bbox order is [y_min, x_min, y_max, x_max] absolute_bbox = denormalize_boxes( @@ -495,65 +501,83 @@ def from_google_gemini_2_5( resolution_wh=(w, h), normalization_factor=1000, ) - xyxy.append(absolute_bbox) + xyxy_list.append(absolute_bbox) if "mask" in item: - png_str = item["mask"] - if not png_str.startswith("data:image/png;base64,"): - masks.append(np.zeros((h, w), dtype=bool)) - continue + if masks_list is not None: + png_str = item["mask"] + if not png_str.startswith("data:image/png;base64,"): + masks_list.append(np.zeros((h, w), dtype=bool)) + continue - png_str = png_str.removeprefix("data:image/png;base64,") - png_str = base64.b64decode(png_str) - mask_img = Image.open(io.BytesIO(png_str)) + png_str = png_str.removeprefix("data:image/png;base64,") + png_str = base64.b64decode(png_str) + mask_img = Image.open(io.BytesIO(png_str)) - y_min, y_max = int(absolute_bbox[1]), int(absolute_bbox[3]) - x_min, x_max = int(absolute_bbox[0]), int(absolute_bbox[2]) + y_min, y_max = int(absolute_bbox[1]), int(absolute_bbox[3]) + x_min, x_max = int(absolute_bbox[0]), int(absolute_bbox[2]) - bbox_height = y_max - y_min - bbox_width = x_max - x_min + bbox_height = y_max - y_min + bbox_width = x_max - x_min - if bbox_height > 0 and bbox_width > 0: - mask_img = mask_img.resize( - (bbox_width, bbox_height), resample=Image.Resampling.BILINEAR - ) - np_mask = np.zeros((h, w), dtype=bool) - np_mask[y_min:y_max, x_min:x_max] = np.array(mask_img) > 0 - masks.append(np_mask) - else: - masks.append(np.zeros((h, w), dtype=bool)) + if bbox_height > 0 and bbox_width > 0: + mask_img = mask_img.resize( + (bbox_width, bbox_height), resample=Image.Resampling.BILINEAR + ) + np_mask = np.zeros((h, w), dtype=bool) + np_mask[y_min:y_max, x_min:x_max] = np.array(mask_img) > 0 + masks_list.append(np_mask) + else: + masks_list.append(np.zeros((h, w), dtype=bool)) else: - masks.append(np.zeros((h, w), dtype=bool)) + masks_list = None if "confidence" in item: - confidence.append(item["confidence"]) + if confidence_list is not None: + confidence_list.append(item["confidence"]) else: - confidence.append(0.0) + confidence_list = None - if not xyxy: + if not xyxy_list: return ( np.empty((0, 4)), - np.array([], dtype=int), + np.array([], dtype=int), np.array([], dtype=str), - np.array([], dtype=np.float32), + np.array([], dtype=float), None, ) + xyxy = np.array(xyxy_list, dtype=float) + class_name = np.array(labels_list) + class_id: np.ndarray if classes is not None: mask = np.array([name in classes for name in class_name], dtype=bool) xyxy = xyxy[mask] class_name = class_name[mask] - class_id = np.array([classes.index(name) for name in class_name], dtype=int) - masks = [masks[i] for i in range(len(masks)) if mask[i]] + class_id = np.array([classes.index(name) for name in class_name]) + if masks_list is not None: + masks_list = [masks_list[i] for i, m in enumerate(mask) if m] + if confidence_list is not None: + confidence_list = [c for c, m in zip(confidence_list, mask) if m] + else: + # When classes is None, generate class_id based on unique labels + unique_labels = sorted(list(set(class_name))) + label_to_id = {label: i for i, label in enumerate(unique_labels)} + class_id = np.array([label_to_id[name] for name in class_name]) + + confidence = ( + np.array(confidence_list, dtype=float) if confidence_list is not None else None + ) + masks = np.array(masks_list) if masks_list is not None else None return ( - np.array(xyxy, dtype=float), - np.array(class_id, dtype=int), - np.array(class_name, dtype=str), - np.array(confidence, dtype=float), - np.array(masks) if masks is not None else None, + xyxy, + class_id, + class_name, + confidence, + masks, ) @@ -583,7 +607,7 @@ def from_moondream( Args: result: Dictionary containing the JSON output from the model. resolution_wh: (output_width, output_height) to which we rescale the boxes. - + Returns: xyxy (np.ndarray): An array of shape `(n, 4)` containing the bounding boxes coordinates in format `[x1, y1, x2, y2]` @@ -596,7 +620,7 @@ def from_moondream( ) if "objects" not in result or not isinstance(result["objects"], list): - return np.empty((0, 4)) + return np.empty((0, 4), dtype=float) denormalize_xyxy = [] diff --git a/test/detection/test_vlm.py b/test/detection/test_vlm.py index c2762f5d..2135600b 100644 --- a/test/detection/test_vlm.py +++ b/test/detection/test_vlm.py @@ -8,6 +8,7 @@ import pytest from supervision.detection.vlm import ( from_florence_2, from_google_gemini_2_0, + from_google_gemini_2_5, from_moondream, from_paligemma, from_qwen_2_5_vl, @@ -883,3 +884,204 @@ def test_florence_2( assert result[3] is None else: np.testing.assert_array_equal(result[3], expected_results[3]) + + +@pytest.mark.parametrize( + "exception, result, resolution_wh, classes, expected_results", + [ + ( + does_not_raise(), + "random text", + (1000, 1000), + None, + ( + np.empty((0, 4)), + np.empty(0, dtype=int), + np.empty(0, dtype=str), + np.empty(0, dtype=float), + None, + ), + ), + ( + does_not_raise(), + "```json\ninvalid json\n```", + (1000, 1000), + None, + ( + np.empty((0, 4)), + np.empty(0, dtype=int), + np.empty(0, dtype=str), + np.empty(0, dtype=float), + None, + ), + ), + ( + does_not_raise(), + "```json\n[]\n```", + (1000, 1000), + None, + ( + np.empty((0, 4)), + np.empty(0, dtype=int), + np.empty(0, dtype=str), + np.empty(0, dtype=float), + None, + ), + ), + ( + does_not_raise(), + """```json + [ + {"box_2d": [100, 200, 300, 400], "label": "cat", "confidence": 0.8} + ] + ```""", + (1000, 500), + None, + ( + np.array([[200.0, 50.0, 400.0, 150.0]]), + np.array([0]), + np.array(["cat"], dtype=str), + np.array([0.8]), + None, + ), + ), + ( + does_not_raise(), + """```json + [ + {"box_2d": [10, 20, 110, 120], "label": "cat", "confidence": 0.8}, + {"box_2d": [50, 100, 150, 200], "label": "dog", "confidence": 0.9} + ] + ```""", + (640, 480), + None, + ( + np.array([[12.8, 4.8, 76.8, 52.8], [64.0, 24.0, 128.0, 72.0]]), + np.array([0, 1]), + np.array(["cat", "dog"], dtype=str), + np.array([0.8, 0.9]), + None, + ), + ), + ( + does_not_raise(), + """```json + [ + {"box_2d": [10, 20, 110, 120], "label": "cat", "confidence": 0.8} + ] + ```""", + (640, 480), + ["dog", "person"], + ( + np.empty((0, 4)), + np.empty(0, dtype=int), + np.empty(0, dtype=str), + np.empty(0, dtype=float), + None, + ), + ), + ( + does_not_raise(), + """```json + [ + {"box_2d": [10, 20, 110, 120], "label": "cat", "confidence": 0.8}, + {"box_2d": [50, 100, 150, 200], "label": "dog", "confidence": 0.9} + ] + ```""", + (640, 480), + ["person", "dog"], + ( + np.array([[64.0, 24.0, 128.0, 72.0]]), + np.array([1]), + np.array(["dog"], dtype=str), + np.array([0.9]), + None, + ), + ), + ( + does_not_raise(), + """```json + [ + {"box_2d": [10, 20, 110, 120], "label": "cat", "confidence": 0.8}, + {"box_2d": [50, 100, 150, 200], "label": "dog", "confidence": 0.9} + ] + ```""", + (640, 480), + ["cat", "dog"], + ( + np.array([[12.8, 4.8, 76.8, 52.8], [64.0, 24.0, 128.0, 72.0]]), + np.array([0, 1]), + np.array(["cat", "dog"]), + np.array([0.8, 0.9]), + None, + ), + ), + ( + pytest.raises(ValueError), + """```json + [ + {"box_2d": [10, 20, 110, 120], "label": "cat"} + ] + ```""", + (0, 480), + None, + None, + ), + ( + pytest.raises(ValueError), + """```json + [ + {"box_2d": [10, 20, 110, 120], "label": "cat"} + ] + ```""", + (640, -100), + None, + None, + ), + ], +) +def test_from_google_gemini_2_5( + exception, + result: str, + resolution_wh: Tuple[int, int], + classes: Optional[List[str]], + expected_results: Optional[ + Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray] + ], +): + with exception: + ( + xyxy, + class_id, + class_name, + confidence, + masks, + ) = from_google_gemini_2_5( + result=result, resolution_wh=resolution_wh, classes=classes + ) + + if expected_results is None: + return + + assert xyxy.shape == expected_results[0].shape + assert np.allclose(xyxy, expected_results[0]) + + assert class_id.shape == expected_results[1].shape + assert np.array_equal(class_id, expected_results[1]) + + assert class_name.shape == expected_results[2].shape + assert np.array_equal(class_name, expected_results[2]) + + if confidence is None: + assert expected_results[3] is None + else: + assert expected_results[3] is not None + assert confidence.shape == expected_results[3].shape + assert np.allclose(confidence, expected_results[3]) + + if masks is None: + assert expected_results[4] is None + else: + assert masks is not None + assert masks.shape == expected_results[4].shape + assert np.array_equal(masks, expected_results[4]) From 076f9e293f0b337f9c029d80dcc9589e9594f1f5 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 17:18:03 +0300 Subject: [PATCH 040/110] =?UTF-8?q?fix:=20=F0=9F=90=9E=20fix=20mask=20filt?= =?UTF-8?q?ering=20in=20from=5Fgoogle=5Fgemini=5F2=5F5=20to=20detect=20pro?= =?UTF-8?q?perly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/vlm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 1294b1d4..2d3806ec 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -557,10 +557,10 @@ def from_google_gemini_2_5( class_name = class_name[mask] class_id = np.array([classes.index(name) for name in class_name]) if masks_list is not None: - masks_list = [masks_list[i] for i, m in enumerate(mask) if m] + masks_list = [m for m, keep in zip(masks_list, mask) if keep] if confidence_list is not None: - confidence_list = [c for c, m in zip(confidence_list, mask) if m] + confidence_list = [c for c, keep in zip(confidence_list, mask) if keep] else: # When classes is None, generate class_id based on unique labels unique_labels = sorted(list(set(class_name))) From b87a504d22ab4caed31007b03dca2eae762dfa6e Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 17:26:59 +0300 Subject: [PATCH 041/110] =?UTF-8?q?fix:=20=F0=9F=90=9E=20remove=20GOOGLE?= =?UTF-8?q?=5FGEMINI=5F2=5F5=20from=20gemini=5F2=5F0=20check=20and=20only?= =?UTF-8?q?=20use=20new=20gemini=5F2=5F5=20func?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 2478721b..246ff288 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -1136,7 +1136,7 @@ class Detections: return cls(xyxy=xyxy, mask=mask, data=data) - if vlm == VLM.GOOGLE_GEMINI_2_0 or vlm == VLM.GOOGLE_GEMINI_2_5: + if vlm == VLM.GOOGLE_GEMINI_2_0: xyxy, class_id, class_name = from_google_gemini_2_0(result, **kwargs) data = {CLASS_NAME_DATA_FIELD: class_name} return cls(xyxy=xyxy, class_id=class_id, data=data) From 129eb89c20fe19c58ab5ee5fc306950ce1c893d2 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 17:29:25 +0300 Subject: [PATCH 042/110] =?UTF-8?q?fix:=20=F0=9F=90=9E=20add=20missing=20n?= =?UTF-8?q?ewline=20at=20end=20of=20extra.css=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/stylesheets/extra.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css index a341cda6..2910d5ff 100644 --- a/docs/stylesheets/extra.css +++ b/docs/stylesheets/extra.css @@ -267,4 +267,4 @@ th, td { .md-typeset__table table:not([class]) td, .md-typeset__table table:not([class]) th { padding: 10px; -} \ No newline at end of file +} From 9517987b7b427049747a1b3cd41d9f2549d70314 Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Mon, 14 Jul 2025 20:19:32 +0530 Subject: [PATCH 043/110] chore: make pre-commit happy --- supervision/detection/overlap_filter.py | 3 ++- supervision/detection/utils.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index b763cf2c..26edeaef 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -319,7 +319,8 @@ def group_overlapping_masks( predictions (npt.NDArray[np.float64]): An array of shape `(n, 5)` containing the bounding boxes coordinates in format `[x1, y1, x2, y2]` and the confidence scores. - masks (npt.NDArray[np.float64]): A 3D array of binary masks corresponding to the predictions. + masks (npt.NDArray[np.float64]): A 3D array of binary masks corresponding to + the predictions. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. Defaults to 0.5. match_metric (str): Metric used for matching detections in slices. diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index c700aeb0..b44cd2b6 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -185,7 +185,8 @@ def box_iou_batch( ) else: raise ValueError( - f"match_metric {match_metric} is not supported, only 'IOU' and 'IOS' are supported" + f"match_metric {match_metric} is not supported, " + "only 'IOU' and 'IOS' are supported" ) ious = np.nan_to_num(ious) @@ -237,7 +238,8 @@ def _mask_iou_batch_split( ) else: raise ValueError( - f"match_metric {match_metric} is not supported, only 'IOU' and 'IOS' are supported" + f"match_metric {match_metric} is not supported, " + "only 'IOU' and 'IOS' are supported" ) ious = np.nan_to_num(ious) From 2c63511af6243c5c7c77cd26eaf6cd4136bc7854 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 17:53:39 +0300 Subject: [PATCH 044/110] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20add=20usag?= =?UTF-8?q?e=20tips=20and=20examples=20for=20Google=20Gemini=202.5=20in=20?= =?UTF-8?q?core.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 176 ++++++++++++++++++++++++++++++++++ supervision/detection/vlm.py | 1 - 2 files changed, 176 insertions(+), 1 deletion(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 246ff288..677a0a12 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -901,8 +901,94 @@ class Detections: detections.xyxy # array([[543., 40., 728., 200.], [653., 352., 820., 522.]]) + detections.data + # {'class_name': array(['cat', 'dog'], dtype=' Date: Mon, 14 Jul 2025 14:57:21 +0000 Subject: [PATCH 045/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 677a0a12..4ecb98ba 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -923,7 +923,7 @@ class Detections: For each detected object, provide: - "label": exact class name from the list above - - "confidence": how certain you are (0.0 to 1.0) + - "confidence": how certain you are (0.0 to 1.0) - "box_2d": bounding box [ymin, xmin, ymax, xmax] normalized 0-1000 - "mask": binary mask of the object in the image, as a base64 encoded string @@ -938,7 +938,7 @@ class Detections: "mask": "..." }, { - "label": "kite", + "label": "kite", "confidence": 0.80, "box_2d": [50, 150, 250, 350], "mask": "..." @@ -996,7 +996,7 @@ class Detections: detections.class_id # array([0, 1]) ``` - + Examples: ```python @@ -1179,7 +1179,7 @@ class Detections: For each detected object, provide: - "label": exact class name from the list above - - "confidence": how certain you are (0.0 to 1.0) + - "confidence": how certain you are (0.0 to 1.0) - "box_2d": bounding box [ymin, xmin, ymax, xmax] normalized 0-1000 - "mask": binary mask of the object in the image, as a base64 encoded string @@ -1194,7 +1194,7 @@ class Detections: "mask": "..." }, { - "label": "kite", + "label": "kite", "confidence": 0.80, "box_2d": [50, 150, 250, 350], "mask": "..." From 8c4a1e5a5e7f585148f8c5b76334daf2ae954362 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 17:58:40 +0300 Subject: [PATCH 046/110] =?UTF-8?q?fix:=20=F0=9F=90=9E=20correct=20formatt?= =?UTF-8?q?ing=20and=20remove=20trailing=20whitespace=20in=20core.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 4ecb98ba..0ab7f03b 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -1029,7 +1029,7 @@ class Detections: # array([[1752.28, 818.82, 2165.72, 1229.14], # [1908.01, 1346.67, 2585.99, 2024.11]]) ``` - """ + """ # noqa: E501 # filler logic mapping old from_lmm to new from_vlm lmm_to_vlm = { @@ -1286,7 +1286,7 @@ class Detections: ``` - """ + """ # noqa: E501 vlm = validate_vlm_parameters(vlm, result, kwargs) if vlm == VLM.PALIGEMMA: From c2abb24c2641b0c4a2a7afe0ac2b83c0df9d806d Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 18:36:07 +0300 Subject: [PATCH 047/110] =?UTF-8?q?test:=20=F0=9F=A7=AA=20add=20test=20cas?= =?UTF-8?q?e=20for=20gemini=202.5=20segmentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/detection/test_vlm.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/detection/test_vlm.py b/test/detection/test_vlm.py index 2135600b..d18e03b4 100644 --- a/test/detection/test_vlm.py +++ b/test/detection/test_vlm.py @@ -1038,6 +1038,23 @@ def test_florence_2( None, None, ), + ( + does_not_raise(), + """```json + [ + {"box_2d": [10, 20, 110, 120], "mask": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAAAAACoWZBhAAAADElEQVR4nGNgoCcAAABuAAFIXXpjAAAAAElFTkSuQmCC", "label": "cat"} + ] + ```""", # noqa E501 // docs + (10, 10), + ["cat"], + ( + np.array([[0.2, 0.1, 1.2, 1.1]]), + np.array([0]), + np.array(["cat"]), + None, + np.array([np.zeros((10, 10), dtype=bool)]), + ), + ), ], ) def test_from_google_gemini_2_5( From d29fb8ad056cda3773a476fbf851522b9cff00c2 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 18:48:17 +0300 Subject: [PATCH 048/110] =?UTF-8?q?test:=20=F0=9F=A7=AA=20add=20test=20cas?= =?UTF-8?q?e=20for=20Google=20Gemini=202.5=20with=20sample=20JSON=20output?= =?UTF-8?q?=20for=202=20masks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/detection/test_vlm.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/detection/test_vlm.py b/test/detection/test_vlm.py index d18e03b4..6464c234 100644 --- a/test/detection/test_vlm.py +++ b/test/detection/test_vlm.py @@ -1055,6 +1055,26 @@ def test_florence_2( np.array([np.zeros((10, 10), dtype=bool)]), ), ), + ( + does_not_raise(), + """```json + [ + {"box_2d": [100, 100, 200, 200], "mask": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAAAAACoWZBhAAAADElEQVR4nGNgoCcAAABuAAFIXXpjAAAAAElFTkSuQmCC", "label": "cat", "confidence": 0.8}, + {"box_2d": [300, 300, 400, 400], "mask": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAAAAACoWZBhAAAADElEQVR4nGNgoCcAAABuAAFIXXpjAAAAAElFTkSuQmCC", "label": "dog", "confidence": 0.9} + ] + ```""", # noqa E501 // docs + (10, 10), + ["cat", "dog"], + ( + np.array([[1.0, 1.0, 2.0, 2.0], [3.0, 3.0, 4.0, 4.0]]), + np.array([0, 1]), + np.array(["cat", "dog"]), + np.array([0.8, 0.9]), + np.array( + [np.zeros((10, 10), dtype=bool), np.zeros((10, 10), dtype=bool)], + ), + ), + ), ], ) def test_from_google_gemini_2_5( From 328c34ab8bc0a10b6cd07ae7540e7d534aee47f9 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 19:59:44 +0300 Subject: [PATCH 049/110] =?UTF-8?q?feat:=20=E2=9C=A8=20add=20MOONDREAM=20e?= =?UTF-8?q?num=20and=20allowed=20arguments=20in=20VLM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/vlm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 09fa580d..664bb6f7 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -27,6 +27,7 @@ class LMM(Enum): QWEN_2_5_VL = "qwen_2_5_vl" GOOGLE_GEMINI_2_0 = "gemini_2_0" GOOGLE_GEMINI_2_5 = "gemini_2_5" + MOONDREAM = "moondream" class VLM(Enum): @@ -62,6 +63,7 @@ ALLOWED_ARGUMENTS: Dict[VLM, List[str]] = { VLM.QWEN_2_5_VL: ["input_wh", "resolution_wh", "classes"], VLM.GOOGLE_GEMINI_2_0: ["resolution_wh", "classes"], VLM.GOOGLE_GEMINI_2_5: ["resolution_wh", "classes"], + VLM.MOONDREAM: ["resolution_wh"], } SUPPORTED_TASKS_FLORENCE_2 = [ From 00fab37e58052f121b0c993b3b4053feed937b5b Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 20:12:11 +0300 Subject: [PATCH 050/110] =?UTF-8?q?feat:=20=F0=9F=9A=80=20dropping=20pytho?= =?UTF-8?q?n=203.8=20support=20and=20upgrade=20all=20codes=20to=20python3.?= =?UTF-8?q?9=20syntax=20style=20as=20min?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- .github/workflows/uv-test.yml | 2 +- .pre-commit-config.yaml | 6 ++ docs/stylesheets/extra.css | 2 +- .../count_people_in_zone/inference_example.py | 15 ++- .../ultralytics_example.py | 15 ++- .../time_in_zone/inference_file_example.py | 3 +- .../inference_naive_stream_example.py | 3 +- .../time_in_zone/inference_stream_example.py | 5 +- examples/time_in_zone/scripts/draw_zones.py | 4 +- .../time_in_zone/ultralytics_file_example.py | 3 +- .../ultralytics_naive_stream_example.py | 3 +- .../ultralytics_stream_example.py | 5 +- examples/time_in_zone/utils/general.py | 8 +- examples/time_in_zone/utils/timers.py | 5 +- .../traffic_analysis/inference_example.py | 15 +-- .../traffic_analysis/ultralytics_example.py | 15 +-- pyproject.toml | 9 +- supervision/annotators/core.py | 46 +++++----- supervision/annotators/utils.py | 8 +- supervision/assets/list.py | 3 +- supervision/classification/core.py | 6 +- supervision/dataset/core.py | 62 ++++++------- supervision/dataset/formats/coco.py | 26 +++--- supervision/dataset/formats/pascal_voc.py | 14 +-- supervision/dataset/formats/yolo.py | 26 +++--- supervision/dataset/utils.py | 20 ++-- supervision/detection/core.py | 53 +++++------ supervision/detection/line_zone.py | 27 +++--- supervision/detection/overlap_filter.py | 9 +- supervision/detection/tools/csv_sink.py | 22 ++--- .../detection/tools/inference_slicer.py | 22 ++--- supervision/detection/tools/json_sink.py | 18 ++-- supervision/detection/tools/polygon_zone.py | 3 +- supervision/detection/tools/transformers.py | 20 ++-- supervision/detection/utils.py | 50 +++++----- supervision/detection/vlm.py | 36 ++++---- supervision/draw/color.py | 15 ++- supervision/draw/utils.py | 6 +- supervision/geometry/core.py | 9 +- supervision/keypoint/annotators.py | 22 ++--- supervision/keypoint/core.py | 33 +++---- supervision/keypoint/skeletons.py | 9 +- supervision/metrics/core.py | 2 +- supervision/metrics/detection.py | 34 +++---- supervision/metrics/f1_score.py | 28 +++--- supervision/metrics/mean_average_precision.py | 56 +++++------ supervision/metrics/mean_average_recall.py | 30 +++--- supervision/metrics/precision.py | 28 +++--- supervision/metrics/recall.py | 28 +++--- supervision/tracker/byte_tracker/core.py | 20 ++-- .../tracker/byte_tracker/kalman_filter.py | 12 +-- supervision/tracker/byte_tracker/matching.py | 10 +- .../byte_tracker/single_object_track.py | 3 +- supervision/utils/conversion.py | 3 +- supervision/utils/file.py | 22 ++--- supervision/utils/image.py | 92 +++++++++---------- supervision/utils/internal.py | 28 +++--- supervision/utils/iterables.py | 9 +- supervision/utils/notebook.py | 12 +-- supervision/utils/video.py | 15 +-- supervision/validators/__init__.py | 6 +- test/classification/test_core.py | 4 +- test/dataset/formats/test_coco.py | 24 ++--- test/dataset/formats/test_pascal_voc.py | 4 +- test/dataset/formats/test_yolo.py | 12 +-- test/dataset/test_core.py | 4 +- test/dataset/test_utils.py | 20 ++-- test/detection/test_core.py | 6 +- test/detection/test_csv.py | 16 ++-- test/detection/test_json.py | 10 +- test/detection/test_line_counter.py | 46 +++++----- test/detection/test_overlap_filter.py | 4 +- test/detection/test_utils.py | 20 ++-- test/detection/test_vlm.py | 26 +++--- test/detection/tools/test_inference_slicer.py | 16 ++-- test/test_utils.py | 22 ++--- test/tracker/test_byte_tracker.py | 4 +- test/utils/conftest.py | 9 +- test/utils/test_file.py | 4 +- test/utils/test_image.py | 20 ++-- test/utils/test_internal.py | 4 +- 81 files changed, 690 insertions(+), 706 deletions(-) diff --git a/.github/workflows/uv-test.yml b/.github/workflows/uv-test.yml index 59904ae9..1aa2882e 100644 --- a/.github/workflows/uv-test.yml +++ b/.github/workflows/uv-test.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] runs-on: ${{ matrix.os }} steps: - name: 📥 Checkout the repository diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7efab7c7..69a30f2e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -53,3 +53,9 @@ repos: - id: codespell additional_dependencies: - tomli + + + - repo: https://github.com/venomlab/pyproject-pyupgrade + rev: v0.1.1 + hooks: + - id: ppyupgrade diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css index a341cda6..2910d5ff 100644 --- a/docs/stylesheets/extra.css +++ b/docs/stylesheets/extra.css @@ -267,4 +267,4 @@ th, td { .md-typeset__table table:not([class]) td, .md-typeset__table table:not([class]) th { padding: 10px; -} \ No newline at end of file +} diff --git a/examples/count_people_in_zone/inference_example.py b/examples/count_people_in_zone/inference_example.py index 38018c16..2225594f 100644 --- a/examples/count_people_in_zone/inference_example.py +++ b/examples/count_people_in_zone/inference_example.py @@ -1,7 +1,6 @@ import argparse import json import os -from typing import List, Tuple import cv2 import numpy as np @@ -14,7 +13,7 @@ import supervision as sv COLORS = sv.ColorPalette.DEFAULT -def load_zones_config(file_path: str) -> List[np.ndarray]: +def load_zones_config(file_path: str) -> list[np.ndarray]: """ Load polygon zone configurations from a JSON file. @@ -28,14 +27,14 @@ def load_zones_config(file_path: str) -> List[np.ndarray]: Returns: List[np.ndarray]: A list of polygons, each represented as a NumPy array. """ - with open(file_path, "r") as file: + with open(file_path) as file: data = json.load(file) return [np.array(polygon, np.int32) for polygon in data["polygons"]] def initiate_annotators( - polygons: List[np.ndarray], resolution_wh: Tuple[int, int] -) -> Tuple[List[sv.PolygonZone], List[sv.PolygonZoneAnnotator], List[sv.BoxAnnotator]]: + polygons: list[np.ndarray], resolution_wh: tuple[int, int] +) -> tuple[list[sv.PolygonZone], list[sv.PolygonZoneAnnotator], list[sv.BoxAnnotator]]: line_thickness = sv.calculate_optimal_line_thickness(resolution_wh=resolution_wh) text_scale = sv.calculate_optimal_text_scale(resolution_wh=resolution_wh) @@ -93,9 +92,9 @@ def detect( def annotate( frame: np.ndarray, - zones: List[sv.PolygonZone], - zone_annotators: List[sv.PolygonZoneAnnotator], - box_annotators: List[sv.BoxAnnotator], + zones: list[sv.PolygonZone], + zone_annotators: list[sv.PolygonZoneAnnotator], + box_annotators: list[sv.BoxAnnotator], detections: sv.Detections, ) -> np.ndarray: """ diff --git a/examples/count_people_in_zone/ultralytics_example.py b/examples/count_people_in_zone/ultralytics_example.py index 04169597..f18acfb2 100644 --- a/examples/count_people_in_zone/ultralytics_example.py +++ b/examples/count_people_in_zone/ultralytics_example.py @@ -1,6 +1,5 @@ import argparse import json -from typing import List, Tuple import cv2 import numpy as np @@ -12,7 +11,7 @@ import supervision as sv COLORS = sv.ColorPalette.DEFAULT -def load_zones_config(file_path: str) -> List[np.ndarray]: +def load_zones_config(file_path: str) -> list[np.ndarray]: """ Load polygon zone configurations from a JSON file. @@ -26,14 +25,14 @@ def load_zones_config(file_path: str) -> List[np.ndarray]: Returns: List[np.ndarray]: A list of polygons, each represented as a NumPy array. """ - with open(file_path, "r") as file: + with open(file_path) as file: data = json.load(file) return [np.array(polygon, np.int32) for polygon in data["polygons"]] def initiate_annotators( - polygons: List[np.ndarray], resolution_wh: Tuple[int, int] -) -> Tuple[List[sv.PolygonZone], List[sv.PolygonZoneAnnotator], List[sv.BoxAnnotator]]: + polygons: list[np.ndarray], resolution_wh: tuple[int, int] +) -> tuple[list[sv.PolygonZone], list[sv.PolygonZoneAnnotator], list[sv.BoxAnnotator]]: line_thickness = sv.calculate_optimal_line_thickness(resolution_wh=resolution_wh) text_scale = sv.calculate_optimal_text_scale(resolution_wh=resolution_wh) @@ -90,9 +89,9 @@ def detect( def annotate( frame: np.ndarray, - zones: List[sv.PolygonZone], - zone_annotators: List[sv.PolygonZoneAnnotator], - box_annotators: List[sv.BoxAnnotator], + zones: list[sv.PolygonZone], + zone_annotators: list[sv.PolygonZoneAnnotator], + box_annotators: list[sv.BoxAnnotator], detections: sv.Detections, ) -> np.ndarray: """ diff --git a/examples/time_in_zone/inference_file_example.py b/examples/time_in_zone/inference_file_example.py index f4955464..6dcaf353 100644 --- a/examples/time_in_zone/inference_file_example.py +++ b/examples/time_in_zone/inference_file_example.py @@ -1,5 +1,4 @@ import argparse -from typing import List import cv2 import numpy as np @@ -22,7 +21,7 @@ def main( model_id: str, confidence: float, iou: float, - classes: List[int], + classes: list[int], ) -> None: model = get_model(model_id=model_id) tracker = sv.ByteTrack(minimum_matching_threshold=0.5) diff --git a/examples/time_in_zone/inference_naive_stream_example.py b/examples/time_in_zone/inference_naive_stream_example.py index 21880269..98f60d9d 100644 --- a/examples/time_in_zone/inference_naive_stream_example.py +++ b/examples/time_in_zone/inference_naive_stream_example.py @@ -1,5 +1,4 @@ import argparse -from typing import List import cv2 import numpy as np @@ -22,7 +21,7 @@ def main( model_id: str, confidence: float, iou: float, - classes: List[int], + classes: list[int], ) -> None: model = get_model(model_id=model_id) tracker = sv.ByteTrack(minimum_matching_threshold=0.5) diff --git a/examples/time_in_zone/inference_stream_example.py b/examples/time_in_zone/inference_stream_example.py index 0dfdf660..91056d13 100644 --- a/examples/time_in_zone/inference_stream_example.py +++ b/examples/time_in_zone/inference_stream_example.py @@ -1,5 +1,4 @@ import argparse -from typing import List import cv2 import numpy as np @@ -18,7 +17,7 @@ LABEL_ANNOTATOR = sv.LabelAnnotator( class CustomSink: - def __init__(self, zone_configuration_path: str, classes: List[int]): + def __init__(self, zone_configuration_path: str, classes: list[int]): self.classes = classes self.tracker = sv.ByteTrack(minimum_matching_threshold=0.5) self.fps_monitor = sv.FPSMonitor() @@ -83,7 +82,7 @@ def main( model_id: str, confidence: float, iou: float, - classes: List[int], + classes: list[int], ) -> None: sink = CustomSink(zone_configuration_path=zone_configuration_path, classes=classes) diff --git a/examples/time_in_zone/scripts/draw_zones.py b/examples/time_in_zone/scripts/draw_zones.py index 3afae9e7..0e09a865 100644 --- a/examples/time_in_zone/scripts/draw_zones.py +++ b/examples/time_in_zone/scripts/draw_zones.py @@ -1,7 +1,7 @@ import argparse import json import os -from typing import Any, Optional, Tuple +from typing import Any, Optional import cv2 import numpy as np @@ -19,7 +19,7 @@ COLORS = sv.ColorPalette.DEFAULT WINDOW_NAME = "Draw Zones" POLYGONS = [[]] -current_mouse_position: Optional[Tuple[int, int]] = None +current_mouse_position: Optional[tuple[int, int]] = None def resolve_source(source_path: str) -> Optional[np.ndarray]: diff --git a/examples/time_in_zone/ultralytics_file_example.py b/examples/time_in_zone/ultralytics_file_example.py index b470b7a3..1b83108d 100644 --- a/examples/time_in_zone/ultralytics_file_example.py +++ b/examples/time_in_zone/ultralytics_file_example.py @@ -1,5 +1,4 @@ import argparse -from typing import List import cv2 import numpy as np @@ -23,7 +22,7 @@ def main( device: str, confidence: float, iou: float, - classes: List[int], + classes: list[int], ) -> None: model = YOLO(weights) tracker = sv.ByteTrack(minimum_matching_threshold=0.5) diff --git a/examples/time_in_zone/ultralytics_naive_stream_example.py b/examples/time_in_zone/ultralytics_naive_stream_example.py index d6922143..58abc210 100644 --- a/examples/time_in_zone/ultralytics_naive_stream_example.py +++ b/examples/time_in_zone/ultralytics_naive_stream_example.py @@ -1,5 +1,4 @@ import argparse -from typing import List import cv2 import numpy as np @@ -23,7 +22,7 @@ def main( device: str, confidence: float, iou: float, - classes: List[int], + classes: list[int], ) -> None: model = YOLO(weights) tracker = sv.ByteTrack(minimum_matching_threshold=0.5) diff --git a/examples/time_in_zone/ultralytics_stream_example.py b/examples/time_in_zone/ultralytics_stream_example.py index 8b8ecd60..ca5000a4 100644 --- a/examples/time_in_zone/ultralytics_stream_example.py +++ b/examples/time_in_zone/ultralytics_stream_example.py @@ -1,5 +1,4 @@ import argparse -from typing import List import cv2 import numpy as np @@ -19,7 +18,7 @@ LABEL_ANNOTATOR = sv.LabelAnnotator( class CustomSink: - def __init__(self, zone_configuration_path: str, classes: List[int]): + def __init__(self, zone_configuration_path: str, classes: list[int]): self.classes = classes self.tracker = sv.ByteTrack(minimum_matching_threshold=0.8) self.fps_monitor = sv.FPSMonitor() @@ -84,7 +83,7 @@ def main( device: str, confidence: float, iou: float, - classes: List[int], + classes: list[int], ) -> None: model = YOLO(weights) diff --git a/examples/time_in_zone/utils/general.py b/examples/time_in_zone/utils/general.py index 803d116a..a40b36cc 100644 --- a/examples/time_in_zone/utils/general.py +++ b/examples/time_in_zone/utils/general.py @@ -1,11 +1,11 @@ import json -from typing import Generator, List +from collections.abc import Generator import cv2 import numpy as np -def load_zones_config(file_path: str) -> List[np.ndarray]: +def load_zones_config(file_path: str) -> list[np.ndarray]: """ Load polygon zone configurations from a JSON file. @@ -19,12 +19,12 @@ def load_zones_config(file_path: str) -> List[np.ndarray]: Returns: List[np.ndarray]: A list of polygons, each represented as a NumPy array. """ - with open(file_path, "r") as file: + with open(file_path) as file: data = json.load(file) return [np.array(polygon, np.int32) for polygon in data] -def find_in_list(array: np.ndarray, search_list: List[int]) -> np.ndarray: +def find_in_list(array: np.ndarray, search_list: list[int]) -> np.ndarray: """Determines if elements of a numpy array are present in a list. Args: diff --git a/examples/time_in_zone/utils/timers.py b/examples/time_in_zone/utils/timers.py index 7afa9af3..f5bef51c 100644 --- a/examples/time_in_zone/utils/timers.py +++ b/examples/time_in_zone/utils/timers.py @@ -1,5 +1,4 @@ from datetime import datetime -from typing import Dict import numpy as np @@ -26,7 +25,7 @@ class FPSBasedTimer: """ self.fps = fps self.frame_id = 0 - self.tracker_id2frame_id: Dict[int, int] = {} + self.tracker_id2frame_id: dict[int, int] = {} def tick(self, detections: sv.Detections) -> np.ndarray: """Processes the current frame, updating time durations for each tracker. @@ -63,7 +62,7 @@ class ClockBasedTimer: def __init__(self) -> None: """Initializes the ClockBasedTimer.""" - self.tracker_id2start_time: Dict[int, datetime] = {} + self.tracker_id2start_time: dict[int, datetime] = {} def tick(self, detections: sv.Detections) -> np.ndarray: """Processes the current frame, updating time durations for each tracker. diff --git a/examples/traffic_analysis/inference_example.py b/examples/traffic_analysis/inference_example.py index d98abcc5..6cd4e4bd 100644 --- a/examples/traffic_analysis/inference_example.py +++ b/examples/traffic_analysis/inference_example.py @@ -1,6 +1,7 @@ import argparse import os -from typing import Dict, Iterable, List, Optional, Set +from collections.abc import Iterable +from typing import Optional import cv2 import numpy as np @@ -29,14 +30,14 @@ ZONE_OUT_POLYGONS = [ class DetectionsManager: def __init__(self) -> None: - self.tracker_id_to_zone_id: Dict[int, int] = {} - self.counts: Dict[int, Dict[int, Set[int]]] = {} + self.tracker_id_to_zone_id: dict[int, int] = {} + self.counts: dict[int, dict[int, set[int]]] = {} def update( self, detections_all: sv.Detections, - detections_in_zones: List[sv.Detections], - detections_out_zones: List[sv.Detections], + detections_in_zones: list[sv.Detections], + detections_out_zones: list[sv.Detections], ) -> sv.Detections: for zone_in_id, detections_in_zone in enumerate(detections_in_zones): for tracker_id in detections_in_zone.tracker_id: @@ -59,9 +60,9 @@ class DetectionsManager: def initiate_polygon_zones( - polygons: List[np.ndarray], + polygons: list[np.ndarray], triggering_anchors: Iterable[sv.Position] = [sv.Position.CENTER], -) -> List[sv.PolygonZone]: +) -> list[sv.PolygonZone]: return [ sv.PolygonZone( polygon=polygon, diff --git a/examples/traffic_analysis/ultralytics_example.py b/examples/traffic_analysis/ultralytics_example.py index 269967f5..4beb1826 100644 --- a/examples/traffic_analysis/ultralytics_example.py +++ b/examples/traffic_analysis/ultralytics_example.py @@ -1,5 +1,6 @@ import argparse -from typing import Dict, Iterable, List, Optional, Set +from collections.abc import Iterable +from typing import Optional import cv2 import numpy as np @@ -27,14 +28,14 @@ ZONE_OUT_POLYGONS = [ class DetectionsManager: def __init__(self) -> None: - self.tracker_id_to_zone_id: Dict[int, int] = {} - self.counts: Dict[int, Dict[int, Set[int]]] = {} + self.tracker_id_to_zone_id: dict[int, int] = {} + self.counts: dict[int, dict[int, set[int]]] = {} def update( self, detections_all: sv.Detections, - detections_in_zones: List[sv.Detections], - detections_out_zones: List[sv.Detections], + detections_in_zones: list[sv.Detections], + detections_out_zones: list[sv.Detections], ) -> sv.Detections: for zone_in_id, detections_in_zone in enumerate(detections_in_zones): for tracker_id in detections_in_zone.tracker_id: @@ -57,9 +58,9 @@ class DetectionsManager: def initiate_polygon_zones( - polygons: List[np.ndarray], + polygons: list[np.ndarray], triggering_anchors: Iterable[sv.Position] = [sv.Position.CENTER], -) -> List[sv.PolygonZone]: +) -> list[sv.PolygonZone]: return [ sv.PolygonZone( polygon=polygon, diff --git a/pyproject.toml b/pyproject.toml index 30e0afb7..aa5a387e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ description = "A set of easy-to-use utils that will come in handy in any Compute license = { text = "MIT" } version = "0.26.0rc7" readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.9" authors = [ { name = "Piotr Skalski", email = "piotr.skalski92@gmail.com" } ] @@ -75,7 +75,7 @@ docs = [ "mkdocstrings-python>=1.10.9", "mike>=2.0.0", "mkdocs-jupyter>=0.24.3", - "mkdocs-git-committers-plugin-2>=2.4.1; python_version >= '3.8' and python_version < '4'", + "mkdocs-git-committers-plugin-2>=2.4.1; python_version >= '3.9' and python_version < '4'", "mkdocs-git-revision-date-localized-plugin>=1.2.4" ] build = [ @@ -93,7 +93,7 @@ check = true imports = ["cv2", "supervision"] [tool.ruff] -target-version = "py38" +target-version = "py39" # Exclude a variety of commonly ignored directories. exclude = [ @@ -220,6 +220,9 @@ count = true quiet-level = 3 ignore-words-list = "STrack,sTrack,strack" +[tool.pyupgrade] +py39-plus = true + [tool.setuptools] include-package-data = false diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index b5395737..44c643c8 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1,6 +1,6 @@ from functools import lru_cache from math import sqrt -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import cv2 import numpy as np @@ -1010,7 +1010,7 @@ class LabelAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - labels: Optional[List[str]] = None, + labels: Optional[list[str]] = None, custom_color_lookup: Optional[np.ndarray] = None, ) -> ImageType: """ @@ -1075,7 +1075,7 @@ class LabelAnnotator(BaseAnnotator): return scene - def _validate_labels(self, labels: Optional[List[str]], detections: Detections): + def _validate_labels(self, labels: Optional[list[str]], detections: Detections): if labels is not None and len(labels) != len(detections): raise ValueError( f"The number of labels ({len(labels)}) does not match the " @@ -1086,7 +1086,7 @@ class LabelAnnotator(BaseAnnotator): def _get_label_properties( self, detections: Detections, - labels: List[str], + labels: list[str], ) -> np.ndarray: """ Calculate the numerical properties required to draw the labels on the image. @@ -1128,8 +1128,8 @@ class LabelAnnotator(BaseAnnotator): @staticmethod def _get_labels_text( - detections: Detections, custom_labels: Optional[List[str]] - ) -> List[str]: + detections: Detections, custom_labels: Optional[list[str]] + ) -> list[str]: if custom_labels is not None: return [str(label) for label in custom_labels] @@ -1146,7 +1146,7 @@ class LabelAnnotator(BaseAnnotator): def _draw_labels( self, scene: np.ndarray, - labels: List[str], + labels: list[str], label_properties: np.ndarray, detections: Detections, custom_color_lookup: Optional[np.ndarray], @@ -1202,8 +1202,8 @@ class LabelAnnotator(BaseAnnotator): @staticmethod def draw_rounded_rectangle( scene: np.ndarray, - xyxy: Tuple[int, int, int, int], - color: Tuple[int, int, int], + xyxy: tuple[int, int, int, int], + color: tuple[int, int, int], border_radius: int, ) -> np.ndarray: x1, y1, x2, y2 = xyxy @@ -1291,7 +1291,7 @@ class RichLabelAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - labels: Optional[List[str]] = None, + labels: Optional[list[str]] = None, custom_color_lookup: Optional[np.ndarray] = None, ) -> ImageType: """ @@ -1355,7 +1355,7 @@ class RichLabelAnnotator(BaseAnnotator): return scene - def _validate_labels(self, labels: Optional[List[str]], detections: Detections): + def _validate_labels(self, labels: Optional[list[str]], detections: Detections): if labels is not None and len(labels) != len(detections): raise ValueError( f"The number of labels ({len(labels)}) does not match the " @@ -1364,7 +1364,7 @@ class RichLabelAnnotator(BaseAnnotator): ) def _get_label_properties( - self, draw, detections: Detections, labels: List[str] + self, draw, detections: Detections, labels: list[str] ) -> np.ndarray: """ Calculate the numerical properties required to draw the labels on the image. @@ -1402,8 +1402,8 @@ class RichLabelAnnotator(BaseAnnotator): @staticmethod def _get_labels_text( - detections: Detections, custom_labels: Optional[List[str]] - ) -> List[str]: + detections: Detections, custom_labels: Optional[list[str]] + ) -> list[str]: if custom_labels is not None: return custom_labels @@ -1420,7 +1420,7 @@ class RichLabelAnnotator(BaseAnnotator): def _draw_labels( self, draw, - labels: List[str], + labels: list[str], label_properties: np.ndarray, detections: Detections, custom_color_lookup: Optional[np.ndarray], @@ -1494,9 +1494,9 @@ class IconAnnotator(BaseAnnotator): def __init__( self, - icon_resolution_wh: Tuple[int, int] = (64, 64), + icon_resolution_wh: tuple[int, int] = (64, 64), icon_position: Position = Position.TOP_CENTER, - offset_xy: Tuple[int, int] = (0, 0), + offset_xy: tuple[int, int] = (0, 0), ): """ Args: @@ -1512,7 +1512,7 @@ class IconAnnotator(BaseAnnotator): @ensure_cv2_image_for_annotation def annotate( - self, scene: ImageType, detections: Detections, icon_path: Union[str, List[str]] + self, scene: ImageType, detections: Detections, icon_path: Union[str, list[str]] ) -> ImageType: """ Annotates the given scene with given icons. @@ -2322,8 +2322,8 @@ class PercentageBarAnnotator(BaseAnnotator): @staticmethod def calculate_border_coordinates( - anchor_xy: Tuple[int, int], border_wh: Tuple[int, int], position: Position - ) -> Tuple[Tuple[int, int], Tuple[int, int]]: + anchor_xy: tuple[int, int], border_wh: tuple[int, int], position: Position + ) -> tuple[tuple[int, int], tuple[int, int]]: cx, cy = anchor_xy width, height = border_wh @@ -2351,7 +2351,7 @@ class PercentageBarAnnotator(BaseAnnotator): @staticmethod def validate_custom_values( - custom_values: Optional[Union[np.ndarray, List[float]]], detections: Detections + custom_values: Optional[Union[np.ndarray, list[float]]], detections: Detections ) -> None: if custom_values is None: if detections.confidence is None: @@ -2485,8 +2485,8 @@ class CropAnnotator(BaseAnnotator): @staticmethod def calculate_crop_coordinates( - anchor: Tuple[int, int], crop_wh: Tuple[int, int], position: Position - ) -> Tuple[Tuple[int, int], Tuple[int, int]]: + anchor: tuple[int, int], crop_wh: tuple[int, int], position: Position + ) -> tuple[tuple[int, int], tuple[int, int]]: anchor_x, anchor_y = anchor width, height = crop_wh diff --git a/supervision/annotators/utils.py b/supervision/annotators/utils.py index 74d25a65..7cdfc890 100644 --- a/supervision/annotators/utils.py +++ b/supervision/annotators/utils.py @@ -1,5 +1,5 @@ from enum import Enum -from typing import Optional, Tuple, Union +from typing import Optional, Union import numpy as np @@ -70,10 +70,10 @@ def resolve_color_idx( def resolve_text_background_xyxy( - center_coordinates: Tuple[int, int], - text_wh: Tuple[int, int], + center_coordinates: tuple[int, int], + text_wh: tuple[int, int], position: Position, -) -> Tuple[int, int, int, int]: +) -> tuple[int, int, int, int]: center_x, center_y = center_coordinates text_w, text_h = text_wh diff --git a/supervision/assets/list.py b/supervision/assets/list.py index 926adeba..01bdadc3 100644 --- a/supervision/assets/list.py +++ b/supervision/assets/list.py @@ -1,5 +1,4 @@ from enum import Enum -from typing import Dict, Tuple BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" @@ -39,7 +38,7 @@ class VideoAssets(Enum): return list(map(lambda c: c.value, cls)) -VIDEO_ASSETS: Dict[str, Tuple[str, str]] = { +VIDEO_ASSETS: dict[str, tuple[str, str]] = { VideoAssets.VEHICLES.value: ( f"{BASE_VIDEO_URL}{VideoAssets.VEHICLES.value}", "8155ff4e4de08cfa25f39de96483f918", diff --git a/supervision/classification/core.py b/supervision/classification/core.py index df4b1be0..184a67fe 100644 --- a/supervision/classification/core.py +++ b/supervision/classification/core.py @@ -1,7 +1,7 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Optional, Tuple +from typing import Any import numpy as np @@ -28,7 +28,7 @@ def _validate_confidence(confidence: Any, n: int) -> None: @dataclass class Classifications: class_id: np.ndarray - confidence: Optional[np.ndarray] = None + confidence: np.ndarray | None = None def __post_init__(self) -> None: """ @@ -154,7 +154,7 @@ class Classifications: class_id = np.arange(len(confidence)) return cls(class_id=class_id, confidence=confidence) - def get_top_k(self, k: int) -> Tuple[np.ndarray, np.ndarray]: + def get_top_k(self, k: int) -> tuple[np.ndarray, np.ndarray]: """ Retrieve the top k class IDs and confidences, ordered in descending order by confidence. diff --git a/supervision/dataset/core.py b/supervision/dataset/core.py index be72128b..0d5d5e9f 100644 --- a/supervision/dataset/core.py +++ b/supervision/dataset/core.py @@ -2,10 +2,10 @@ from __future__ import annotations import os from abc import ABC, abstractmethod +from collections.abc import Iterator from dataclasses import dataclass from itertools import chain from pathlib import Path -from typing import Dict, Iterator, List, Optional, Tuple, Union import cv2 import numpy as np @@ -45,9 +45,9 @@ class BaseDataset(ABC): def split( self, split_ratio: float = 0.8, - random_state: Optional[int] = None, + random_state: int | None = None, shuffle: bool = True, - ) -> Tuple[BaseDataset, BaseDataset]: + ) -> tuple[BaseDataset, BaseDataset]: pass @@ -71,9 +71,9 @@ class DetectionDataset(BaseDataset): def __init__( self, - classes: List[str], - images: Union[List[str], Dict[str, np.ndarray]], - annotations: Dict[str, Detections], + classes: list[str], + images: list[str] | dict[str, np.ndarray], + annotations: dict[str, Detections], ) -> None: self.classes = classes @@ -86,7 +86,7 @@ class DetectionDataset(BaseDataset): # Eliminate duplicates while preserving order self.image_paths = list(dict.fromkeys(images)) - self._images_in_memory: Dict[str, np.ndarray] = {} + self._images_in_memory: dict[str, np.ndarray] = {} def _get_image(self, image_path: str) -> np.ndarray: """Assumes that image is in dataset""" @@ -97,7 +97,7 @@ class DetectionDataset(BaseDataset): def __len__(self) -> int: return len(self._images_in_memory) or len(self.image_paths) - def __getitem__(self, i: int) -> Tuple[str, np.ndarray, Detections]: + def __getitem__(self, i: int) -> tuple[str, np.ndarray, Detections]: """ Returns: Tuple[str, np.ndarray, Detections]: The image path, image data, @@ -108,7 +108,7 @@ class DetectionDataset(BaseDataset): annotation = self.annotations[image_path] return image_path, image, annotation - def __iter__(self) -> Iterator[Tuple[str, np.ndarray, Detections]]: + def __iter__(self) -> Iterator[tuple[str, np.ndarray, Detections]]: """ Iterate over the images and annotations in the dataset. @@ -146,9 +146,9 @@ class DetectionDataset(BaseDataset): def split( self, split_ratio: float = 0.8, - random_state: Optional[int] = None, + random_state: int | None = None, shuffle: bool = True, - ) -> Tuple[DetectionDataset, DetectionDataset]: + ) -> tuple[DetectionDataset, DetectionDataset]: """ Splits the dataset into two parts (training and testing) using the provided split_ratio. @@ -182,8 +182,8 @@ class DetectionDataset(BaseDataset): shuffle=shuffle, ) - train_input: Union[List[str], Dict[str, np.ndarray]] - test_input: Union[List[str], Dict[str, np.ndarray]] + train_input: list[str] | dict[str, np.ndarray] + test_input: list[str] | dict[str, np.ndarray] if self._images_in_memory: train_input = {path: self._images_in_memory[path] for path in train_paths} test_input = {path: self._images_in_memory[path] for path in test_paths} @@ -206,7 +206,7 @@ class DetectionDataset(BaseDataset): return train_dataset, test_dataset @classmethod - def merge(cls, dataset_list: List[DetectionDataset]) -> DetectionDataset: + def merge(cls, dataset_list: list[DetectionDataset]) -> DetectionDataset: """ Merge a list of `DetectionDataset` objects into a single `DetectionDataset` object. @@ -300,8 +300,8 @@ class DetectionDataset(BaseDataset): def as_pascal_voc( self, - images_directory_path: Optional[str] = None, - annotations_directory_path: Optional[str] = None, + images_directory_path: str | None = None, + annotations_directory_path: str | None = None, min_image_area_percentage: float = 0.0, max_image_area_percentage: float = 1.0, approximation_percentage: float = 0.0, @@ -474,9 +474,9 @@ class DetectionDataset(BaseDataset): def as_yolo( self, - images_directory_path: Optional[str] = None, - annotations_directory_path: Optional[str] = None, - data_yaml_path: Optional[str] = None, + images_directory_path: str | None = None, + annotations_directory_path: str | None = None, + data_yaml_path: str | None = None, min_image_area_percentage: float = 0.0, max_image_area_percentage: float = 1.0, approximation_percentage: float = 0.0, @@ -575,8 +575,8 @@ class DetectionDataset(BaseDataset): def as_coco( self, - images_directory_path: Optional[str] = None, - annotations_path: Optional[str] = None, + images_directory_path: str | None = None, + annotations_path: str | None = None, min_image_area_percentage: float = 0.0, max_image_area_percentage: float = 1.0, approximation_percentage: float = 0.0, @@ -647,9 +647,9 @@ class ClassificationDataset(BaseDataset): def __init__( self, - classes: List[str], - images: Union[List[str], Dict[str, np.ndarray]], - annotations: Dict[str, Classifications], + classes: list[str], + images: list[str] | dict[str, np.ndarray], + annotations: dict[str, Classifications], ) -> None: self.classes = classes @@ -662,7 +662,7 @@ class ClassificationDataset(BaseDataset): # Eliminate duplicates while preserving order self.image_paths = list(dict.fromkeys(images)) - self._images_in_memory: Dict[str, np.ndarray] = {} + self._images_in_memory: dict[str, np.ndarray] = {} if isinstance(images, dict): self._images_in_memory = images warn_deprecated( @@ -680,7 +680,7 @@ class ClassificationDataset(BaseDataset): def __len__(self) -> int: return len(self._images_in_memory) or len(self.image_paths) - def __getitem__(self, i: int) -> Tuple[str, np.ndarray, Classifications]: + def __getitem__(self, i: int) -> tuple[str, np.ndarray, Classifications]: """ Returns: Tuple[str, np.ndarray, Classifications]: The image path, image data, @@ -691,7 +691,7 @@ class ClassificationDataset(BaseDataset): annotation = self.annotations[image_path] return image_path, image, annotation - def __iter__(self) -> Iterator[Tuple[str, np.ndarray, Classifications]]: + def __iter__(self) -> Iterator[tuple[str, np.ndarray, Classifications]]: """ Iterate over the images and annotations in the dataset. @@ -729,9 +729,9 @@ class ClassificationDataset(BaseDataset): def split( self, split_ratio: float = 0.8, - random_state: Optional[int] = None, + random_state: int | None = None, shuffle: bool = True, - ) -> Tuple[ClassificationDataset, ClassificationDataset]: + ) -> tuple[ClassificationDataset, ClassificationDataset]: """ Splits the dataset into two parts (training and testing) using the provided split_ratio. @@ -764,8 +764,8 @@ class ClassificationDataset(BaseDataset): shuffle=shuffle, ) - train_input: Union[List[str], Dict[str, np.ndarray]] - test_input: Union[List[str], Dict[str, np.ndarray]] + train_input: list[str] | dict[str, np.ndarray] + test_input: list[str] | dict[str, np.ndarray] if self._images_in_memory: train_input = {path: self._images_in_memory[path] for path in train_paths} test_input = {path: self._images_in_memory[path] for path in test_paths} diff --git a/supervision/dataset/formats/coco.py b/supervision/dataset/formats/coco.py index 879ecfb2..ab032d47 100644 --- a/supervision/dataset/formats/coco.py +++ b/supervision/dataset/formats/coco.py @@ -1,7 +1,7 @@ import os from datetime import datetime from pathlib import Path -from typing import TYPE_CHECKING, Dict, List, Tuple +from typing import TYPE_CHECKING import numpy as np import numpy.typing as npt @@ -24,7 +24,7 @@ if TYPE_CHECKING: from supervision.dataset.core import DetectionDataset -def coco_categories_to_classes(coco_categories: List[dict]) -> List[str]: +def coco_categories_to_classes(coco_categories: list[dict]) -> list[str]: return [ category["name"] for category in sorted(coco_categories, key=lambda category: category["id"]) @@ -32,8 +32,8 @@ def coco_categories_to_classes(coco_categories: List[dict]) -> List[str]: def build_coco_class_index_mapping( - coco_categories: List[dict], target_classes: List[str] -) -> Dict[int, int]: + coco_categories: list[dict], target_classes: list[str] +) -> dict[int, int]: source_class_to_index = { category["name"]: category["id"] for category in coco_categories } @@ -43,7 +43,7 @@ def build_coco_class_index_mapping( } -def classes_to_coco_categories(classes: List[str]) -> List[dict]: +def classes_to_coco_categories(classes: list[str]) -> list[dict]: return [ { "id": class_id, @@ -55,8 +55,8 @@ def classes_to_coco_categories(classes: List[str]) -> List[dict]: def group_coco_annotations_by_image_id( - coco_annotations: List[dict], -) -> Dict[int, List[dict]]: + coco_annotations: list[dict], +) -> dict[int, list[dict]]: annotations = {} for annotation in coco_annotations: image_id = annotation["image_id"] @@ -67,7 +67,7 @@ def group_coco_annotations_by_image_id( def coco_annotations_to_masks( - image_annotations: List[dict], resolution_wh: Tuple[int, int] + image_annotations: list[dict], resolution_wh: tuple[int, int] ) -> npt.NDArray[np.bool_]: return np.array( [ @@ -90,8 +90,8 @@ def coco_annotations_to_masks( def coco_annotations_to_detections( - image_annotations: List[dict], - resolution_wh: Tuple[int, int], + image_annotations: list[dict], + resolution_wh: tuple[int, int], with_masks: bool, use_iscrowd: bool = True, ) -> Detections: @@ -134,7 +134,7 @@ def detections_to_coco_annotations( min_image_area_percentage: float = 0.0, max_image_area_percentage: float = 1.0, approximation_percentage: float = 0.75, -) -> Tuple[List[Dict], int]: +) -> tuple[list[dict], int]: coco_annotations = [] for xyxy, mask, _, class_id, _, _ in detections: box_width, box_height = xyxy[2] - xyxy[0], xyxy[3] - xyxy[1] @@ -173,7 +173,7 @@ def detections_to_coco_annotations( return coco_annotations, annotation_id -def get_coco_class_index_mapping(annotations_path: str) -> Dict[int, int]: +def get_coco_class_index_mapping(annotations_path: str) -> dict[int, int]: """ Generates a mapping from sequential class indices to original COCO class ids. @@ -217,7 +217,7 @@ def load_coco_annotations( annotations_path: str, force_masks: bool = False, use_iscrowd: bool = True, -) -> Tuple[List[str], List[str], Dict[str, Detections]]: +) -> tuple[list[str], list[str], dict[str, Detections]]: coco_data = read_json_file(file_path=annotations_path) classes = coco_categories_to_classes(coco_categories=coco_data["categories"]) diff --git a/supervision/dataset/formats/pascal_voc.py b/supervision/dataset/formats/pascal_voc.py index 49c59a39..8eddfb96 100644 --- a/supervision/dataset/formats/pascal_voc.py +++ b/supervision/dataset/formats/pascal_voc.py @@ -1,6 +1,6 @@ import os from pathlib import Path -from typing import Dict, List, Optional, Tuple +from typing import Optional from xml.etree.ElementTree import Element, SubElement import cv2 @@ -51,9 +51,9 @@ def object_to_pascal_voc( def detections_to_pascal_voc( detections: Detections, - classes: List[str], + classes: list[str], filename: str, - image_shape: Tuple[int, int, int], + image_shape: tuple[int, int, int], min_image_area_percentage: float = 0.0, max_image_area_percentage: float = 1.0, approximation_percentage: float = 0.75, @@ -138,7 +138,7 @@ def load_pascal_voc_annotations( images_directory_path: str, annotations_directory_path: str, force_masks: bool = False, -) -> Tuple[List[str], List[str], Dict[str, Detections]]: +) -> tuple[list[str], list[str], dict[str, Detections]]: """ Loads PASCAL VOC XML annotations and returns the image name, a Detections instance, and a list of class names. @@ -163,7 +163,7 @@ def load_pascal_voc_annotations( ) ] - classes: List[str] = [] + classes: list[str] = [] annotations = {} for image_path in image_paths: @@ -187,8 +187,8 @@ def load_pascal_voc_annotations( def detections_from_xml_obj( - root: Element, classes: List[str], resolution_wh, force_masks: bool = False -) -> Tuple[Detections, List[str]]: + root: Element, classes: list[str], resolution_wh, force_masks: bool = False +) -> tuple[Detections, list[str]]: """ Converts an XML object in Pascal VOC format to a Detections object. Expected XML format: diff --git a/supervision/dataset/formats/yolo.py b/supervision/dataset/formats/yolo.py index 7e5a9d45..7903e598 100644 --- a/supervision/dataset/formats/yolo.py +++ b/supervision/dataset/formats/yolo.py @@ -1,6 +1,6 @@ import os from pathlib import Path -from typing import TYPE_CHECKING, Dict, List, Optional, Tuple +from typing import TYPE_CHECKING, Optional import numpy as np from PIL import Image @@ -21,7 +21,7 @@ if TYPE_CHECKING: from supervision.dataset.core import DetectionDataset -def _parse_box(values: List[str]) -> np.ndarray: +def _parse_box(values: list[str]) -> np.ndarray: x_center, y_center, width, height = values return np.array( [ @@ -40,12 +40,12 @@ def _box_to_polygon(box: np.ndarray) -> np.ndarray: ) -def _parse_polygon(values: List[str]) -> np.ndarray: +def _parse_polygon(values: list[str]) -> np.ndarray: return np.array(values, dtype=np.float32).reshape(-1, 2) def _polygons_to_masks( - polygons: List[np.ndarray], resolution_wh: Tuple[int, int] + polygons: list[np.ndarray], resolution_wh: tuple[int, int] ) -> np.ndarray: return np.array( [ @@ -56,11 +56,11 @@ def _polygons_to_masks( ) -def _with_mask(lines: List[str]) -> bool: +def _with_mask(lines: list[str]) -> bool: return any([len(line.split()) > 5 for line in lines]) -def _extract_class_names(file_path: str) -> List[str]: +def _extract_class_names(file_path: str) -> list[str]: data = read_yaml_file(file_path=file_path) names = data["names"] if isinstance(names, dict): @@ -74,8 +74,8 @@ def _image_name_to_annotation_name(image_name: str) -> str: def yolo_annotations_to_detections( - lines: List[str], - resolution_wh: Tuple[int, int], + lines: list[str], + resolution_wh: tuple[int, int], with_masks: bool, is_obb: bool = False, ) -> Detections: @@ -127,7 +127,7 @@ def load_yolo_annotations( data_yaml_path: str, force_masks: bool = False, is_obb: bool = False, -) -> Tuple[List[str], List[str], Dict[str, Detections]]: +) -> tuple[list[str], list[str], dict[str, Detections]]: """ Loads YOLO annotations and returns class names, images, and their corresponding detections. @@ -204,7 +204,7 @@ def load_yolo_annotations( def object_to_yolo( xyxy: np.ndarray, class_id: int, - image_shape: Tuple[int, int, int], + image_shape: tuple[int, int, int], polygon: Optional[np.ndarray] = None, ) -> str: h, w, _ = image_shape @@ -225,11 +225,11 @@ def object_to_yolo( def detections_to_yolo_annotations( detections: Detections, - image_shape: Tuple[int, int, int], + image_shape: tuple[int, int, int], min_image_area_percentage: float = 0.0, max_image_area_percentage: float = 1.0, approximation_percentage: float = 0.75, -) -> List[str]: +) -> list[str]: annotation = [] for xyxy, mask, _, class_id, _, _ in detections: if class_id is None: @@ -283,7 +283,7 @@ def save_yolo_annotations( save_text_file(lines=lines, file_path=yolo_annotations_path) -def save_data_yaml(data_yaml_path: str, classes: List[str]) -> None: +def save_data_yaml(data_yaml_path: str, classes: list[str]) -> None: data = {"nc": len(classes), "names": classes} Path(data_yaml_path).parent.mkdir(parents=True, exist_ok=True) save_yaml_file(data=data, file_path=data_yaml_path) diff --git a/supervision/dataset/utils.py b/supervision/dataset/utils.py index 6c30eeab..487ff1d9 100644 --- a/supervision/dataset/utils.py +++ b/supervision/dataset/utils.py @@ -3,7 +3,7 @@ import os import random import shutil from pathlib import Path -from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, TypeVar, Union +from typing import TYPE_CHECKING, Optional, TypeVar, Union import cv2 import numpy as np @@ -27,7 +27,7 @@ def approximate_mask_with_polygons( min_image_area_percentage: float = 0.0, max_image_area_percentage: float = 1.0, approximation_percentage: float = 0.75, -) -> List[np.ndarray]: +) -> list[np.ndarray]: height, width = mask.shape image_area = height * width minimum_detection_area = min_image_area_percentage * image_area @@ -50,7 +50,7 @@ def approximate_mask_with_polygons( ] -def merge_class_lists(class_lists: List[List[str]]) -> List[str]: +def merge_class_lists(class_lists: list[list[str]]) -> list[str]: unique_classes = set() for class_list in class_lists: @@ -61,8 +61,8 @@ def merge_class_lists(class_lists: List[List[str]]) -> List[str]: def build_class_index_mapping( - source_classes: List[str], target_classes: List[str] -) -> Dict[int, int]: + source_classes: list[str], target_classes: list[str] +) -> dict[int, int]: """Returns the index map of source classes -> target classes.""" index_mapping = {} @@ -79,7 +79,7 @@ def build_class_index_mapping( def map_detections_class_id( - source_to_target_mapping: Dict[int, int], detections: Detections + source_to_target_mapping: dict[int, int], detections: Detections ) -> Detections: if detections.class_id is None: raise ValueError("Detections must have class_id attribute.") @@ -112,11 +112,11 @@ def save_dataset_images( def train_test_split( - data: List[T], + data: list[T], train_ratio: float = 0.8, random_state: Optional[int] = None, shuffle: bool = True, -) -> Tuple[List[T], List[T]]: +) -> tuple[list[T], list[T]]: """ Splits the data into two parts using the provided train_ratio. @@ -140,7 +140,7 @@ def train_test_split( def rle_to_mask( - rle: Union[npt.NDArray[np.int_], List[int]], resolution_wh: Tuple[int, int] + rle: Union[npt.NDArray[np.int_], list[int]], resolution_wh: tuple[int, int] ) -> npt.NDArray[np.bool_]: """ Converts run-length encoding (RLE) to a binary mask. @@ -195,7 +195,7 @@ def rle_to_mask( return decoded_rle.reshape((height, width), order="F") -def mask_to_rle(mask: npt.NDArray[np.bool_]) -> List[int]: +def mask_to_rle(mask: npt.NDArray[np.bool_]) -> list[int]: """ Converts a binary mask into a run-length encoding (RLE). diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 7d142000..7fb53df4 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -1,8 +1,9 @@ from __future__ import annotations +from collections.abc import Iterator from dataclasses import dataclass, field from enum import Enum -from typing import Any, Dict, Iterator, List, Optional, Tuple, Union +from typing import Any import numpy as np @@ -137,12 +138,12 @@ class Detections: """ # noqa: E501 // docs xyxy: np.ndarray - mask: Optional[np.ndarray] = None - confidence: Optional[np.ndarray] = None - class_id: Optional[np.ndarray] = None - tracker_id: Optional[np.ndarray] = None - data: Dict[str, Union[np.ndarray, List]] = field(default_factory=dict) - metadata: Dict[str, Any] = field(default_factory=dict) + mask: np.ndarray | None = None + confidence: np.ndarray | None = None + class_id: np.ndarray | None = None + tracker_id: np.ndarray | None = None + data: dict[str, np.ndarray | list] = field(default_factory=dict) + metadata: dict[str, Any] = field(default_factory=dict) def __post_init__(self): validate_detections_fields( @@ -163,13 +164,13 @@ class Detections: def __iter__( self, ) -> Iterator[ - Tuple[ + tuple[ np.ndarray, - Optional[np.ndarray], - Optional[float], - Optional[int], - Optional[int], - Dict[str, Union[np.ndarray, List]], + np.ndarray | None, + float | None, + int | None, + int | None, + dict[str, np.ndarray | list], ] ]: """ @@ -458,7 +459,7 @@ class Detections: @classmethod def from_transformers( - cls, transformers_results: dict, id2label: Optional[Dict[int, str]] = None + cls, transformers_results: dict, id2label: dict[int, str] | None = None ) -> Detections: """ Creates a Detections instance from object detection or panoptic, semantic @@ -581,7 +582,7 @@ class Detections: ) @classmethod - def from_inference(cls, roboflow_result: Union[dict, Any]) -> Detections: + def from_inference(cls, roboflow_result: dict | Any) -> Detections: """ Create a `sv.Detections` object from the [Roboflow](https://roboflow.com/) API inference result or the [Inference](https://inference.roboflow.com/) @@ -633,7 +634,7 @@ class Detections: ) @classmethod - def from_sam(cls, sam_result: List[dict]) -> Detections: + def from_sam(cls, sam_result: list[dict]) -> Detections: """ Creates a Detections instance from [Segment Anything Model](https://github.com/facebookresearch/segment-anything) @@ -676,7 +677,7 @@ class Detections: @classmethod def from_azure_analyze_image( - cls, azure_result: dict, class_map: Optional[Dict[int, str]] = None + cls, azure_result: dict, class_map: dict[int, str] | None = None ) -> Detections: """ Creates a Detections instance from [Azure Image Analysis 4.0]( @@ -808,9 +809,7 @@ class Detections: "`Detections.from_lmm` property is deprecated and will be removed in " "`supervision-0.31.0`. Use Detections.from_vlm instead." ) - def from_lmm( - cls, lmm: Union[LMM, str], result: Union[str, dict], **kwargs: Any - ) -> Detections: + def from_lmm(cls, lmm: LMM | str, result: str | dict, **kwargs: Any) -> Detections: """ Creates a Detections object from the given result string based on the specified Large Multimodal Model (LMM). @@ -974,9 +973,7 @@ class Detections: return cls.from_vlm(vlm=vlm, result=result, **kwargs) @classmethod - def from_vlm( - cls, vlm: Union[VLM, str], result: Union[str, dict], **kwargs: Any - ) -> Detections: + def from_vlm(cls, vlm: VLM | str, result: str | dict, **kwargs: Any) -> Detections: """ Creates a Detections object from the given result string based on the specified Vision Language Model (VLM). @@ -1282,7 +1279,7 @@ class Detections: return self == empty_detections @classmethod - def merge(cls, detections_list: List[Detections]) -> Detections: + def merge(cls, detections_list: list[Detections]) -> Detections: """ Merge a list of Detections objects into a single Detections object. @@ -1452,8 +1449,8 @@ class Detections: raise ValueError(f"{anchor} is not supported.") def __getitem__( - self, index: Union[int, slice, List[int], np.ndarray, str] - ) -> Union[Detections, List, np.ndarray, None]: + self, index: int | slice | list[int] | np.ndarray | str + ) -> Detections | list | np.ndarray | None: """ Get a subset of the Detections object or access an item from its data field. @@ -1501,7 +1498,7 @@ class Detections: metadata=self.metadata, ) - def __setitem__(self, key: str, value: Union[np.ndarray, List]): + def __setitem__(self, key: str, value: np.ndarray | list): """ Set a value in the data dictionary of the Detections object. @@ -1774,7 +1771,7 @@ def merge_inner_detection_object_pair( def merge_inner_detections_objects( - detections: List[Detections], threshold=0.5 + detections: list[Detections], threshold=0.5 ) -> Detections: """ Given N detections each of length 1 (exactly one object inside), combine them into a diff --git a/supervision/detection/line_zone.py b/supervision/detection/line_zone.py index b63660bc..ad9260bd 100644 --- a/supervision/detection/line_zone.py +++ b/supervision/detection/line_zone.py @@ -1,8 +1,9 @@ import math import warnings from collections import Counter, defaultdict, deque +from collections.abc import Iterable from functools import lru_cache -from typing import Any, Deque, Dict, Iterable, List, Literal, Optional, Tuple +from typing import Any, Deque, Literal, Optional import cv2 import numpy as np @@ -99,7 +100,7 @@ class LineZone: self.vector = Vector(start=start, end=end) self.limits = self._calculate_region_of_interest_limits(vector=self.vector) self.crossing_history_length = max(2, minimum_crossing_threshold + 1) - self.crossing_state_history: Dict[int, Deque[bool]] = defaultdict( + self.crossing_state_history: dict[int, Deque[bool]] = defaultdict( lambda: deque(maxlen=self.crossing_history_length) ) self._in_count_per_class: Counter = Counter() @@ -107,7 +108,7 @@ class LineZone: self.triggering_anchors = triggering_anchors if not list(self.triggering_anchors): raise ValueError("Triggering anchors cannot be empty.") - self.class_id_to_name: Dict[int, str] = {} + self.class_id_to_name: dict[int, str] = {} @property def in_count(self) -> int: @@ -118,14 +119,14 @@ class LineZone: return sum(self._out_count_per_class.values()) @property - def in_count_per_class(self) -> Dict[int, int]: + def in_count_per_class(self) -> dict[int, int]: return dict(self._in_count_per_class) @property - def out_count_per_class(self) -> Dict[int, int]: + def out_count_per_class(self) -> dict[int, int]: return dict(self._out_count_per_class) - def trigger(self, detections: Detections) -> Tuple[np.ndarray, np.ndarray]: + def trigger(self, detections: Detections) -> tuple[np.ndarray, np.ndarray]: """ Update the `in_count` and `out_count` based on the objects that cross the line. @@ -160,7 +161,7 @@ class LineZone: self._compute_anchor_sides(detections) ) - class_ids: List[Optional[int]] = ( + class_ids: list[Optional[int]] = ( list(detections.class_id) if detections.class_id is not None else [None] * len(detections) @@ -200,7 +201,7 @@ class LineZone: return crossed_in, crossed_out @staticmethod - def _calculate_region_of_interest_limits(vector: Vector) -> Tuple[Vector, Vector]: + def _calculate_region_of_interest_limits(vector: Vector) -> tuple[Vector, Vector]: magnitude = vector.magnitude if magnitude == 0: @@ -233,7 +234,7 @@ class LineZone: def _compute_anchor_sides( self, detections: Detections - ) -> Tuple[npt.NDArray[np.bool_], npt.NDArray[np.bool_], npt.NDArray[np.bool_]]: + ) -> tuple[npt.NDArray[np.bool_], npt.NDArray[np.bool_], npt.NDArray[np.bool_]]: """ Find if detections' anchors are within the limit of the line zone and which anchors are on its left and right side. @@ -471,7 +472,7 @@ class LineZoneAnnotator: text_height: int, is_in_count: bool, label_dimension: int, - ) -> Tuple[int, int]: + ) -> tuple[int, int]: """ Calculate insertion anchor in frame to position the center of the count image. @@ -663,7 +664,7 @@ class LineZoneAnnotator: annotation = np.zeros((*annotation_shape, 3), dtype=np.uint8) annotation_alpha = np.zeros((*annotation_shape, 1), dtype=np.uint8) - text_args: Dict[str, Any] = dict( + text_args: dict[str, Any] = dict( text=text, text_anchor=annotation_center, text_scale=text_scale, @@ -756,8 +757,8 @@ class LineZoneAnnotatorMulticlass: def annotate( self, frame: np.ndarray, - line_zones: List[LineZone], - line_zone_labels: Optional[List[str]] = None, + line_zones: list[LineZone], + line_zone_labels: Optional[list[str]] = None, ) -> np.ndarray: """ Draws a table with the number of objects of each class that crossed each line. diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index 133e2f6d..43dac244 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -1,7 +1,6 @@ from __future__ import annotations from enum import Enum -from typing import List, Union import numpy as np import numpy.typing as npt @@ -149,7 +148,7 @@ def box_non_max_suppression( def group_overlapping_boxes( predictions: npt.NDArray[np.float64], iou_threshold: float = 0.5 -) -> List[List[int]]: +) -> list[list[int]]: """ Apply greedy version of non-maximum merging to avoid detecting too many overlapping bounding boxes for a given object. @@ -165,7 +164,7 @@ def group_overlapping_boxes( List[List[int]]: Groups of prediction indices be merged. Each group may have 1 or more elements. """ - merge_groups: List[List[int]] = [] + merge_groups: list[list[int]] = [] scores = predictions[:, 4] order = scores.argsort() @@ -192,7 +191,7 @@ def group_overlapping_boxes( def box_non_max_merge( predictions: npt.NDArray[np.float64], iou_threshold: float = 0.5, -) -> List[List[int]]: +) -> list[list[int]]: """ Apply greedy version of non-maximum merging per category to avoid detecting too many overlapping bounding boxes for a given object. @@ -254,7 +253,7 @@ class OverlapFilter(Enum): return list(map(lambda c: c.value, cls)) @classmethod - def from_value(cls, value: Union[OverlapFilter, str]) -> OverlapFilter: + def from_value(cls, value: OverlapFilter | str) -> OverlapFilter: if isinstance(value, cls): return value if isinstance(value, str): diff --git a/supervision/detection/tools/csv_sink.py b/supervision/detection/tools/csv_sink.py index ea7e58bb..5a899fee 100644 --- a/supervision/detection/tools/csv_sink.py +++ b/supervision/detection/tools/csv_sink.py @@ -2,7 +2,7 @@ from __future__ import annotations import csv import os -from typing import Any, Dict, List, Optional +from typing import Any from supervision.detection.core import Detections @@ -61,8 +61,8 @@ class CSVSink: None """ self.file_name = file_name - self.file: Optional[open] = None - self.writer: Optional[csv.writer] = None + self.file: open | None = None + self.writer: csv.writer | None = None self.header_written = False self.field_names = [] @@ -72,9 +72,9 @@ class CSVSink: def __exit__( self, - exc_type: Optional[type], - exc_val: Optional[Exception], - exc_tb: Optional[Any], + exc_type: type | None, + exc_val: Exception | None, + exc_tb: Any | None, ) -> None: self.close() @@ -104,8 +104,8 @@ class CSVSink: @staticmethod def parse_detection_data( - detections: Detections, custom_data: Optional[Dict[str, Any]] = None - ) -> List[Dict[str, Any]]: + detections: Detections, custom_data: dict[str, Any] | None = None + ) -> list[dict[str, Any]]: parsed_rows = [] for i in range(len(detections.xyxy)): row = { @@ -137,7 +137,7 @@ class CSVSink: return parsed_rows def append( - self, detections: Detections, custom_data: Optional[Dict[str, Any]] = None + self, detections: Detections, custom_data: dict[str, Any] | None = None ) -> None: """ Append detection data to the CSV file. @@ -173,8 +173,8 @@ class CSVSink: @staticmethod def parse_field_names( - detections: Detections, custom_data: Dict[str, Any] - ) -> List[str]: + detections: Detections, custom_data: dict[str, Any] + ) -> list[str]: dynamic_header = sorted( set(custom_data.keys()) | set(getattr(detections, "data", {}).keys()) ) diff --git a/supervision/detection/tools/inference_slicer.py b/supervision/detection/tools/inference_slicer.py index 05469dd6..0bf5a103 100644 --- a/supervision/detection/tools/inference_slicer.py +++ b/supervision/detection/tools/inference_slicer.py @@ -1,6 +1,6 @@ import warnings from concurrent.futures import ThreadPoolExecutor, as_completed -from typing import Callable, Optional, Tuple, Union +from typing import Callable, Optional, Union import numpy as np @@ -18,7 +18,7 @@ from supervision.utils.internal import ( def move_detections( detections: Detections, offset: np.ndarray, - resolution_wh: Optional[Tuple[int, int]] = None, + resolution_wh: Optional[tuple[int, int]] = None, ) -> Detections: """ Args: @@ -86,9 +86,9 @@ class InferenceSlicer: def __init__( self, callback: Callable[[np.ndarray], Detections], - slice_wh: Tuple[int, int] = (320, 320), - overlap_ratio_wh: Optional[Tuple[float, float]] = (0.2, 0.2), - overlap_wh: Optional[Tuple[int, int]] = None, + slice_wh: tuple[int, int] = (320, 320), + overlap_ratio_wh: Optional[tuple[float, float]] = (0.2, 0.2), + overlap_wh: Optional[tuple[int, int]] = None, overlap_filter: Union[OverlapFilter, str] = OverlapFilter.NON_MAX_SUPPRESSION, iou_threshold: float = 0.5, thread_workers: int = 1, @@ -198,10 +198,10 @@ class InferenceSlicer: @staticmethod def _generate_offset( - resolution_wh: Tuple[int, int], - slice_wh: Tuple[int, int], - overlap_ratio_wh: Optional[Tuple[float, float]], - overlap_wh: Optional[Tuple[int, int]], + resolution_wh: tuple[int, int], + slice_wh: tuple[int, int], + overlap_ratio_wh: Optional[tuple[float, float]], + overlap_wh: Optional[tuple[int, int]], ) -> np.ndarray: """ Generate offset coordinates for slicing an image based on the given resolution, @@ -260,8 +260,8 @@ class InferenceSlicer: @staticmethod def _validate_overlap( - overlap_ratio_wh: Optional[Tuple[float, float]], - overlap_wh: Optional[Tuple[int, int]], + overlap_ratio_wh: Optional[tuple[float, float]], + overlap_wh: Optional[tuple[int, int]], ) -> None: if overlap_ratio_wh is not None and overlap_wh is not None: raise ValueError( diff --git a/supervision/detection/tools/json_sink.py b/supervision/detection/tools/json_sink.py index b8927c5f..42fb187c 100644 --- a/supervision/detection/tools/json_sink.py +++ b/supervision/detection/tools/json_sink.py @@ -2,7 +2,7 @@ from __future__ import annotations import json import os -from typing import Any, Dict, List, Optional +from typing import Any from supervision.detection.core import Detections @@ -51,8 +51,8 @@ class JSONSink: None """ self.file_name = file_name - self.file: Optional[open] = None - self.data: List[Dict[str, Any]] = [] + self.file: open | None = None + self.data: list[dict[str, Any]] = [] def __enter__(self) -> JSONSink: self.open() @@ -60,9 +60,9 @@ class JSONSink: def __exit__( self, - exc_type: Optional[type], - exc_val: Optional[Exception], - exc_tb: Optional[Any], + exc_type: type | None, + exc_val: Exception | None, + exc_tb: Any | None, ) -> None: self.write_and_close() @@ -92,8 +92,8 @@ class JSONSink: @staticmethod def parse_detection_data( - detections: Detections, custom_data: Optional[Dict[str, Any]] = None - ) -> List[Dict[str, Any]]: + detections: Detections, custom_data: dict[str, Any] | None = None + ) -> list[dict[str, Any]]: parsed_rows = [] for i in range(len(detections.xyxy)): row = { @@ -126,7 +126,7 @@ class JSONSink: return parsed_rows def append( - self, detections: Detections, custom_data: Optional[Dict[str, Any]] = None + self, detections: Detections, custom_data: dict[str, Any] | None = None ) -> None: """ Append detection data to the JSON file. diff --git a/supervision/detection/tools/polygon_zone.py b/supervision/detection/tools/polygon_zone.py index 5cd976b1..0b1141ce 100644 --- a/supervision/detection/tools/polygon_zone.py +++ b/supervision/detection/tools/polygon_zone.py @@ -1,5 +1,6 @@ +from collections.abc import Iterable from dataclasses import replace -from typing import Iterable, Optional +from typing import Optional import cv2 import numpy as np diff --git a/supervision/detection/tools/transformers.py b/supervision/detection/tools/transformers.py index 047c1f94..433aa48f 100644 --- a/supervision/detection/tools/transformers.py +++ b/supervision/detection/tools/transformers.py @@ -1,5 +1,5 @@ import io -from typing import Any, Dict, Optional +from typing import Any, Optional import numpy as np from PIL import Image @@ -9,7 +9,7 @@ from supervision.detection.utils import mask_to_xyxy def process_transformers_detection_result( - detection_result: dict, id2label: Optional[Dict[int, str]] + detection_result: dict, id2label: Optional[dict[int, str]] ) -> dict: """ Process the result of Transformers object detection functions such as @@ -38,7 +38,7 @@ def process_transformers_detection_result( def process_transformers_v4_segmentation_result( - segmentation_result: dict, id2label: Optional[Dict[int, str]] + segmentation_result: dict, id2label: Optional[dict[int, str]] ) -> dict: """ Process the result of Transformers segmentation functions such as @@ -77,7 +77,7 @@ def process_transformers_v4_segmentation_result( def process_transformers_v5_segmentation_result( - segmentation_result: dict, id2label: Optional[Dict[int, str]] + segmentation_result: dict, id2label: Optional[dict[int, str]] ) -> dict: """ Process the result of Transformers segmentation functions such as @@ -107,7 +107,7 @@ def process_transformers_v5_segmentation_result( def process_transformers_v5_semantic_or_instance_segmentation_result( - segmentation_result: dict, id2label: Optional[Dict[int, str]] + segmentation_result: dict, id2label: Optional[dict[int, str]] ) -> dict: """ Process the result of Transformers segmentation functions such as @@ -143,7 +143,7 @@ def process_transformers_v5_semantic_or_instance_segmentation_result( def process_transformers_v4_panoptic_segmentation_result( - segmentation_result: dict, id2label: Optional[Dict[int, str]] + segmentation_result: dict, id2label: Optional[dict[int, str]] ) -> dict: """ Process the result of the Transformers function `post_process_panoptic` (v4). @@ -177,7 +177,7 @@ def process_transformers_v4_panoptic_segmentation_result( def process_transformers_v5_panoptic_segmentation_result( - segmentation_array: np.ndarray, id2label: Optional[Dict[int, str]] + segmentation_array: np.ndarray, id2label: Optional[dict[int, str]] ) -> dict: """ Process the result of the Transformers function @@ -220,9 +220,9 @@ def png_string_to_segmentation_array(png_string: bytes) -> np.ndarray: def append_class_names_to_data( class_ids: np.ndarray, - id2label: Optional[Dict[int, str]], - data: Optional[Dict[str, Any]] = None, -) -> Dict[str, Any]: + id2label: Optional[dict[int, str]], + data: Optional[dict[str, Any]] = None, +) -> dict[str, Any]: """ Helper function to create or append to a data dictionary with class names if available. diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 13c3f1a6..63180c29 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -1,5 +1,5 @@ from itertools import chain -from typing import Any, Dict, List, Optional, Tuple, Union +from typing import Any, Optional, Union import cv2 import numpy as np @@ -30,7 +30,7 @@ def xyxy_to_polygons(box: np.ndarray) -> np.ndarray: return polygon -def polygon_to_mask(polygon: np.ndarray, resolution_wh: Tuple[int, int]) -> np.ndarray: +def polygon_to_mask(polygon: np.ndarray, resolution_wh: tuple[int, int]) -> np.ndarray: """Generate a mask from a polygon. Args: @@ -49,8 +49,8 @@ def polygon_to_mask(polygon: np.ndarray, resolution_wh: Tuple[int, int]) -> np.n def box_iou( - box_true: Union[List[float], np.ndarray], - box_detection: Union[List[float], np.ndarray], + box_true: Union[list[float], np.ndarray], + box_detection: Union[list[float], np.ndarray], ) -> float: """ Compute the Intersection over Union (IoU) between two bounding boxes. @@ -283,7 +283,7 @@ def oriented_box_iou_batch( return ious -def clip_boxes(xyxy: np.ndarray, resolution_wh: Tuple[int, int]) -> np.ndarray: +def clip_boxes(xyxy: np.ndarray, resolution_wh: tuple[int, int]) -> np.ndarray: """ Clips bounding boxes coordinates to fit within the frame resolution. @@ -535,7 +535,7 @@ def xyxy_to_xcycarh(xyxy: np.ndarray) -> np.ndarray: def denormalize_boxes( normalized_xyxy: np.ndarray, - resolution_wh: Tuple[int, int], + resolution_wh: tuple[int, int], normalization_factor: float = 1.0, ) -> np.ndarray: """ @@ -615,7 +615,7 @@ def mask_to_xyxy(masks: np.ndarray) -> np.ndarray: return xyxy -def mask_to_polygons(mask: np.ndarray) -> List[np.ndarray]: +def mask_to_polygons(mask: np.ndarray) -> list[np.ndarray]: """ Converts a binary mask to a list of polygons. @@ -642,10 +642,10 @@ def mask_to_polygons(mask: np.ndarray) -> List[np.ndarray]: def filter_polygons_by_area( - polygons: List[np.ndarray], + polygons: list[np.ndarray], min_area: Optional[float] = None, max_area: Optional[float] = None, -) -> List[np.ndarray]: +) -> list[np.ndarray]: """ Filters a list of polygons based on their area. @@ -779,13 +779,13 @@ def extract_ultralytics_masks(yolov8_results) -> Optional[np.ndarray]: def process_roboflow_result( roboflow_result: dict, -) -> Tuple[ +) -> tuple[ np.ndarray, np.ndarray, np.ndarray, Optional[np.ndarray], Optional[np.ndarray], - Dict[str, Union[List[np.ndarray], np.ndarray]], + dict[str, Union[list[np.ndarray], np.ndarray]], ]: if not roboflow_result["predictions"]: return ( @@ -940,7 +940,7 @@ def move_oriented_boxes( def move_masks( masks: npt.NDArray[np.bool_], offset: npt.NDArray[np.int32], - resolution_wh: Tuple[int, int], + resolution_wh: tuple[int, int], ) -> npt.NDArray[np.bool_]: """ Offset the masks in an array by the specified (x, y) amount. @@ -1086,7 +1086,7 @@ def calculate_masks_centroids(masks: np.ndarray) -> np.ndarray: return np.column_stack((centroid_x, centroid_y)).astype(int) -def is_data_equal(data_a: Dict[str, np.ndarray], data_b: Dict[str, np.ndarray]) -> bool: +def is_data_equal(data_a: dict[str, np.ndarray], data_b: dict[str, np.ndarray]) -> bool: """ Compares the data payloads of two Detections instances. @@ -1101,7 +1101,7 @@ def is_data_equal(data_a: Dict[str, np.ndarray], data_b: Dict[str, np.ndarray]) ) -def is_metadata_equal(metadata_a: Dict[str, Any], metadata_b: Dict[str, Any]) -> bool: +def is_metadata_equal(metadata_a: dict[str, Any], metadata_b: dict[str, Any]) -> bool: """ Compares the metadata payloads of two Detections instances. @@ -1123,8 +1123,8 @@ def is_metadata_equal(metadata_a: Dict[str, Any], metadata_b: Dict[str, Any]) -> def merge_data( - data_list: List[Dict[str, Union[npt.NDArray[np.generic], List]]], -) -> Dict[str, Union[npt.NDArray[np.generic], List]]: + data_list: list[dict[str, Union[npt.NDArray[np.generic], list]]], +) -> dict[str, Union[npt.NDArray[np.generic], list]]: """ Merges the data payloads of a list of Detections instances. @@ -1183,7 +1183,7 @@ def merge_data( return merged_data -def merge_metadata(metadata_list: List[Dict[str, Any]]) -> Dict[str, Any]: +def merge_metadata(metadata_list: list[dict[str, Any]]) -> dict[str, Any]: """ Merge metadata from a list of metadata dictionaries. @@ -1210,7 +1210,7 @@ def merge_metadata(metadata_list: List[Dict[str, Any]]) -> Dict[str, Any]: if not all(keys_set == all_keys_sets[0] for keys_set in all_keys_sets): raise ValueError("All metadata dictionaries must have the same keys to merge.") - merged_metadata: Dict[str, Any] = {} + merged_metadata: dict[str, Any] = {} for metadata in metadata_list: for key, value in metadata.items(): if key not in merged_metadata: @@ -1239,9 +1239,9 @@ def merge_metadata(metadata_list: List[Dict[str, Any]]) -> Dict[str, Any]: def get_data_item( - data: Dict[str, Union[np.ndarray, List]], - index: Union[int, slice, List[int], np.ndarray], -) -> Dict[str, Union[np.ndarray, List]]: + data: dict[str, Union[np.ndarray, list]], + index: Union[int, slice, list[int], np.ndarray], +) -> dict[str, Union[np.ndarray, list]]: """ Retrieve a subset of the data dictionary based on the given index. @@ -1469,7 +1469,7 @@ def spread_out_boxes( return pad_boxes(xyxy_padded, px=-1) -def _jaccard(box_a: List[float], box_b: List[float], is_crowd: bool) -> float: +def _jaccard(box_a: list[float], box_b: list[float], is_crowd: bool) -> float: """ Calculate the Jaccard index (intersection over union) between two bounding boxes. If a gt object is marked as "iscrowd", a dt is allowed to match any subregion @@ -1511,9 +1511,9 @@ def _jaccard(box_a: List[float], box_b: List[float], is_crowd: bool) -> float: def box_iou_batch_with_jaccard( - boxes_true: List[List[float]], - boxes_detection: List[List[float]], - is_crowd: List[bool], + boxes_true: list[list[float]], + boxes_detection: list[list[float]], + is_crowd: list[bool], ) -> np.ndarray: """ Calculate the intersection over union (IoU) between detection bounding boxes (dt) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 022060f6..b44c769d 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -1,7 +1,7 @@ import json import re from enum import Enum -from typing import Any, Dict, List, Optional, Tuple, Union +from typing import Any, Optional, Union import numpy as np @@ -34,7 +34,7 @@ class VLM(Enum): MOONDREAM = "moondream" -RESULT_TYPES: Dict[VLM, type] = { +RESULT_TYPES: dict[VLM, type] = { VLM.PALIGEMMA: str, VLM.FLORENCE_2: dict, VLM.QWEN_2_5_VL: str, @@ -43,7 +43,7 @@ RESULT_TYPES: Dict[VLM, type] = { VLM.MOONDREAM: dict, } -REQUIRED_ARGUMENTS: Dict[VLM, List[str]] = { +REQUIRED_ARGUMENTS: dict[VLM, list[str]] = { VLM.PALIGEMMA: ["resolution_wh"], VLM.FLORENCE_2: ["resolution_wh"], VLM.QWEN_2_5_VL: ["input_wh", "resolution_wh"], @@ -52,7 +52,7 @@ REQUIRED_ARGUMENTS: Dict[VLM, List[str]] = { VLM.MOONDREAM: ["resolution_wh"], } -ALLOWED_ARGUMENTS: Dict[VLM, List[str]] = { +ALLOWED_ARGUMENTS: dict[VLM, list[str]] = { VLM.PALIGEMMA: ["resolution_wh", "classes"], VLM.FLORENCE_2: ["resolution_wh"], VLM.QWEN_2_5_VL: ["input_wh", "resolution_wh", "classes"], @@ -75,7 +75,7 @@ SUPPORTED_TASKS_FLORENCE_2 = [ def validate_vlm_parameters( - vlm: Union[VLM, str], result: Any, kwargs: Dict[str, Any] + vlm: Union[VLM, str], result: Any, kwargs: dict[str, Any] ) -> VLM: if isinstance(vlm, str): try: @@ -104,8 +104,8 @@ def validate_vlm_parameters( def from_paligemma( - result: str, resolution_wh: Tuple[int, int], classes: Optional[List[str]] = None -) -> Tuple[np.ndarray, Optional[np.ndarray], np.ndarray]: + result: str, resolution_wh: tuple[int, int], classes: Optional[list[str]] = None +) -> tuple[np.ndarray, Optional[np.ndarray], np.ndarray]: """ Parse bounding boxes from paligemma-formatted text, scale them to the specified resolution, and optionally filter by classes. @@ -157,10 +157,10 @@ def from_paligemma( def from_qwen_2_5_vl( result: str, - input_wh: Tuple[int, int], - resolution_wh: Tuple[int, int], - classes: Optional[List[str]] = None, -) -> Tuple[np.ndarray, Optional[np.ndarray], np.ndarray]: + input_wh: tuple[int, int], + resolution_wh: tuple[int, int], + classes: Optional[list[str]] = None, +) -> tuple[np.ndarray, Optional[np.ndarray], np.ndarray]: """ Parse and scale bounding boxes from Qwen-2.5-VL style JSON output. @@ -241,8 +241,8 @@ def from_qwen_2_5_vl( def from_florence_2( - result: dict, resolution_wh: Tuple[int, int] -) -> Tuple[ + result: dict, resolution_wh: tuple[int, int] +) -> tuple[ np.ndarray, Optional[np.ndarray], Optional[np.ndarray], Optional[np.ndarray] ]: """ @@ -337,9 +337,9 @@ def from_florence_2( def from_google_gemini( result: str, - resolution_wh: Tuple[int, int], - classes: Optional[List[str]] = None, -) -> Tuple[np.ndarray, Optional[np.ndarray], np.ndarray]: + resolution_wh: tuple[int, int], + classes: Optional[list[str]] = None, +) -> tuple[np.ndarray, Optional[np.ndarray], np.ndarray]: """ Parse and scale bounding boxes from Google Gemini style [JSON output](https://ai.google.dev/gemini-api/docs/vision?lang=python). @@ -429,8 +429,8 @@ def from_google_gemini( def from_moondream( result: dict, - resolution_wh: Tuple[int, int], -) -> Tuple[np.ndarray]: + resolution_wh: tuple[int, int], +) -> tuple[np.ndarray]: """ Parse and scale bounding boxes from moondream JSON output. diff --git a/supervision/draw/color.py b/supervision/draw/color.py index e52df5a0..705d5922 100644 --- a/supervision/draw/color.py +++ b/supervision/draw/color.py @@ -1,7 +1,6 @@ from __future__ import annotations from dataclasses import dataclass -from typing import List, Tuple, Union import matplotlib.pyplot as plt @@ -132,7 +131,7 @@ class Color: return cls(r, g, b) @classmethod - def from_rgb_tuple(cls, color_tuple: Tuple[int, int, int]) -> Color: + def from_rgb_tuple(cls, color_tuple: tuple[int, int, int]) -> Color: """ Create a Color instance from an RGB tuple. @@ -155,7 +154,7 @@ class Color: return cls(r=r, g=g, b=b) @classmethod - def from_bgr_tuple(cls, color_tuple: Tuple[int, int, int]) -> Color: + def from_bgr_tuple(cls, color_tuple: tuple[int, int, int]) -> Color: """ Create a Color instance from a BGR tuple. @@ -194,7 +193,7 @@ class Color: """ return f"#{self.r:02x}{self.g:02x}{self.b:02x}" - def as_rgb(self) -> Tuple[int, int, int]: + def as_rgb(self) -> tuple[int, int, int]: """ Returns the color as an RGB tuple. @@ -211,7 +210,7 @@ class Color: """ return self.r, self.g, self.b - def as_bgr(self) -> Tuple[int, int, int]: + def as_bgr(self) -> tuple[int, int, int]: """ Returns the color as a BGR tuple. @@ -274,7 +273,7 @@ class Color: @dataclass class ColorPalette: - colors: List[Color] + colors: list[Color] @classproperty def DEFAULT(cls) -> ColorPalette: @@ -323,7 +322,7 @@ class ColorPalette: return ColorPalette.from_hex(color_hex_list=LEGACY_COLOR_PALETTE) @classmethod - def from_hex(cls, color_hex_list: List[str]) -> ColorPalette: + def from_hex(cls, color_hex_list: list[str]) -> ColorPalette: """ Create a ColorPalette instance from a list of hex strings. @@ -412,7 +411,7 @@ class ColorPalette: return len(self.colors) -def unify_to_bgr(color: Union[Tuple[int, int, int], Color]) -> Tuple[int, int, int]: +def unify_to_bgr(color: tuple[int, int, int] | Color) -> tuple[int, int, int]: """ Converts a color input in multiple formats to a standardized BGR format. diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 0c3767ff..87a96a2a 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -1,5 +1,5 @@ import os -from typing import Optional, Tuple, Union +from typing import Optional, Union import cv2 import numpy as np @@ -343,7 +343,7 @@ def draw_image( return scene -def calculate_optimal_text_scale(resolution_wh: Tuple[int, int]) -> float: +def calculate_optimal_text_scale(resolution_wh: tuple[int, int]) -> float: """ Calculate font scale based on the resolution of an image. @@ -357,7 +357,7 @@ def calculate_optimal_text_scale(resolution_wh: Tuple[int, int]) -> float: return min(resolution_wh) * 1e-3 -def calculate_optimal_line_thickness(resolution_wh: Tuple[int, int]) -> int: +def calculate_optimal_line_thickness(resolution_wh: tuple[int, int]) -> int: """ Calculate line thickness based on the resolution of an image. diff --git a/supervision/geometry/core.py b/supervision/geometry/core.py index a884a9da..bfa18787 100644 --- a/supervision/geometry/core.py +++ b/supervision/geometry/core.py @@ -3,7 +3,6 @@ from __future__ import annotations from dataclasses import dataclass from enum import Enum from math import sqrt -from typing import Tuple class Position(Enum): @@ -32,10 +31,10 @@ class Point: x: float y: float - def as_xy_int_tuple(self) -> Tuple[int, int]: + def as_xy_int_tuple(self) -> tuple[int, int]: return int(self.x), int(self.y) - def as_xy_float_tuple(self) -> Tuple[float, float]: + def as_xy_float_tuple(self) -> tuple[float, float]: return self.x, self.y @@ -99,7 +98,7 @@ class Rect: height: float @classmethod - def from_xyxy(cls, xyxy: Tuple[float, float, float, float]) -> Rect: + def from_xyxy(cls, xyxy: tuple[float, float, float, float]) -> Rect: x1, y1, x2, y2 = xyxy return cls(x=x1, y=y1, width=x2 - x1, height=y2 - y1) @@ -119,7 +118,7 @@ class Rect: height=self.height + 2 * padding, ) - def as_xyxy_int_tuple(self) -> Tuple[int, int, int, int]: + def as_xyxy_int_tuple(self) -> tuple[int, int, int, int]: return ( int(self.x), int(self.y), diff --git a/supervision/keypoint/annotators.py b/supervision/keypoint/annotators.py index 7537b264..9a44c5eb 100644 --- a/supervision/keypoint/annotators.py +++ b/supervision/keypoint/annotators.py @@ -1,6 +1,6 @@ from abc import ABC, abstractmethod from logging import warn -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import cv2 import numpy as np @@ -106,7 +106,7 @@ class EdgeAnnotator(BaseKeyPointAnnotator): self, color: Color = Color.ROBOFLOW, thickness: int = 2, - edges: Optional[List[Tuple[int, int]]] = None, + edges: Optional[list[tuple[int, int]]] = None, ) -> None: """ Args: @@ -196,8 +196,8 @@ class VertexLabelAnnotator: def __init__( self, - color: Union[Color, List[Color]] = Color.ROBOFLOW, - text_color: Union[Color, List[Color]] = Color.WHITE, + color: Union[Color, list[Color]] = Color.ROBOFLOW, + text_color: Union[Color, list[Color]] = Color.WHITE, text_scale: float = 0.5, text_thickness: int = 1, text_padding: int = 10, @@ -220,8 +220,8 @@ class VertexLabelAnnotator: smart_position (bool): Spread out the labels to avoid overlap. """ self.border_radius: int = border_radius - self.color: Union[Color, List[Color]] = color - self.text_color: Union[Color, List[Color]] = text_color + self.color: Union[Color, list[Color]] = color + self.text_color: Union[Color, list[Color]] = text_color self.text_scale: float = text_scale self.text_thickness: int = text_thickness self.text_padding: int = text_padding @@ -231,7 +231,7 @@ class VertexLabelAnnotator: self, scene: ImageType, key_points: KeyPoints, - labels: Optional[List[str]] = None, + labels: Optional[list[str]] = None, ) -> ImageType: """ A class that draws labels of skeleton vertices on images. It uses specified key @@ -394,8 +394,8 @@ class VertexLabelAnnotator: font: int, text_scale: float, text_thickness: int, - center_coordinates: Tuple[int, int], - ) -> Tuple[int, int, int, int]: + center_coordinates: tuple[int, int], + ) -> tuple[int, int, int, int]: text_w, text_h = cv2.getTextSize( text=text, fontFace=font, @@ -412,7 +412,7 @@ class VertexLabelAnnotator: @staticmethod def preprocess_and_validate_labels( - labels: Optional[List[str]], points_count: int, skeletons_count: int + labels: Optional[list[str]], points_count: int, skeletons_count: int ) -> np.ndarray: if labels and len(labels) != points_count: raise ValueError( @@ -426,7 +426,7 @@ class VertexLabelAnnotator: @staticmethod def preprocess_and_validate_colors( - colors: Optional[Union[Color, List[Color]]], + colors: Optional[Union[Color, list[Color]]], points_count: int, skeletons_count: int, ) -> np.ndarray: diff --git a/supervision/keypoint/core.py b/supervision/keypoint/core.py index 6167f4bb..89bfe0b8 100644 --- a/supervision/keypoint/core.py +++ b/supervision/keypoint/core.py @@ -1,7 +1,8 @@ from __future__ import annotations +from collections.abc import Iterable, Iterator from dataclasses import dataclass, field -from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Union +from typing import Any import numpy as np import numpy.typing as npt @@ -103,9 +104,9 @@ class KeyPoints: """ # noqa: E501 // docs xy: npt.NDArray[np.float32] - class_id: Optional[npt.NDArray[np.int_]] = None - confidence: Optional[npt.NDArray[np.float32]] = None - data: Dict[str, Union[npt.NDArray[Any], List]] = field(default_factory=dict) + class_id: npt.NDArray[np.int_] | None = None + confidence: npt.NDArray[np.float32] | None = None + data: dict[str, npt.NDArray[Any] | list] = field(default_factory=dict) def __post_init__(self): validate_keypoints_fields( @@ -124,13 +125,13 @@ class KeyPoints: def __iter__( self, ) -> Iterator[ - Tuple[ + tuple[ np.ndarray, - Optional[np.ndarray], - Optional[float], - Optional[int], - Optional[int], - Dict[str, Union[np.ndarray, List]], + np.ndarray | None, + float | None, + int | None, + int | None, + dict[str, np.ndarray | list], ] ]: """ @@ -156,7 +157,7 @@ class KeyPoints: ) @classmethod - def from_inference(cls, inference_result: Union[dict, Any]) -> KeyPoints: + def from_inference(cls, inference_result: dict | Any) -> KeyPoints: """ Create a `sv.KeyPoints` object from the [Roboflow](https://roboflow.com/) API inference result or the [Inference](https://inference.roboflow.com/) @@ -239,7 +240,7 @@ class KeyPoints: @classmethod def from_mediapipe( - cls, mediapipe_results, resolution_wh: Tuple[int, int] + cls, mediapipe_results, resolution_wh: tuple[int, int] ) -> KeyPoints: """ Creates a `sv.KeyPoints` instance from a @@ -598,8 +599,8 @@ class KeyPoints: return cls.empty() def __getitem__( - self, index: Union[int, slice, List[int], np.ndarray, str] - ) -> Union[KeyPoints, List, np.ndarray, None]: + self, index: int | slice | list[int] | np.ndarray | str + ) -> KeyPoints | list | np.ndarray | None: """ Get a subset of the `sv.KeyPoints` object or access an item from its data field. @@ -649,7 +650,7 @@ class KeyPoints: data=get_data_item(self.data, index), ) - def __setitem__(self, key: str, value: Union[np.ndarray, List]): + def __setitem__(self, key: str, value: np.ndarray | list): """ Set a value in the data dictionary of the `sv.KeyPoints` object. @@ -710,7 +711,7 @@ class KeyPoints: return self == empty_keypoints def as_detections( - self, selected_keypoint_indices: Optional[Iterable[int]] = None + self, selected_keypoint_indices: Iterable[int] | None = None ) -> Detections: """ Convert a KeyPoints object to a Detections object. This diff --git a/supervision/keypoint/skeletons.py b/supervision/keypoint/skeletons.py index a5ac7b3a..64a22aef 100644 --- a/supervision/keypoint/skeletons.py +++ b/supervision/keypoint/skeletons.py @@ -1,7 +1,6 @@ from enum import Enum -from typing import Dict, Tuple -Edges = Tuple[Tuple[int, int], ...] +Edges = tuple[tuple[int, int], ...] class Skeleton(Enum): @@ -2637,11 +2636,11 @@ class Skeleton(Enum): ) -SKELETONS_BY_EDGE_COUNT: Dict[int, Edges] = {} -SKELETONS_BY_VERTEX_COUNT: Dict[int, Edges] = {} +SKELETONS_BY_EDGE_COUNT: dict[int, Edges] = {} +SKELETONS_BY_VERTEX_COUNT: dict[int, Edges] = {} for skeleton in Skeleton: SKELETONS_BY_EDGE_COUNT[len(skeleton.value)] = skeleton.value - unique_vertices = set(vertex for edge in skeleton.value for vertex in edge) + unique_vertices = {vertex for edge in skeleton.value for vertex in edge} SKELETONS_BY_VERTEX_COUNT[len(unique_vertices)] = skeleton.value diff --git a/supervision/metrics/core.py b/supervision/metrics/core.py index def5999a..75bc5152 100644 --- a/supervision/metrics/core.py +++ b/supervision/metrics/core.py @@ -11,7 +11,7 @@ class Metric(ABC): """ @abstractmethod - def update(self, *args, **kwargs) -> "Metric": + def update(self, *args, **kwargs) -> Metric: """ Add data to the metric, without computing the result. Return the metric itself to allow method chaining. diff --git a/supervision/metrics/detection.py b/supervision/metrics/detection.py index ee6d2b61..3f1f96d5 100644 --- a/supervision/metrics/detection.py +++ b/supervision/metrics/detection.py @@ -1,7 +1,7 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Callable, List, Optional, Tuple +from typing import Callable import matplotlib import matplotlib.pyplot as plt @@ -41,7 +41,7 @@ def detections_to_tensor( return np.concatenate(arrays_to_concat, axis=1) -def validate_input_tensors(predictions: List[np.ndarray], targets: List[np.ndarray]): +def validate_input_tensors(predictions: list[np.ndarray], targets: list[np.ndarray]): """ Checks for shape consistency of input tensors. """ @@ -86,16 +86,16 @@ class ConfusionMatrix: """ matrix: np.ndarray - classes: List[str] + classes: list[str] conf_threshold: float iou_threshold: float @classmethod def from_detections( cls, - predictions: List[Detections], - targets: List[Detections], - classes: List[str], + predictions: list[Detections], + targets: list[Detections], + classes: list[str], conf_threshold: float = 0.3, iou_threshold: float = 0.5, ) -> ConfusionMatrix: @@ -162,9 +162,9 @@ class ConfusionMatrix: @classmethod def from_tensors( cls, - predictions: List[np.ndarray], - targets: List[np.ndarray], - classes: List[str], + predictions: list[np.ndarray], + targets: list[np.ndarray], + classes: list[str], conf_threshold: float = 0.3, iou_threshold: float = 0.5, ) -> ConfusionMatrix: @@ -405,11 +405,11 @@ class ConfusionMatrix: def plot( self, - save_path: Optional[str] = None, - title: Optional[str] = None, - classes: Optional[List[str]] = None, + save_path: str | None = None, + title: str | None = None, + classes: list[str] | None = None, normalize: bool = False, - fig_size: Tuple[int, int] = (12, 10), + fig_size: tuple[int, int] = (12, 10), ) -> matplotlib.figure.Figure: """ Create confusion matrix plot and save it at selected location. @@ -518,8 +518,8 @@ class MeanAveragePrecision: @classmethod def from_detections( cls, - predictions: List[Detections], - targets: List[Detections], + predictions: list[Detections], + targets: list[Detections], ) -> MeanAveragePrecision: """ Calculate mean average precision based on predicted and ground-truth detections. @@ -615,8 +615,8 @@ class MeanAveragePrecision: @classmethod def from_tensors( cls, - predictions: List[np.ndarray], - targets: List[np.ndarray], + predictions: list[np.ndarray], + targets: list[np.ndarray], ) -> MeanAveragePrecision: """ Calculate Mean Average Precision based on predicted and ground-truth diff --git a/supervision/metrics/f1_score.py b/supervision/metrics/f1_score.py index 98cb5f26..193eb915 100644 --- a/supervision/metrics/f1_score.py +++ b/supervision/metrics/f1_score.py @@ -2,7 +2,7 @@ from __future__ import annotations from copy import deepcopy from dataclasses import dataclass -from typing import TYPE_CHECKING, List, Optional, Tuple, Union +from typing import TYPE_CHECKING import numpy as np from matplotlib import pyplot as plt @@ -89,8 +89,8 @@ class F1Score(Metric): self._metric_target = metric_target self.averaging_method = averaging_method - self._predictions_list: List[Detections] = [] - self._targets_list: List[Detections] = [] + self._predictions_list: list[Detections] = [] + self._targets_list: list[Detections] = [] def reset(self) -> None: """ @@ -101,8 +101,8 @@ class F1Score(Metric): def update( self, - predictions: Union[Detections, List[Detections]], - targets: Union[Detections, List[Detections]], + predictions: Detections | list[Detections], + targets: Detections | list[Detections], ) -> F1Score: """ Add new predictions and targets to the metric, but do not compute the result. @@ -160,7 +160,7 @@ class F1Score(Metric): return result def _compute( - self, predictions_list: List[Detections], targets_list: List[Detections] + self, predictions_list: list[Detections], targets_list: list[Detections] ) -> F1ScoreResult: iou_thresholds = np.linspace(0.5, 0.95, 10) stats = [] @@ -242,7 +242,7 @@ class F1Score(Metric): prediction_confidence: np.ndarray, prediction_class_ids: np.ndarray, true_class_ids: np.ndarray, - ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + ) -> tuple[np.ndarray, np.ndarray, np.ndarray]: sorted_indices = np.argsort(-prediction_confidence) matches = matches[sorted_indices] prediction_class_ids = prediction_class_ids[sorted_indices] @@ -435,10 +435,10 @@ class F1Score(Metric): def _filter_predictions_and_targets_by_size( self, - predictions_list: List[Detections], - targets_list: List[Detections], + predictions_list: list[Detections], + targets_list: list[Detections], size_category: ObjectSizeCategory, - ) -> Tuple[List[Detections], List[Detections]]: + ) -> tuple[list[Detections], list[Detections]]: """ Filter predictions and targets by object size category. """ @@ -499,9 +499,9 @@ class F1ScoreResult: iou_thresholds: np.ndarray matched_classes: np.ndarray - small_objects: Optional[F1ScoreResult] - medium_objects: Optional[F1ScoreResult] - large_objects: Optional[F1ScoreResult] + small_objects: F1ScoreResult | None + medium_objects: F1ScoreResult | None + large_objects: F1ScoreResult | None def __str__(self) -> str: """ @@ -553,7 +553,7 @@ class F1ScoreResult: return out_str - def to_pandas(self) -> "pd.DataFrame": + def to_pandas(self) -> pd.DataFrame: """ Convert the result to a pandas DataFrame. diff --git a/supervision/metrics/mean_average_precision.py b/supervision/metrics/mean_average_precision.py index 8e8d18d7..7e1b1e6a 100644 --- a/supervision/metrics/mean_average_precision.py +++ b/supervision/metrics/mean_average_precision.py @@ -7,7 +7,7 @@ from collections import defaultdict from copy import deepcopy from dataclasses import dataclass from enum import Enum -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union +from typing import TYPE_CHECKING, Any import numpy as np from matplotlib import pyplot as plt @@ -71,9 +71,9 @@ class MeanAveragePrecisionResult: ap_per_class: np.ndarray iou_thresholds: np.ndarray matched_classes: np.ndarray - small_objects: Optional[MeanAveragePrecisionResult] = None - medium_objects: Optional[MeanAveragePrecisionResult] = None - large_objects: Optional[MeanAveragePrecisionResult] = None + small_objects: MeanAveragePrecisionResult | None = None + medium_objects: MeanAveragePrecisionResult | None = None + large_objects: MeanAveragePrecisionResult | None = None def __str__(self) -> str: """ @@ -106,7 +106,7 @@ class MeanAveragePrecisionResult: = {self.large_objects.map50_95:.3f}" ) - def to_pandas(self) -> "pd.DataFrame": + def to_pandas(self) -> pd.DataFrame: """ Convert the result to a pandas DataFrame. @@ -218,7 +218,7 @@ class EvaluationDataset: Reference: https://github.com/rafaelpadilla/review_object_detection_metrics """ - def __init__(self, targets: Optional[Dict[str, Any]] = None): + def __init__(self, targets: dict[str, Any] | None = None): """ Constructor of EvaluationDataset object used to evaluate models with Mean Average Precision. @@ -273,9 +273,9 @@ class EvaluationDataset: def get_annotation_ids( self, - img_ids: List[int] = [], - cat_ids: List[int] = [], - area_range: Tuple[float, float] = [], + img_ids: list[int] = [], + cat_ids: list[int] = [], + area_range: tuple[float, float] = [], iscrowd: bool = False, ): """ @@ -328,10 +328,10 @@ class EvaluationDataset: def get_category_ids( self, - cat_names: List[str] = [], - supercategory_names: List[str] = [], - cat_ids: List[int] = [], - ) -> List[int]: + cat_names: list[str] = [], + supercategory_names: list[str] = [], + cat_ids: list[int] = [], + ) -> list[int]: """ Get category ids that satisfy given filter conditions. Args: @@ -374,9 +374,9 @@ class EvaluationDataset: def get_image_ids( self, - img_ids: List[int] = [], - cat_ids: List[int] = [], - ) -> List[int]: + img_ids: list[int] = [], + cat_ids: list[int] = [], + ) -> list[int]: """ Get image ids that satisfy given filter conditions. Args: @@ -398,7 +398,7 @@ class EvaluationDataset: ids &= set(self.cat_to_imgs[cat_id]) return list(ids) - def get_annotations(self, ids: List[int] = []) -> List[dict]: + def get_annotations(self, ids: list[int] = []) -> list[dict]: """ Get annotations with the specified ids. Args: @@ -408,7 +408,7 @@ class EvaluationDataset: """ return [self.anns[idx] for idx in ids] - def load_predictions(self, predictions: List[Dict]) -> "EvaluationDataset": + def load_predictions(self, predictions: list[dict]) -> EvaluationDataset: """ Load prediction result into an EvaluationDataset object. Args: @@ -628,8 +628,8 @@ class COCOEvaluator: return iou def _evaluate_image( - self, img_id: int, cat_id: int, area_range: Tuple[int, int], max_det: int - ) -> Union[Dict[str, Any], None]: + self, img_id: int, cat_id: int, area_range: tuple[int, int], max_det: int + ) -> dict[str, Any] | None: """ Perform evaluation for single category and image. Args: @@ -988,7 +988,7 @@ class COCOEvaluator: self.params.iou_thrs[0], self.params.iou_thrs[-1] ) if iou_thr is None - else "{:0.2f}".format(iou_thr) + else f"{iou_thr:0.2f}" ) all_object_sizes = list(ObjectSize) area_range_idx = all_object_sizes.index(area_range) @@ -1145,8 +1145,8 @@ class MeanAveragePrecision(Metric): self, metric_target: MetricTarget = MetricTarget.BOXES, class_agnostic: bool = False, - class_mapping: Optional[Dict[int, int]] = None, - image_indices: Optional[List[int]] = None, + class_mapping: dict[int, int] | None = None, + image_indices: list[int] | None = None, ): """ Initialize the Mean Average Precision metric. @@ -1161,8 +1161,8 @@ class MeanAveragePrecision(Metric): self._metric_target = metric_target self._class_agnostic = class_agnostic - self._predictions_list: List[Detections] = [] - self._targets_list: List[Detections] = [] + self._predictions_list: list[Detections] = [] + self._targets_list: list[Detections] = [] self._class_mapping = class_mapping self._image_indices = image_indices @@ -1175,8 +1175,8 @@ class MeanAveragePrecision(Metric): def update( self, - predictions: Union[Detections, List[Detections]], - targets: Union[Detections, List[Detections]], + predictions: Detections | list[Detections], + targets: Detections | list[Detections], ) -> MeanAveragePrecision: """ Add new predictions and targets to the metric, but do not compute the result. @@ -1245,7 +1245,7 @@ class MeanAveragePrecision(Metric): } annotations.append(dict_annotation) # Category list - all_cat_ids = set([annotation.get("category_id") for annotation in annotations]) + all_cat_ids = {annotation.get("category_id") for annotation in annotations} categories = [{"id": cat_id} for cat_id in all_cat_ids] # Create coco dictionary return { diff --git a/supervision/metrics/mean_average_recall.py b/supervision/metrics/mean_average_recall.py index 464c203a..37aa2d4e 100644 --- a/supervision/metrics/mean_average_recall.py +++ b/supervision/metrics/mean_average_recall.py @@ -2,7 +2,7 @@ from __future__ import annotations from copy import deepcopy from dataclasses import dataclass -from typing import TYPE_CHECKING, List, Optional, Tuple, Union +from typing import TYPE_CHECKING import numpy as np from matplotlib import pyplot as plt @@ -87,8 +87,8 @@ class MeanAverageRecall(Metric): """ self._metric_target = metric_target - self._predictions_list: List[Detections] = [] - self._targets_list: List[Detections] = [] + self._predictions_list: list[Detections] = [] + self._targets_list: list[Detections] = [] self.max_detections = np.array([1, 10, 100]) @@ -101,8 +101,8 @@ class MeanAverageRecall(Metric): def update( self, - predictions: Union[Detections, List[Detections]], - targets: Union[Detections, List[Detections]], + predictions: Detections | list[Detections], + targets: Detections | list[Detections], ) -> MeanAverageRecall: """ Add new predictions and targets to the metric, but do not compute the result. @@ -160,7 +160,7 @@ class MeanAverageRecall(Metric): return result def _compute( - self, predictions_list: List[Detections], targets_list: List[Detections] + self, predictions_list: list[Detections], targets_list: list[Detections] ) -> MeanAverageRecallResult: iou_thresholds = np.linspace(0.5, 0.95, 10) stats = [] @@ -242,7 +242,7 @@ class MeanAverageRecall(Metric): prediction_confidence: np.ndarray, prediction_class_ids: np.ndarray, true_class_ids: np.ndarray, - ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + ) -> tuple[np.ndarray, np.ndarray, np.ndarray]: sorted_indices = np.argsort(-prediction_confidence) matches = matches[sorted_indices] prediction_class_ids = prediction_class_ids[sorted_indices] @@ -309,7 +309,7 @@ class MeanAverageRecall(Metric): sorted_prediction_class_ids: np.ndarray, unique_classes: np.ndarray, class_counts: np.ndarray, - max_detections: Optional[int] = None, + max_detections: int | None = None, ) -> np.ndarray: """ Compute the confusion matrix for each class and IoU threshold. @@ -443,10 +443,10 @@ class MeanAverageRecall(Metric): def _filter_predictions_and_targets_by_size( self, - predictions_list: List[Detections], - targets_list: List[Detections], + predictions_list: list[Detections], + targets_list: list[Detections], size_category: ObjectSizeCategory, - ) -> Tuple[List[Detections], List[Detections]]: + ) -> tuple[list[Detections], list[Detections]]: new_predictions_list = [] new_targets_list = [] for predictions, targets in zip(predictions_list, targets_list): @@ -536,9 +536,9 @@ class MeanAverageRecallResult: iou_thresholds: np.ndarray matched_classes: np.ndarray - small_objects: Optional[MeanAverageRecallResult] - medium_objects: Optional[MeanAverageRecallResult] - large_objects: Optional[MeanAverageRecallResult] + small_objects: MeanAverageRecallResult | None + medium_objects: MeanAverageRecallResult | None + large_objects: MeanAverageRecallResult | None def __str__(self) -> str: """ @@ -591,7 +591,7 @@ class MeanAverageRecallResult: return out_str - def to_pandas(self) -> "pd.DataFrame": + def to_pandas(self) -> pd.DataFrame: """ Convert the result to a pandas DataFrame. diff --git a/supervision/metrics/precision.py b/supervision/metrics/precision.py index a5d4011e..e77b78eb 100644 --- a/supervision/metrics/precision.py +++ b/supervision/metrics/precision.py @@ -2,7 +2,7 @@ from __future__ import annotations from copy import deepcopy from dataclasses import dataclass -from typing import TYPE_CHECKING, List, Optional, Tuple, Union +from typing import TYPE_CHECKING import numpy as np from matplotlib import pyplot as plt @@ -92,8 +92,8 @@ class Precision(Metric): self._metric_target = metric_target self.averaging_method = averaging_method - self._predictions_list: List[Detections] = [] - self._targets_list: List[Detections] = [] + self._predictions_list: list[Detections] = [] + self._targets_list: list[Detections] = [] def reset(self) -> None: """ @@ -104,8 +104,8 @@ class Precision(Metric): def update( self, - predictions: Union[Detections, List[Detections]], - targets: Union[Detections, List[Detections]], + predictions: Detections | list[Detections], + targets: Detections | list[Detections], ) -> Precision: """ Add new predictions and targets to the metric, but do not compute the result. @@ -163,7 +163,7 @@ class Precision(Metric): return result def _compute( - self, predictions_list: List[Detections], targets_list: List[Detections] + self, predictions_list: list[Detections], targets_list: list[Detections] ) -> PrecisionResult: iou_thresholds = np.linspace(0.5, 0.95, 10) stats = [] @@ -245,7 +245,7 @@ class Precision(Metric): prediction_confidence: np.ndarray, prediction_class_ids: np.ndarray, true_class_ids: np.ndarray, - ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + ) -> tuple[np.ndarray, np.ndarray, np.ndarray]: sorted_indices = np.argsort(-prediction_confidence) matches = matches[sorted_indices] prediction_class_ids = prediction_class_ids[sorted_indices] @@ -438,10 +438,10 @@ class Precision(Metric): def _filter_predictions_and_targets_by_size( self, - predictions_list: List[Detections], - targets_list: List[Detections], + predictions_list: list[Detections], + targets_list: list[Detections], size_category: ObjectSizeCategory, - ) -> Tuple[List[Detections], List[Detections]]: + ) -> tuple[list[Detections], list[Detections]]: """ Filter predictions and targets by object size category. """ @@ -502,9 +502,9 @@ class PrecisionResult: iou_thresholds: np.ndarray matched_classes: np.ndarray - small_objects: Optional[PrecisionResult] - medium_objects: Optional[PrecisionResult] - large_objects: Optional[PrecisionResult] + small_objects: PrecisionResult | None + medium_objects: PrecisionResult | None + large_objects: PrecisionResult | None def __str__(self) -> str: """ @@ -558,7 +558,7 @@ class PrecisionResult: return out_str - def to_pandas(self) -> "pd.DataFrame": + def to_pandas(self) -> pd.DataFrame: """ Convert the result to a pandas DataFrame. diff --git a/supervision/metrics/recall.py b/supervision/metrics/recall.py index b3586ff7..1e1ae3e0 100644 --- a/supervision/metrics/recall.py +++ b/supervision/metrics/recall.py @@ -2,7 +2,7 @@ from __future__ import annotations from copy import deepcopy from dataclasses import dataclass -from typing import TYPE_CHECKING, List, Optional, Tuple, Union +from typing import TYPE_CHECKING import numpy as np from matplotlib import pyplot as plt @@ -93,8 +93,8 @@ class Recall(Metric): self._metric_target = metric_target self.averaging_method = averaging_method - self._predictions_list: List[Detections] = [] - self._targets_list: List[Detections] = [] + self._predictions_list: list[Detections] = [] + self._targets_list: list[Detections] = [] def reset(self) -> None: """ @@ -105,8 +105,8 @@ class Recall(Metric): def update( self, - predictions: Union[Detections, List[Detections]], - targets: Union[Detections, List[Detections]], + predictions: Detections | list[Detections], + targets: Detections | list[Detections], ) -> Recall: """ Add new predictions and targets to the metric, but do not compute the result. @@ -164,7 +164,7 @@ class Recall(Metric): return result def _compute( - self, predictions_list: List[Detections], targets_list: List[Detections] + self, predictions_list: list[Detections], targets_list: list[Detections] ) -> RecallResult: iou_thresholds = np.linspace(0.5, 0.95, 10) stats = [] @@ -246,7 +246,7 @@ class Recall(Metric): prediction_confidence: np.ndarray, prediction_class_ids: np.ndarray, true_class_ids: np.ndarray, - ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + ) -> tuple[np.ndarray, np.ndarray, np.ndarray]: sorted_indices = np.argsort(-prediction_confidence) matches = matches[sorted_indices] prediction_class_ids = prediction_class_ids[sorted_indices] @@ -437,10 +437,10 @@ class Recall(Metric): def _filter_predictions_and_targets_by_size( self, - predictions_list: List[Detections], - targets_list: List[Detections], + predictions_list: list[Detections], + targets_list: list[Detections], size_category: ObjectSizeCategory, - ) -> Tuple[List[Detections], List[Detections]]: + ) -> tuple[list[Detections], list[Detections]]: """ Filter predictions and targets by object size category. """ @@ -501,9 +501,9 @@ class RecallResult: iou_thresholds: np.ndarray matched_classes: np.ndarray - small_objects: Optional[RecallResult] - medium_objects: Optional[RecallResult] - large_objects: Optional[RecallResult] + small_objects: RecallResult | None + medium_objects: RecallResult | None + large_objects: RecallResult | None def __str__(self) -> str: """ @@ -557,7 +557,7 @@ class RecallResult: return out_str - def to_pandas(self) -> "pd.DataFrame": + def to_pandas(self) -> pd.DataFrame: """ Convert the result to a pandas DataFrame. diff --git a/supervision/tracker/byte_tracker/core.py b/supervision/tracker/byte_tracker/core.py index cb46af73..7b506763 100644 --- a/supervision/tracker/byte_tracker/core.py +++ b/supervision/tracker/byte_tracker/core.py @@ -1,5 +1,3 @@ -from typing import List, Tuple - import numpy as np from supervision.detection.core import Detections @@ -55,9 +53,9 @@ class ByteTrack: self.kalman_filter = KalmanFilter() self.shared_kalman = KalmanFilter() - self.tracked_tracks: List[STrack] = [] - self.lost_tracks: List[STrack] = [] - self.removed_tracks: List[STrack] = [] + self.tracked_tracks: list[STrack] = [] + self.lost_tracks: list[STrack] = [] + self.removed_tracks: list[STrack] = [] # Warning, possible bug: If you also set internal_id to start at 1, # all traces will be connected across objects. @@ -150,7 +148,7 @@ class ByteTrack: self.lost_tracks = [] self.removed_tracks = [] - def update_with_tensors(self, tensors: np.ndarray) -> List[STrack]: + def update_with_tensors(self, tensors: np.ndarray) -> list[STrack]: """ Updates the tracker with the provided tensors and returns the updated tracks. @@ -315,8 +313,8 @@ class ByteTrack: def joint_tracks( - track_list_a: List[STrack], track_list_b: List[STrack] -) -> List[STrack]: + track_list_a: list[STrack], track_list_b: list[STrack] +) -> list[STrack]: """ Joins two lists of tracks, ensuring that the resulting list does not contain tracks with duplicate internal_track_id values. @@ -340,7 +338,7 @@ def joint_tracks( return result -def sub_tracks(track_list_a: List[STrack], track_list_b: List[STrack]) -> List[int]: +def sub_tracks(track_list_a: list[STrack], track_list_b: list[STrack]) -> list[int]: """ Returns a list of tracks from track_list_a after removing any tracks that share the same internal_track_id with tracks in track_list_b. @@ -362,8 +360,8 @@ def sub_tracks(track_list_a: List[STrack], track_list_b: List[STrack]) -> List[i def remove_duplicate_tracks( - tracks_a: List[STrack], tracks_b: List[STrack] -) -> Tuple[List[STrack], List[STrack]]: + tracks_a: list[STrack], tracks_b: list[STrack] +) -> tuple[list[STrack], list[STrack]]: pairwise_distance = matching.iou_distance(tracks_a, tracks_b) matching_pairs = np.where(pairwise_distance < 0.15) diff --git a/supervision/tracker/byte_tracker/kalman_filter.py b/supervision/tracker/byte_tracker/kalman_filter.py index f55fa6d7..5b678ec5 100644 --- a/supervision/tracker/byte_tracker/kalman_filter.py +++ b/supervision/tracker/byte_tracker/kalman_filter.py @@ -1,5 +1,3 @@ -from typing import Tuple - import numpy as np import scipy.linalg @@ -30,7 +28,7 @@ class KalmanFilter: self._std_weight_position = 1.0 / 20 self._std_weight_velocity = 1.0 / 160 - def initiate(self, measurement: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + def initiate(self, measurement: np.ndarray) -> tuple[np.ndarray, np.ndarray]: """ Create track from an unassociated measurement. @@ -62,7 +60,7 @@ class KalmanFilter: def predict( self, mean: np.ndarray, covariance: np.ndarray - ) -> Tuple[np.ndarray, np.ndarray]: + ) -> tuple[np.ndarray, np.ndarray]: """ Run Kalman filter prediction step. @@ -101,7 +99,7 @@ class KalmanFilter: def project( self, mean: np.ndarray, covariance: np.ndarray - ) -> Tuple[np.ndarray, np.ndarray]: + ) -> tuple[np.ndarray, np.ndarray]: """ Project state distribution to measurement space. @@ -129,7 +127,7 @@ class KalmanFilter: def multi_predict( self, mean: np.ndarray, covariance: np.ndarray - ) -> Tuple[np.ndarray, np.ndarray]: + ) -> tuple[np.ndarray, np.ndarray]: """ Run Kalman filter prediction step (Vectorized version). @@ -171,7 +169,7 @@ class KalmanFilter: def update( self, mean: np.ndarray, covariance: np.ndarray, measurement: np.ndarray - ) -> Tuple[np.ndarray, np.ndarray]: + ) -> tuple[np.ndarray, np.ndarray]: """ Run Kalman filter correction step. diff --git a/supervision/tracker/byte_tracker/matching.py b/supervision/tracker/byte_tracker/matching.py index eb774d4c..5850dc9e 100644 --- a/supervision/tracker/byte_tracker/matching.py +++ b/supervision/tracker/byte_tracker/matching.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, List, Tuple +from typing import TYPE_CHECKING import numpy as np from scipy.optimize import linear_sum_assignment @@ -13,7 +13,7 @@ if TYPE_CHECKING: def indices_to_matches( cost_matrix: np.ndarray, indices: np.ndarray, thresh: float -) -> Tuple[np.ndarray, tuple, tuple]: +) -> tuple[np.ndarray, tuple, tuple]: matched_cost = cost_matrix[tuple(zip(*indices))] matched_mask = matched_cost <= thresh @@ -25,7 +25,7 @@ def indices_to_matches( def linear_assignment( cost_matrix: np.ndarray, thresh: float -) -> Tuple[np.ndarray, Tuple[int], Tuple[int, int]]: +) -> tuple[np.ndarray, tuple[int], tuple[int, int]]: if cost_matrix.size == 0: return ( np.empty((0, 2), dtype=int), @@ -40,7 +40,7 @@ def linear_assignment( return indices_to_matches(cost_matrix, indices, thresh) -def iou_distance(atracks: List[STrack], btracks: List[STrack]) -> np.ndarray: +def iou_distance(atracks: list[STrack], btracks: list[STrack]) -> np.ndarray: if (len(atracks) > 0 and isinstance(atracks[0], np.ndarray)) or ( len(btracks) > 0 and isinstance(btracks[0], np.ndarray) ): @@ -58,7 +58,7 @@ def iou_distance(atracks: List[STrack], btracks: List[STrack]) -> np.ndarray: return cost_matrix -def fuse_score(cost_matrix: np.ndarray, stracks: List[STrack]) -> np.ndarray: +def fuse_score(cost_matrix: np.ndarray, stracks: list[STrack]) -> np.ndarray: if cost_matrix.size == 0: return cost_matrix iou_sim = 1 - cost_matrix diff --git a/supervision/tracker/byte_tracker/single_object_track.py b/supervision/tracker/byte_tracker/single_object_track.py index 3b9bfdf2..b2041370 100644 --- a/supervision/tracker/byte_tracker/single_object_track.py +++ b/supervision/tracker/byte_tracker/single_object_track.py @@ -1,7 +1,6 @@ from __future__ import annotations from enum import Enum -from typing import List import numpy as np import numpy.typing as npt @@ -57,7 +56,7 @@ class STrack: ) @staticmethod - def multi_predict(stracks: List[STrack], shared_kalman: KalmanFilter) -> None: + def multi_predict(stracks: list[STrack], shared_kalman: KalmanFilter) -> None: if len(stracks) > 0: multi_mean = [] multi_covariance = [] diff --git a/supervision/utils/conversion.py b/supervision/utils/conversion.py index 646d7dcf..79ec5003 100644 --- a/supervision/utils/conversion.py +++ b/supervision/utils/conversion.py @@ -1,5 +1,4 @@ from functools import wraps -from typing import List import cv2 import numpy as np @@ -80,7 +79,7 @@ def ensure_pil_image_for_annotation(annotate_func): return wrapper -def images_to_cv2(images: List[ImageType]) -> List[np.ndarray]: +def images_to_cv2(images: list[ImageType]) -> list[np.ndarray]: """ Converts images provided either as Pillow images or OpenCV images into OpenCV format. diff --git a/supervision/utils/file.py b/supervision/utils/file.py index 987bf64f..82c32ef3 100644 --- a/supervision/utils/file.py +++ b/supervision/utils/file.py @@ -1,6 +1,6 @@ import json from pathlib import Path -from typing import Dict, List, Optional, Union +from typing import Optional, Union import numpy as np import yaml @@ -14,12 +14,12 @@ class NumpyJsonEncoder(json.JSONEncoder): return float(obj) if isinstance(obj, np.ndarray): return obj.tolist() - return super(NumpyJsonEncoder, self).default(obj) + return super().default(obj) def list_files_with_extensions( - directory: Union[str, Path], extensions: Optional[List[str]] = None -) -> List[Path]: + directory: Union[str, Path], extensions: Optional[list[str]] = None +) -> list[Path]: """ List files in a directory with specified extensions or all files if no extensions are provided. @@ -57,7 +57,7 @@ def list_files_with_extensions( return files_with_extensions -def read_txt_file(file_path: Union[str, Path], skip_empty: bool = False) -> List[str]: +def read_txt_file(file_path: Union[str, Path], skip_empty: bool = False) -> list[str]: """ Read a text file and return a list of strings without newline characters. Optionally skip empty lines. @@ -70,7 +70,7 @@ def read_txt_file(file_path: Union[str, Path], skip_empty: bool = False) -> List Returns: List[str]: A list of strings representing the lines in the text file. """ - with open(str(file_path), "r") as file: + with open(str(file_path)) as file: if skip_empty: lines = [line.rstrip("\n") for line in file if line.strip()] else: @@ -79,7 +79,7 @@ def read_txt_file(file_path: Union[str, Path], skip_empty: bool = False) -> List return lines -def save_text_file(lines: List[str], file_path: Union[str, Path]) -> None: +def save_text_file(lines: list[str], file_path: Union[str, Path]) -> None: """ Write a list of strings to a text file, each string on a new line. @@ -92,7 +92,7 @@ def save_text_file(lines: List[str], file_path: Union[str, Path]) -> None: file.write(line + "\n") -def read_json_file(file_path: Union[str, Path]) -> Dict: +def read_json_file(file_path: Union[str, Path]) -> dict: """ Read a json file and return a dict. @@ -102,7 +102,7 @@ def read_json_file(file_path: Union[str, Path]) -> Dict: Returns: dict: A dict of annotations information """ - with open(str(file_path), "r") as file: + with open(str(file_path)) as file: data = json.load(file) return data @@ -120,7 +120,7 @@ def save_json_file(data: dict, file_path: Union[str, Path], indent: int = 3) -> json.dump(data, fp, cls=NumpyJsonEncoder, indent=indent) -def read_yaml_file(file_path: Union[str, Path]) -> Dict: +def read_yaml_file(file_path: Union[str, Path]) -> dict: """ Read a yaml file and return a dict. @@ -130,7 +130,7 @@ def read_yaml_file(file_path: Union[str, Path]) -> Dict: Returns: dict: A dict of content information """ - with open(str(file_path), "r") as file: + with open(str(file_path)) as file: data = yaml.safe_load(file) return data diff --git a/supervision/utils/image.py b/supervision/utils/image.py index 37025656..b34872fc 100644 --- a/supervision/utils/image.py +++ b/supervision/utils/image.py @@ -3,7 +3,7 @@ import math import os import shutil from functools import partial -from typing import Callable, List, Literal, Optional, Tuple, Union +from typing import Callable, Literal, Optional, Union import cv2 import numpy as np @@ -28,7 +28,7 @@ MAX_COLUMNS_FOR_SINGLE_ROW_GRID = 3 @ensure_cv2_image_for_processing def crop_image( image: ImageType, - xyxy: Union[npt.NDArray[int], List[int], Tuple[int, int, int, int]], + xyxy: Union[npt.NDArray[int], list[int], tuple[int, int, int, int]], ) -> ImageType: """ Crops the given image based on the given bounding box. @@ -146,7 +146,7 @@ def scale_image(image: ImageType, scale_factor: float) -> ImageType: @ensure_cv2_image_for_processing def resize_image( image: ImageType, - resolution_wh: Tuple[int, int], + resolution_wh: tuple[int, int], keep_aspect_ratio: bool = False, ) -> ImageType: """ @@ -219,8 +219,8 @@ def resize_image( @ensure_cv2_image_for_processing def letterbox_image( image: ImageType, - resolution_wh: Tuple[int, int], - color: Union[Tuple[int, int, int], Color] = Color.BLACK, + resolution_wh: tuple[int, int], + color: Union[tuple[int, int, int], Color] = Color.BLACK, ) -> ImageType: """ Resizes and pads an image to a specified resolution with a given color, maintaining @@ -302,7 +302,7 @@ def letterbox_image( def overlay_image( image: npt.NDArray[np.uint8], overlay: npt.NDArray[np.uint8], - anchor: Tuple[int, int], + anchor: tuple[int, int], ) -> npt.NDArray[np.uint8]: """ Places an image onto a scene at a given anchor point, handling cases where @@ -435,22 +435,22 @@ class ImageSink: def create_tiles( - images: List[ImageType], - grid_size: Optional[Tuple[Optional[int], Optional[int]]] = None, - single_tile_size: Optional[Tuple[int, int]] = None, + images: list[ImageType], + grid_size: Optional[tuple[Optional[int], Optional[int]]] = None, + single_tile_size: Optional[tuple[int, int]] = None, tile_scaling: Literal["min", "max", "avg"] = "avg", - tile_padding_color: Union[Tuple[int, int, int], Color] = Color.from_hex("#D9D9D9"), + tile_padding_color: Union[tuple[int, int, int], Color] = Color.from_hex("#D9D9D9"), tile_margin: int = 10, - tile_margin_color: Union[Tuple[int, int, int], Color] = Color.from_hex("#BFBEBD"), + tile_margin_color: Union[tuple[int, int, int], Color] = Color.from_hex("#BFBEBD"), return_type: Literal["auto", "cv2", "pillow"] = "auto", - titles: Optional[List[Optional[str]]] = None, - titles_anchors: Optional[Union[Point, List[Optional[Point]]]] = None, - titles_color: Union[Tuple[int, int, int], Color] = Color.from_hex("#262523"), + titles: Optional[list[Optional[str]]] = None, + titles_anchors: Optional[Union[Point, list[Optional[Point]]]] = None, + titles_color: Union[tuple[int, int, int], Color] = Color.from_hex("#262523"), titles_scale: Optional[float] = None, titles_thickness: int = 1, titles_padding: int = 10, titles_text_font: int = cv2.FONT_HERSHEY_SIMPLEX, - titles_background_color: Union[Tuple[int, int, int], Color] = Color.from_hex( + titles_background_color: Union[tuple[int, int, int], Color] = Color.from_hex( "#D9D9D9" ), default_title_placement: RelativePosition = "top", @@ -579,7 +579,7 @@ def create_tiles( return tiles -def _negotiate_tiles_format(images: List[ImageType]) -> Literal["cv2", "pillow"]: +def _negotiate_tiles_format(images: list[ImageType]) -> Literal["cv2", "pillow"]: number_of_np_arrays = sum(issubclass(type(i), np.ndarray) for i in images) if number_of_np_arrays >= (len(images) // 2): return "cv2" @@ -587,8 +587,8 @@ def _negotiate_tiles_format(images: List[ImageType]) -> Literal["cv2", "pillow"] def _calculate_aggregated_images_shape( - images: List[np.ndarray], aggregator: Callable[[List[int]], float] -) -> Tuple[int, int]: + images: list[np.ndarray], aggregator: Callable[[list[int]], float] +) -> tuple[int, int]: height = round(aggregator([i.shape[0] for i in images])) width = round(aggregator([i.shape[1] for i in images])) return width, height @@ -602,8 +602,8 @@ SHAPE_AGGREGATION_FUN = { def _aggregate_images_shape( - images: List[np.ndarray], mode: Literal["min", "max", "avg"] -) -> Tuple[int, int]: + images: list[np.ndarray], mode: Literal["min", "max", "avg"] +) -> tuple[int, int]: if mode not in SHAPE_AGGREGATION_FUN: raise ValueError( f"Could not aggregate images shape - provided unknown mode: {mode}. " @@ -613,8 +613,8 @@ def _aggregate_images_shape( def _establish_grid_size( - images: List[np.ndarray], grid_size: Optional[Tuple[Optional[int], Optional[int]]] -) -> Tuple[int, int]: + images: list[np.ndarray], grid_size: Optional[tuple[Optional[int], Optional[int]]] +) -> tuple[int, int]: if grid_size is None or all(e is None for e in grid_size): return _negotiate_grid_size(images=images) if grid_size[0] is None: @@ -624,7 +624,7 @@ def _establish_grid_size( return grid_size -def _negotiate_grid_size(images: List[np.ndarray]) -> Tuple[int, int]: +def _negotiate_grid_size(images: list[np.ndarray]) -> tuple[int, int]: if len(images) <= MAX_COLUMNS_FOR_SINGLE_ROW_GRID: return 1, len(images) nearest_sqrt = math.ceil(np.sqrt(len(images))) @@ -636,20 +636,20 @@ def _negotiate_grid_size(images: List[np.ndarray]) -> Tuple[int, int]: def _generate_tiles( - images: List[np.ndarray], - grid_size: Tuple[int, int], - single_tile_size: Tuple[int, int], - tile_padding_color: Tuple[int, int, int], + images: list[np.ndarray], + grid_size: tuple[int, int], + single_tile_size: tuple[int, int], + tile_padding_color: tuple[int, int, int], tile_margin: int, - tile_margin_color: Tuple[int, int, int], - titles: Optional[List[Optional[str]]], - titles_anchors: List[Optional[Point]], - titles_color: Tuple[int, int, int], + tile_margin_color: tuple[int, int, int], + titles: Optional[list[Optional[str]]], + titles_anchors: list[Optional[Point]], + titles_color: tuple[int, int, int], titles_scale: Optional[float], titles_thickness: int, titles_padding: int, titles_text_font: int, - titles_background_color: Tuple[int, int, int], + titles_background_color: tuple[int, int, int], default_title_placement: RelativePosition, ) -> np.ndarray: images = _draw_texts( @@ -685,17 +685,17 @@ def _generate_tiles( def _draw_texts( - images: List[np.ndarray], - titles: Optional[List[Optional[str]]], - titles_anchors: List[Optional[Point]], - titles_color: Tuple[int, int, int], + images: list[np.ndarray], + titles: Optional[list[Optional[str]]], + titles_anchors: list[Optional[Point]], + titles_color: tuple[int, int, int], titles_scale: Optional[float], titles_thickness: int, titles_padding: int, titles_text_font: int, - titles_background_color: Tuple[int, int, int], + titles_background_color: tuple[int, int, int], default_title_placement: RelativePosition, -) -> List[np.ndarray]: +) -> list[np.ndarray]: if titles is None: return images titles_anchors = _prepare_default_titles_anchors( @@ -729,10 +729,10 @@ def _draw_texts( def _prepare_default_titles_anchors( - images: List[np.ndarray], - titles_anchors: List[Optional[Point]], + images: list[np.ndarray], + titles_anchors: list[Optional[Point]], default_title_placement: RelativePosition, -) -> List[Point]: +) -> list[Point]: result = [] for image, anchor in zip(images, titles_anchors): if anchor is not None: @@ -748,11 +748,11 @@ def _prepare_default_titles_anchors( def _merge_tiles_elements( - tiles_elements: List[List[np.ndarray]], - grid_size: Tuple[int, int], - single_tile_size: Tuple[int, int], + tiles_elements: list[list[np.ndarray]], + grid_size: tuple[int, int], + single_tile_size: tuple[int, int], tile_margin: int, - tile_margin_color: Tuple[int, int, int], + tile_margin_color: tuple[int, int, int], ) -> np.ndarray: vertical_padding = ( np.ones((single_tile_size[1], tile_margin, 3)) * tile_margin_color @@ -783,6 +783,6 @@ def _merge_tiles_elements( def _generate_color_image( - shape: Tuple[int, int], color: Tuple[int, int, int] + shape: tuple[int, int], color: tuple[int, int, int] ) -> np.ndarray: return np.ones((*shape[::-1], 3), dtype=np.uint8) * color diff --git a/supervision/utils/internal.py b/supervision/utils/internal.py index 10f4a450..94b5465c 100644 --- a/supervision/utils/internal.py +++ b/supervision/utils/internal.py @@ -2,7 +2,7 @@ import functools import inspect import os import warnings -from typing import Any, Callable, Generic, Optional, Set, TypeVar +from typing import Any, Callable, Generic, Optional, TypeVar class SupervisionWarnings(Warning): @@ -161,7 +161,7 @@ class classproperty(Generic[T]): return self.fget(owner_cls) -def get_instance_variables(instance: Any, include_properties=False) -> Set[str]: +def get_instance_variables(instance: Any, include_properties=False) -> set[str]: """ Get the public variables of a class instance. @@ -179,22 +179,18 @@ def get_instance_variables(instance: Any, include_properties=False) -> Set[str]: if isinstance(instance, type): raise ValueError("Only class instances are supported, not classes.") - fields = set( - ( - name - for name, val in inspect.getmembers(instance) - if not callable(val) and not name.startswith("_") - ) - ) + fields = { + name + for name, val in inspect.getmembers(instance) + if not callable(val) and not name.startswith("_") + } if not include_properties: - properties = set( - ( - name - for name, val in inspect.getmembers(instance.__class__) - if isinstance(val, property) - ) - ) + properties = { + name + for name, val in inspect.getmembers(instance.__class__) + if isinstance(val, property) + } fields -= properties return fields diff --git a/supervision/utils/iterables.py b/supervision/utils/iterables.py index 29601d62..66116740 100644 --- a/supervision/utils/iterables.py +++ b/supervision/utils/iterables.py @@ -1,11 +1,12 @@ -from typing import Generator, Iterable, List, TypeVar +from collections.abc import Generator, Iterable +from typing import TypeVar V = TypeVar("V") def create_batches( sequence: Iterable[V], batch_size: int -) -> Generator[List[V], None, None]: +) -> Generator[list[V], None, None]: """ Provides a generator that yields chunks of the input sequence of the size specified by the `batch_size` parameter. The last @@ -40,7 +41,7 @@ def create_batches( yield current_batch -def fill(sequence: List[V], desired_size: int, content: V) -> List[V]: +def fill(sequence: list[V], desired_size: int, content: V) -> list[V]: """ Fill the sequence with padding elements until the sequence reaches the desired size. @@ -70,7 +71,7 @@ def fill(sequence: List[V], desired_size: int, content: V) -> List[V]: return sequence -def find_duplicates(sequence: List) -> List: +def find_duplicates(sequence: list) -> list: """ Find all duplicate elements in the input sequence. """ diff --git a/supervision/utils/notebook.py b/supervision/utils/notebook.py index e40ed2b5..5e7091f8 100644 --- a/supervision/utils/notebook.py +++ b/supervision/utils/notebook.py @@ -1,4 +1,4 @@ -from typing import List, Optional, Tuple +from typing import Optional import cv2 import matplotlib.pyplot as plt @@ -9,7 +9,7 @@ from supervision.utils.conversion import pillow_to_cv2 def plot_image( - image: ImageType, size: Tuple[int, int] = (12, 12), cmap: Optional[str] = "gray" + image: ImageType, size: tuple[int, int] = (12, 12), cmap: Optional[str] = "gray" ) -> None: """ Plots image using matplotlib. @@ -46,10 +46,10 @@ def plot_image( def plot_images_grid( - images: List[ImageType], - grid_size: Tuple[int, int], - titles: Optional[List[str]] = None, - size: Tuple[int, int] = (12, 12), + images: list[ImageType], + grid_size: tuple[int, int], + titles: Optional[list[str]] = None, + size: tuple[int, int] = (12, 12), cmap: Optional[str] = "gray", ) -> None: """ diff --git a/supervision/utils/video.py b/supervision/utils/video.py index 67f5191d..32d1879b 100644 --- a/supervision/utils/video.py +++ b/supervision/utils/video.py @@ -2,8 +2,9 @@ from __future__ import annotations import time from collections import deque +from collections.abc import Generator from dataclasses import dataclass -from typing import Callable, Generator, Optional, Tuple +from typing import Callable import cv2 import numpy as np @@ -40,7 +41,7 @@ class VideoInfo: width: int height: int fps: int - total_frames: Optional[int] = None + total_frames: int | None = None @classmethod def from_video_path(cls, video_path: str) -> VideoInfo: @@ -56,7 +57,7 @@ class VideoInfo: return VideoInfo(width, height, fps, total_frames) @property - def resolution_wh(self) -> Tuple[int, int]: + def resolution_wh(self) -> tuple[int, int]: return self.width, self.height @@ -118,7 +119,7 @@ class VideoSink: def _validate_and_setup_video( - source_path: str, start: int, end: Optional[int], iterative_seek: bool = False + source_path: str, start: int, end: int | None, iterative_seek: bool = False ): video = cv2.VideoCapture(source_path) if not video.isOpened(): @@ -145,9 +146,9 @@ def get_video_frames_generator( source_path: str, stride: int = 1, start: int = 0, - end: Optional[int] = None, + end: int | None = None, iterative_seek: bool = False, -) -> Generator[np.ndarray, None, None]: +) -> Generator[np.ndarray]: """ Get a generator that yields the frames of the video. @@ -196,7 +197,7 @@ def process_video( source_path: str, target_path: str, callback: Callable[[np.ndarray, int], np.ndarray], - max_frames: Optional[int] = None, + max_frames: int | None = None, show_progress: bool = False, progress_message: str = "Processing video", ) -> None: diff --git a/supervision/validators/__init__.py b/supervision/validators/__init__.py index 29ac0da9..cc92648c 100644 --- a/supervision/validators/__init__.py +++ b/supervision/validators/__init__.py @@ -79,7 +79,7 @@ def validate_tracker_id(tracker_id: Any, n: int) -> None: ) -def validate_data(data: Dict[str, Any], n: int) -> None: +def validate_data(data: dict[str, Any], n: int) -> None: for key, value in data.items(): if isinstance(value, list): if len(value) != n: @@ -115,7 +115,7 @@ def validate_detections_fields( class_id: Any, confidence: Any, tracker_id: Any, - data: Dict[str, Any], + data: dict[str, Any], ) -> None: validate_xyxy(xyxy) n = len(xyxy) @@ -130,7 +130,7 @@ def validate_keypoints_fields( xy: Any, class_id: Any, confidence: Any, - data: Dict[str, Any], + data: dict[str, Any], ) -> None: n = len(xy) m = len(xy[0]) if len(xy) > 0 else 0 diff --git a/test/classification/test_core.py b/test/classification/test_core.py index 83a441b1..9ab04e63 100644 --- a/test/classification/test_core.py +++ b/test/classification/test_core.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from typing import Optional, Tuple +from typing import Optional import numpy as np import pytest @@ -51,7 +51,7 @@ def test_top_k( class_id: np.ndarray, confidence: Optional[np.ndarray], k: int, - expected_result: Optional[Tuple[np.ndarray, np.ndarray]], + expected_result: Optional[tuple[np.ndarray, np.ndarray]], exception: Exception, ) -> None: with exception: diff --git a/test/dataset/formats/test_coco.py b/test/dataset/formats/test_coco.py index b8f53461..d9748cf3 100644 --- a/test/dataset/formats/test_coco.py +++ b/test/dataset/formats/test_coco.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from typing import Dict, List, Optional, Tuple, Union +from typing import Optional, Union import numpy as np import pytest @@ -19,9 +19,9 @@ def mock_coco_annotation( annotation_id: int = 0, image_id: int = 0, category_id: int = 0, - bbox: Tuple[float, float, float, float] = (0.0, 0.0, 0.0, 0.0), + bbox: tuple[float, float, float, float] = (0.0, 0.0, 0.0, 0.0), area: float = 0.0, - segmentation: Optional[Union[List[list], Dict]] = None, + segmentation: Optional[Union[list[list], dict]] = None, iscrowd: bool = False, ) -> dict: if not segmentation: @@ -78,7 +78,7 @@ def mock_coco_annotation( ], ) def test_coco_categories_to_classes( - coco_categories: List[dict], expected_result: List[str], exception: Exception + coco_categories: list[dict], expected_result: list[str], exception: Exception ) -> None: with exception: result = coco_categories_to_classes(coco_categories=coco_categories) @@ -94,7 +94,7 @@ def test_coco_categories_to_classes( ], ) def test_classes_to_coco_categories_and_back_to_classes( - classes: List[str], exception: Exception + classes: list[str], exception: Exception ) -> None: with exception: coco_categories = classes_to_coco_categories(classes=classes) @@ -154,7 +154,7 @@ def test_classes_to_coco_categories_and_back_to_classes( ], ) def test_group_coco_annotations_by_image_id( - coco_annotations: List[dict], expected_result: dict, exception: Exception + coco_annotations: list[dict], expected_result: dict, exception: Exception ) -> None: with exception: result = group_coco_annotations_by_image_id(coco_annotations=coco_annotations) @@ -582,8 +582,8 @@ def test_group_coco_annotations_by_image_id( ], ) def test_coco_annotations_to_detections( - image_annotations: List[dict], - resolution_wh: Tuple[int, int], + image_annotations: list[dict], + resolution_wh: tuple[int, int], with_masks: bool, use_iscrowd: bool, expected_result: Detections, @@ -646,9 +646,9 @@ def test_coco_annotations_to_detections( ], ) def test_build_coco_class_index_mapping( - coco_categories: List[dict], - target_classes: List[str], - expected_result: Dict[int, int], + coco_categories: list[dict], + target_classes: list[str], + expected_result: dict[int, int], exception: Exception, ) -> None: with exception: @@ -774,7 +774,7 @@ def test_detections_to_coco_annotations( detections: Detections, image_id: int, annotation_id: int, - expected_result: List[Dict], + expected_result: list[dict], exception: Exception, ) -> None: with exception: diff --git a/test/dataset/formats/test_pascal_voc.py b/test/dataset/formats/test_pascal_voc.py index 80d83cc7..3006e227 100644 --- a/test/dataset/formats/test_pascal_voc.py +++ b/test/dataset/formats/test_pascal_voc.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from typing import List, Optional +from typing import Optional import numpy as np import pytest @@ -84,7 +84,7 @@ def test_object_to_pascal_voc( ) def test_parse_polygon_points( polygon_element, - expected_result: List[list], + expected_result: list[list], exception, ): with exception: diff --git a/test/dataset/formats/test_yolo.py b/test/dataset/formats/test_yolo.py index 70f0e362..62774a5d 100644 --- a/test/dataset/formats/test_yolo.py +++ b/test/dataset/formats/test_yolo.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from typing import List, Optional, Tuple +from typing import Optional import numpy as np import pytest @@ -13,7 +13,7 @@ from supervision.dataset.formats.yolo import ( from supervision.detection.core import Detections -def _mock_simple_mask(resolution_wh: Tuple[int, int], box: List[int]) -> np.ndarray: +def _mock_simple_mask(resolution_wh: tuple[int, int], box: list[int]) -> np.ndarray: x_min, y_min, x_max, y_max = box mask = np.full(resolution_wh, False, dtype=bool) mask[y_min:y_max, x_min:x_max] = True @@ -57,7 +57,7 @@ def _arrays_almost_equal( ], ) def test_with_mask( - lines: List[str], expected_result: Optional[bool], exception: Exception + lines: list[str], expected_result: Optional[bool], exception: Exception ) -> None: with exception: result = _with_mask(lines=lines) @@ -171,8 +171,8 @@ def test_with_mask( ], ) def test_yolo_annotations_to_detections( - lines: List[str], - resolution_wh: Tuple[int, int], + lines: list[str], + resolution_wh: tuple[int, int], with_masks: bool, expected_result: Optional[Detections], exception: Exception, @@ -267,7 +267,7 @@ def test_image_name_to_annotation_name( def test_object_to_yolo( xyxy: np.ndarray, class_id: int, - image_shape: Tuple[int, int, int], + image_shape: tuple[int, int, int], polygon: Optional[np.ndarray], expected_result: Optional[str], exception: Exception, diff --git a/test/dataset/test_core.py b/test/dataset/test_core.py index 1a898cf6..3cc19a80 100644 --- a/test/dataset/test_core.py +++ b/test/dataset/test_core.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from typing import List, Optional +from typing import Optional import pytest @@ -158,7 +158,7 @@ from test.test_utils import mock_detections ], ) def test_dataset_merge( - dataset_list: List[DetectionDataset], + dataset_list: list[DetectionDataset], expected_result: Optional[DetectionDataset], exception: Exception, ) -> None: diff --git a/test/dataset/test_utils.py b/test/dataset/test_utils.py index dcbe6d19..758e6d4c 100644 --- a/test/dataset/test_utils.py +++ b/test/dataset/test_utils.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from typing import Dict, List, Optional, Tuple, TypeVar +from typing import Optional, TypeVar import numpy as np import numpy.typing as npt @@ -74,11 +74,11 @@ T = TypeVar("T") ], ) def test_train_test_split( - data: List[T], + data: list[T], train_ratio: float, random_state: int, shuffle: bool, - expected_result: Optional[Tuple[List[T], List[T]]], + expected_result: Optional[tuple[list[T], list[T]]], exception: Exception, ) -> None: with exception: @@ -118,7 +118,7 @@ def test_train_test_split( ], ) def test_merge_class_maps( - class_lists: List[List[str]], expected_result: List[str], exception: Exception + class_lists: list[list[str]], expected_result: list[str], exception: Exception ) -> None: with exception: result = merge_class_lists(class_lists=class_lists) @@ -163,9 +163,9 @@ def test_merge_class_maps( ], ) def test_build_class_index_mapping( - source_classes: List[str], - target_classes: List[str], - expected_result: Optional[Dict[int, int]], + source_classes: list[str], + target_classes: list[str], + expected_result: Optional[dict[int, int]], exception: Exception, ) -> None: with exception: @@ -223,7 +223,7 @@ def test_build_class_index_mapping( ], ) def test_map_detections_class_id( - source_to_target_mapping: Dict[int, int], + source_to_target_mapping: dict[int, int], detections: Detections, expected_result: Optional[Detections], exception: Exception, @@ -287,7 +287,7 @@ def test_map_detections_class_id( ], ) def test_mask_to_rle( - mask: npt.NDArray[np.bool_], expected_rle: List[int], exception: Exception + mask: npt.NDArray[np.bool_], expected_rle: list[int], exception: Exception ) -> None: with exception: result = mask_to_rle(mask=mask) @@ -354,7 +354,7 @@ def test_mask_to_rle( ) def test_rle_to_mask( rle: npt.NDArray[np.int_], - resolution_wh: Tuple[int, int], + resolution_wh: tuple[int, int], expected_mask: npt.NDArray[np.bool_], exception: Exception, ) -> None: diff --git a/test/detection/test_core.py b/test/detection/test_core.py index dfa784fc..c0270f70 100644 --- a/test/detection/test_core.py +++ b/test/detection/test_core.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from typing import List, Optional, Union +from typing import Optional, Union import numpy as np import pytest @@ -233,7 +233,7 @@ TEST_DET_DIFFERENT_METADATA = Detections( ) def test_getitem( detections: Detections, - index: Union[int, slice, List[int], np.ndarray], + index: Union[int, slice, list[int], np.ndarray], expected_result: Optional[Detections], exception: Exception, ) -> None: @@ -505,7 +505,7 @@ def test_getitem( ], ) def test_merge( - detections_list: List[Detections], + detections_list: list[Detections], expected_result: Optional[Detections], exception: Exception, ) -> None: diff --git a/test/detection/test_csv.py b/test/detection/test_csv.py index 0c51a0e3..bad4b8a1 100644 --- a/test/detection/test_csv.py +++ b/test/detection/test_csv.py @@ -1,6 +1,6 @@ import csv import os -from typing import Any, Dict, List +from typing import Any import pytest @@ -192,11 +192,11 @@ from test.test_utils import mock_detections ) def test_csv_sink( detections: mock_detections, - custom_data: Dict[str, Any], + custom_data: dict[str, Any], second_detections: mock_detections, - second_custom_data: Dict[str, Any], + second_custom_data: dict[str, Any], file_name: str, - expected_result: List[List[Any]], + expected_result: list[list[Any]], ) -> None: with sv.CSVSink(file_name) as sink: sink.append(detections, custom_data) @@ -389,11 +389,11 @@ def test_csv_sink( ) def test_csv_sink_manual( detections: mock_detections, - custom_data: Dict[str, Any], + custom_data: dict[str, Any], second_detections: mock_detections, - second_custom_data: Dict[str, Any], + second_custom_data: dict[str, Any], file_name: str, - expected_result: List[List[Any]], + expected_result: list[list[Any]], ) -> None: sink = sv.CSVSink(file_name) sink.open() @@ -405,7 +405,7 @@ def test_csv_sink_manual( def assert_csv_equal(file_name, expected_rows): - with open(file_name, mode="r", newline="") as file: + with open(file_name, newline="") as file: reader = csv.reader(file) for i, row in enumerate(reader): assert [str(item) for item in expected_rows[i]] == row, ( diff --git a/test/detection/test_json.py b/test/detection/test_json.py index b6c8524d..4dd422e1 100644 --- a/test/detection/test_json.py +++ b/test/detection/test_json.py @@ -1,6 +1,6 @@ import json import os -from typing import Any, Dict, List +from typing import Any import pytest @@ -226,11 +226,11 @@ from test.test_utils import mock_detections ) def test_json_sink( detections: mock_detections, - custom_data: Dict[str, Any], + custom_data: dict[str, Any], second_detections: mock_detections, - second_custom_data: Dict[str, Any], + second_custom_data: dict[str, Any], file_name: str, - expected_result: List[List[Any]], + expected_result: list[list[Any]], ) -> None: with sv.JSONSink(file_name) as sink: sink.append(detections, custom_data) @@ -240,7 +240,7 @@ def test_json_sink( def assert_json_equal(file_name, expected_rows): - with open(file_name, "r") as file: + with open(file_name) as file: data = json.load(file) assert data == expected_rows, ( f"Data in JSON file didn't match expected output: {data} != {expected_rows}" diff --git a/test/detection/test_line_counter.py b/test/detection/test_line_counter.py index 0119cf86..7291a1c5 100644 --- a/test/detection/test_line_counter.py +++ b/test/detection/test_line_counter.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from typing import List, Optional, Tuple +from typing import Optional import pytest @@ -65,7 +65,7 @@ from test.test_utils import mock_detections ) def test_calculate_region_of_interest_limits( vector: Vector, - expected_result: Optional[Tuple[Vector, Vector]], + expected_result: Optional[tuple[Vector, Vector]], exception: Exception, ) -> None: with exception: @@ -233,9 +233,9 @@ def test_calculate_region_of_interest_limits( ) def test_line_zone_one_detection_default_anchors( vector: Vector, - xyxy_sequence: List[List[float]], - expected_crossed_in: List[bool], - expected_crossed_out: List[bool], + xyxy_sequence: list[list[float]], + expected_crossed_in: list[bool], + expected_crossed_out: list[bool], ) -> None: line_zone = LineZone(start=vector.start, end=vector.end) @@ -395,10 +395,10 @@ def test_line_zone_one_detection_default_anchors( ) def test_line_zone_one_detection( vector: Vector, - xyxy_sequence: List[List[float]], - triggering_anchors: List[Position], - expected_crossed_in: List[bool], - expected_crossed_out: List[bool], + xyxy_sequence: list[list[float]], + triggering_anchors: list[Position], + expected_crossed_in: list[bool], + expected_crossed_out: list[bool], ) -> None: line_zone = LineZone( start=vector.start, end=vector.end, triggering_anchors=triggering_anchors @@ -467,10 +467,10 @@ def test_line_zone_one_detection( ) def test_line_zone_multiple_detections( vector: Vector, - xyxy_sequence: List[List[List[float]]], - anchors: List[Position], - expected_crossed_in: List[List[bool]], - expected_crossed_out: List[List[bool]], + xyxy_sequence: list[list[list[float]]], + anchors: list[Position], + expected_crossed_in: list[list[bool]], + expected_crossed_out: list[list[bool]], exception: Exception, ) -> None: with exception: @@ -576,11 +576,11 @@ def test_line_zone_multiple_detections( ) def test_line_zone_one_detection_long_horizon( vector: Vector, - xyxy_sequence: List[List[float]], - triggering_anchors: List[Position], + xyxy_sequence: list[list[float]], + triggering_anchors: list[Position], minimum_crossing_threshold: int, - expected_crossed_in: List[bool], - expected_crossed_out: List[bool], + expected_crossed_in: list[bool], + expected_crossed_out: list[bool], ) -> None: line_zone = LineZone( start=vector.start, @@ -741,13 +741,13 @@ def test_line_zone_one_detection_long_horizon( ) def test_line_zone_long_horizon_disappearing_detections( vector: Vector, - xyxy_sequence: List[List[Optional[List[float]]]], - anchors: List[Position], + xyxy_sequence: list[list[Optional[list[float]]]], + anchors: list[Position], minimum_crossing_threshold: int, - expected_crossed_in: List[List[bool]], - expected_crossed_out: List[List[bool]], - expected_count_in: List[int], - expected_count_out: List[int], + expected_crossed_in: list[list[bool]], + expected_crossed_out: list[list[bool]], + expected_count_in: list[int], + expected_count_out: list[int], exception: Exception, ) -> None: with exception: diff --git a/test/detection/test_overlap_filter.py b/test/detection/test_overlap_filter.py index f628c30f..b9d319e1 100644 --- a/test/detection/test_overlap_filter.py +++ b/test/detection/test_overlap_filter.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from typing import List, Optional +from typing import Optional import numpy as np import pytest @@ -127,7 +127,7 @@ from supervision.detection.overlap_filter import ( def test_group_overlapping_boxes( predictions: np.ndarray, iou_threshold: float, - expected_result: List[List[int]], + expected_result: list[list[int]], exception: Exception, ) -> None: with exception: diff --git a/test/detection/test_utils.py b/test/detection/test_utils.py index 8808588b..99762c91 100644 --- a/test/detection/test_utils.py +++ b/test/detection/test_utils.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from typing import Any, Dict, List, Optional, Tuple +from typing import Any, Optional import numpy as np import numpy.typing as npt @@ -66,7 +66,7 @@ TEST_MASK[:, 300:351, 200:251] = True ) def test_clip_boxes( xyxy: np.ndarray, - resolution_wh: Tuple[int, int], + resolution_wh: tuple[int, int], expected_result: np.ndarray, ) -> None: result = clip_boxes(xyxy=xyxy, resolution_wh=resolution_wh) @@ -152,10 +152,10 @@ def test_clip_boxes( ], ) def test_filter_polygons_by_area( - polygons: List[np.ndarray], + polygons: list[np.ndarray], min_area: Optional[float], max_area: Optional[float], - expected_result: List[np.ndarray], + expected_result: list[np.ndarray], exception: Exception, ) -> None: with exception: @@ -372,7 +372,7 @@ def test_filter_polygons_by_area( ) def test_process_roboflow_result( roboflow_result: dict, - expected_result: Tuple[ + expected_result: tuple[ np.ndarray, np.ndarray, np.ndarray, Optional[np.ndarray], np.ndarray ], exception: Exception, @@ -698,7 +698,7 @@ def test_move_boxes( def test_move_masks( masks: np.ndarray, offset: np.ndarray, - resolution_wh: Tuple[int, int], + resolution_wh: tuple[int, int], expected_result: np.ndarray, exception: Exception, ) -> None: @@ -1032,8 +1032,8 @@ def test_calculate_masks_centroids( ], ) def test_merge_data( - data_list: List[Dict[str, Any]], - expected_result: Optional[Dict[str, Any]], + data_list: list[dict[str, Any]], + expected_result: Optional[dict[str, Any]], exception: Exception, ): with exception: @@ -1207,9 +1207,9 @@ def test_merge_data( ], ) def test_get_data_item( - data: Dict[str, Any], + data: dict[str, Any], index: Any, - expected_result: Optional[Dict[str, Any]], + expected_result: Optional[dict[str, Any]], exception: Exception, ): with exception: diff --git a/test/detection/test_vlm.py b/test/detection/test_vlm.py index 7b9acb0c..b405ec33 100644 --- a/test/detection/test_vlm.py +++ b/test/detection/test_vlm.py @@ -1,6 +1,6 @@ from contextlib import ExitStack as DoesNotRaise from contextlib import nullcontext as does_not_raise -from typing import List, Optional, Tuple +from typing import Optional import numpy as np import pytest @@ -183,9 +183,9 @@ from supervision.detection.vlm import ( def test_from_paligemma( exception, result: str, - resolution_wh: Tuple[int, int], - classes: Optional[List[str]], - expected_results: Tuple[np.ndarray, Optional[np.ndarray], np.ndarray], + resolution_wh: tuple[int, int], + classes: Optional[list[str]], + expected_results: tuple[np.ndarray, Optional[np.ndarray], np.ndarray], ) -> None: with exception: result = from_paligemma( @@ -344,9 +344,9 @@ def test_from_paligemma( def test_from_qwen_2_5_vl( exception, result: str, - input_wh: Tuple[int, int], - resolution_wh: Tuple[int, int], - classes: Optional[List[str]], + input_wh: tuple[int, int], + resolution_wh: tuple[int, int], + classes: Optional[list[str]], expected_results, ) -> None: with exception: @@ -487,9 +487,9 @@ def test_from_qwen_2_5_vl( def test_from_google_gemini( exception, result: str, - resolution_wh: Tuple[int, int], - classes: Optional[List[str]], - expected_results: Tuple[np.ndarray, Optional[np.ndarray], np.ndarray], + resolution_wh: tuple[int, int], + classes: Optional[list[str]], + expected_results: tuple[np.ndarray, Optional[np.ndarray], np.ndarray], ) -> None: with exception: xyxy, class_id, class_name = from_google_gemini( @@ -589,7 +589,7 @@ def test_from_google_gemini( def test_from_moondream( exception, result: dict, - resolution_wh: Tuple[int, int], + resolution_wh: tuple[int, int], expected_results, ) -> None: with exception: @@ -862,8 +862,8 @@ def test_from_moondream( ) def test_florence_2( florence_result: dict, - resolution_wh: Tuple[int, int], - expected_results: Tuple[ + resolution_wh: tuple[int, int], + expected_results: tuple[ np.ndarray, Optional[np.ndarray], Optional[np.ndarray], Optional[np.ndarray] ], exception: Exception, diff --git a/test/detection/tools/test_inference_slicer.py b/test/detection/tools/test_inference_slicer.py index e484f513..84f3b803 100644 --- a/test/detection/tools/test_inference_slicer.py +++ b/test/detection/tools/test_inference_slicer.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from typing import Optional, Tuple +from typing import Optional import numpy as np import pytest @@ -46,10 +46,10 @@ def mock_callback(): ) def test_inference_slicer_overlap( mock_callback, - slice_wh: Tuple[int, int], - overlap_ratio_wh: Optional[Tuple[float, float]], - overlap_wh: Optional[Tuple[int, int]], - expected_overlap: Optional[Tuple[int, int]], + slice_wh: tuple[int, int], + overlap_ratio_wh: Optional[tuple[float, float]], + overlap_wh: Optional[tuple[int, int]], + expected_overlap: Optional[tuple[int, int]], exception: Exception, ) -> None: with exception: @@ -167,9 +167,9 @@ def test_inference_slicer_overlap( ], ) def test_generate_offset( - resolution_wh: Tuple[int, int], - slice_wh: Tuple[int, int], - overlap_wh: Optional[Tuple[int, int]], + resolution_wh: tuple[int, int], + slice_wh: tuple[int, int], + overlap_wh: Optional[tuple[int, int]], expected_offsets: np.ndarray, ) -> None: offsets = InferenceSlicer._generate_offset( diff --git a/test/test_utils.py b/test/test_utils.py index ce1bc136..8e5ca016 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, List, Optional +from typing import Any, Optional import numpy as np import numpy.typing as npt @@ -9,13 +9,13 @@ from supervision.keypoint.core import KeyPoints def mock_detections( xyxy: npt.NDArray[np.float32], - mask: Optional[List[np.ndarray]] = None, - confidence: Optional[List[float]] = None, - class_id: Optional[List[int]] = None, - tracker_id: Optional[List[int]] = None, - data: Optional[Dict[str, List[Any]]] = None, + mask: Optional[list[np.ndarray]] = None, + confidence: Optional[list[float]] = None, + class_id: Optional[list[int]] = None, + tracker_id: Optional[list[int]] = None, + data: Optional[dict[str, list[Any]]] = None, ) -> Detections: - def convert_data(data: Dict[str, List[Any]]): + def convert_data(data: dict[str, list[Any]]): return {k: np.array(v) for k, v in data.items()} return Detections( @@ -34,11 +34,11 @@ def mock_detections( def mock_keypoints( xy: npt.NDArray[np.float32], - confidence: Optional[List[float]] = None, - class_id: Optional[List[int]] = None, - data: Optional[Dict[str, List[Any]]] = None, + confidence: Optional[list[float]] = None, + class_id: Optional[list[int]] = None, + data: Optional[dict[str, list[Any]]] = None, ) -> KeyPoints: - def convert_data(data: Dict[str, List[Any]]): + def convert_data(data: dict[str, list[Any]]): return {k: np.array(v) for k, v in data.items()} return KeyPoints( diff --git a/test/tracker/test_byte_tracker.py b/test/tracker/test_byte_tracker.py index 98efeb09..7ca94bbf 100644 --- a/test/tracker/test_byte_tracker.py +++ b/test/tracker/test_byte_tracker.py @@ -1,5 +1,3 @@ -from typing import List - import numpy as np import pytest @@ -32,7 +30,7 @@ import supervision as sv ], ) def test_byte_tracker( - detections: List[sv.Detections], + detections: list[sv.Detections], expected_results: sv.Detections, ) -> None: byte_tracker = sv.ByteTrack() diff --git a/test/utils/conftest.py b/test/utils/conftest.py index 4230571b..967037dd 100644 --- a/test/utils/conftest.py +++ b/test/utils/conftest.py @@ -1,5 +1,4 @@ import os -from typing import List import cv2 import numpy as np @@ -21,7 +20,7 @@ def empty_pillow_image() -> Image.Image: @fixture(scope="function") -def all_images() -> List[np.ndarray]: +def all_images() -> list[np.ndarray]: return [cv2.imread(path) for path in ALL_IMAGES_LIST] @@ -31,17 +30,17 @@ def one_image() -> np.ndarray: @fixture(scope="function") -def two_images() -> List[np.ndarray]: +def two_images() -> list[np.ndarray]: return [cv2.imread(path) for path in ALL_IMAGES_LIST[:2]] @fixture(scope="function") -def three_images() -> List[np.ndarray]: +def three_images() -> list[np.ndarray]: return [cv2.imread(path) for path in ALL_IMAGES_LIST[:3]] @fixture(scope="function") -def four_images() -> List[np.ndarray]: +def four_images() -> list[np.ndarray]: return [cv2.imread(path) for path in ALL_IMAGES_LIST[:4]] diff --git a/test/utils/test_file.py b/test/utils/test_file.py index 7a8dd37f..9a4a4d33 100644 --- a/test/utils/test_file.py +++ b/test/utils/test_file.py @@ -1,6 +1,6 @@ import os from contextlib import ExitStack as DoesNotRaise -from typing import List, Optional +from typing import Optional import pytest @@ -56,7 +56,7 @@ def setup_and_teardown_files(): def test_read_txt_file( file_name: str, skip_empty: bool, - expected_result: Optional[List[str]], + expected_result: Optional[list[str]], exception: Exception, ): with exception: diff --git a/test/utils/test_image.py b/test/utils/test_image.py index 80caf989..39640330 100644 --- a/test/utils/test_image.py +++ b/test/utils/test_image.py @@ -1,5 +1,3 @@ -from typing import List - import numpy as np import pytest from PIL import Image, ImageChops @@ -125,7 +123,7 @@ def test_create_tiles_with_one_image_and_enforced_grid( def test_create_tiles_with_two_images( - two_images: List[np.ndarray], two_images_tile: np.ndarray + two_images: list[np.ndarray], two_images_tile: np.ndarray ) -> None: # when result = create_tiles(images=two_images, single_tile_size=(240, 240)) @@ -135,7 +133,7 @@ def test_create_tiles_with_two_images( def test_create_tiles_with_three_images( - three_images: List[np.ndarray], three_images_tile: np.ndarray + three_images: list[np.ndarray], three_images_tile: np.ndarray ) -> None: # when result = create_tiles(images=three_images, single_tile_size=(240, 240)) @@ -145,7 +143,7 @@ def test_create_tiles_with_three_images( def test_create_tiles_with_four_images( - four_images: List[np.ndarray], + four_images: list[np.ndarray], four_images_tile: np.ndarray, ) -> None: # when @@ -156,7 +154,7 @@ def test_create_tiles_with_four_images( def test_create_tiles_with_all_images( - all_images: List[np.ndarray], + all_images: list[np.ndarray], all_images_tile: np.ndarray, ) -> None: # when @@ -167,7 +165,7 @@ def test_create_tiles_with_all_images( def test_create_tiles_with_all_images_and_custom_grid( - all_images: List[np.ndarray], all_images_tile_and_custom_grid: np.ndarray + all_images: list[np.ndarray], all_images_tile_and_custom_grid: np.ndarray ) -> None: # when result = create_tiles( @@ -181,7 +179,7 @@ def test_create_tiles_with_all_images_and_custom_grid( def test_create_tiles_with_all_images_and_custom_colors( - all_images: List[np.ndarray], all_images_tile_and_custom_colors: np.ndarray + all_images: list[np.ndarray], all_images_tile_and_custom_colors: np.ndarray ) -> None: # when result = create_tiles( @@ -196,7 +194,7 @@ def test_create_tiles_with_all_images_and_custom_colors( def test_create_tiles_with_all_images_and_titles( - all_images: List[np.ndarray], + all_images: list[np.ndarray], all_images_tile_and_custom_colors_and_titles: np.ndarray, ) -> None: # when @@ -211,7 +209,7 @@ def test_create_tiles_with_all_images_and_titles( def test_create_tiles_with_all_images_and_titles_with_custom_configs( - all_images: List[np.ndarray], + all_images: list[np.ndarray], all_images_tile_and_titles_with_custom_configs: np.ndarray, ) -> None: # when @@ -238,7 +236,7 @@ def test_create_tiles_with_all_images_and_titles_with_custom_configs( def test_create_tiles_with_all_images_and_custom_grid_to_small_to_fit_images( - all_images: List[np.ndarray], + all_images: list[np.ndarray], ) -> None: with pytest.raises(ValueError): _ = create_tiles(images=all_images, grid_size=(2, 2)) diff --git a/test/utils/test_internal.py b/test/utils/test_internal.py index 872822a7..07674f39 100644 --- a/test/utils/test_internal.py +++ b/test/utils/test_internal.py @@ -1,6 +1,6 @@ from contextlib import ExitStack as DoesNotRaise from dataclasses import dataclass, field -from typing import Any, Set +from typing import Any import numpy as np import pytest @@ -202,7 +202,7 @@ class MockDataclass: def test_get_instance_variables( input_instance: Any, include_properties: bool, - expected: Set[str], + expected: set[str], exception: Exception, ) -> None: with exception: From 5d883447a365100ccf482446e9a62039f552aa42 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 20:21:35 +0300 Subject: [PATCH 051/110] =?UTF-8?q?docs:=20=F0=9F=93=9D=20update=20Python?= =?UTF-8?q?=20version=20requirement=20to=203.9=20in=20docs=20and=20clean?= =?UTF-8?q?=20up=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 6 ------ README.md | 2 +- docs/index.md | 2 +- pyproject.toml | 2 +- supervision/detection/line_zone.py | 4 ++-- supervision/metrics/mean_average_precision.py | 4 +--- supervision/tracker/byte_tracker/single_object_track.py | 4 +--- supervision/validators/__init__.py | 2 +- 8 files changed, 8 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 69a30f2e..7efab7c7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -53,9 +53,3 @@ repos: - id: codespell additional_dependencies: - tomli - - - - repo: https://github.com/venomlab/pyproject-pyupgrade - rev: v0.1.1 - hooks: - - id: ppyupgrade diff --git a/README.md b/README.md index 2aa3cef0..43d7cf6f 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ ## 💻 install Pip install the supervision package in a -[**Python>=3.8**](https://www.python.org/) environment. +[**Python>=3.9**](https://www.python.org/) environment. ```bash pip install supervision diff --git a/docs/index.md b/docs/index.md index 98338774..1a1be772 100644 --- a/docs/index.md +++ b/docs/index.md @@ -37,7 +37,7 @@ We write your reusable computer vision tools. Whether you need to load your data ## 💻 Install You can install `supervision` in a -[**Python>=3.8**](https://www.python.org/) environment. +[**Python>=3.9**](https://www.python.org/) environment. !!! example "Installation" diff --git a/pyproject.toml b/pyproject.toml index aa5a387e..3cb92e34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -128,7 +128,7 @@ indent-width = 4 [tool.ruff.lint] # Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default. -select = ["E", "F", "I", "A", "Q", "W", "RUF"] +select = ["E", "F", "I", "A", "Q", "W", "RUF", "UP"] ignore = [] # Allow autofix for all enabled rules (when `--fix`) is provided. fixable = [ diff --git a/supervision/detection/line_zone.py b/supervision/detection/line_zone.py index ad9260bd..b94fc531 100644 --- a/supervision/detection/line_zone.py +++ b/supervision/detection/line_zone.py @@ -3,7 +3,7 @@ import warnings from collections import Counter, defaultdict, deque from collections.abc import Iterable from functools import lru_cache -from typing import Any, Deque, Literal, Optional +from typing import Any, Literal, Optional import cv2 import numpy as np @@ -100,7 +100,7 @@ class LineZone: self.vector = Vector(start=start, end=end) self.limits = self._calculate_region_of_interest_limits(vector=self.vector) self.crossing_history_length = max(2, minimum_crossing_threshold + 1) - self.crossing_state_history: dict[int, Deque[bool]] = defaultdict( + self.crossing_state_history: dict[int, deque[bool]] = defaultdict( lambda: deque(maxlen=self.crossing_history_length) ) self._in_count_per_class: Counter = Counter() diff --git a/supervision/metrics/mean_average_precision.py b/supervision/metrics/mean_average_precision.py index 7e1b1e6a..89e461fc 100644 --- a/supervision/metrics/mean_average_precision.py +++ b/supervision/metrics/mean_average_precision.py @@ -984,9 +984,7 @@ class COCOEvaluator: titleStr = "Average Precision" if use_ap else "Average Recall" typeStr = "(AP)" if use_ap else "(AR)" iou_str = ( - "{:0.2f}:{:0.2f}".format( - self.params.iou_thrs[0], self.params.iou_thrs[-1] - ) + f"{self.params.iou_thrs[0]:0.2f}:{self.params.iou_thrs[-1]:0.2f}" if iou_thr is None else f"{iou_thr:0.2f}" ) diff --git a/supervision/tracker/byte_tracker/single_object_track.py b/supervision/tracker/byte_tracker/single_object_track.py index b2041370..c7573300 100644 --- a/supervision/tracker/byte_tracker/single_object_track.py +++ b/supervision/tracker/byte_tracker/single_object_track.py @@ -172,6 +172,4 @@ class STrack: return ret def __repr__(self) -> str: - return "OT_{}_({}-{})".format( - self.internal_track_id, self.start_frame, self.frame_id - ) + return f"OT_{self.internal_track_id}_({self.start_frame}-{self.frame_id})" diff --git a/supervision/validators/__init__.py b/supervision/validators/__init__.py index cc92648c..328be67d 100644 --- a/supervision/validators/__init__.py +++ b/supervision/validators/__init__.py @@ -1,4 +1,4 @@ -from typing import Any, Dict +from typing import Any import numpy as np From 2b052430bd562b79934d43dd971a74a076e6af67 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Mon, 14 Jul 2025 19:32:14 +0200 Subject: [PATCH 052/110] updated `from_lmm` docs --- supervision/detection/core.py | 150 +++++++++++++++++++--------------- 1 file changed, 84 insertions(+), 66 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 0ab7f03b..0b8c48d2 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -815,6 +815,15 @@ class Detections: """ Creates a Detections object from the given result string based on the specified Large Multimodal Model (LMM). + + | Name | Enum (sv.LMM) | Tasks | Required parameters | Optional parameters | + |---------------------|----------------------|-------------------------|-----------------------------|---------------------| + | PaliGemma | `PALIGEMMA` | detection | `resolution_wh` | `classes` | + | PaliGemma 2 | `PALIGEMMA` | detection | `resolution_wh` | `classes` | + | Qwen2.5-VL | `QWEN_2_5_VL` | detection | `resolution_wh`, `input_wh` | `classes` | + | Google Gemini 2.0 | `GOOGLE_GEMINI_2_0` | detection | `resolution_wh` | `classes` | + | Google Gemini 2.5 | `GOOGLE_GEMINI_2_5` | detection, segmentation | `resolution_wh` | `classes` | + | Moondream | `MOONDREAM` | detection | `resolution_wh` | | Args: lmm (Union[LMM, str]): The type of LMM (Large Multimodal Model) to use. @@ -828,9 +837,10 @@ class Detections: ValueError: If the LMM is invalid, required arguments are missing, or disallowed arguments are provided. ValueError: If the specified LMM is not supported. - - Examples: + + !!! example "PaliGemma" ```python + import supervision as sv paligemma_result = " cat" @@ -850,7 +860,7 @@ class Detections: # {'class_name': array(['cat'], dtype=' Date: Mon, 14 Jul 2025 17:32:49 +0000 Subject: [PATCH 053/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 52 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 0b8c48d2..6d682b46 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -815,7 +815,7 @@ class Detections: """ Creates a Detections object from the given result string based on the specified Large Multimodal Model (LMM). - + | Name | Enum (sv.LMM) | Tasks | Required parameters | Optional parameters | |---------------------|----------------------|-------------------------|-----------------------------|---------------------| | PaliGemma | `PALIGEMMA` | detection | `resolution_wh` | `classes` | @@ -837,10 +837,10 @@ class Detections: ValueError: If the LMM is invalid, required arguments are missing, or disallowed arguments are provided. ValueError: If the specified LMM is not supported. - + !!! example "PaliGemma" ```python - + import supervision as sv paligemma_result = " cat" @@ -919,35 +919,35 @@ class Detections: ``` !!! example "Gemini 2.5" - + ??? tip "Prompt engineering" - + To get the best results from Google Gemini 2.5, use the following prompt. - - This prompt is designed to detect all visible objects in the image, - including small, distant, or partially visible ones, and to return + + This prompt is designed to detect all visible objects in the image, + including small, distant, or partially visible ones, and to return tight bounding boxes. - + ``` - Carefully examine this image and detect ALL visible objects, including + Carefully examine this image and detect ALL visible objects, including small, distant, or partially visible ones. - - IMPORTANT: Focus on finding as many objects as possible, even if you are + + IMPORTANT: Focus on finding as many objects as possible, even if you are only moderately confident. - + Make sure each bounding box is as tight as possible. - + Valid object classes: {class_list} - + For each detected object, provide: - "label": the exact class name from the list above - "confidence": your certainty (between 0.0 and 1.0) - "box_2d": the bounding box [ymin, xmin, ymax, xmax] normalized to 0–1000 - "mask": the binary mask of the object as a base64-encoded string - - Detect everything that matches the valid classes. Do not be + + Detect everything that matches the valid classes. Do not be conservative; include objects even with moderate confidence. - + Return a JSON array, for example: [ { @@ -964,10 +964,10 @@ class Detections: } ] ``` - - When using the google-genai library, it is recommended to set + + When using the google-genai library, it is recommended to set thinking_budget=0 in thinking_config for more direct and faster responses. - + ```python from google.generativeai import types @@ -980,15 +980,15 @@ class Detections: ) ) ``` - + For a shorter prompt focused only on segmentation masks, you can use: - + ``` - Return a JSON list of segmentation masks. Each entry should include the - 2D bounding box in the "box_2d" key, the segmentation mask in the "mask" + Return a JSON list of segmentation masks. Each entry should include the + 2D bounding box in the "box_2d" key, the segmentation mask in the "mask" key, and the text label in the "label" key. Use descriptive labels. ``` - + ```python import supervision as sv From 85ec990aa455be435de5de76564ae04222661969 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 20:48:35 +0300 Subject: [PATCH 054/110] =?UTF-8?q?docs:=20=F0=9F=93=9D=20improve=20docume?= =?UTF-8?q?ntation=20for=20VLM=20parameters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- supervision/detection/core.py | 139 +++++++++++++++++++--------------- 1 file changed, 78 insertions(+), 61 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 6d682b46..6edd8073 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -1037,7 +1037,7 @@ class Detections: ] } - detections = sv.Detections.from_vmm( + detections = sv.Detections.from_lmm( sv.LMM.MOONDREAM, moondream_result, resolution_wh=(1000, 1000), @@ -1084,11 +1084,21 @@ class Detections: cls, vlm: Union[VLM, str], result: Union[str, dict], **kwargs: Any ) -> Detections: """ + Creates a Detections object from the given result string based on the specified Vision Language Model (VLM). + | Name | Enum (sv.VLM) | Tasks | Required parameters | Optional parameters | + |---------------------|----------------------|-------------------------|-----------------------------|---------------------| + | PaliGemma | `PALIGEMMA` | detection | `resolution_wh` | `classes` | + | PaliGemma 2 | `PALIGEMMA` | detection | `resolution_wh` | `classes` | + | Qwen2.5-VL | `QWEN_2_5_VL` | detection | `resolution_wh`, `input_wh` | `classes` | + | Google Gemini 2.0 | `GOOGLE_GEMINI_2_0` | detection | `resolution_wh` | `classes` | + | Google Gemini 2.5 | `GOOGLE_GEMINI_2_5` | detection, segmentation | `resolution_wh` | `classes` | + | Moondream | `MOONDREAM` | detection | `resolution_wh` | | + Args: - vlm (Union[VLM, str]): The type of VLM (Large Multimodal Model) to use. + vlm (Union[VLM, str]): The type of VLM (Vision Language Model) to use. result (str): The result string containing the detection data. **kwargs (Any): Additional keyword arguments required by the specified VLM. @@ -1100,8 +1110,9 @@ class Detections: disallowed arguments are provided. ValueError: If the specified VLM is not supported. - Examples: + !!! example "PaliGemma" ```python + import supervision as sv paligemma_result = " cat" @@ -1121,7 +1132,7 @@ class Detections: # {'class_name': array(['cat'], dtype=' Date: Mon, 14 Jul 2025 20:50:54 +0300 Subject: [PATCH 055/110] =?UTF-8?q?chore:=20=F0=9F=A7=B9formatting=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 6edd8073..ed3cdf15 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -942,7 +942,7 @@ class Detections: For each detected object, provide: - "label": the exact class name from the list above - "confidence": your certainty (between 0.0 and 1.0) - - "box_2d": the bounding box [ymin, xmin, ymax, xmax] normalized to 0–1000 + - "box_2d": the bounding box [ymin, xmin, ymax, xmax] normalized to 0-1000 - "mask": the binary mask of the object as a base64-encoded string Detect everything that matches the valid classes. Do not be @@ -1214,7 +1214,7 @@ class Detections: For each detected object, provide: - "label": the exact class name from the list above - "confidence": your certainty (between 0.0 and 1.0) - - "box_2d": the bounding box [ymin, xmin, ymax, xmax] normalized to 0–1000 + - "box_2d": the bounding box [ymin, xmin, ymax, xmax] normalized to 0-1000 - "mask": the binary mask of the object as a base64-encoded string Detect everything that matches the valid classes. Do not be From efe59cb91c665004247d2d326c0e1895984cd0f4 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Mon, 14 Jul 2025 20:57:07 +0300 Subject: [PATCH 056/110] =?UTF-8?q?chore:=20=F0=9F=A7=B9=20use=20same=20va?= =?UTF-8?q?r=20name=20compare=20to=20other=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/vlm.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 664bb6f7..030db73e 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -389,14 +389,15 @@ def from_google_gemini_2_0( return np.empty((0, 4)), None, np.empty((0,), dtype=str) labels = [] - xyxy = [] + boxes_list = [] + for item in data: if "box_2d" not in item or "label" not in item: continue labels.append(item["label"]) box = item["box_2d"] # Gemini bbox order is [y_min, x_min, y_max, x_max] - xyxy.append( + boxes_list.append( denormalize_boxes( np.array([box[1], box[0], box[3], box[2]]).astype(np.float64), resolution_wh=(w, h), @@ -404,10 +405,10 @@ def from_google_gemini_2_0( ) ) - if not xyxy: + if not boxes_list: return np.empty((0, 4)), None, np.empty((0,), dtype=str) - xyxy = np.array(xyxy) + xyxy = np.array(boxes_list) class_name = np.array(labels) class_id = None @@ -487,7 +488,7 @@ def from_google_gemini_2_5( None, ) - xyxy_list: list = [] + boxes_list: list = [] labels_list: list = [] confidence_list: Optional[list] = [] masks_list: Optional[list] = [] @@ -503,7 +504,7 @@ def from_google_gemini_2_5( resolution_wh=(w, h), normalization_factor=1000, ) - xyxy_list.append(absolute_bbox) + boxes_list.append(absolute_bbox) if "mask" in item: if masks_list is not None: @@ -540,7 +541,7 @@ def from_google_gemini_2_5( else: confidence_list = None - if not xyxy_list: + if not boxes_list: return ( np.empty((0, 4)), np.array([], dtype=int), @@ -549,7 +550,7 @@ def from_google_gemini_2_5( None, ) - xyxy = np.array(xyxy_list, dtype=float) + xyxy = np.array(boxes_list, dtype=float) class_name = np.array(labels_list) class_id: np.ndarray From edfe0a944acefc9bb0e20168c559531dd7fe04d9 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 00:16:40 +0300 Subject: [PATCH 057/110] =?UTF-8?q?refactor:=20=F0=9F=9B=A0=EF=B8=8F=20upd?= =?UTF-8?q?ate=20type=20hints=20to=20use=20built-in=20types=20in=20VLM=20a?= =?UTF-8?q?nd=20validation=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 8 ++++++++ supervision/detection/vlm.py | 8 ++++---- supervision/validators/__init__.py | 3 ++- test/detection/test_vlm.py | 6 +++--- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 98d8d364..85b49dfb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -53,3 +53,11 @@ repos: - id: codespell additional_dependencies: - tomli + + - repo: https://github.com/asottile/pyupgrade + rev: v3.20.0 + hooks: + - id: pyupgrade + args: ["--py39-plus"] + additional_dependencies: + - tomli diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index c07f4170..d98405e3 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -118,7 +118,7 @@ def from_paligemma( Args: result: String containing paligemma-formatted locations and labels. - resolution_wh: Tuple (width, height) to which we scale the box coordinates. + resolution_wh: tuple (width, height) to which we scale the box coordinates. classes: Optional list of valid class names. If provided, boxes and labels not in this list are filtered out. @@ -423,9 +423,9 @@ def from_google_gemini_2_0( def from_google_gemini_2_5( result: str, - resolution_wh: Tuple[int, int], - classes: Optional[List[str]] = None, -) -> Tuple[ + resolution_wh: tuple[int, int], + classes: Optional[list[str]] = None, +) -> tuple[ np.ndarray, Optional[np.ndarray], np.ndarray, diff --git a/supervision/validators/__init__.py b/supervision/validators/__init__.py index 5a2ffc98..97fedabd 100644 --- a/supervision/validators/__init__.py +++ b/supervision/validators/__init__.py @@ -1,4 +1,5 @@ from typing import Any + import numpy as np @@ -139,7 +140,7 @@ def validate_keypoints_fields( validate_data(data, n) -def validate_resolution(resolution: Any) -> Tuple[int, int]: +def validate_resolution(resolution: Any) -> tuple[int, int]: if not (isinstance(resolution, tuple) and len(resolution) == 2): raise ValueError( f""" diff --git a/test/detection/test_vlm.py b/test/detection/test_vlm.py index 54a7cf47..93e030a6 100644 --- a/test/detection/test_vlm.py +++ b/test/detection/test_vlm.py @@ -1080,10 +1080,10 @@ def test_florence_2( def test_from_google_gemini_2_5( exception, result: str, - resolution_wh: Tuple[int, int], - classes: Optional[List[str]], + resolution_wh: tuple[int, int], + classes: Optional[list[str]], expected_results: Optional[ - Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray] + tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray] ], ): with exception: From 63cc934cd4c9d435ea1d20079b7f070fd05f3e9b Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 00:17:52 +0300 Subject: [PATCH 058/110] =?UTF-8?q?chore:=20=F0=9F=A7=B9=20remove=20unused?= =?UTF-8?q?=20pyupgrade=20configuration=20from=20pyproject.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3cb92e34..d96a0ae0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -220,9 +220,6 @@ count = true quiet-level = 3 ignore-words-list = "STrack,sTrack,strack" -[tool.pyupgrade] -py39-plus = true - [tool.setuptools] include-package-data = false From 1d3e887fcaecc0ecac2c6faef726884bf885787d Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 00:58:35 +0300 Subject: [PATCH 059/110] =?UTF-8?q?chore:=20=F0=9F=A7=B9=20update=20requir?= =?UTF-8?q?ements=20and=20change=20default=20weights=20file=20in=20ultraly?= =?UTF-8?q?tics=5Fexample.py=20for=20count=20people=20example?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/count_people_in_zone/requirements.txt | 6 +++--- examples/count_people_in_zone/ultralytics_example.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/count_people_in_zone/requirements.txt b/examples/count_people_in_zone/requirements.txt index e07ecb06..a8f583e8 100644 --- a/examples/count_people_in_zone/requirements.txt +++ b/examples/count_people_in_zone/requirements.txt @@ -1,5 +1,5 @@ gdown -inference==0.9.17 -supervision>=0.20.0 +inference +supervision tqdm -ultralytics<=8.3.40 +ultralytics diff --git a/examples/count_people_in_zone/ultralytics_example.py b/examples/count_people_in_zone/ultralytics_example.py index f18acfb2..22909480 100644 --- a/examples/count_people_in_zone/ultralytics_example.py +++ b/examples/count_people_in_zone/ultralytics_example.py @@ -134,7 +134,7 @@ if __name__ == "__main__": ) parser.add_argument( "--source_weights_path", - default="yolov8x.pt", + default="yolo11x.pt", help="Path to the source weights file", type=str, ) From 667e6491ac96f5f62ec5ac12b6791e8c2472c053 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 02:13:44 +0200 Subject: [PATCH 060/110] =?UTF-8?q?chore:=20=F0=9F=A7=B9=20update=20uv=20l?= =?UTF-8?q?ock=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uv.lock | 2953 +++++-------------------------------------------------- 1 file changed, 268 insertions(+), 2685 deletions(-) diff --git a/uv.lock b/uv.lock index 6fd5f879..4dd081c4 100644 --- a/uv.lock +++ b/uv.lock @@ -1,6 +1,6 @@ version = 1 revision = 2 -requires-python = ">=3.8" +requires-python = ">=3.9" resolution-markers = [ "python_full_version >= '3.12' and sys_platform == 'darwin'", "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", @@ -11,57 +11,20 @@ resolution-markers = [ "python_full_version == '3.10.*' and sys_platform == 'darwin'", "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] - -[[package]] -name = "anyio" -version = "4.5.2" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "exceptiongroup", marker = "python_full_version < '3.9'" }, - { name = "idna", marker = "python_full_version < '3.9'" }, - { name = "sniffio", marker = "python_full_version < '3.9'" }, - { name = "typing-extensions", version = "4.13.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/4d/f9/9a7ce600ebe7804daf90d4d48b1c0510a4561ddce43a596be46676f82343/anyio-4.5.2.tar.gz", hash = "sha256:23009af4ed04ce05991845451e11ef02fc7c5ed29179ac9a420e5ad0ac7ddc5b", size = 171293, upload-time = "2024-10-13T22:18:03.307Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/1b/b4/f7e396030e3b11394436358ca258a81d6010106582422f23443c16ca1873/anyio-4.5.2-py3-none-any.whl", hash = "sha256:c011ee36bc1e8ba40e5a81cb9df91925c218fe9b778554e0b56a21e1b5d4716f", size = 89766, upload-time = "2024-10-13T22:18:01.524Z" }, + "python_full_version < '3.10' and platform_machine == 'arm64' and sys_platform == 'darwin'", + "python_full_version < '3.10' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version < '3.10' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.10' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.10' and sys_platform != 'darwin' and sys_platform != 'linux')", ] [[package]] name = "anyio" version = "4.9.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "exceptiongroup", marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, - { name = "idna", marker = "python_full_version >= '3.9'" }, - { name = "sniffio", marker = "python_full_version >= '3.9'" }, - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9' and python_full_version < '3.13'" }, + { name = "exceptiongroup", marker = "python_full_version < '3.11'" }, + { name = "idna" }, + { name = "sniffio" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/95/7d/4c1bd541d4dffa1b52bd83fb8527089e097a106fc90b467a7313b105f840/anyio-4.9.0.tar.gz", hash = "sha256:673c0c244e15788651a4ff38710fea9675823028a6f08a5eda409e0c9840a028", size = 190949, upload-time = "2025-03-17T00:02:54.77Z" } wheels = [ @@ -108,11 +71,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/8b/95/143cd64feb24a15fa4b189a3e1e7efbaeeb00f39a51e99b26fc62fbacabd/argon2_cffi_bindings-21.2.0-cp36-abi3-win32.whl", hash = "sha256:603ca0aba86b1349b147cab91ae970c63118a0f30444d4bc80355937c950c082", size = 27698, upload-time = "2021-12-01T09:09:27.87Z" }, { url = "https://files.pythonhosted.org/packages/37/2c/e34e47c7dee97ba6f01a6203e0383e15b60fb85d78ac9a15cd066f6fe28b/argon2_cffi_bindings-21.2.0-cp36-abi3-win_amd64.whl", hash = "sha256:b2ef1c30440dbbcba7a5dc3e319408b59676e2e039e2ae11a8775ecf482b192f", size = 30817, upload-time = "2021-12-01T09:09:30.267Z" }, { url = "https://files.pythonhosted.org/packages/5a/e4/bf8034d25edaa495da3c8a3405627d2e35758e44ff6eaa7948092646fdcc/argon2_cffi_bindings-21.2.0-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:e415e3f62c8d124ee16018e491a009937f8cf7ebf5eb430ffc5de21b900dad93", size = 53104, upload-time = "2021-12-01T09:09:31.335Z" }, - { url = "https://files.pythonhosted.org/packages/34/da/d105a3235ae86c1c1a80c1e9c46953e6e53cc8c4c61fb3c5ac8a39bbca48/argon2_cffi_bindings-21.2.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:3b9ef65804859d335dc6b31582cad2c5166f0c3e7975f324d9ffaa34ee7e6583", size = 23689, upload-time = "2021-12-01T09:09:40.511Z" }, - { url = "https://files.pythonhosted.org/packages/43/f3/20bc53a6e50471dfea16a63dc9b69d2a9ec78fd2b9532cc25f8317e121d9/argon2_cffi_bindings-21.2.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d4966ef5848d820776f5f562a7d45fdd70c2f330c961d0d745b784034bd9f48d", size = 28122, upload-time = "2021-12-01T09:09:42.818Z" }, - { url = "https://files.pythonhosted.org/packages/2e/f1/48888db30b6a4a0c78ab7bc7444058a1135b223b6a2a5f2ac7d6780e7443/argon2_cffi_bindings-21.2.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:20ef543a89dee4db46a1a6e206cd015360e5a75822f76df533845c3cbaf72670", size = 27882, upload-time = "2021-12-01T09:09:43.93Z" }, - { url = "https://files.pythonhosted.org/packages/ee/0f/a2260a207f21ce2ff4cad00a417c31597f08eafb547e00615bcbf403d8ea/argon2_cffi_bindings-21.2.0-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ed2937d286e2ad0cc79a7087d3c272832865f779430e0cc2b4f3718d3159b0cb", size = 30745, upload-time = "2021-12-01T09:09:41.73Z" }, - { url = "https://files.pythonhosted.org/packages/ed/55/f8ba268bc9005d0ca57a862e8f1b55bf1775e97a36bd30b0a8fb568c265c/argon2_cffi_bindings-21.2.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:5e00316dabdaea0b2dd82d141cc66889ced0cdcbfa599e8b471cf22c620c329a", size = 28587, upload-time = "2021-12-01T09:09:45.508Z" }, ] [[package]] @@ -121,8 +79,7 @@ version = "1.3.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "python-dateutil" }, - { name = "types-python-dateutil", version = "2.9.0.20241206", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "types-python-dateutil", version = "2.9.0.20250708", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "types-python-dateutil" }, ] sdist = { url = "https://files.pythonhosted.org/packages/2e/00/0f6e8fcdb23ea632c866620cc872729ff43ed91d284c866b515c6342b173/arrow-1.3.0.tar.gz", hash = "sha256:d4540617648cb5f895730f1ad8c82a65f2dad0166f57b75f3ca54759c4d67a85", size = 131960, upload-time = "2023-09-30T22:11:18.25Z" } wheels = [ @@ -138,56 +95,12 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/25/8a/c46dcc25341b5bce5472c718902eb3d38600a903b14fa6aeecef3f21a46f/asttokens-3.0.0-py3-none-any.whl", hash = "sha256:e3078351a059199dd5138cb1c706e6430c05eff2ff136af5eb4790f9d28932e2", size = 26918, upload-time = "2024-11-30T04:30:10.946Z" }, ] -[[package]] -name = "astunparse" -version = "1.6.3" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "six", marker = "python_full_version < '3.9'" }, - { name = "wheel", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/f3/af/4182184d3c338792894f34a62672919db7ca008c89abee9b564dd34d8029/astunparse-1.6.3.tar.gz", hash = "sha256:5ad93a8456f0d084c3456d059fd9a92cce667963232cbf763eac3bc5b7940872", size = 18290, upload-time = "2019-12-22T18:12:13.129Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/2b/03/13dde6512ad7b4557eb792fbcf0c653af6076b81e5941d36ec61f7ce6028/astunparse-1.6.3-py2.py3-none-any.whl", hash = "sha256:c2652417f2c8b5bb325c885ae329bdf3f86424075c4fd1a128674bc6fba4b8e8", size = 12732, upload-time = "2019-12-22T18:12:11.297Z" }, -] - -[[package]] -name = "async-lru" -version = "2.0.4" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "typing-extensions", version = "4.13.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/80/e2/2b4651eff771f6fd900d233e175ddc5e2be502c7eb62c0c42f975c6d36cd/async-lru-2.0.4.tar.gz", hash = "sha256:b8a59a5df60805ff63220b2a0c5b5393da5521b113cd5465a44eb037d81a5627", size = 10019, upload-time = "2023-07-27T19:12:18.631Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/fa/9f/3c3503693386c4b0f245eaf5ca6198e3b28879ca0a40bde6b0e319793453/async_lru-2.0.4-py3-none-any.whl", hash = "sha256:ff02944ce3c288c5be660c42dbcca0742b32c3b279d6dceda655190240b99224", size = 6111, upload-time = "2023-07-27T19:12:17.164Z" }, -] - [[package]] name = "async-lru" version = "2.0.5" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, + { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/b2/4d/71ec4d3939dc755264f680f6c2b4906423a304c3d18e96853f0a595dfe97/async_lru-2.0.5.tar.gz", hash = "sha256:481d52ccdd27275f42c43a928b4a50c3bfb2d67af4e78b170e3e0bb39c66e5bb", size = 10380, upload-time = "2025-03-16T17:25:36.919Z" } wheels = [ @@ -207,23 +120,11 @@ wheels = [ name = "babel" version = "2.17.0" source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "pytz", marker = "python_full_version < '3.9'" }, -] sdist = { url = "https://files.pythonhosted.org/packages/7d/6b/d52e42361e1aa00709585ecc30b3f9684b3ab62530771402248b1b1d6240/babel-2.17.0.tar.gz", hash = "sha256:0c54cffb19f690cdcc52a3b50bcbf71e07a808d1c80d549f2459b9d2cf0afb9d", size = 9951852, upload-time = "2025-02-01T15:17:41.026Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/b7/b8/3fe70c75fe32afc4bb507f75563d39bc5642255d1d94f1f23604725780bf/babel-2.17.0-py3-none-any.whl", hash = "sha256:4d0b53093fdfb4b21c92b5213dba5a1b23885afa8383709427046b21c366e5f2", size = 10182537, upload-time = "2025-02-01T15:17:37.39Z" }, ] -[[package]] -name = "backcall" -version = "0.2.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/a2/40/764a663805d84deee23043e1426a9175567db89c8b3287b5c2ad9f71aa93/backcall-0.2.0.tar.gz", hash = "sha256:5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e", size = 18041, upload-time = "2020-06-09T15:11:32.931Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/4c/1c/ff6546b6c12603d8dd1070aa3c3d273ad4c07f5771689a7b69a550e8c951/backcall-0.2.0-py2.py3-none-any.whl", hash = "sha256:fbbce6a29f263178a1f7915c1940bde0ec2b2a967566fe1c65c1dfb7422bd255", size = 11157, upload-time = "2020-06-09T15:11:30.87Z" }, -] - [[package]] name = "backports-tarfile" version = "1.2.0" @@ -233,42 +134,10 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b9/fa/123043af240e49752f1c4bd24da5053b6bd00cad78c2be53c0d1e8b975bc/backports.tarfile-1.2.0-py3-none-any.whl", hash = "sha256:77e284d754527b01fb1e6fa8a1afe577858ebe4e9dad8919e34c862cb399bc34", size = 30181, upload-time = "2024-05-28T17:01:53.112Z" }, ] -[[package]] -name = "backrefs" -version = "5.7.post1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/df/30/903f35159c87ff1d92aa3fcf8cb52de97632a21e0ae43ed940f5d033e01a/backrefs-5.7.post1.tar.gz", hash = "sha256:8b0f83b770332ee2f1c8244f4e03c77d127a0fa529328e6a0e77fa25bee99678", size = 6582270, upload-time = "2024-06-16T18:38:20.166Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/24/bb/47fc255d1060dcfd55b460236380edd8ebfc5b2a42a0799ca90c9fc983e3/backrefs-5.7.post1-py310-none-any.whl", hash = "sha256:c5e3fd8fd185607a7cb1fefe878cfb09c34c0be3c18328f12c574245f1c0287e", size = 380429, upload-time = "2024-06-16T18:38:10.131Z" }, - { url = "https://files.pythonhosted.org/packages/89/72/39ef491caef3abae945f5a5fd72830d3b596bfac0630508629283585e213/backrefs-5.7.post1-py311-none-any.whl", hash = "sha256:712ea7e494c5bf3291156e28954dd96d04dc44681d0e5c030adf2623d5606d51", size = 392234, upload-time = "2024-06-16T18:38:12.283Z" }, - { url = "https://files.pythonhosted.org/packages/6a/00/33403f581b732ca70fdebab558e8bbb426a29c34e0c3ed674a479b74beea/backrefs-5.7.post1-py312-none-any.whl", hash = "sha256:a6142201c8293e75bce7577ac29e1a9438c12e730d73a59efdd1b75528d1a6c5", size = 398110, upload-time = "2024-06-16T18:38:14.257Z" }, - { url = "https://files.pythonhosted.org/packages/5d/ea/df0ac74a26838f6588aa012d5d801831448b87d0a7d0aefbbfabbe894870/backrefs-5.7.post1-py38-none-any.whl", hash = "sha256:ec61b1ee0a4bfa24267f6b67d0f8c5ffdc8e0d7dc2f18a2685fd1d8d9187054a", size = 369477, upload-time = "2024-06-16T18:38:16.196Z" }, - { url = "https://files.pythonhosted.org/packages/6f/e8/e43f535c0a17a695e5768670fc855a0e5d52dc0d4135b3915bfa355f65ac/backrefs-5.7.post1-py39-none-any.whl", hash = "sha256:05c04af2bf752bb9a6c9dcebb2aff2fab372d3d9d311f2a138540e307756bd3a", size = 380429, upload-time = "2024-06-16T18:38:18.079Z" }, -] - [[package]] name = "backrefs" version = "5.9" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/eb/a7/312f673df6a79003279e1f55619abbe7daebbb87c17c976ddc0345c04c7b/backrefs-5.9.tar.gz", hash = "sha256:808548cb708d66b82ee231f962cb36faaf4f2baab032f2fbb783e9c2fdddaa59", size = 5765857, upload-time = "2025-06-22T19:34:13.97Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/19/4d/798dc1f30468134906575156c089c492cf79b5a5fd373f07fe26c4d046bf/backrefs-5.9-py310-none-any.whl", hash = "sha256:db8e8ba0e9de81fcd635f440deab5ae5f2591b54ac1ebe0550a2ca063488cd9f", size = 380267, upload-time = "2025-06-22T19:34:05.252Z" }, @@ -285,57 +154,19 @@ version = "4.13.4" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "soupsieve" }, - { name = "typing-extensions", version = "4.13.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "typing-extensions" }, ] sdist = { url = "https://files.pythonhosted.org/packages/d8/e4/0c4c39e18fd76d6a628d4dd8da40543d136ce2d1752bd6eeeab0791f4d6b/beautifulsoup4-4.13.4.tar.gz", hash = "sha256:dbb3c4e1ceae6aefebdaf2423247260cd062430a410e38c66f2baa50a8437195", size = 621067, upload-time = "2025-04-15T17:05:13.836Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/50/cd/30110dc0ffcf3b131156077b90e9f60ed75711223f306da4db08eff8403b/beautifulsoup4-4.13.4-py3-none-any.whl", hash = "sha256:9bbbb14bfde9d79f38b8cd5f8c7c85f4b8f2523190ebed90e950a8dea4cb1c4b", size = 187285, upload-time = "2025-04-15T17:05:12.221Z" }, ] -[[package]] -name = "bleach" -version = "6.1.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "six", marker = "python_full_version < '3.9'" }, - { name = "webencodings", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/6d/10/77f32b088738f40d4f5be801daa5f327879eadd4562f36a2b5ab975ae571/bleach-6.1.0.tar.gz", hash = "sha256:0a31f1837963c41d46bbf1331b8778e1308ea0791db03cc4e7357b97cf42a8fe", size = 202119, upload-time = "2023-10-06T19:30:51.304Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/ea/63/da7237f805089ecc28a3f36bca6a21c31fcbc2eb380f3b8f1be3312abd14/bleach-6.1.0-py3-none-any.whl", hash = "sha256:3225f354cfc436b9789c66c4ee030194bee0568fbf9cbdad3bc8b5c26c5f12b6", size = 162750, upload-time = "2023-10-06T19:30:49.408Z" }, -] - -[package.optional-dependencies] -css = [ - { name = "tinycss2", version = "1.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] - [[package]] name = "bleach" version = "6.2.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "webencodings", marker = "python_full_version >= '3.9'" }, + { name = "webencodings" }, ] sdist = { url = "https://files.pythonhosted.org/packages/76/9a/0e33f5054c54d349ea62c277191c020c2d6ef1d65ab2cb1993f91ec846d1/bleach-6.2.0.tar.gz", hash = "sha256:123e894118b8a599fd80d3ec1a6d4cc7ce4e5882b1317a7e1ba69b56e95f991f", size = 203083, upload-time = "2024-10-29T18:30:40.477Z" } wheels = [ @@ -344,7 +175,7 @@ wheels = [ [package.optional-dependencies] css = [ - { name = "tinycss2", version = "1.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "tinycss2" }, ] [[package]] @@ -353,8 +184,7 @@ version = "1.2.2.post1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "colorama", marker = "(python_full_version < '3.10' and os_name == 'nt' and platform_machine != 'arm64' and sys_platform == 'darwin') or (os_name == 'nt' and platform_machine != 'aarch64' and sys_platform == 'linux') or (os_name == 'nt' and sys_platform != 'darwin' and sys_platform != 'linux')" }, - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9' and python_full_version < '3.10.2'" }, + { name = "importlib-metadata", marker = "python_full_version < '3.10.2'" }, { name = "packaging" }, { name = "pyproject-hooks" }, { name = "tomli", marker = "python_full_version < '3.11'" }, @@ -364,38 +194,10 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/84/c2/80633736cd183ee4a62107413def345f7e6e3c01563dbca1417363cf957e/build-1.2.2.post1-py3-none-any.whl", hash = "sha256:1d61c0887fa860c01971625baae8bdd338e517b836a2f70dd1f7aa3a6b2fc5b5", size = 22950, upload-time = "2024-10-06T17:22:23.299Z" }, ] -[[package]] -name = "cachetools" -version = "5.5.2" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/6c/81/3747dad6b14fa2cf53fcf10548cf5aea6913e96fab41a3c198676f8948a5/cachetools-5.5.2.tar.gz", hash = "sha256:1a661caa9175d26759571b2e19580f9d6393969e5dfca11fdb1f947a23e640d4", size = 28380, upload-time = "2025-02-20T21:01:19.524Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/72/76/20fa66124dbe6be5cafeb312ece67de6b61dd91a0247d1ea13db4ebb33c2/cachetools-5.5.2-py3-none-any.whl", hash = "sha256:d26a22bcc62eb95c3beabd9f1ee5e820d3d2704fe2967cbe350e20c8ffcd3f0a", size = 10080, upload-time = "2025-02-20T21:01:16.647Z" }, -] - [[package]] name = "cachetools" version = "6.1.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/8a/89/817ad5d0411f136c484d535952aef74af9b25e0d99e90cdffbe121e6d628/cachetools-6.1.0.tar.gz", hash = "sha256:b4c4f404392848db3ce7aac34950d17be4d864da4b8b66911008e430bc544587", size = 30714, upload-time = "2025-06-16T18:51:03.07Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/00/f0/2ef431fe4141f5e334759d73e81120492b23b2824336883a91ac04ba710b/cachetools-6.1.0-py3-none-any.whl", hash = "sha256:1c7bb3cf9193deaf3508b7c5f2a79986c13ea38965c5adcff1f84519cf39163e", size = 11189, upload-time = "2025-06-16T18:51:01.514Z" }, @@ -413,51 +215,16 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/93/d8/ba13451aa6b745c49536e87b6bf8f629b950e84bd0e8308f7dc6883b67e2/cairocffi-1.7.1-py3-none-any.whl", hash = "sha256:9803a0e11f6c962f3b0ae2ec8ba6ae45e957a146a004697a1ac1bbf16b073b3f", size = 75611, upload-time = "2024-06-18T10:55:59.489Z" }, ] -[[package]] -name = "cairosvg" -version = "2.7.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "cairocffi", marker = "python_full_version < '3.9'" }, - { name = "cssselect2", version = "0.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "defusedxml", marker = "python_full_version < '3.9'" }, - { name = "pillow", marker = "python_full_version < '3.9'" }, - { name = "tinycss2", version = "1.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/d5/e6/ec5900b724e3c44af7f6f51f719919137284e5da4aabe96508baec8a1b40/CairoSVG-2.7.1.tar.gz", hash = "sha256:432531d72347291b9a9ebfb6777026b607563fd8719c46ee742db0aef7271ba0", size = 8399085, upload-time = "2023-08-05T09:08:05.75Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/01/a5/1866b42151f50453f1a0d28fc4c39f5be5f412a2e914f33449c42daafdf1/CairoSVG-2.7.1-py3-none-any.whl", hash = "sha256:8a5222d4e6c3f86f1f7046b63246877a63b49923a1cd202184c3a634ef546b3b", size = 43235, upload-time = "2023-08-05T09:08:01.583Z" }, -] - [[package]] name = "cairosvg" version = "2.8.2" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "cairocffi", marker = "python_full_version >= '3.9'" }, - { name = "cssselect2", version = "0.8.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "defusedxml", marker = "python_full_version >= '3.9'" }, - { name = "pillow", marker = "python_full_version >= '3.9'" }, - { name = "tinycss2", version = "1.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "cairocffi" }, + { name = "cssselect2" }, + { name = "defusedxml" }, + { name = "pillow" }, + { name = "tinycss2" }, ] sdist = { url = "https://files.pythonhosted.org/packages/ab/b9/5106168bd43d7cd8b7cc2a2ee465b385f14b63f4c092bb89eee2d48c8e67/cairosvg-2.8.2.tar.gz", hash = "sha256:07cbf4e86317b27a92318a4cac2a4bb37a5e9c1b8a27355d06874b22f85bef9f", size = 8398590, upload-time = "2025-05-15T06:56:32.653Z" } wheels = [ @@ -528,14 +295,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/f1/47/d7145bf2dc04684935d57d67dff9d6d795b2ba2796806bb109864be3a151/cffi-1.17.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:72e72408cad3d5419375fc87d289076ee319835bdfa2caad331e377589aebba9", size = 488469, upload-time = "2024-09-04T20:44:41.616Z" }, { url = "https://files.pythonhosted.org/packages/bf/ee/f94057fa6426481d663b88637a9a10e859e492c73d0384514a17d78ee205/cffi-1.17.1-cp313-cp313-win32.whl", hash = "sha256:e03eab0a8677fa80d646b5ddece1cbeaf556c313dcfac435ba11f107ba117b5d", size = 172475, upload-time = "2024-09-04T20:44:43.733Z" }, { url = "https://files.pythonhosted.org/packages/7c/fc/6a8cb64e5f0324877d503c854da15d76c1e50eb722e320b15345c4d0c6de/cffi-1.17.1-cp313-cp313-win_amd64.whl", hash = "sha256:f6a16c31041f09ead72d69f583767292f750d24913dadacf5756b966aacb3f1a", size = 182009, upload-time = "2024-09-04T20:44:45.309Z" }, - { url = "https://files.pythonhosted.org/packages/48/08/15bf6b43ae9bd06f6b00ad8a91f5a8fe1069d4c9fab550a866755402724e/cffi-1.17.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:636062ea65bd0195bc012fea9321aca499c0504409f413dc88af450b57ffd03b", size = 182457, upload-time = "2024-09-04T20:44:47.892Z" }, - { url = "https://files.pythonhosted.org/packages/c2/5b/f1523dd545f92f7df468e5f653ffa4df30ac222f3c884e51e139878f1cb5/cffi-1.17.1-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c7eac2ef9b63c79431bc4b25f1cd649d7f061a28808cbc6c47b534bd789ef964", size = 425932, upload-time = "2024-09-04T20:44:49.491Z" }, - { url = "https://files.pythonhosted.org/packages/53/93/7e547ab4105969cc8c93b38a667b82a835dd2cc78f3a7dad6130cfd41e1d/cffi-1.17.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e221cf152cff04059d011ee126477f0d9588303eb57e88923578ace7baad17f9", size = 448585, upload-time = "2024-09-04T20:44:51.671Z" }, - { url = "https://files.pythonhosted.org/packages/56/c4/a308f2c332006206bb511de219efeff090e9d63529ba0a77aae72e82248b/cffi-1.17.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:31000ec67d4221a71bd3f67df918b1f88f676f1c3b535a7eb473255fdc0b83fc", size = 456268, upload-time = "2024-09-04T20:44:53.51Z" }, - { url = "https://files.pythonhosted.org/packages/ca/5b/b63681518265f2f4060d2b60755c1c77ec89e5e045fc3773b72735ddaad5/cffi-1.17.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6f17be4345073b0a7b8ea599688f692ac3ef23ce28e5df79c04de519dbc4912c", size = 436592, upload-time = "2024-09-04T20:44:55.085Z" }, - { url = "https://files.pythonhosted.org/packages/bb/19/b51af9f4a4faa4a8ac5a0e5d5c2522dcd9703d07fac69da34a36c4d960d3/cffi-1.17.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e2b1fac190ae3ebfe37b979cc1ce69c81f4e4fe5746bb401dca63a9062cdaf1", size = 446512, upload-time = "2024-09-04T20:44:57.135Z" }, - { url = "https://files.pythonhosted.org/packages/e2/63/2bed8323890cb613bbecda807688a31ed11a7fe7afe31f8faaae0206a9a3/cffi-1.17.1-cp38-cp38-win32.whl", hash = "sha256:7596d6620d3fa590f677e9ee430df2958d2d6d6de2feeae5b20e82c00b76fbf8", size = 171576, upload-time = "2024-09-04T20:44:58.535Z" }, - { url = "https://files.pythonhosted.org/packages/2f/70/80c33b044ebc79527447fd4fbc5455d514c3bb840dede4455de97da39b4d/cffi-1.17.1-cp38-cp38-win_amd64.whl", hash = "sha256:78122be759c3f8a014ce010908ae03364d00a1f81ab5c7f4a7a5120607ea56e1", size = 181229, upload-time = "2024-09-04T20:44:59.963Z" }, { url = "https://files.pythonhosted.org/packages/b9/ea/8bb50596b8ffbc49ddd7a1ad305035daa770202a6b782fc164647c2673ad/cffi-1.17.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b2ab587605f4ba0bf81dc0cb08a41bd1c0a5906bd59243d56bad7668a6fc6c16", size = 182220, upload-time = "2024-09-04T20:45:01.577Z" }, { url = "https://files.pythonhosted.org/packages/ae/11/e77c8cd24f58285a82c23af484cf5b124a376b32644e445960d1a4654c3a/cffi-1.17.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:28b16024becceed8c6dfbc75629e27788d8a3f9030691a1dbf9821a128b22c36", size = 178605, upload-time = "2024-09-04T20:45:03.837Z" }, { url = "https://files.pythonhosted.org/packages/ed/65/25a8dc32c53bf5b7b6c2686b42ae2ad58743f7ff644844af7cdb29b49361/cffi-1.17.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1d599671f396c4723d016dbddb72fe8e0397082b0a77a4fab8028923bec050e8", size = 424910, upload-time = "2024-09-04T20:45:05.315Z" }, @@ -617,19 +376,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/78/be/8392efc43487ac051eee6c36d5fbd63032d78f7728cb37aebcc98191f1ff/charset_normalizer-3.4.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4a476b06fbcf359ad25d34a057b7219281286ae2477cc5ff5e3f70a246971148", size = 149166, upload-time = "2025-05-02T08:33:15.458Z" }, { url = "https://files.pythonhosted.org/packages/44/96/392abd49b094d30b91d9fbda6a69519e95802250b777841cf3bda8fe136c/charset_normalizer-3.4.2-cp313-cp313-win32.whl", hash = "sha256:aaeeb6a479c7667fbe1099af9617c83aaca22182d6cf8c53966491a0f1b7ffb7", size = 98064, upload-time = "2025-05-02T08:33:17.06Z" }, { url = "https://files.pythonhosted.org/packages/e9/b0/0200da600134e001d91851ddc797809e2fe0ea72de90e09bec5a2fbdaccb/charset_normalizer-3.4.2-cp313-cp313-win_amd64.whl", hash = "sha256:aa6af9e7d59f9c12b33ae4e9450619cf2488e2bbe9b44030905877f0b2324980", size = 105641, upload-time = "2025-05-02T08:33:18.753Z" }, - { url = "https://files.pythonhosted.org/packages/4c/fd/f700cfd4ad876def96d2c769d8a32d808b12d1010b6003dc6639157f99ee/charset_normalizer-3.4.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:76af085e67e56c8816c3ccf256ebd136def2ed9654525348cfa744b6802b69eb", size = 198257, upload-time = "2025-05-02T08:33:45.511Z" }, - { url = "https://files.pythonhosted.org/packages/3a/95/6eec4cbbbd119e6a402e3bfd16246785cc52ce64cf21af2ecdf7b3a08e91/charset_normalizer-3.4.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e45ba65510e2647721e35323d6ef54c7974959f6081b58d4ef5d87c60c84919a", size = 143453, upload-time = "2025-05-02T08:33:47.463Z" }, - { url = "https://files.pythonhosted.org/packages/b6/b3/d4f913660383b3d93dbe6f687a312ea9f7e89879ae883c4e8942048174d4/charset_normalizer-3.4.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:046595208aae0120559a67693ecc65dd75d46f7bf687f159127046628178dc45", size = 153130, upload-time = "2025-05-02T08:33:50.568Z" }, - { url = "https://files.pythonhosted.org/packages/e5/69/7540141529eabc55bf19cc05cd9b61c2078bebfcdbd3e799af99b777fc28/charset_normalizer-3.4.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:75d10d37a47afee94919c4fab4c22b9bc2a8bf7d4f46f87363bcf0573f3ff4f5", size = 145688, upload-time = "2025-05-02T08:33:52.828Z" }, - { url = "https://files.pythonhosted.org/packages/2e/bb/d76d3d6e340fb0967c43c564101e28a78c9a363ea62f736a68af59ee3683/charset_normalizer-3.4.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6333b3aa5a12c26b2a4d4e7335a28f1475e0e5e17d69d55141ee3cab736f66d1", size = 147418, upload-time = "2025-05-02T08:33:54.718Z" }, - { url = "https://files.pythonhosted.org/packages/3e/ef/b7c1f39c0dc3808160c8b72e0209c2479393966313bfebc833533cfff9cc/charset_normalizer-3.4.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e8323a9b031aa0393768b87f04b4164a40037fb2a3c11ac06a03ffecd3618027", size = 150066, upload-time = "2025-05-02T08:33:56.597Z" }, - { url = "https://files.pythonhosted.org/packages/20/26/4e47cc23d2a4a5eb6ed7d6f0f8cda87d753e2f8abc936d5cf5ad2aae8518/charset_normalizer-3.4.2-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:24498ba8ed6c2e0b56d4acbf83f2d989720a93b41d712ebd4f4979660db4417b", size = 144499, upload-time = "2025-05-02T08:33:58.637Z" }, - { url = "https://files.pythonhosted.org/packages/d7/9c/efdf59dd46593cecad0548d36a702683a0bdc056793398a9cd1e1546ad21/charset_normalizer-3.4.2-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:844da2b5728b5ce0e32d863af26f32b5ce61bc4273a9c720a9f3aa9df73b1455", size = 152954, upload-time = "2025-05-02T08:34:00.552Z" }, - { url = "https://files.pythonhosted.org/packages/59/b3/4e8b73f7299d9aaabd7cd26db4a765f741b8e57df97b034bb8de15609002/charset_normalizer-3.4.2-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:65c981bdbd3f57670af8b59777cbfae75364b483fa8a9f420f08094531d54a01", size = 155876, upload-time = "2025-05-02T08:34:02.527Z" }, - { url = "https://files.pythonhosted.org/packages/53/cb/6fa0ccf941a069adce3edb8a1e430bc80e4929f4d43b5140fdf8628bdf7d/charset_normalizer-3.4.2-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:3c21d4fca343c805a52c0c78edc01e3477f6dd1ad7c47653241cf2a206d4fc58", size = 153186, upload-time = "2025-05-02T08:34:04.481Z" }, - { url = "https://files.pythonhosted.org/packages/ac/c6/80b93fabc626b75b1665ffe405e28c3cef0aae9237c5c05f15955af4edd8/charset_normalizer-3.4.2-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:dc7039885fa1baf9be153a0626e337aa7ec8bf96b0128605fb0d77788ddc1681", size = 148007, upload-time = "2025-05-02T08:34:06.888Z" }, - { url = "https://files.pythonhosted.org/packages/41/eb/c7367ac326a2628e4f05b5c737c86fe4a8eb3ecc597a4243fc65720b3eeb/charset_normalizer-3.4.2-cp38-cp38-win32.whl", hash = "sha256:8272b73e1c5603666618805fe821edba66892e2870058c94c53147602eab29c7", size = 97923, upload-time = "2025-05-02T08:34:08.792Z" }, - { url = "https://files.pythonhosted.org/packages/7c/02/1c82646582ccf2c757fa6af69b1a3ea88744b8d2b4ab93b7686b2533e023/charset_normalizer-3.4.2-cp38-cp38-win_amd64.whl", hash = "sha256:70f7172939fdf8790425ba31915bfbe8335030f05b9913d7ae00a87d4395620a", size = 105020, upload-time = "2025-05-02T08:34:10.6Z" }, { url = "https://files.pythonhosted.org/packages/28/f8/dfb01ff6cc9af38552c69c9027501ff5a5117c4cc18dcd27cb5259fa1888/charset_normalizer-3.4.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:005fa3432484527f9732ebd315da8da8001593e2cf46a3d817669f062c3d9ed4", size = 201671, upload-time = "2025-05-02T08:34:12.696Z" }, { url = "https://files.pythonhosted.org/packages/32/fb/74e26ee556a9dbfe3bd264289b67be1e6d616329403036f6507bb9f3f29c/charset_normalizer-3.4.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e92fca20c46e9f5e1bb485887d074918b13543b1c2a1185e69bb8d17ab6236a7", size = 144744, upload-time = "2025-05-02T08:34:14.665Z" }, { url = "https://files.pythonhosted.org/packages/ad/06/8499ee5aa7addc6f6d72e068691826ff093329fe59891e83b092ae4c851c/charset_normalizer-3.4.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:50bf98d5e563b83cc29471fa114366e6806bc06bc7a25fd59641e41445327836", size = 154993, upload-time = "2025-05-02T08:34:17.134Z" }, @@ -651,12 +397,9 @@ name = "click" version = "8.1.8" source = { registry = "https://pypi.org/simple" } resolution-markers = [ - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", + "python_full_version < '3.10' and platform_machine == 'arm64' and sys_platform == 'darwin'", + "python_full_version < '3.10' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version < '3.10' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.10' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.10' and sys_platform != 'darwin' and sys_platform != 'linux')", ] dependencies = [ { name = "colorama", marker = "python_full_version < '3.10' and sys_platform == 'win32'" }, @@ -710,84 +453,17 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e6/75/49e5bfe642f71f272236b5b2d2691cf915a7283cc0ceda56357b61daa538/comm-0.2.2-py3-none-any.whl", hash = "sha256:e6fb86cb70ff661ee8c9c14e7d36d6de3b4066f1441be4063df9c5009f0a64d3", size = 7180, upload-time = "2024-03-12T16:53:39.226Z" }, ] -[[package]] -name = "contourpy" -version = "1.1.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "numpy", version = "1.24.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/b1/7d/087ee4295e7580d3f7eb8a8a4e0ec8c7847e60f34135248ccf831cf5bbfc/contourpy-1.1.1.tar.gz", hash = "sha256:96ba37c2e24b7212a77da85004c38e7c4d155d3e72a45eeaf22c1f03f607e8ab", size = 13433167, upload-time = "2023-09-16T10:25:49.501Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/fb/7f/c44a51a83a093bf5c84e07dd1e3cfe9f68c47b6499bd05a9de0c6dbdc2bc/contourpy-1.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:46e24f5412c948d81736509377e255f6040e94216bf1a9b5ea1eaa9d29f6ec1b", size = 247207, upload-time = "2023-09-16T10:20:32.848Z" }, - { url = "https://files.pythonhosted.org/packages/a9/65/544d66da0716b20084874297ff7596704e435cf011512f8e576638e83db2/contourpy-1.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0e48694d6a9c5a26ee85b10130c77a011a4fedf50a7279fa0bdaf44bafb4299d", size = 232428, upload-time = "2023-09-16T10:20:36.337Z" }, - { url = "https://files.pythonhosted.org/packages/5b/e6/697085cc34a294bd399548fd99562537a75408f113e3a815807e206246f0/contourpy-1.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a66045af6cf00e19d02191ab578a50cb93b2028c3eefed999793698e9ea768ae", size = 285304, upload-time = "2023-09-16T10:20:40.182Z" }, - { url = "https://files.pythonhosted.org/packages/69/4b/52d0d2e85c59f00f6ddbd6fea819f267008c58ee7708da96d112a293e91c/contourpy-1.1.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4ebf42695f75ee1a952f98ce9775c873e4971732a87334b099dde90b6af6a916", size = 322655, upload-time = "2023-09-16T10:20:44.175Z" }, - { url = "https://files.pythonhosted.org/packages/82/fc/3decc656a547a6d5d5b4249f81c72668a1f3259a62b2def2504120d38746/contourpy-1.1.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f6aec19457617ef468ff091669cca01fa7ea557b12b59a7908b9474bb9674cf0", size = 296430, upload-time = "2023-09-16T10:20:47.767Z" }, - { url = "https://files.pythonhosted.org/packages/f1/6b/e4b0f8708f22dd7c321f87eadbb98708975e115ac6582eb46d1f32197ce6/contourpy-1.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:462c59914dc6d81e0b11f37e560b8a7c2dbab6aca4f38be31519d442d6cde1a1", size = 301672, upload-time = "2023-09-16T10:20:51.395Z" }, - { url = "https://files.pythonhosted.org/packages/c3/87/201410522a756e605069078833d806147cad8532fdc164a96689d05c5afc/contourpy-1.1.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6d0a8efc258659edc5299f9ef32d8d81de8b53b45d67bf4bfa3067f31366764d", size = 820145, upload-time = "2023-09-16T10:20:58.426Z" }, - { url = "https://files.pythonhosted.org/packages/b4/d9/42680a17d43edda04ab2b3f11125cf97b61bce5d3b52721a42960bf748bd/contourpy-1.1.1-cp310-cp310-win32.whl", hash = "sha256:d6ab42f223e58b7dac1bb0af32194a7b9311065583cc75ff59dcf301afd8a431", size = 399542, upload-time = "2023-09-16T10:21:02.719Z" }, - { url = "https://files.pythonhosted.org/packages/55/14/0dc1884e3c04f9b073a47283f5d424926644250891db392a07c56f05e5c5/contourpy-1.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:549174b0713d49871c6dee90a4b499d3f12f5e5f69641cd23c50a4542e2ca1eb", size = 477974, upload-time = "2023-09-16T10:21:07.565Z" }, - { url = "https://files.pythonhosted.org/packages/8b/4f/be28a39cd5e988b8d3c2cc642c2c7ffeeb28fe80a86df71b6d1e473c5038/contourpy-1.1.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:407d864db716a067cc696d61fa1ef6637fedf03606e8417fe2aeed20a061e6b2", size = 248613, upload-time = "2023-09-16T10:21:10.695Z" }, - { url = "https://files.pythonhosted.org/packages/2c/8e/656f8e7cd316aa68d9824744773e90dbd71f847429d10c82001e927480a2/contourpy-1.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dfe80c017973e6a4c367e037cb31601044dd55e6bfacd57370674867d15a899b", size = 233603, upload-time = "2023-09-16T10:21:13.771Z" }, - { url = "https://files.pythonhosted.org/packages/60/2a/4d4bd4541212ab98f3411f21bf58b0b246f333ae996e9f57e1acf12bcc45/contourpy-1.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e30aaf2b8a2bac57eb7e1650df1b3a4130e8d0c66fc2f861039d507a11760e1b", size = 287037, upload-time = "2023-09-16T10:21:17.622Z" }, - { url = "https://files.pythonhosted.org/packages/24/67/8abf919443381585a4eee74069e311c736350549dae02d3d014fef93d50a/contourpy-1.1.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3de23ca4f381c3770dee6d10ead6fff524d540c0f662e763ad1530bde5112532", size = 323274, upload-time = "2023-09-16T10:21:21.404Z" }, - { url = "https://files.pythonhosted.org/packages/2a/e5/6da11329dd35a2f2e404a95e5374b5702de6ac52e776e8b87dd6ea4b29d0/contourpy-1.1.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:566f0e41df06dfef2431defcfaa155f0acfa1ca4acbf8fd80895b1e7e2ada40e", size = 297801, upload-time = "2023-09-16T10:21:25.155Z" }, - { url = "https://files.pythonhosted.org/packages/b7/f6/78f60fa0b6ae64971178e2542e8b3ad3ba5f4f379b918ab7b18038a3f897/contourpy-1.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b04c2f0adaf255bf756cf08ebef1be132d3c7a06fe6f9877d55640c5e60c72c5", size = 302821, upload-time = "2023-09-16T10:21:28.663Z" }, - { url = "https://files.pythonhosted.org/packages/da/25/6062395a1c6a06f46a577da821318886b8b939453a098b9cd61671bb497b/contourpy-1.1.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d0c188ae66b772d9d61d43c6030500344c13e3f73a00d1dc241da896f379bb62", size = 820121, upload-time = "2023-09-16T10:21:36.251Z" }, - { url = "https://files.pythonhosted.org/packages/41/5e/64e78b1e8682cbab10c13fc1a2c070d30acedb805ab2f42afbd3d88f7225/contourpy-1.1.1-cp311-cp311-win32.whl", hash = "sha256:0683e1ae20dc038075d92e0e0148f09ffcefab120e57f6b4c9c0f477ec171f33", size = 401590, upload-time = "2023-09-16T10:21:40.42Z" }, - { url = "https://files.pythonhosted.org/packages/e5/76/94bc17eb868f8c7397f8fdfdeae7661c1b9a35f3a7219da308596e8c252a/contourpy-1.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:8636cd2fc5da0fb102a2504fa2c4bea3cbc149533b345d72cdf0e7a924decc45", size = 480534, upload-time = "2023-09-16T10:21:45.724Z" }, - { url = "https://files.pythonhosted.org/packages/94/0f/07a5e26fec7176658f6aecffc615900ff1d303baa2b67bc37fd98ce67c87/contourpy-1.1.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:560f1d68a33e89c62da5da4077ba98137a5e4d3a271b29f2f195d0fba2adcb6a", size = 249799, upload-time = "2023-09-16T10:21:48.797Z" }, - { url = "https://files.pythonhosted.org/packages/32/0b/d7baca3f60d3b3a77c9ba1307c7792befd3c1c775a26c649dca1bfa9b6ba/contourpy-1.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:24216552104ae8f3b34120ef84825400b16eb6133af2e27a190fdc13529f023e", size = 232739, upload-time = "2023-09-16T10:21:51.854Z" }, - { url = "https://files.pythonhosted.org/packages/6d/62/a385b4d4b5718e3a933de5791528f45f1f5b364d3c79172ad0309c832041/contourpy-1.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:56de98a2fb23025882a18b60c7f0ea2d2d70bbbcfcf878f9067234b1c4818442", size = 282171, upload-time = "2023-09-16T10:21:55.794Z" }, - { url = "https://files.pythonhosted.org/packages/91/21/8c6819747fea53557f3963ca936035b3e8bed87d591f5278ad62516a059d/contourpy-1.1.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:07d6f11dfaf80a84c97f1a5ba50d129d9303c5b4206f776e94037332e298dda8", size = 321182, upload-time = "2023-09-16T10:21:59.576Z" }, - { url = "https://files.pythonhosted.org/packages/22/29/d75da9002f9df09c755b12cf0357eb91b081c858e604f4e92b4b8bfc3c15/contourpy-1.1.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f1eaac5257a8f8a047248d60e8f9315c6cff58f7803971170d952555ef6344a7", size = 295869, upload-time = "2023-09-16T10:22:03.248Z" }, - { url = "https://files.pythonhosted.org/packages/a7/47/4e7e66159f881c131e3b97d1cc5c0ea72be62bdd292c7f63fd13937d07f4/contourpy-1.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:19557fa407e70f20bfaba7d55b4d97b14f9480856c4fb65812e8a05fe1c6f9bf", size = 298756, upload-time = "2023-09-16T10:22:06.663Z" }, - { url = "https://files.pythonhosted.org/packages/d3/bb/bffc99bc3172942b5eda8027ca0cb80ddd336fcdd634d68adce957d37231/contourpy-1.1.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:081f3c0880712e40effc5f4c3b08feca6d064cb8cfbb372ca548105b86fd6c3d", size = 818441, upload-time = "2023-09-16T10:22:13.805Z" }, - { url = "https://files.pythonhosted.org/packages/da/1b/904baf0aaaf6c6e2247801dcd1ff0d7bf84352839927d356b28ae804cbb0/contourpy-1.1.1-cp312-cp312-win32.whl", hash = "sha256:059c3d2a94b930f4dafe8105bcdc1b21de99b30b51b5bce74c753686de858cb6", size = 410294, upload-time = "2023-09-16T10:22:18.055Z" }, - { url = "https://files.pythonhosted.org/packages/75/d4/c3b7a9a0d1f99b528e5a46266b0b9f13aad5a0dd1156d071418df314c427/contourpy-1.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:f44d78b61740e4e8c71db1cf1fd56d9050a4747681c59ec1094750a658ceb970", size = 486678, upload-time = "2023-09-16T10:22:23.249Z" }, - { url = "https://files.pythonhosted.org/packages/02/7e/ffaba1bf3719088be3ad6983a5e85e1fc9edccd7b406b98e433436ecef74/contourpy-1.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:70e5a10f8093d228bb2b552beeb318b8928b8a94763ef03b858ef3612b29395d", size = 247023, upload-time = "2023-09-16T10:22:26.954Z" }, - { url = "https://files.pythonhosted.org/packages/a6/82/29f5ff4ae074c3230e266bc9efef449ebde43721a727b989dd8ef8f97d73/contourpy-1.1.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8394e652925a18ef0091115e3cc191fef350ab6dc3cc417f06da66bf98071ae9", size = 232380, upload-time = "2023-09-16T10:22:30.423Z" }, - { url = "https://files.pythonhosted.org/packages/9b/cb/08f884c4c2efd433a38876b1b8069bfecef3f2d21ff0ce635d455962f70f/contourpy-1.1.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c5bd5680f844c3ff0008523a71949a3ff5e4953eb7701b28760805bc9bcff217", size = 285830, upload-time = "2023-09-16T10:22:33.787Z" }, - { url = "https://files.pythonhosted.org/packages/8e/57/cd4d4c99d999a25e9d518f628b4793e64b1ecb8ad3147f8469d8d4a80678/contourpy-1.1.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:66544f853bfa85c0d07a68f6c648b2ec81dafd30f272565c37ab47a33b220684", size = 322038, upload-time = "2023-09-16T10:22:37.627Z" }, - { url = "https://files.pythonhosted.org/packages/32/b6/c57ed305a6f86731107fc183e97c7e6a6005d145f5c5228a44718082ad12/contourpy-1.1.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e0c02b75acfea5cab07585d25069207e478d12309557f90a61b5a3b4f77f46ce", size = 295797, upload-time = "2023-09-16T10:22:41.952Z" }, - { url = "https://files.pythonhosted.org/packages/8e/71/7f20855592cc929bc206810432b991ec4c702dc26b0567b132e52c85536f/contourpy-1.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:41339b24471c58dc1499e56783fedc1afa4bb018bcd035cfb0ee2ad2a7501ef8", size = 301124, upload-time = "2023-09-16T10:22:45.993Z" }, - { url = "https://files.pythonhosted.org/packages/86/6d/52c2fc80f433e7cdc8624d82e1422ad83ad461463cf16a1953bbc7d10eb1/contourpy-1.1.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:f29fb0b3f1217dfe9362ec55440d0743fe868497359f2cf93293f4b2701b8251", size = 819787, upload-time = "2023-09-16T10:22:53.511Z" }, - { url = "https://files.pythonhosted.org/packages/d0/b0/f8d4548e89f929d6c5ca329df9afad6190af60079ec77d8c31eb48cf6f82/contourpy-1.1.1-cp38-cp38-win32.whl", hash = "sha256:f9dc7f933975367251c1b34da882c4f0e0b2e24bb35dc906d2f598a40b72bfc7", size = 400031, upload-time = "2023-09-16T10:22:57.78Z" }, - { url = "https://files.pythonhosted.org/packages/96/1b/b05cd42c8d21767a0488b883b38658fb9a45f86c293b7b42521a8113dc5d/contourpy-1.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:498e53573e8b94b1caeb9e62d7c2d053c263ebb6aa259c81050766beb50ff8d9", size = 477949, upload-time = "2023-09-16T10:23:02.587Z" }, - { url = "https://files.pythonhosted.org/packages/16/d9/8a15ff67fc27c65939e454512955e1b240ec75cd201d82e115b3b63ef76d/contourpy-1.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ba42e3810999a0ddd0439e6e5dbf6d034055cdc72b7c5c839f37a7c274cb4eba", size = 247396, upload-time = "2023-09-16T10:23:06.429Z" }, - { url = "https://files.pythonhosted.org/packages/09/fe/086e6847ee53da10ddf0b6c5e5f877ab43e68e355d2f4c85f67561ee8a57/contourpy-1.1.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6c06e4c6e234fcc65435223c7b2a90f286b7f1b2733058bdf1345d218cc59e34", size = 232598, upload-time = "2023-09-16T10:23:11.009Z" }, - { url = "https://files.pythonhosted.org/packages/a3/9c/662925239e1185c6cf1da8c334e4c61bddcfa8e528f4b51083b613003170/contourpy-1.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca6fab080484e419528e98624fb5c4282148b847e3602dc8dbe0cb0669469887", size = 286436, upload-time = "2023-09-16T10:23:14.624Z" }, - { url = "https://files.pythonhosted.org/packages/d3/7e/417cdf65da7140981079eda6a81ecd593ae0239bf8c738f2e2b3f6df8920/contourpy-1.1.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:93df44ab351119d14cd1e6b52a5063d3336f0754b72736cc63db59307dabb718", size = 322629, upload-time = "2023-09-16T10:23:18.203Z" }, - { url = "https://files.pythonhosted.org/packages/a8/22/ffd88aef74cc045698c5e5c400e8b7cd62311199c109245ac7827290df2c/contourpy-1.1.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:eafbef886566dc1047d7b3d4b14db0d5b7deb99638d8e1be4e23a7c7ac59ff0f", size = 297117, upload-time = "2023-09-16T10:23:21.586Z" }, - { url = "https://files.pythonhosted.org/packages/2b/c0/24c34c41a180f875419b536125799c61e2330b997d77a5a818a3bc3e08cd/contourpy-1.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:efe0fab26d598e1ec07d72cf03eaeeba8e42b4ecf6b9ccb5a356fde60ff08b85", size = 301855, upload-time = "2023-09-16T10:23:25.584Z" }, - { url = "https://files.pythonhosted.org/packages/bf/ec/f9877f6378a580cd683bd76c8a781dcd972e82965e0da951a739d3364677/contourpy-1.1.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:f08e469821a5e4751c97fcd34bcb586bc243c39c2e39321822060ba902eac49e", size = 820597, upload-time = "2023-09-16T10:23:33.133Z" }, - { url = "https://files.pythonhosted.org/packages/e1/3a/c41f4bc7122d3a06388acae1bed6f50a665c1031863ca42bd701094dcb1f/contourpy-1.1.1-cp39-cp39-win32.whl", hash = "sha256:bfc8a5e9238232a45ebc5cb3bfee71f1167064c8d382cadd6076f0d51cff1da0", size = 400031, upload-time = "2023-09-16T10:23:37.546Z" }, - { url = "https://files.pythonhosted.org/packages/87/2b/9b49451f7412cc1a79198e94a771a4e52d65c479aae610b1161c0290ef2c/contourpy-1.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:c84fdf3da00c2827d634de4fcf17e3e067490c4aea82833625c4c8e6cdea0887", size = 435965, upload-time = "2023-09-16T10:23:42.512Z" }, - { url = "https://files.pythonhosted.org/packages/e6/3c/fc36884b6793e2066a6ff25c86e21b8bd62553456b07e964c260bcf22711/contourpy-1.1.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:229a25f68046c5cf8067d6d6351c8b99e40da11b04d8416bf8d2b1d75922521e", size = 246493, upload-time = "2023-09-16T10:23:45.721Z" }, - { url = "https://files.pythonhosted.org/packages/3d/85/f4c5b09ce79828ed4553a8ae2ebdf937794f57b45848b1f5c95d9744ecc2/contourpy-1.1.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a10dab5ea1bd4401c9483450b5b0ba5416be799bbd50fc7a6cc5e2a15e03e8a3", size = 289240, upload-time = "2023-09-16T10:23:49.207Z" }, - { url = "https://files.pythonhosted.org/packages/18/d3/9d7c0a372baf5130c1417a4b8275079d5379c11355436cb9fc78af7d7559/contourpy-1.1.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:4f9147051cb8fdb29a51dc2482d792b3b23e50f8f57e3720ca2e3d438b7adf23", size = 476043, upload-time = "2023-09-16T10:23:54.495Z" }, - { url = "https://files.pythonhosted.org/packages/e7/12/643242c3d9b031ca19f9a440f63e568dd883a04711056ca5d607f9bda888/contourpy-1.1.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:a75cc163a5f4531a256f2c523bd80db509a49fc23721b36dd1ef2f60ff41c3cb", size = 246247, upload-time = "2023-09-16T10:23:58.204Z" }, - { url = "https://files.pythonhosted.org/packages/e1/37/95716fe235bf441422059e4afcd4b9b7c5821851c2aee992a06d1e9f831a/contourpy-1.1.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3b53d5769aa1f2d4ea407c65f2d1d08002952fac1d9e9d307aa2e1023554a163", size = 289029, upload-time = "2023-09-16T10:24:02.085Z" }, - { url = "https://files.pythonhosted.org/packages/e5/fd/14852c4a688031e0d8a20d9a1b60078d45507186ef17042093835be2f01a/contourpy-1.1.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:11b836b7dbfb74e049c302bbf74b4b8f6cb9d0b6ca1bf86cfa8ba144aedadd9c", size = 476043, upload-time = "2023-09-16T10:24:07.292Z" }, -] - [[package]] name = "contourpy" version = "1.3.0" source = { registry = "https://pypi.org/simple" } resolution-markers = [ - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", + "python_full_version < '3.10' and platform_machine == 'arm64' and sys_platform == 'darwin'", + "python_full_version < '3.10' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version < '3.10' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.10' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.10' and sys_platform != 'darwin' and sys_platform != 'linux')", ] dependencies = [ - { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/f5/f6/31a8f28b4a2a4fa0e01085e542f3081ab0588eff8e589d39d775172c9792/contourpy-1.3.0.tar.gz", hash = "sha256:7ffa0db17717a8ffb127efd0c95a4362d996b892c2904db72428d5b52e1938a4", size = 13464370, upload-time = "2024-08-27T21:00:03.328Z" } wheels = [ @@ -973,45 +649,13 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/38/6a/69fc67e5266bff68a91bcb81dff8fb0aba4d79a78521a08812048913e16f/cryptography-45.0.5-pp311-pypy311_pp73-manylinux_2_34_x86_64.whl", hash = "sha256:5aa1e32983d4443e310f726ee4b071ab7569f58eedfdd65e9675484a4eb67bd1", size = 4385593, upload-time = "2025-07-02T13:06:15.689Z" }, ] -[[package]] -name = "cssselect2" -version = "0.7.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "tinycss2", version = "1.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "webencodings", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/e7/fc/326cb6f988905998f09bb54a3f5d98d4462ba119363c0dfad29750d48c09/cssselect2-0.7.0.tar.gz", hash = "sha256:1ccd984dab89fc68955043aca4e1b03e0cf29cad9880f6e28e3ba7a74b14aa5a", size = 35888, upload-time = "2022-09-19T12:55:11.876Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/9d/3a/e39436efe51894243ff145a37c4f9a030839b97779ebcc4f13b3ba21c54e/cssselect2-0.7.0-py3-none-any.whl", hash = "sha256:fd23a65bfd444595913f02fc71f6b286c29261e354c41d722ca7a261a49b5969", size = 15586, upload-time = "2022-09-19T12:55:07.56Z" }, -] - [[package]] name = "cssselect2" version = "0.8.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "tinycss2", version = "1.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "webencodings", marker = "python_full_version >= '3.9'" }, + { name = "tinycss2" }, + { name = "webencodings" }, ] sdist = { url = "https://files.pythonhosted.org/packages/9f/86/fd7f58fc498b3166f3a7e8e0cddb6e620fe1da35b02248b1bd59e95dbaaa/cssselect2-0.8.0.tar.gz", hash = "sha256:7674ffb954a3b46162392aee2a3a0aedb2e14ecf99fcc28644900f4e6e3e9d3a", size = 35716, upload-time = "2025-03-05T14:46:07.988Z" } wheels = [ @@ -1049,10 +693,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ba/f1/6f2ee3f991327ad9e4c2f8b82611a467052a0fb0e247390192580e89f7ff/debugpy-1.8.14-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f920c7f9af409d90f5fd26e313e119d908b0dd2952c2393cd3247a462331f15", size = 4217514, upload-time = "2025-04-10T19:46:34.336Z" }, { url = "https://files.pythonhosted.org/packages/79/28/b9d146f8f2dc535c236ee09ad3e5ac899adb39d7a19b49f03ac95d216beb/debugpy-1.8.14-cp313-cp313-win32.whl", hash = "sha256:3784ec6e8600c66cbdd4ca2726c72d8ca781e94bce2f396cc606d458146f8f4e", size = 5254756, upload-time = "2025-04-10T19:46:36.199Z" }, { url = "https://files.pythonhosted.org/packages/e0/62/a7b4a57013eac4ccaef6977966e6bec5c63906dd25a86e35f155952e29a1/debugpy-1.8.14-cp313-cp313-win_amd64.whl", hash = "sha256:684eaf43c95a3ec39a96f1f5195a7ff3d4144e4a18d69bb66beeb1a6de605d6e", size = 5297119, upload-time = "2025-04-10T19:46:38.141Z" }, - { url = "https://files.pythonhosted.org/packages/c8/8e/08924875dc5f0ae5c15684376256b0ff0507ef920d61a33bd1222619b159/debugpy-1.8.14-cp38-cp38-macosx_14_0_x86_64.whl", hash = "sha256:d5582bcbe42917bc6bbe5c12db1bffdf21f6bfc28d4554b738bf08d50dc0c8c3", size = 2077185, upload-time = "2025-04-10T19:46:39.61Z" }, - { url = "https://files.pythonhosted.org/packages/49/dc/6d7f8e0cce44309d3b5a701bca15a9076d0d02a99df8e629580205e008fb/debugpy-1.8.14-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5349b7c3735b766a281873fbe32ca9cca343d4cc11ba4a743f84cb854339ff35", size = 3631418, upload-time = "2025-04-10T19:46:41.512Z" }, - { url = "https://files.pythonhosted.org/packages/99/a1/39c036ab61c6d87b9e6fba21a851b7fb10d8bbaa60f5558c979496d17037/debugpy-1.8.14-cp38-cp38-win32.whl", hash = "sha256:7118d462fe9724c887d355eef395fae68bc764fd862cdca94e70dcb9ade8a23d", size = 5212840, upload-time = "2025-04-10T19:46:43.073Z" }, - { url = "https://files.pythonhosted.org/packages/f1/8b/675a183a51ebc6ae729b288cc65aa1f686a91a4e9e760bed244f8caa07fd/debugpy-1.8.14-cp38-cp38-win_amd64.whl", hash = "sha256:d235e4fa78af2de4e5609073972700523e372cf5601742449970110d565ca28c", size = 5246434, upload-time = "2025-04-10T19:46:44.934Z" }, { url = "https://files.pythonhosted.org/packages/85/6f/96ba96545f55b6a675afa08c96b42810de9b18c7ad17446bbec82762127a/debugpy-1.8.14-cp39-cp39-macosx_14_0_x86_64.whl", hash = "sha256:413512d35ff52c2fb0fd2d65e69f373ffd24f0ecb1fac514c04a668599c5ce7f", size = 2077696, upload-time = "2025-04-10T19:46:46.817Z" }, { url = "https://files.pythonhosted.org/packages/fa/84/f378a2dd837d94de3c85bca14f1db79f8fcad7e20b108b40d59da56a6d22/debugpy-1.8.14-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4c9156f7524a0d70b7a7e22b2e311d8ba76a15496fb00730e46dcdeedb9e1eea", size = 3554846, upload-time = "2025-04-10T19:46:48.72Z" }, { url = "https://files.pythonhosted.org/packages/db/52/88824fe5d6893f59933f664c6e12783749ab537a2101baf5c713164d8aa2/debugpy-1.8.14-cp39-cp39-win32.whl", hash = "sha256:b44985f97cc3dd9d52c42eb59ee9d7ee0c4e7ecd62bca704891f997de4cef23d", size = 5209350, upload-time = "2025-04-10T19:46:50.284Z" }, @@ -1087,38 +727,10 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/91/a1/cf2472db20f7ce4a6be1253a81cfdf85ad9c7885ffbed7047fb72c24cf87/distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87", size = 468973, upload-time = "2024-10-09T18:35:44.272Z" }, ] -[[package]] -name = "docutils" -version = "0.20.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/1f/53/a5da4f2c5739cf66290fac1431ee52aff6851c7c8ffd8264f13affd7bcdd/docutils-0.20.1.tar.gz", hash = "sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b", size = 2058365, upload-time = "2023-05-16T23:39:19.748Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/26/87/f238c0670b94533ac0353a4e2a1a771a0cc73277b88bff23d3ae35a256c1/docutils-0.20.1-py3-none-any.whl", hash = "sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6", size = 572666, upload-time = "2023-05-16T23:39:15.976Z" }, -] - [[package]] name = "docutils" version = "0.21.2" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/ae/ed/aefcc8cd0ba62a0560c3c18c33925362d46c6075480bfa4df87b28e169a9/docutils-0.21.2.tar.gz", hash = "sha256:3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f", size = 2204444, upload-time = "2024-04-23T18:57:18.24Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/8f/d7/9322c609343d929e75e7e5e6255e614fcc67572cfd083959cdef3b7aad79/docutils-0.21.2-py3-none-any.whl", hash = "sha256:dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2", size = 587408, upload-time = "2024-04-23T18:57:14.835Z" }, @@ -1129,8 +741,7 @@ name = "exceptiongroup" version = "1.3.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "typing-extensions", version = "4.13.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, + { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/0b/9f/a65090624ecf468cdca03533906e7c69ed7588582240cfe7cc9e770b50eb/exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88", size = 29749, upload-time = "2025-05-10T17:42:51.123Z" } wheels = [ @@ -1155,123 +766,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/90/2b/0817a2b257fe88725c25589d89aec060581aabf668707a8d03b2e9e0cb2a/fastjsonschema-2.21.1-py3-none-any.whl", hash = "sha256:c9e5b7e908310918cf494a434eeb31384dd84a98b57a30bcb1f535015b554667", size = 23924, upload-time = "2024-12-02T10:55:07.599Z" }, ] -[[package]] -name = "filelock" -version = "3.16.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/9d/db/3ef5bb276dae18d6ec2124224403d1d67bccdbefc17af4cc8f553e341ab1/filelock-3.16.1.tar.gz", hash = "sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435", size = 18037, upload-time = "2024-09-17T19:02:01.779Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b9/f8/feced7779d755758a52d1f6635d990b8d98dc0a29fa568bbe0625f18fdf3/filelock-3.16.1-py3-none-any.whl", hash = "sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0", size = 16163, upload-time = "2024-09-17T19:02:00.268Z" }, -] - [[package]] name = "filelock" version = "3.18.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/0a/10/c23352565a6544bdc5353e0b15fc1c563352101f30e24bf500207a54df9a/filelock-3.18.0.tar.gz", hash = "sha256:adbc88eabb99d2fec8c9c1b229b171f18afa655400173ddc653d5d01501fb9f2", size = 18075, upload-time = "2025-03-14T07:11:40.47Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/4d/36/2a115987e2d8c300a974597416d9de88f2444426de9571f4b59b2cca3acc/filelock-3.18.0-py3-none-any.whl", hash = "sha256:c401f4f8377c4464e6db25fff06205fd89bdd83b65eb0488ed1b160f780e21de", size = 16215, upload-time = "2025-03-14T07:11:39.145Z" }, ] -[[package]] -name = "fonttools" -version = "4.57.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/03/2d/a9a0b6e3a0cf6bd502e64fc16d894269011930cabfc89aee20d1635b1441/fonttools-4.57.0.tar.gz", hash = "sha256:727ece10e065be2f9dd239d15dd5d60a66e17eac11aea47d447f9f03fdbc42de", size = 3492448, upload-time = "2025-04-03T11:07:13.898Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/db/17/3ddfd1881878b3f856065130bb603f5922e81ae8a4eb53bce0ea78f765a8/fonttools-4.57.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:babe8d1eb059a53e560e7bf29f8e8f4accc8b6cfb9b5fd10e485bde77e71ef41", size = 2756260, upload-time = "2025-04-03T11:05:28.582Z" }, - { url = "https://files.pythonhosted.org/packages/26/2b/6957890c52c030b0bf9e0add53e5badab4682c6ff024fac9a332bb2ae063/fonttools-4.57.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:81aa97669cd726349eb7bd43ca540cf418b279ee3caba5e2e295fb4e8f841c02", size = 2284691, upload-time = "2025-04-03T11:05:31.526Z" }, - { url = "https://files.pythonhosted.org/packages/cc/8e/c043b4081774e5eb06a834cedfdb7d432b4935bc8c4acf27207bdc34dfc4/fonttools-4.57.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f0e9618630edd1910ad4f07f60d77c184b2f572c8ee43305ea3265675cbbfe7e", size = 4566077, upload-time = "2025-04-03T11:05:33.559Z" }, - { url = "https://files.pythonhosted.org/packages/59/bc/e16ae5d9eee6c70830ce11d1e0b23d6018ddfeb28025fda092cae7889c8b/fonttools-4.57.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:34687a5d21f1d688d7d8d416cb4c5b9c87fca8a1797ec0d74b9fdebfa55c09ab", size = 4608729, upload-time = "2025-04-03T11:05:35.49Z" }, - { url = "https://files.pythonhosted.org/packages/25/13/e557bf10bb38e4e4c436d3a9627aadf691bc7392ae460910447fda5fad2b/fonttools-4.57.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:69ab81b66ebaa8d430ba56c7a5f9abe0183afefd3a2d6e483060343398b13fb1", size = 4759646, upload-time = "2025-04-03T11:05:37.963Z" }, - { url = "https://files.pythonhosted.org/packages/bc/c9/5e2952214d4a8e31026bf80beb18187199b7001e60e99a6ce19773249124/fonttools-4.57.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:d639397de852f2ccfb3134b152c741406752640a266d9c1365b0f23d7b88077f", size = 4941652, upload-time = "2025-04-03T11:05:40.089Z" }, - { url = "https://files.pythonhosted.org/packages/df/04/e80242b3d9ec91a1f785d949edc277a13ecfdcfae744de4b170df9ed77d8/fonttools-4.57.0-cp310-cp310-win32.whl", hash = "sha256:cc066cb98b912f525ae901a24cd381a656f024f76203bc85f78fcc9e66ae5aec", size = 2159432, upload-time = "2025-04-03T11:05:41.754Z" }, - { url = "https://files.pythonhosted.org/packages/33/ba/e858cdca275daf16e03c0362aa43734ea71104c3b356b2100b98543dba1b/fonttools-4.57.0-cp310-cp310-win_amd64.whl", hash = "sha256:7a64edd3ff6a7f711a15bd70b4458611fb240176ec11ad8845ccbab4fe6745db", size = 2203869, upload-time = "2025-04-03T11:05:43.712Z" }, - { url = "https://files.pythonhosted.org/packages/81/1f/e67c99aa3c6d3d2f93d956627e62a57ae0d35dc42f26611ea2a91053f6d6/fonttools-4.57.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:3871349303bdec958360eedb619169a779956503ffb4543bb3e6211e09b647c4", size = 2757392, upload-time = "2025-04-03T11:05:45.715Z" }, - { url = "https://files.pythonhosted.org/packages/aa/f1/f75770d0ddc67db504850898d96d75adde238c35313409bfcd8db4e4a5fe/fonttools-4.57.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c59375e85126b15a90fcba3443eaac58f3073ba091f02410eaa286da9ad80ed8", size = 2285609, upload-time = "2025-04-03T11:05:47.977Z" }, - { url = "https://files.pythonhosted.org/packages/f5/d3/bc34e4953cb204bae0c50b527307dce559b810e624a733351a654cfc318e/fonttools-4.57.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:967b65232e104f4b0f6370a62eb33089e00024f2ce143aecbf9755649421c683", size = 4873292, upload-time = "2025-04-03T11:05:49.921Z" }, - { url = "https://files.pythonhosted.org/packages/41/b8/d5933559303a4ab18c799105f4c91ee0318cc95db4a2a09e300116625e7a/fonttools-4.57.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:39acf68abdfc74e19de7485f8f7396fa4d2418efea239b7061d6ed6a2510c746", size = 4902503, upload-time = "2025-04-03T11:05:52.17Z" }, - { url = "https://files.pythonhosted.org/packages/32/13/acb36bfaa316f481153ce78de1fa3926a8bad42162caa3b049e1afe2408b/fonttools-4.57.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:9d077f909f2343daf4495ba22bb0e23b62886e8ec7c109ee8234bdbd678cf344", size = 5077351, upload-time = "2025-04-03T11:05:54.162Z" }, - { url = "https://files.pythonhosted.org/packages/b5/23/6d383a2ca83b7516d73975d8cca9d81a01acdcaa5e4db8579e4f3de78518/fonttools-4.57.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:46370ac47a1e91895d40e9ad48effbe8e9d9db1a4b80888095bc00e7beaa042f", size = 5275067, upload-time = "2025-04-03T11:05:57.375Z" }, - { url = "https://files.pythonhosted.org/packages/bc/ca/31b8919c6da0198d5d522f1d26c980201378c087bdd733a359a1e7485769/fonttools-4.57.0-cp311-cp311-win32.whl", hash = "sha256:ca2aed95855506b7ae94e8f1f6217b7673c929e4f4f1217bcaa236253055cb36", size = 2158263, upload-time = "2025-04-03T11:05:59.567Z" }, - { url = "https://files.pythonhosted.org/packages/13/4c/de2612ea2216eb45cfc8eb91a8501615dd87716feaf5f8fb65cbca576289/fonttools-4.57.0-cp311-cp311-win_amd64.whl", hash = "sha256:17168a4670bbe3775f3f3f72d23ee786bd965395381dfbb70111e25e81505b9d", size = 2204968, upload-time = "2025-04-03T11:06:02.16Z" }, - { url = "https://files.pythonhosted.org/packages/cb/98/d4bc42d43392982eecaaca117d79845734d675219680cd43070bb001bc1f/fonttools-4.57.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:889e45e976c74abc7256d3064aa7c1295aa283c6bb19810b9f8b604dfe5c7f31", size = 2751824, upload-time = "2025-04-03T11:06:03.782Z" }, - { url = "https://files.pythonhosted.org/packages/1a/62/7168030eeca3742fecf45f31e63b5ef48969fa230a672216b805f1d61548/fonttools-4.57.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:0425c2e052a5f1516c94e5855dbda706ae5a768631e9fcc34e57d074d1b65b92", size = 2283072, upload-time = "2025-04-03T11:06:05.533Z" }, - { url = "https://files.pythonhosted.org/packages/5d/82/121a26d9646f0986ddb35fbbaf58ef791c25b59ecb63ffea2aab0099044f/fonttools-4.57.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:44c26a311be2ac130f40a96769264809d3b0cb297518669db437d1cc82974888", size = 4788020, upload-time = "2025-04-03T11:06:07.249Z" }, - { url = "https://files.pythonhosted.org/packages/5b/26/e0f2fb662e022d565bbe280a3cfe6dafdaabf58889ff86fdef2d31ff1dde/fonttools-4.57.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:84c41ba992df5b8d680b89fd84c6a1f2aca2b9f1ae8a67400c8930cd4ea115f6", size = 4859096, upload-time = "2025-04-03T11:06:09.469Z" }, - { url = "https://files.pythonhosted.org/packages/9e/44/9075e323347b1891cdece4b3f10a3b84a8f4c42a7684077429d9ce842056/fonttools-4.57.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:ea1e9e43ca56b0c12440a7c689b1350066595bebcaa83baad05b8b2675129d98", size = 4964356, upload-time = "2025-04-03T11:06:11.294Z" }, - { url = "https://files.pythonhosted.org/packages/48/28/caa8df32743462fb966be6de6a79d7f30393859636d7732e82efa09fbbb4/fonttools-4.57.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:84fd56c78d431606332a0627c16e2a63d243d0d8b05521257d77c6529abe14d8", size = 5226546, upload-time = "2025-04-03T11:06:13.6Z" }, - { url = "https://files.pythonhosted.org/packages/f6/46/95ab0f0d2e33c5b1a4fc1c0efe5e286ba9359602c0a9907adb1faca44175/fonttools-4.57.0-cp312-cp312-win32.whl", hash = "sha256:f4376819c1c778d59e0a31db5dc6ede854e9edf28bbfa5b756604727f7f800ac", size = 2146776, upload-time = "2025-04-03T11:06:15.643Z" }, - { url = "https://files.pythonhosted.org/packages/06/5d/1be5424bb305880e1113631f49a55ea7c7da3a5fe02608ca7c16a03a21da/fonttools-4.57.0-cp312-cp312-win_amd64.whl", hash = "sha256:57e30241524879ea10cdf79c737037221f77cc126a8cdc8ff2c94d4a522504b9", size = 2193956, upload-time = "2025-04-03T11:06:17.534Z" }, - { url = "https://files.pythonhosted.org/packages/e9/2f/11439f3af51e4bb75ac9598c29f8601aa501902dcedf034bdc41f47dd799/fonttools-4.57.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:408ce299696012d503b714778d89aa476f032414ae57e57b42e4b92363e0b8ef", size = 2739175, upload-time = "2025-04-03T11:06:19.583Z" }, - { url = "https://files.pythonhosted.org/packages/25/52/677b55a4c0972dc3820c8dba20a29c358197a78229daa2ea219fdb19e5d5/fonttools-4.57.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:bbceffc80aa02d9e8b99f2a7491ed8c4a783b2fc4020119dc405ca14fb5c758c", size = 2276583, upload-time = "2025-04-03T11:06:21.753Z" }, - { url = "https://files.pythonhosted.org/packages/64/79/184555f8fa77b827b9460a4acdbbc0b5952bb6915332b84c615c3a236826/fonttools-4.57.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f022601f3ee9e1f6658ed6d184ce27fa5216cee5b82d279e0f0bde5deebece72", size = 4766437, upload-time = "2025-04-03T11:06:23.521Z" }, - { url = "https://files.pythonhosted.org/packages/f8/ad/c25116352f456c0d1287545a7aa24e98987b6d99c5b0456c4bd14321f20f/fonttools-4.57.0-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4dea5893b58d4637ffa925536462ba626f8a1b9ffbe2f5c272cdf2c6ebadb817", size = 4838431, upload-time = "2025-04-03T11:06:25.423Z" }, - { url = "https://files.pythonhosted.org/packages/53/ae/398b2a833897297797a44f519c9af911c2136eb7aa27d3f1352c6d1129fa/fonttools-4.57.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:dff02c5c8423a657c550b48231d0a48d7e2b2e131088e55983cfe74ccc2c7cc9", size = 4951011, upload-time = "2025-04-03T11:06:27.41Z" }, - { url = "https://files.pythonhosted.org/packages/b7/5d/7cb31c4bc9ffb9a2bbe8b08f8f53bad94aeb158efad75da645b40b62cb73/fonttools-4.57.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:767604f244dc17c68d3e2dbf98e038d11a18abc078f2d0f84b6c24571d9c0b13", size = 5205679, upload-time = "2025-04-03T11:06:29.804Z" }, - { url = "https://files.pythonhosted.org/packages/4c/e4/6934513ec2c4d3d69ca1bc3bd34d5c69dafcbf68c15388dd3bb062daf345/fonttools-4.57.0-cp313-cp313-win32.whl", hash = "sha256:8e2e12d0d862f43d51e5afb8b9751c77e6bec7d2dc00aad80641364e9df5b199", size = 2144833, upload-time = "2025-04-03T11:06:31.737Z" }, - { url = "https://files.pythonhosted.org/packages/c4/0d/2177b7fdd23d017bcfb702fd41e47d4573766b9114da2fddbac20dcc4957/fonttools-4.57.0-cp313-cp313-win_amd64.whl", hash = "sha256:f1d6bc9c23356908db712d282acb3eebd4ae5ec6d8b696aa40342b1d84f8e9e3", size = 2190799, upload-time = "2025-04-03T11:06:34.784Z" }, - { url = "https://files.pythonhosted.org/packages/8a/3f/c16dbbec7221783f37dcc2022d5a55f0d704ffc9feef67930f6eb517e8ce/fonttools-4.57.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:9d57b4e23ebbe985125d3f0cabbf286efa191ab60bbadb9326091050d88e8213", size = 2753756, upload-time = "2025-04-03T11:06:36.875Z" }, - { url = "https://files.pythonhosted.org/packages/48/9f/5b4a3d6aed5430b159dd3494bb992d4e45102affa3725f208e4f0aedc6a3/fonttools-4.57.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:579ba873d7f2a96f78b2e11028f7472146ae181cae0e4d814a37a09e93d5c5cc", size = 2283179, upload-time = "2025-04-03T11:06:39.095Z" }, - { url = "https://files.pythonhosted.org/packages/17/b2/4e887b674938b4c3848029a4134ac90dd8653ea80b4f464fa1edeae37f25/fonttools-4.57.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6e3e1ec10c29bae0ea826b61f265ec5c858c5ba2ce2e69a71a62f285cf8e4595", size = 4647139, upload-time = "2025-04-03T11:06:41.315Z" }, - { url = "https://files.pythonhosted.org/packages/a5/0e/b6314a09a4d561aaa7e09de43fa700917be91e701f07df6178865962666c/fonttools-4.57.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a1968f2a2003c97c4ce6308dc2498d5fd4364ad309900930aa5a503c9851aec8", size = 4691211, upload-time = "2025-04-03T11:06:43.566Z" }, - { url = "https://files.pythonhosted.org/packages/bf/1d/b9f4b70d165c25f5c9aee61eb6ae90b0e9b5787b2c0a45e4f3e50a839274/fonttools-4.57.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:aff40f8ac6763d05c2c8f6d240c6dac4bb92640a86d9b0c3f3fff4404f34095c", size = 4873755, upload-time = "2025-04-03T11:06:45.457Z" }, - { url = "https://files.pythonhosted.org/packages/3b/fa/a731c8f42ae2c6761d1c22bd3c90241d5b2b13cabb70598abc74a828b51f/fonttools-4.57.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:d07f1b64008e39fceae7aa99e38df8385d7d24a474a8c9872645c4397b674481", size = 5070072, upload-time = "2025-04-03T11:06:47.853Z" }, - { url = "https://files.pythonhosted.org/packages/1f/1e/6a988230109a2ba472e5de0a4c3936d49718cfc4b700b6bad53eca414bcf/fonttools-4.57.0-cp38-cp38-win32.whl", hash = "sha256:51d8482e96b28fb28aa8e50b5706f3cee06de85cbe2dce80dbd1917ae22ec5a6", size = 1484098, upload-time = "2025-04-03T11:06:50.167Z" }, - { url = "https://files.pythonhosted.org/packages/dc/7a/2b3666e8c13d035adf656a8ae391380656144760353c97f74747c64fd3e5/fonttools-4.57.0-cp38-cp38-win_amd64.whl", hash = "sha256:03290e818782e7edb159474144fca11e36a8ed6663d1fcbd5268eb550594fd8e", size = 1529536, upload-time = "2025-04-03T11:06:52.468Z" }, - { url = "https://files.pythonhosted.org/packages/d2/c7/3bddafbb95447f6fbabdd0b399bf468649321fd4029e356b4f6bd70fbc1b/fonttools-4.57.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7339e6a3283e4b0ade99cade51e97cde3d54cd6d1c3744459e886b66d630c8b3", size = 2758942, upload-time = "2025-04-03T11:06:54.679Z" }, - { url = "https://files.pythonhosted.org/packages/d4/a2/8dd7771022e365c90e428b1607174c3297d5c0a2cc2cf4cdccb2221945b7/fonttools-4.57.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:05efceb2cb5f6ec92a4180fcb7a64aa8d3385fd49cfbbe459350229d1974f0b1", size = 2285959, upload-time = "2025-04-03T11:06:56.792Z" }, - { url = "https://files.pythonhosted.org/packages/58/5a/2fd29c5e38b14afe1fae7d472373e66688e7c7a98554252f3cf44371e033/fonttools-4.57.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a97bb05eb24637714a04dee85bdf0ad1941df64fe3b802ee4ac1c284a5f97b7c", size = 4571677, upload-time = "2025-04-03T11:06:59.002Z" }, - { url = "https://files.pythonhosted.org/packages/bf/30/b77cf81923f1a67ff35d6765a9db4718c0688eb8466c464c96a23a2e28d4/fonttools-4.57.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:541cb48191a19ceb1a2a4b90c1fcebd22a1ff7491010d3cf840dd3a68aebd654", size = 4616644, upload-time = "2025-04-03T11:07:01.238Z" }, - { url = "https://files.pythonhosted.org/packages/06/33/376605898d8d553134144dff167506a49694cb0e0cf684c14920fbc1e99f/fonttools-4.57.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:cdef9a056c222d0479a1fdb721430f9efd68268014c54e8166133d2643cb05d9", size = 4761314, upload-time = "2025-04-03T11:07:03.162Z" }, - { url = "https://files.pythonhosted.org/packages/48/e4/e0e48f5bae04bc1a1c6b4fcd7d1ca12b29f1fe74221534b7ff83ed0db8fe/fonttools-4.57.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:3cf97236b192a50a4bf200dc5ba405aa78d4f537a2c6e4c624bb60466d5b03bd", size = 4945563, upload-time = "2025-04-03T11:07:05.313Z" }, - { url = "https://files.pythonhosted.org/packages/61/98/2dacfc6d70f2d93bde1bbf814286be343cb17f53057130ad3b843144dd00/fonttools-4.57.0-cp39-cp39-win32.whl", hash = "sha256:e952c684274a7714b3160f57ec1d78309f955c6335c04433f07d36c5eb27b1f9", size = 2159997, upload-time = "2025-04-03T11:07:07.467Z" }, - { url = "https://files.pythonhosted.org/packages/93/fa/e61cc236f40d504532d2becf90c297bfed8e40abc0c8b08375fbb83eff29/fonttools-4.57.0-cp39-cp39-win_amd64.whl", hash = "sha256:a2a722c0e4bfd9966a11ff55c895c817158fcce1b2b6700205a376403b546ad9", size = 2204508, upload-time = "2025-04-03T11:07:09.632Z" }, - { url = "https://files.pythonhosted.org/packages/90/27/45f8957c3132917f91aaa56b700bcfc2396be1253f685bd5c68529b6f610/fonttools-4.57.0-py3-none-any.whl", hash = "sha256:3122c604a675513c68bd24c6a8f9091f1c2376d18e8f5fe5a101746c81b3e98f", size = 1093605, upload-time = "2025-04-03T11:07:11.341Z" }, -] - [[package]] name = "fonttools" version = "4.58.5" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/52/97/5735503e58d3816b0989955ef9b2df07e4c99b246469bd8b3823a14095da/fonttools-4.58.5.tar.gz", hash = "sha256:b2a35b0a19f1837284b3a23dd64fd7761b8911d50911ecd2bdbaf5b2d1b5df9c", size = 3526243, upload-time = "2025-07-03T14:04:47.736Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/0b/cd/d2a50d9e9e9f01491993acd557051a05b0bbe57eb47710c6381dca741ac9/fonttools-4.58.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d500d399aa4e92d969a0d21052696fa762385bb23c3e733703af4a195ad9f34c", size = 2749015, upload-time = "2025-07-03T14:03:15.683Z" }, @@ -1362,44 +869,12 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/1d/9a/4114a9057db2f1462d5c8f8390ab7383925fe1ac012eaa42402ad65c2963/GitPython-3.1.44-py3-none-any.whl", hash = "sha256:9e0e10cda9bed1ee64bc9a6de50e7e38a9c9943241cd7f585f6df3ed28011110", size = 207599, upload-time = "2025-01-02T07:32:40.731Z" }, ] -[[package]] -name = "griffe" -version = "1.4.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "astunparse", marker = "python_full_version < '3.9'" }, - { name = "colorama", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/05/e9/b2c86ad9d69053e497a24ceb25d661094fb321ab4ed39a8b71793dcbae82/griffe-1.4.0.tar.gz", hash = "sha256:8fccc585896d13f1221035d32c50dec65830c87d23f9adb9b1e6f3d63574f7f5", size = 381028, upload-time = "2024-10-11T12:53:54.414Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/22/7c/e9e66869c2e4c9b378474e49c993128ec0131ef4721038b6d06e50538caf/griffe-1.4.0-py3-none-any.whl", hash = "sha256:e589de8b8c137e99a46ec45f9598fc0ac5b6868ce824b24db09c02d117b89bc5", size = 127015, upload-time = "2024-10-11T12:53:52.383Z" }, -] - [[package]] name = "griffe" version = "1.7.3" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "colorama", marker = "python_full_version >= '3.9'" }, + { name = "colorama" }, ] sdist = { url = "https://files.pythonhosted.org/packages/a9/3e/5aa9a61f7c3c47b0b52a1d930302992229d191bf4bc76447b324b731510a/griffe-1.7.3.tar.gz", hash = "sha256:52ee893c6a3a968b639ace8015bec9d36594961e156e23315c8e8e51401fa50b", size = 395137, upload-time = "2025-04-23T11:29:09.147Z" } wheels = [ @@ -1433,8 +908,7 @@ name = "httpx" version = "0.28.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "anyio", version = "4.5.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "anyio", version = "4.9.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "anyio" }, { name = "certifi" }, { name = "httpcore" }, { name = "idna" }, @@ -1465,86 +939,24 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442, upload-time = "2024-09-15T18:07:37.964Z" }, ] -[[package]] -name = "importlib-metadata" -version = "8.5.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "zipp", version = "3.20.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/cd/12/33e59336dca5be0c398a7482335911a33aa0e20776128f038019f1a95f1b/importlib_metadata-8.5.0.tar.gz", hash = "sha256:71522656f0abace1d072b9e5481a48f07c138e00f079c38c8f883823f9c26bd7", size = 55304, upload-time = "2024-09-11T14:56:08.937Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/a0/d9/a1e041c5e7caa9a05c925f4bdbdfb7f006d1f74996af53467bc394c97be7/importlib_metadata-8.5.0-py3-none-any.whl", hash = "sha256:45e54197d28b7a7f1559e60b95e7c567032b602131fbd588f1497f47880aa68b", size = 26514, upload-time = "2024-09-11T14:56:07.019Z" }, -] - [[package]] name = "importlib-metadata" version = "8.7.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "zipp", version = "3.23.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "zipp" }, ] sdist = { url = "https://files.pythonhosted.org/packages/76/66/650a33bd90f786193e4de4b3ad86ea60b53c89b669a5c7be931fac31cdb0/importlib_metadata-8.7.0.tar.gz", hash = "sha256:d13b81ad223b890aa16c5471f2ac3056cf76c5f10f82d6f9292f0b415f389000", size = 56641, upload-time = "2025-04-27T15:29:01.736Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/20/b0/36bd937216ec521246249be3bf9855081de4c5e06a0c9b4219dbeda50373/importlib_metadata-8.7.0-py3-none-any.whl", hash = "sha256:e5dd1551894c77868a30651cef00984d50e1002d06942a7101d34870c5f02afd", size = 27656, upload-time = "2025-04-27T15:29:00.214Z" }, ] -[[package]] -name = "importlib-resources" -version = "6.4.5" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "zipp", version = "3.20.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/98/be/f3e8c6081b684f176b761e6a2fef02a0be939740ed6f54109a2951d806f3/importlib_resources-6.4.5.tar.gz", hash = "sha256:980862a1d16c9e147a59603677fa2aa5fd82b87f223b6cb870695bcfce830065", size = 43372, upload-time = "2024-09-09T17:03:14.677Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e1/6a/4604f9ae2fa62ef47b9de2fa5ad599589d28c9fd1d335f32759813dfa91e/importlib_resources-6.4.5-py3-none-any.whl", hash = "sha256:ac29d5f956f01d5e4bb63102a5a19957f1b9175e45649977264a1416783bb717", size = 36115, upload-time = "2024-09-09T17:03:13.39Z" }, -] - [[package]] name = "importlib-resources" version = "6.5.2" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "zipp", version = "3.23.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "zipp", marker = "python_full_version < '3.10'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/cf/8c/f834fbf984f691b4f7ff60f50b514cc3de5cc08abfc3295564dd89c5e2e7/importlib_resources-6.5.2.tar.gz", hash = "sha256:185f87adef5bcc288449d98fb4fba07cea78bc036455dd44c5fc4a2fe78fed2c", size = 44693, upload-time = "2025-01-03T18:51:56.698Z" } wheels = [ @@ -1568,8 +980,7 @@ dependencies = [ { name = "appnope", marker = "sys_platform == 'darwin'" }, { name = "comm" }, { name = "debugpy" }, - { name = "ipython", version = "8.12.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "ipython", version = "8.18.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "ipython", version = "8.18.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "ipython", version = "8.37.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" }, { name = "ipython", version = "9.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "jupyter-client" }, @@ -1579,8 +990,7 @@ dependencies = [ { name = "packaging" }, { name = "psutil" }, { name = "pyzmq" }, - { name = "tornado", version = "6.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "tornado", version = "6.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "tornado" }, { name = "traitlets" }, ] sdist = { url = "https://files.pythonhosted.org/packages/e9/5c/67594cb0c7055dc50814b21731c22a601101ea3b1b50a9a1b090e11f5d0f/ipykernel-6.29.5.tar.gz", hash = "sha256:f093a22c4a40f8828f8e330a9c297cb93dcab13bd9678ded6de8e5cf81c56215", size = 163367, upload-time = "2024-07-01T14:07:22.543Z" } @@ -1588,56 +998,27 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/94/5c/368ae6c01c7628438358e6d337c19b05425727fbb221d2a3c4303c372f42/ipykernel-6.29.5-py3-none-any.whl", hash = "sha256:afdb66ba5aa354b09b91379bac28ae4afebbb30e8b39510c9690afb7a10421b5", size = 117173, upload-time = "2024-07-01T14:07:19.603Z" }, ] -[[package]] -name = "ipython" -version = "8.12.3" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "appnope", marker = "python_full_version < '3.9' and sys_platform == 'darwin'" }, - { name = "backcall", marker = "python_full_version < '3.9'" }, - { name = "colorama", marker = "python_full_version < '3.9' and sys_platform == 'win32'" }, - { name = "decorator", marker = "python_full_version < '3.9'" }, - { name = "jedi", marker = "python_full_version < '3.9'" }, - { name = "matplotlib-inline", marker = "python_full_version < '3.9'" }, - { name = "pexpect", marker = "python_full_version < '3.9' and sys_platform != 'win32'" }, - { name = "pickleshare", marker = "python_full_version < '3.9'" }, - { name = "prompt-toolkit", marker = "python_full_version < '3.9'" }, - { name = "pygments", marker = "python_full_version < '3.9'" }, - { name = "stack-data", marker = "python_full_version < '3.9'" }, - { name = "traitlets", marker = "python_full_version < '3.9'" }, - { name = "typing-extensions", version = "4.13.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/9e/6a/44ef299b1762f5a73841e87fae8a73a8cc8aee538d6dc8c77a5afe1fd2ce/ipython-8.12.3.tar.gz", hash = "sha256:3910c4b54543c2ad73d06579aa771041b7d5707b033bd488669b4cf544e3b363", size = 5470171, upload-time = "2023-09-29T09:14:37.468Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/8d/97/8fe103906cd81bc42d3b0175b5534a9f67dccae47d6451131cf8d0d70bb2/ipython-8.12.3-py3-none-any.whl", hash = "sha256:b0340d46a933d27c657b211a329d0be23793c36595acf9e6ef4164bc01a1804c", size = 798307, upload-time = "2023-09-29T09:14:34.431Z" }, -] - [[package]] name = "ipython" version = "8.18.1" source = { registry = "https://pypi.org/simple" } resolution-markers = [ - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", + "python_full_version < '3.10' and platform_machine == 'arm64' and sys_platform == 'darwin'", + "python_full_version < '3.10' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version < '3.10' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.10' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.10' and sys_platform != 'darwin' and sys_platform != 'linux')", ] dependencies = [ - { name = "colorama", marker = "python_full_version == '3.9.*' and sys_platform == 'win32'" }, - { name = "decorator", marker = "python_full_version == '3.9.*'" }, - { name = "exceptiongroup", marker = "python_full_version == '3.9.*'" }, - { name = "jedi", marker = "python_full_version == '3.9.*'" }, - { name = "matplotlib-inline", marker = "python_full_version == '3.9.*'" }, - { name = "pexpect", marker = "python_full_version == '3.9.*' and sys_platform != 'win32'" }, - { name = "prompt-toolkit", marker = "python_full_version == '3.9.*'" }, - { name = "pygments", marker = "python_full_version == '3.9.*'" }, - { name = "stack-data", marker = "python_full_version == '3.9.*'" }, - { name = "traitlets", marker = "python_full_version == '3.9.*'" }, - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "colorama", marker = "python_full_version < '3.10' and sys_platform == 'win32'" }, + { name = "decorator", marker = "python_full_version < '3.10'" }, + { name = "exceptiongroup", marker = "python_full_version < '3.10'" }, + { name = "jedi", marker = "python_full_version < '3.10'" }, + { name = "matplotlib-inline", marker = "python_full_version < '3.10'" }, + { name = "pexpect", marker = "python_full_version < '3.10' and sys_platform != 'win32'" }, + { name = "prompt-toolkit", marker = "python_full_version < '3.10'" }, + { name = "pygments", marker = "python_full_version < '3.10'" }, + { name = "stack-data", marker = "python_full_version < '3.10'" }, + { name = "traitlets", marker = "python_full_version < '3.10'" }, + { name = "typing-extensions", marker = "python_full_version < '3.10'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/b1/b9/3ba6c45a6df813c09a48bac313c22ff83efa26cbb55011218d925a46e2ad/ipython-8.18.1.tar.gz", hash = "sha256:ca6f079bb33457c66e233e4580ebfc4128855b4cf6370dddd73842a9563e8a27", size = 5486330, upload-time = "2023-11-27T09:58:34.596Z" } wheels = [ @@ -1664,7 +1045,7 @@ dependencies = [ { name = "pygments", marker = "python_full_version == '3.10.*'" }, { name = "stack-data", marker = "python_full_version == '3.10.*'" }, { name = "traitlets", marker = "python_full_version == '3.10.*'" }, - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" }, + { name = "typing-extensions", marker = "python_full_version == '3.10.*'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/85/31/10ac88f3357fc276dc8a64e8880c82e80e7459326ae1d0a211b40abf6665/ipython-8.37.0.tar.gz", hash = "sha256:ca815841e1a41a1e6b73a0b08f3038af9b2252564d01fc405356d34033012216", size = 5606088, upload-time = "2025-05-31T16:39:09.613Z" } wheels = [ @@ -1694,7 +1075,7 @@ dependencies = [ { name = "pygments", marker = "python_full_version >= '3.11'" }, { name = "stack-data", marker = "python_full_version >= '3.11'" }, { name = "traitlets", marker = "python_full_version >= '3.11'" }, - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.11.*'" }, + { name = "typing-extensions", marker = "python_full_version == '3.11.*'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/54/80/406f9e3bde1c1fd9bf5a0be9d090f8ae623e401b7670d8f6fdf2ab679891/ipython-9.4.0.tar.gz", hash = "sha256:c033c6d4e7914c3d9768aabe76bbe87ba1dc66a92a05db6bfa1125d81f2ee270", size = 4385338, upload-time = "2025-07-01T11:11:30.606Z" } wheels = [ @@ -1719,8 +1100,7 @@ version = "8.1.7" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "comm" }, - { name = "ipython", version = "8.12.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "ipython", version = "8.18.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "ipython", version = "8.18.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "ipython", version = "8.37.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" }, { name = "ipython", version = "9.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "jupyterlab-widgets" }, @@ -1749,8 +1129,7 @@ name = "jaraco-classes" version = "3.4.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "more-itertools", version = "10.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "more-itertools", version = "10.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "more-itertools" }, ] sdist = { url = "https://files.pythonhosted.org/packages/06/c0/ed4a27bc5571b99e3cff68f8a9fa5b56ff7df1c2251cc715a652ddd26402/jaraco.classes-3.4.0.tar.gz", hash = "sha256:47a024b51d0239c0dd8c8540c6c7f484be3b8fcf0b2d85c13825780d3b3f3acd", size = 11780, upload-time = "2024-03-31T07:27:36.643Z" } wheels = [ @@ -1769,43 +1148,12 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ff/db/0c52c4cf5e4bd9f5d7135ec7669a3a767af21b3a308e1ed3674881e52b62/jaraco.context-6.0.1-py3-none-any.whl", hash = "sha256:f797fc481b490edb305122c9181830a3a5b76d84ef6d1aef2fb9b47ab956f9e4", size = 6825, upload-time = "2024-08-20T03:39:25.966Z" }, ] -[[package]] -name = "jaraco-functools" -version = "4.1.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "more-itertools", version = "10.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/ab/23/9894b3df5d0a6eb44611c36aec777823fc2e07740dabbd0b810e19594013/jaraco_functools-4.1.0.tar.gz", hash = "sha256:70f7e0e2ae076498e212562325e805204fc092d7b4c17e0e86c959e249701a9d", size = 19159, upload-time = "2024-09-27T19:47:09.122Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/9f/4f/24b319316142c44283d7540e76c7b5a6dbd5db623abd86bb7b3491c21018/jaraco.functools-4.1.0-py3-none-any.whl", hash = "sha256:ad159f13428bc4acbf5541ad6dec511f91573b90fba04df61dafa2a1231cf649", size = 10187, upload-time = "2024-09-27T19:47:07.14Z" }, -] - [[package]] name = "jaraco-functools" version = "4.2.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "more-itertools", version = "10.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "more-itertools" }, ] sdist = { url = "https://files.pythonhosted.org/packages/49/1c/831faaaa0f090b711c355c6d8b2abf277c72133aab472b6932b03322294c/jaraco_functools-4.2.1.tar.gz", hash = "sha256:be634abfccabce56fa3053f8c7ebe37b682683a4ee7793670ced17bab0087353", size = 19661, upload-time = "2025-06-21T19:22:03.201Z" } wheels = [ @@ -1838,8 +1186,7 @@ name = "jinja2" version = "3.1.6" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "markupsafe", version = "2.1.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "markupsafe", version = "3.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "markupsafe" }, ] sdist = { url = "https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d", size = 245115, upload-time = "2025-03-05T20:05:02.478Z" } wheels = [ @@ -1864,63 +1211,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/71/92/5e77f98553e9e75130c78900d000368476aed74276eb8ae8796f65f00918/jsonpointer-3.0.0-py2.py3-none-any.whl", hash = "sha256:13e088adc14fca8b6aa8177c044e12701e6ad4b28ff10e65f2267a90109c9942", size = 7595, upload-time = "2024-06-10T19:24:40.698Z" }, ] -[[package]] -name = "jsonschema" -version = "4.23.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "attrs", marker = "python_full_version < '3.9'" }, - { name = "importlib-resources", version = "6.4.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jsonschema-specifications", version = "2023.12.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "pkgutil-resolve-name", marker = "python_full_version < '3.9'" }, - { name = "referencing", version = "0.35.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "rpds-py", version = "0.20.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/38/2e/03362ee4034a4c917f697890ccd4aec0800ccf9ded7f511971c75451deec/jsonschema-4.23.0.tar.gz", hash = "sha256:d71497fef26351a33265337fa77ffeb82423f3ea21283cd9467bb03999266bc4", size = 325778, upload-time = "2024-07-08T18:40:05.546Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/69/4a/4f9dbeb84e8850557c02365a0eee0649abe5eb1d84af92a25731c6c0f922/jsonschema-4.23.0-py3-none-any.whl", hash = "sha256:fbadb6f8b144a8f8cf9f0b89ba94501d143e50411a1278633f56a7acf7fd5566", size = 88462, upload-time = "2024-07-08T18:40:00.165Z" }, -] - -[package.optional-dependencies] -format-nongpl = [ - { name = "fqdn", marker = "python_full_version < '3.9'" }, - { name = "idna", marker = "python_full_version < '3.9'" }, - { name = "isoduration", marker = "python_full_version < '3.9'" }, - { name = "jsonpointer", marker = "python_full_version < '3.9'" }, - { name = "rfc3339-validator", marker = "python_full_version < '3.9'" }, - { name = "rfc3986-validator", marker = "python_full_version < '3.9'" }, - { name = "uri-template", marker = "python_full_version < '3.9'" }, - { name = "webcolors", version = "24.8.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] - [[package]] name = "jsonschema" version = "4.24.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "attrs", marker = "python_full_version >= '3.9'" }, - { name = "jsonschema-specifications", version = "2025.4.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "referencing", version = "0.36.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "rpds-py", version = "0.26.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "attrs" }, + { name = "jsonschema-specifications" }, + { name = "referencing" }, + { name = "rpds-py" }, ] sdist = { url = "https://files.pythonhosted.org/packages/bf/d3/1cf5326b923a53515d8f3a2cd442e6d7e94fcc444716e879ea70a0ce3177/jsonschema-4.24.0.tar.gz", hash = "sha256:0b4e8069eb12aedfa881333004bccaec24ecef5a8a6a4b6df142b2cc9599d196", size = 353480, upload-time = "2025-05-26T18:48:10.459Z" } wheels = [ @@ -1929,54 +1228,22 @@ wheels = [ [package.optional-dependencies] format-nongpl = [ - { name = "fqdn", marker = "python_full_version >= '3.9'" }, - { name = "idna", marker = "python_full_version >= '3.9'" }, - { name = "isoduration", marker = "python_full_version >= '3.9'" }, - { name = "jsonpointer", marker = "python_full_version >= '3.9'" }, - { name = "rfc3339-validator", marker = "python_full_version >= '3.9'" }, - { name = "rfc3986-validator", marker = "python_full_version >= '3.9'" }, - { name = "uri-template", marker = "python_full_version >= '3.9'" }, - { name = "webcolors", version = "24.11.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, -] - -[[package]] -name = "jsonschema-specifications" -version = "2023.12.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "importlib-resources", version = "6.4.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "referencing", version = "0.35.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/f8/b9/cc0cc592e7c195fb8a650c1d5990b10175cf13b4c97465c72ec841de9e4b/jsonschema_specifications-2023.12.1.tar.gz", hash = "sha256:48a76787b3e70f5ed53f1160d2b81f586e4ca6d1548c5de7085d1682674764cc", size = 13983, upload-time = "2023-12-25T15:16:53.63Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/ee/07/44bd408781594c4d0a027666ef27fab1e441b109dc3b76b4f836f8fd04fe/jsonschema_specifications-2023.12.1-py3-none-any.whl", hash = "sha256:87e4fdf3a94858b8a2ba2778d9ba57d8a9cafca7c7489c46ba0d30a8bc6a9c3c", size = 18482, upload-time = "2023-12-25T15:16:51.997Z" }, + { name = "fqdn" }, + { name = "idna" }, + { name = "isoduration" }, + { name = "jsonpointer" }, + { name = "rfc3339-validator" }, + { name = "rfc3986-validator" }, + { name = "uri-template" }, + { name = "webcolors" }, ] [[package]] name = "jsonschema-specifications" version = "2025.4.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "referencing", version = "0.36.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "referencing" }, ] sdist = { url = "https://files.pythonhosted.org/packages/bf/ce/46fbd9c8119cfc3581ee5643ea49464d168028cfb5caff5fc0596d0cf914/jsonschema_specifications-2025.4.1.tar.gz", hash = "sha256:630159c9f4dbea161a6a2205c3011cc4f18ff381b189fff48bb39b9bf26ae608", size = 15513, upload-time = "2025-04-23T12:34:07.418Z" } wheels = [ @@ -1988,13 +1255,11 @@ name = "jupyter-client" version = "8.6.3" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "importlib-metadata", marker = "python_full_version < '3.10'" }, { name = "jupyter-core" }, { name = "python-dateutil" }, { name = "pyzmq" }, - { name = "tornado", version = "6.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "tornado", version = "6.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "tornado" }, { name = "traitlets" }, ] sdist = { url = "https://files.pythonhosted.org/packages/71/22/bf9f12fdaeae18019a468b68952a60fe6dbab5d67cd2a103cac7659b41ca/jupyter_client-8.6.3.tar.gz", hash = "sha256:35b3a0947c4a6e9d589eb97d7d4cd5e90f910ee73101611f01283732bd6d9419", size = 342019, upload-time = "2024-09-17T10:44:17.613Z" } @@ -2007,8 +1272,7 @@ name = "jupyter-core" version = "5.8.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "platformdirs", version = "4.3.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "platformdirs", version = "4.3.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "platformdirs" }, { name = "pywin32", marker = "platform_python_implementation != 'PyPy' and sys_platform == 'win32'" }, { name = "traitlets" }, ] @@ -2017,56 +1281,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/2f/57/6bffd4b20b88da3800c5d691e0337761576ee688eb01299eae865689d2df/jupyter_core-5.8.1-py3-none-any.whl", hash = "sha256:c28d268fc90fb53f1338ded2eb410704c5449a358406e8a948b75706e24863d0", size = 28880, upload-time = "2025-05-27T07:38:15.137Z" }, ] -[[package]] -name = "jupyter-events" -version = "0.10.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "jsonschema", version = "4.23.0", source = { registry = "https://pypi.org/simple" }, extra = ["format-nongpl"], marker = "python_full_version < '3.9'" }, - { name = "python-json-logger", marker = "python_full_version < '3.9'" }, - { name = "pyyaml", marker = "python_full_version < '3.9'" }, - { name = "referencing", version = "0.35.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "rfc3339-validator", marker = "python_full_version < '3.9'" }, - { name = "rfc3986-validator", marker = "python_full_version < '3.9'" }, - { name = "traitlets", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/8d/53/7537a1aa558229bb0b1b178d814c9d68a9c697d3aecb808a1cb2646acf1f/jupyter_events-0.10.0.tar.gz", hash = "sha256:670b8229d3cc882ec782144ed22e0d29e1c2d639263f92ca8383e66682845e22", size = 61516, upload-time = "2024-03-18T17:41:58.642Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/a5/94/059180ea70a9a326e1815176b2370da56376da347a796f8c4f0b830208ef/jupyter_events-0.10.0-py3-none-any.whl", hash = "sha256:4b72130875e59d57716d327ea70d3ebc3af1944d3717e5a498b8a06c6c159960", size = 18777, upload-time = "2024-03-18T17:41:56.155Z" }, -] - [[package]] name = "jupyter-events" version = "0.12.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "jsonschema", version = "4.24.0", source = { registry = "https://pypi.org/simple" }, extra = ["format-nongpl"], marker = "python_full_version >= '3.9'" }, - { name = "packaging", marker = "python_full_version >= '3.9'" }, - { name = "python-json-logger", marker = "python_full_version >= '3.9'" }, - { name = "pyyaml", marker = "python_full_version >= '3.9'" }, - { name = "referencing", version = "0.36.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "rfc3339-validator", marker = "python_full_version >= '3.9'" }, - { name = "rfc3986-validator", marker = "python_full_version >= '3.9'" }, - { name = "traitlets", marker = "python_full_version >= '3.9'" }, + { name = "jsonschema", extra = ["format-nongpl"] }, + { name = "packaging" }, + { name = "python-json-logger" }, + { name = "pyyaml" }, + { name = "referencing" }, + { name = "rfc3339-validator" }, + { name = "rfc3986-validator" }, + { name = "traitlets" }, ] sdist = { url = "https://files.pythonhosted.org/packages/9d/c3/306d090461e4cf3cd91eceaff84bede12a8e52cd821c2d20c9a4fd728385/jupyter_events-0.12.0.tar.gz", hash = "sha256:fc3fce98865f6784c9cd0a56a20644fc6098f21c8c33834a8d9fe383c17e554b", size = 62196, upload-time = "2025-02-03T17:23:41.485Z" } wheels = [ @@ -2078,89 +1305,38 @@ name = "jupyter-lsp" version = "2.2.5" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, - { name = "jupyter-server", version = "2.14.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jupyter-server", version = "2.16.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "importlib-metadata", marker = "python_full_version < '3.10'" }, + { name = "jupyter-server" }, ] sdist = { url = "https://files.pythonhosted.org/packages/85/b4/3200b0b09c12bc3b72d943d923323c398eff382d1dcc7c0dbc8b74630e40/jupyter-lsp-2.2.5.tar.gz", hash = "sha256:793147a05ad446f809fd53ef1cd19a9f5256fd0a2d6b7ce943a982cb4f545001", size = 48741, upload-time = "2024-04-09T17:59:44.918Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/07/e0/7bd7cff65594fd9936e2f9385701e44574fc7d721331ff676ce440b14100/jupyter_lsp-2.2.5-py3-none-any.whl", hash = "sha256:45fbddbd505f3fbfb0b6cb2f1bc5e15e83ab7c79cd6e89416b248cb3c00c11da", size = 69146, upload-time = "2024-04-09T17:59:43.388Z" }, ] -[[package]] -name = "jupyter-server" -version = "2.14.2" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "anyio", version = "4.5.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "argon2-cffi", marker = "python_full_version < '3.9'" }, - { name = "jinja2", marker = "python_full_version < '3.9'" }, - { name = "jupyter-client", marker = "python_full_version < '3.9'" }, - { name = "jupyter-core", marker = "python_full_version < '3.9'" }, - { name = "jupyter-events", version = "0.10.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jupyter-server-terminals", marker = "python_full_version < '3.9'" }, - { name = "nbconvert", marker = "python_full_version < '3.9'" }, - { name = "nbformat", marker = "python_full_version < '3.9'" }, - { name = "overrides", marker = "python_full_version < '3.9'" }, - { name = "packaging", marker = "python_full_version < '3.9'" }, - { name = "prometheus-client", version = "0.21.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "pywinpty", version = "2.0.14", source = { registry = "https://pypi.org/simple" }, marker = "(python_full_version < '3.9' and os_name == 'nt' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and os_name == 'nt' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and os_name == 'nt' and sys_platform != 'darwin' and sys_platform != 'linux')" }, - { name = "pyzmq", marker = "python_full_version < '3.9'" }, - { name = "send2trash", marker = "python_full_version < '3.9'" }, - { name = "terminado", marker = "python_full_version < '3.9'" }, - { name = "tornado", version = "6.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "traitlets", marker = "python_full_version < '3.9'" }, - { name = "websocket-client", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/0c/34/88b47749c7fa9358e10eac356c4b97d94a91a67d5c935a73f69bc4a31118/jupyter_server-2.14.2.tar.gz", hash = "sha256:66095021aa9638ced276c248b1d81862e4c50f292d575920bbe960de1c56b12b", size = 719933, upload-time = "2024-07-12T18:31:43.019Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/57/e1/085edea6187a127ca8ea053eb01f4e1792d778b4d192c74d32eb6730fed6/jupyter_server-2.14.2-py3-none-any.whl", hash = "sha256:47ff506127c2f7851a17bf4713434208fc490955d0e8632e95014a9a9afbeefd", size = 383556, upload-time = "2024-07-12T18:31:39.724Z" }, -] - [[package]] name = "jupyter-server" version = "2.16.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "anyio", version = "4.9.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "argon2-cffi", marker = "python_full_version >= '3.9'" }, - { name = "jinja2", marker = "python_full_version >= '3.9'" }, - { name = "jupyter-client", marker = "python_full_version >= '3.9'" }, - { name = "jupyter-core", marker = "python_full_version >= '3.9'" }, - { name = "jupyter-events", version = "0.12.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "jupyter-server-terminals", marker = "python_full_version >= '3.9'" }, - { name = "nbconvert", marker = "python_full_version >= '3.9'" }, - { name = "nbformat", marker = "python_full_version >= '3.9'" }, - { name = "overrides", marker = "python_full_version >= '3.9'" }, - { name = "packaging", marker = "python_full_version >= '3.9'" }, - { name = "prometheus-client", version = "0.22.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "pywinpty", version = "2.0.15", source = { registry = "https://pypi.org/simple" }, marker = "(python_full_version == '3.9.*' and os_name == 'nt' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version >= '3.9' and os_name == 'nt' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.9' and os_name == 'nt' and sys_platform != 'darwin' and sys_platform != 'linux')" }, - { name = "pyzmq", marker = "python_full_version >= '3.9'" }, - { name = "send2trash", marker = "python_full_version >= '3.9'" }, - { name = "terminado", marker = "python_full_version >= '3.9'" }, - { name = "tornado", version = "6.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "traitlets", marker = "python_full_version >= '3.9'" }, - { name = "websocket-client", marker = "python_full_version >= '3.9'" }, + { name = "anyio" }, + { name = "argon2-cffi" }, + { name = "jinja2" }, + { name = "jupyter-client" }, + { name = "jupyter-core" }, + { name = "jupyter-events" }, + { name = "jupyter-server-terminals" }, + { name = "nbconvert" }, + { name = "nbformat" }, + { name = "overrides" }, + { name = "packaging" }, + { name = "prometheus-client" }, + { name = "pywinpty", marker = "(python_full_version < '3.10' and os_name == 'nt' and platform_machine != 'arm64' and sys_platform == 'darwin') or (os_name == 'nt' and platform_machine != 'aarch64' and sys_platform == 'linux') or (os_name == 'nt' and sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "pyzmq" }, + { name = "send2trash" }, + { name = "terminado" }, + { name = "tornado" }, + { name = "traitlets" }, + { name = "websocket-client" }, ] sdist = { url = "https://files.pythonhosted.org/packages/41/c8/ba2bbcd758c47f1124c4ca14061e8ce60d9c6fd537faee9534a95f83521a/jupyter_server-2.16.0.tar.gz", hash = "sha256:65d4b44fdf2dcbbdfe0aa1ace4a842d4aaf746a2b7b168134d5aaed35621b7f6", size = 728177, upload-time = "2025-05-12T16:44:46.245Z" } wheels = [ @@ -2172,8 +1348,7 @@ name = "jupyter-server-terminals" version = "0.5.3" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "pywinpty", version = "2.0.14", source = { registry = "https://pypi.org/simple" }, marker = "(python_full_version < '3.9' and os_name == 'nt' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and os_name == 'nt' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and os_name == 'nt' and sys_platform != 'darwin' and sys_platform != 'linux')" }, - { name = "pywinpty", version = "2.0.15", source = { registry = "https://pypi.org/simple" }, marker = "(python_full_version == '3.9.*' and os_name == 'nt' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version >= '3.9' and os_name == 'nt' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.9' and os_name == 'nt' and sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "pywinpty", marker = "(python_full_version < '3.10' and os_name == 'nt' and platform_machine != 'arm64' and sys_platform == 'darwin') or (os_name == 'nt' and platform_machine != 'aarch64' and sys_platform == 'linux') or (os_name == 'nt' and sys_platform != 'darwin' and sys_platform != 'linux')" }, { name = "terminado" }, ] sdist = { url = "https://files.pythonhosted.org/packages/fc/d5/562469734f476159e99a55426d697cbf8e7eb5efe89fb0e0b4f83a3d3459/jupyter_server_terminals-0.5.3.tar.gz", hash = "sha256:5ae0295167220e9ace0edcfdb212afd2b01ee8d179fe6f23c899590e9b8a5269", size = 31430, upload-time = "2024-03-12T14:37:03.049Z" } @@ -2181,72 +1356,26 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/07/2d/2b32cdbe8d2a602f697a649798554e4f072115438e92249624e532e8aca6/jupyter_server_terminals-0.5.3-py3-none-any.whl", hash = "sha256:41ee0d7dc0ebf2809c668e0fc726dfaf258fcd3e769568996ca731b6194ae9aa", size = 13656, upload-time = "2024-03-12T14:37:00.708Z" }, ] -[[package]] -name = "jupyterlab" -version = "4.3.8" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "async-lru", version = "2.0.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "httpx", marker = "python_full_version < '3.9'" }, - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-resources", version = "6.4.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "ipykernel", marker = "python_full_version < '3.9'" }, - { name = "jinja2", marker = "python_full_version < '3.9'" }, - { name = "jupyter-core", marker = "python_full_version < '3.9'" }, - { name = "jupyter-lsp", marker = "python_full_version < '3.9'" }, - { name = "jupyter-server", version = "2.14.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jupyterlab-server", marker = "python_full_version < '3.9'" }, - { name = "notebook-shim", marker = "python_full_version < '3.9'" }, - { name = "packaging", marker = "python_full_version < '3.9'" }, - { name = "setuptools", version = "75.3.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "tomli", marker = "python_full_version < '3.9'" }, - { name = "tornado", version = "6.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "traitlets", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/c1/8e/9d3d91a0492be047167850419e43ba72e7950145ba2ff60824366bcae50f/jupyterlab-4.3.8.tar.gz", hash = "sha256:2ffd0e7b82786dba54743f4d1646130642ed81cb9e52f0a31e79416f6e5ba2e7", size = 21826824, upload-time = "2025-06-24T16:49:34.005Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e6/15/ef346ab227f161cba2dcffe3ffeb8b4e4d2630600408f8276945d49fc868/jupyterlab-4.3.8-py3-none-any.whl", hash = "sha256:8c6451ef224a18b457975fd52010e45a7aef58b719dfb242c5f253e0e48ea047", size = 11682103, upload-time = "2025-06-24T16:49:28.459Z" }, -] - [[package]] name = "jupyterlab" version = "4.4.4" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "async-lru", version = "2.0.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "httpx", marker = "python_full_version >= '3.9'" }, - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, - { name = "ipykernel", marker = "python_full_version >= '3.9'" }, - { name = "jinja2", marker = "python_full_version >= '3.9'" }, - { name = "jupyter-core", marker = "python_full_version >= '3.9'" }, - { name = "jupyter-lsp", marker = "python_full_version >= '3.9'" }, - { name = "jupyter-server", version = "2.16.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "jupyterlab-server", marker = "python_full_version >= '3.9'" }, - { name = "notebook-shim", marker = "python_full_version >= '3.9'" }, - { name = "packaging", marker = "python_full_version >= '3.9'" }, - { name = "setuptools", version = "80.9.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "tomli", marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, - { name = "tornado", version = "6.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "traitlets", marker = "python_full_version >= '3.9'" }, + { name = "async-lru" }, + { name = "httpx" }, + { name = "importlib-metadata", marker = "python_full_version < '3.10'" }, + { name = "ipykernel" }, + { name = "jinja2" }, + { name = "jupyter-core" }, + { name = "jupyter-lsp" }, + { name = "jupyter-server" }, + { name = "jupyterlab-server" }, + { name = "notebook-shim" }, + { name = "packaging" }, + { name = "setuptools" }, + { name = "tomli", marker = "python_full_version < '3.11'" }, + { name = "tornado" }, + { name = "traitlets" }, ] sdist = { url = "https://files.pythonhosted.org/packages/e2/4d/7ca5b46ea56742880d71a768a9e6fb8f8482228427eb89492d55c5d0bb7d/jupyterlab-4.4.4.tar.gz", hash = "sha256:163fee1ef702e0a057f75d2eed3ed1da8a986d59eb002cbeb6f0c2779e6cd153", size = 23044296, upload-time = "2025-06-28T13:07:20.708Z" } wheels = [ @@ -2268,14 +1397,11 @@ version = "2.27.3" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "babel" }, - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "importlib-metadata", marker = "python_full_version < '3.10'" }, { name = "jinja2" }, { name = "json5" }, - { name = "jsonschema", version = "4.23.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jsonschema", version = "4.24.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "jupyter-server", version = "2.14.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jupyter-server", version = "2.16.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "jsonschema" }, + { name = "jupyter-server" }, { name = "packaging" }, { name = "requests" }, ] @@ -2293,109 +1419,35 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/43/6a/ca128561b22b60bd5a0c4ea26649e68c8556b82bc70a0c396eebc977fe86/jupyterlab_widgets-3.0.15-py3-none-any.whl", hash = "sha256:d59023d7d7ef71400d51e6fee9a88867f6e65e10a4201605d2d7f3e8f012a31c", size = 216571, upload-time = "2025-05-05T12:32:29.534Z" }, ] -[[package]] -name = "jupytext" -version = "1.17.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "markdown-it-py", marker = "python_full_version < '3.9'" }, - { name = "mdit-py-plugins", marker = "python_full_version < '3.9'" }, - { name = "nbformat", marker = "python_full_version < '3.9'" }, - { name = "packaging", marker = "python_full_version < '3.9'" }, - { name = "pyyaml", marker = "python_full_version < '3.9'" }, - { name = "tomli", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/6e/d9/b7acd3bed66c194cec1915c5bbec30994dbb50693ec209e5b115c28ddf63/jupytext-1.17.1.tar.gz", hash = "sha256:c02fda8af76ffd6e064a04cf2d3cc8aae242b2f0e38c42b4cd80baf89c3325d3", size = 3746897, upload-time = "2025-04-26T21:16:11.453Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/12/b7/e7e3d34c8095c19228874b1babedfb5d901374e40d51ae66f2a90203be53/jupytext-1.17.1-py3-none-any.whl", hash = "sha256:99145b1e1fa96520c21ba157de7d354ffa4904724dcebdcd70b8413688a312de", size = 164286, upload-time = "2025-04-26T21:16:09.636Z" }, -] - [[package]] name = "jupytext" version = "1.17.2" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "markdown-it-py", marker = "python_full_version >= '3.9'" }, - { name = "mdit-py-plugins", marker = "python_full_version >= '3.9'" }, - { name = "nbformat", marker = "python_full_version >= '3.9'" }, - { name = "packaging", marker = "python_full_version >= '3.9'" }, - { name = "pyyaml", marker = "python_full_version >= '3.9'" }, - { name = "tomli", marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, + { name = "markdown-it-py" }, + { name = "mdit-py-plugins" }, + { name = "nbformat" }, + { name = "packaging" }, + { name = "pyyaml" }, + { name = "tomli", marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/30/ce/0bd5290ca4978777154e2683413dca761781aacf57f7dc0146f5210df8b1/jupytext-1.17.2.tar.gz", hash = "sha256:772d92898ac1f2ded69106f897b34af48ce4a85c985fa043a378ff5a65455f02", size = 3748577, upload-time = "2025-06-01T21:31:48.231Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/ed/f1/82ea8e783433707cafd9790099a2d19f113c22f32a31c8bb5abdc7a61dbb/jupytext-1.17.2-py3-none-any.whl", hash = "sha256:4f85dc43bb6a24b75491c5c434001ad5ef563932f68f15dd3e1c8ce12a4a426b", size = 164401, upload-time = "2025-06-01T21:31:46.319Z" }, ] -[[package]] -name = "keyring" -version = "25.5.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-resources", version = "6.4.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jaraco-classes", marker = "python_full_version < '3.9'" }, - { name = "jaraco-context", marker = "python_full_version < '3.9'" }, - { name = "jaraco-functools", version = "4.1.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jeepney", marker = "python_full_version < '3.9' and sys_platform == 'linux'" }, - { name = "pywin32-ctypes", marker = "python_full_version < '3.9' and sys_platform == 'win32'" }, - { name = "secretstorage", marker = "python_full_version < '3.9' and sys_platform == 'linux'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/f6/24/64447b13df6a0e2797b586dad715766d756c932ce8ace7f67bd384d76ae0/keyring-25.5.0.tar.gz", hash = "sha256:4c753b3ec91717fe713c4edd522d625889d8973a349b0e582622f49766de58e6", size = 62675, upload-time = "2024-10-26T15:40:12.344Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/32/c9/353c156fa2f057e669106e5d6bcdecf85ef8d3536ce68ca96f18dc7b6d6f/keyring-25.5.0-py3-none-any.whl", hash = "sha256:e67f8ac32b04be4714b42fe84ce7dad9c40985b9ca827c592cc303e7c26d9741", size = 39096, upload-time = "2024-10-26T15:40:10.296Z" }, -] - [[package]] name = "keyring" version = "25.6.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9' and python_full_version < '3.12'" }, - { name = "jaraco-classes", marker = "python_full_version >= '3.9'" }, - { name = "jaraco-context", marker = "python_full_version >= '3.9'" }, - { name = "jaraco-functools", version = "4.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "jeepney", marker = "python_full_version >= '3.9' and sys_platform == 'linux'" }, - { name = "pywin32-ctypes", marker = "python_full_version >= '3.9' and sys_platform == 'win32'" }, - { name = "secretstorage", marker = "python_full_version >= '3.9' and sys_platform == 'linux'" }, + { name = "importlib-metadata", marker = "python_full_version < '3.12'" }, + { name = "jaraco-classes" }, + { name = "jaraco-context" }, + { name = "jaraco-functools" }, + { name = "jeepney", marker = "sys_platform == 'linux'" }, + { name = "pywin32-ctypes", marker = "sys_platform == 'win32'" }, + { name = "secretstorage", marker = "sys_platform == 'linux'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/70/09/d904a6e96f76ff214be59e7aa6ef7190008f52a0ab6689760a98de0bf37d/keyring-25.6.0.tar.gz", hash = "sha256:0b39998aa941431eb3d9b0d4b2460bc773b9df6fed7621c2dfb291a7e0187a66", size = 62750, upload-time = "2024-12-25T15:26:45.782Z" } wheels = [ @@ -2407,12 +1459,9 @@ name = "kiwisolver" version = "1.4.7" source = { registry = "https://pypi.org/simple" } resolution-markers = [ - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", + "python_full_version < '3.10' and platform_machine == 'arm64' and sys_platform == 'darwin'", + "python_full_version < '3.10' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version < '3.10' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.10' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.10' and sys_platform != 'darwin' and sys_platform != 'linux')", ] sdist = { url = "https://files.pythonhosted.org/packages/85/4d/2255e1c76304cbd60b48cee302b66d1dde4468dc5b1160e4b7cb43778f2a/kiwisolver-1.4.7.tar.gz", hash = "sha256:9893ff81bd7107f7b685d3017cc6583daadb4fc26e4a888350df530e41980a60", size = 97286, upload-time = "2024-09-04T09:39:44.302Z" } wheels = [ @@ -2480,21 +1529,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/a8/b2/15f7f556df0a6e5b3772a1e076a9d9f6c538ce5f05bd590eca8106508e06/kiwisolver-1.4.7-cp313-cp313-win32.whl", hash = "sha256:f4c9aee212bc89d4e13f58be11a56cc8036cabad119259d12ace14b34476fd07", size = 46364, upload-time = "2024-09-04T09:05:27.184Z" }, { url = "https://files.pythonhosted.org/packages/0b/db/32e897e43a330eee8e4770bfd2737a9584b23e33587a0812b8e20aac38f7/kiwisolver-1.4.7-cp313-cp313-win_amd64.whl", hash = "sha256:8a3ec5aa8e38fc4c8af308917ce12c536f1c88452ce554027e55b22cbbfbff76", size = 55887, upload-time = "2024-09-04T09:05:28.372Z" }, { url = "https://files.pythonhosted.org/packages/c8/a4/df2bdca5270ca85fd25253049eb6708d4127be2ed0e5c2650217450b59e9/kiwisolver-1.4.7-cp313-cp313-win_arm64.whl", hash = "sha256:76c8094ac20ec259471ac53e774623eb62e6e1f56cd8690c67ce6ce4fcb05650", size = 48530, upload-time = "2024-09-04T09:05:30.225Z" }, - { url = "https://files.pythonhosted.org/packages/57/d6/620247574d9e26fe24384087879e8399e309f0051782f95238090afa6ccc/kiwisolver-1.4.7-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:5d5abf8f8ec1f4e22882273c423e16cae834c36856cac348cfbfa68e01c40f3a", size = 122325, upload-time = "2024-09-04T09:05:31.648Z" }, - { url = "https://files.pythonhosted.org/packages/bd/c6/572ad7d73dbd898cffa9050ffd7ff7e78a055a1d9b7accd6b4d1f50ec858/kiwisolver-1.4.7-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:aeb3531b196ef6f11776c21674dba836aeea9d5bd1cf630f869e3d90b16cfade", size = 65679, upload-time = "2024-09-04T09:05:32.934Z" }, - { url = "https://files.pythonhosted.org/packages/14/a7/bb8ab10e12cc8764f4da0245d72dee4731cc720bdec0f085d5e9c6005b98/kiwisolver-1.4.7-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b7d755065e4e866a8086c9bdada157133ff466476a2ad7861828e17b6026e22c", size = 64267, upload-time = "2024-09-04T09:05:34.11Z" }, - { url = "https://files.pythonhosted.org/packages/54/a4/3b5a2542429e182a4df0528214e76803f79d016110f5e67c414a0357cd7d/kiwisolver-1.4.7-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:08471d4d86cbaec61f86b217dd938a83d85e03785f51121e791a6e6689a3be95", size = 1387236, upload-time = "2024-09-04T09:05:35.97Z" }, - { url = "https://files.pythonhosted.org/packages/a6/d7/bc3005e906c1673953a3e31ee4f828157d5e07a62778d835dd937d624ea0/kiwisolver-1.4.7-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7bbfcb7165ce3d54a3dfbe731e470f65739c4c1f85bb1018ee912bae139e263b", size = 1500555, upload-time = "2024-09-04T09:05:37.552Z" }, - { url = "https://files.pythonhosted.org/packages/09/a7/87cb30741f13b7af08446795dca6003491755805edc9c321fe996c1320b8/kiwisolver-1.4.7-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5d34eb8494bea691a1a450141ebb5385e4b69d38bb8403b5146ad279f4b30fa3", size = 1431684, upload-time = "2024-09-04T09:05:39.75Z" }, - { url = "https://files.pythonhosted.org/packages/37/a4/1e4e2d8cdaa42c73d523413498445247e615334e39401ae49dae74885429/kiwisolver-1.4.7-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9242795d174daa40105c1d86aba618e8eab7bf96ba8c3ee614da8302a9f95503", size = 1125811, upload-time = "2024-09-04T09:05:41.31Z" }, - { url = "https://files.pythonhosted.org/packages/76/36/ae40d7a3171e06f55ac77fe5536079e7be1d8be2a8210e08975c7f9b4d54/kiwisolver-1.4.7-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:a0f64a48bb81af7450e641e3fe0b0394d7381e342805479178b3d335d60ca7cf", size = 1179987, upload-time = "2024-09-04T09:05:42.893Z" }, - { url = "https://files.pythonhosted.org/packages/d8/5d/6e4894b9fdf836d8bd095729dff123bbbe6ad0346289287b45c800fae656/kiwisolver-1.4.7-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:8e045731a5416357638d1700927529e2b8ab304811671f665b225f8bf8d8f933", size = 2186817, upload-time = "2024-09-04T09:05:44.474Z" }, - { url = "https://files.pythonhosted.org/packages/f0/2d/603079b2c2fd62890be0b0ebfc8bb6dda8a5253ca0758885596565b0dfc1/kiwisolver-1.4.7-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:4322872d5772cae7369f8351da1edf255a604ea7087fe295411397d0cfd9655e", size = 2332538, upload-time = "2024-09-04T09:05:46.206Z" }, - { url = "https://files.pythonhosted.org/packages/bb/2a/9a28279c865c38a27960db38b07179143aafc94877945c209bfc553d9dd3/kiwisolver-1.4.7-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:e1631290ee9271dffe3062d2634c3ecac02c83890ada077d225e081aca8aab89", size = 2293890, upload-time = "2024-09-04T09:05:47.819Z" }, - { url = "https://files.pythonhosted.org/packages/1a/4d/4da8967f3bf13c764984b8fbae330683ee5fbd555b4a5624ad2b9decc0ab/kiwisolver-1.4.7-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:edcfc407e4eb17e037bca59be0e85a2031a2ac87e4fed26d3e9df88b4165f92d", size = 2434677, upload-time = "2024-09-04T09:05:49.459Z" }, - { url = "https://files.pythonhosted.org/packages/08/e9/a97a2b6b74dd850fa5974309367e025c06093a143befe9b962d0baebb4f0/kiwisolver-1.4.7-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:4d05d81ecb47d11e7f8932bd8b61b720bf0b41199358f3f5e36d38e28f0532c5", size = 2250339, upload-time = "2024-09-04T09:05:51.165Z" }, - { url = "https://files.pythonhosted.org/packages/8a/e7/55507a387ba1766e69f5e13a79e1aefabdafe0532bee5d1972dfc42b3d16/kiwisolver-1.4.7-cp38-cp38-win32.whl", hash = "sha256:b38ac83d5f04b15e515fd86f312479d950d05ce2368d5413d46c088dda7de90a", size = 46932, upload-time = "2024-09-04T09:05:52.49Z" }, - { url = "https://files.pythonhosted.org/packages/52/77/7e04cca2ff1dc6ee6b7654cebe233de72b7a3ec5616501b6f3144fb70740/kiwisolver-1.4.7-cp38-cp38-win_amd64.whl", hash = "sha256:d83db7cde68459fc803052a55ace60bea2bae361fc3b7a6d5da07e11954e4b09", size = 55836, upload-time = "2024-09-04T09:05:54.078Z" }, { url = "https://files.pythonhosted.org/packages/11/88/37ea0ea64512997b13d69772db8dcdc3bfca5442cda3a5e4bb943652ee3e/kiwisolver-1.4.7-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:3f9362ecfca44c863569d3d3c033dbe8ba452ff8eed6f6b5806382741a1334bd", size = 122449, upload-time = "2024-09-04T09:05:55.311Z" }, { url = "https://files.pythonhosted.org/packages/4e/45/5a5c46078362cb3882dcacad687c503089263c017ca1241e0483857791eb/kiwisolver-1.4.7-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:e8df2eb9b2bac43ef8b082e06f750350fbbaf2887534a5be97f6cf07b19d9583", size = 65757, upload-time = "2024-09-04T09:05:56.906Z" }, { url = "https://files.pythonhosted.org/packages/8a/be/a6ae58978772f685d48dd2e84460937761c53c4bbd84e42b0336473d9775/kiwisolver-1.4.7-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:f32d6edbc638cde7652bd690c3e728b25332acbadd7cad670cc4a02558d9c417", size = 64312, upload-time = "2024-09-04T09:05:58.384Z" }, @@ -2517,12 +1551,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/81/e1/c64f50987f85b68b1c52b464bb5bf73e71570c0f7782d626d1eb283ad620/kiwisolver-1.4.7-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a91b5f9f1205845d488c928e8570dcb62b893372f63b8b6e98b863ebd2368ff2", size = 80906, upload-time = "2024-09-04T09:06:28.48Z" }, { url = "https://files.pythonhosted.org/packages/fd/71/1687c5c0a0be2cee39a5c9c389e546f9c6e215e46b691d00d9f646892083/kiwisolver-1.4.7-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40fa14dbd66b8b8f470d5fc79c089a66185619d31645f9b0773b88b19f7223c4", size = 79951, upload-time = "2024-09-04T09:06:29.966Z" }, { url = "https://files.pythonhosted.org/packages/ea/8b/d7497df4a1cae9367adf21665dd1f896c2a7aeb8769ad77b662c5e2bcce7/kiwisolver-1.4.7-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:eb542fe7933aa09d8d8f9d9097ef37532a7df6497819d16efe4359890a2f417a", size = 55715, upload-time = "2024-09-04T09:06:31.489Z" }, - { url = "https://files.pythonhosted.org/packages/64/f3/2403d90821fffe496df16f6996cb328b90b0d80c06d2938a930a7732b4f1/kiwisolver-1.4.7-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:bfa1acfa0c54932d5607e19a2c24646fb4c1ae2694437789129cf099789a3b00", size = 59662, upload-time = "2024-09-04T09:06:33.551Z" }, - { url = "https://files.pythonhosted.org/packages/fa/7d/8f409736a4a6ac04354fa530ebf46682ddb1539b0bae15f4731ff2c575bc/kiwisolver-1.4.7-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:eee3ea935c3d227d49b4eb85660ff631556841f6e567f0f7bda972df6c2c9935", size = 57753, upload-time = "2024-09-04T09:06:35.095Z" }, - { url = "https://files.pythonhosted.org/packages/4c/a5/3937c9abe8eedb1356071739ad437a0b486cbad27d54f4ec4733d24882ac/kiwisolver-1.4.7-pp38-pypy38_pp73-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:f3160309af4396e0ed04db259c3ccbfdc3621b5559b5453075e5de555e1f3a1b", size = 103564, upload-time = "2024-09-04T09:06:36.756Z" }, - { url = "https://files.pythonhosted.org/packages/b2/18/a5ae23888f010b90d5eb8d196fed30e268056b2ded54d25b38a193bb70e9/kiwisolver-1.4.7-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:a17f6a29cf8935e587cc8a4dbfc8368c55edc645283db0ce9801016f83526c2d", size = 95264, upload-time = "2024-09-04T09:06:38.786Z" }, - { url = "https://files.pythonhosted.org/packages/f9/d0/c4240ae86306d4395e9701f1d7e6ddcc6d60c28cb0127139176cfcfc9ebe/kiwisolver-1.4.7-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:10849fb2c1ecbfae45a693c070e0320a91b35dd4bcf58172c023b994283a124d", size = 78197, upload-time = "2024-09-04T09:06:40.453Z" }, - { url = "https://files.pythonhosted.org/packages/62/db/62423f0ab66813376a35c1e7da488ebdb4e808fcb54b7cec33959717bda1/kiwisolver-1.4.7-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:ac542bf38a8a4be2dc6b15248d36315ccc65f0743f7b1a76688ffb6b5129a5c2", size = 56080, upload-time = "2024-09-04T09:06:42.061Z" }, { url = "https://files.pythonhosted.org/packages/d5/df/ce37d9b26f07ab90880923c94d12a6ff4d27447096b4c849bfc4339ccfdf/kiwisolver-1.4.7-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:8b01aac285f91ca889c800042c35ad3b239e704b150cfd3382adfc9dcc780e39", size = 58666, upload-time = "2024-09-04T09:06:43.756Z" }, { url = "https://files.pythonhosted.org/packages/b0/d3/e4b04f43bc629ac8e186b77b2b1a251cdfa5b7610fa189dc0db622672ce6/kiwisolver-1.4.7-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:48be928f59a1f5c8207154f935334d374e79f2b5d212826307d072595ad76a2e", size = 57088, upload-time = "2024-09-04T09:06:45.406Z" }, { url = "https://files.pythonhosted.org/packages/30/1c/752df58e2d339e670a535514d2db4fe8c842ce459776b8080fbe08ebb98e/kiwisolver-1.4.7-pp39-pypy39_pp73-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f37cfe618a117e50d8c240555331160d73d0411422b59b5ee217843d7b693608", size = 84321, upload-time = "2024-09-04T09:06:47.557Z" }, @@ -2629,43 +1657,12 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/3a/1d/50ad811d1c5dae091e4cf046beba925bcae0a610e79ae4c538f996f63ed5/kiwisolver-1.4.8-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:65ea09a5a3faadd59c2ce96dc7bf0f364986a315949dc6374f04396b0d60e09b", size = 71762, upload-time = "2024-12-24T18:30:48.903Z" }, ] -[[package]] -name = "markdown" -version = "3.7" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/54/28/3af612670f82f4c056911fbbbb42760255801b3068c48de792d354ff4472/markdown-3.7.tar.gz", hash = "sha256:2ae2471477cfd02dbbf038d5d9bc226d40def84b4fe2986e49b59b6b472bbed2", size = 357086, upload-time = "2024-08-16T15:55:17.812Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/3f/08/83871f3c50fc983b88547c196d11cf8c3340e37c32d2e9d6152abe2c61f7/Markdown-3.7-py3-none-any.whl", hash = "sha256:7eb6df5690b81a1d7942992c97fad2938e956e79df20cbc6186e9c3a77b1c803", size = 106349, upload-time = "2024-08-16T15:55:16.176Z" }, -] - [[package]] name = "markdown" version = "3.8.2" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "importlib-metadata", marker = "python_full_version < '3.10'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/d7/c2/4ab49206c17f75cb08d6311171f2d65798988db4360c4d1485bd0eedd67c/markdown-3.8.2.tar.gz", hash = "sha256:247b9a70dd12e27f67431ce62523e675b866d254f900c4fe75ce3dda62237c45", size = 362071, upload-time = "2025-06-19T17:12:44.483Z" } wheels = [ @@ -2684,87 +1681,10 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/42/d7/1ec15b46af6af88f19b8e5ffea08fa375d433c998b8a7639e76935c14f1f/markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1", size = 87528, upload-time = "2023-06-03T06:41:11.019Z" }, ] -[[package]] -name = "markupsafe" -version = "2.1.5" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/87/5b/aae44c6655f3801e81aa3eef09dbbf012431987ba564d7231722f68df02d/MarkupSafe-2.1.5.tar.gz", hash = "sha256:d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b", size = 19384, upload-time = "2024-02-02T16:31:22.863Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e4/54/ad5eb37bf9d51800010a74e4665425831a9db4e7c4e0fde4352e391e808e/MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a17a92de5231666cfbe003f0e4b9b3a7ae3afb1ec2845aadc2bacc93ff85febc", size = 18206, upload-time = "2024-02-02T16:30:04.105Z" }, - { url = "https://files.pythonhosted.org/packages/6a/4a/a4d49415e600bacae038c67f9fecc1d5433b9d3c71a4de6f33537b89654c/MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:72b6be590cc35924b02c78ef34b467da4ba07e4e0f0454a2c5907f473fc50ce5", size = 14079, upload-time = "2024-02-02T16:30:06.5Z" }, - { url = "https://files.pythonhosted.org/packages/0a/7b/85681ae3c33c385b10ac0f8dd025c30af83c78cec1c37a6aa3b55e67f5ec/MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e61659ba32cf2cf1481e575d0462554625196a1f2fc06a1c777d3f48e8865d46", size = 26620, upload-time = "2024-02-02T16:30:08.31Z" }, - { url = "https://files.pythonhosted.org/packages/7c/52/2b1b570f6b8b803cef5ac28fdf78c0da318916c7d2fe9402a84d591b394c/MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2174c595a0d73a3080ca3257b40096db99799265e1c27cc5a610743acd86d62f", size = 25818, upload-time = "2024-02-02T16:30:09.577Z" }, - { url = "https://files.pythonhosted.org/packages/29/fe/a36ba8c7ca55621620b2d7c585313efd10729e63ef81e4e61f52330da781/MarkupSafe-2.1.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae2ad8ae6ebee9d2d94b17fb62763125f3f374c25618198f40cbb8b525411900", size = 25493, upload-time = "2024-02-02T16:30:11.488Z" }, - { url = "https://files.pythonhosted.org/packages/60/ae/9c60231cdfda003434e8bd27282b1f4e197ad5a710c14bee8bea8a9ca4f0/MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:075202fa5b72c86ad32dc7d0b56024ebdbcf2048c0ba09f1cde31bfdd57bcfff", size = 30630, upload-time = "2024-02-02T16:30:13.144Z" }, - { url = "https://files.pythonhosted.org/packages/65/dc/1510be4d179869f5dafe071aecb3f1f41b45d37c02329dfba01ff59e5ac5/MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:598e3276b64aff0e7b3451b72e94fa3c238d452e7ddcd893c3ab324717456bad", size = 29745, upload-time = "2024-02-02T16:30:14.222Z" }, - { url = "https://files.pythonhosted.org/packages/30/39/8d845dd7d0b0613d86e0ef89549bfb5f61ed781f59af45fc96496e897f3a/MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fce659a462a1be54d2ffcacea5e3ba2d74daa74f30f5f143fe0c58636e355fdd", size = 30021, upload-time = "2024-02-02T16:30:16.032Z" }, - { url = "https://files.pythonhosted.org/packages/c7/5c/356a6f62e4f3c5fbf2602b4771376af22a3b16efa74eb8716fb4e328e01e/MarkupSafe-2.1.5-cp310-cp310-win32.whl", hash = "sha256:d9fad5155d72433c921b782e58892377c44bd6252b5af2f67f16b194987338a4", size = 16659, upload-time = "2024-02-02T16:30:17.079Z" }, - { url = "https://files.pythonhosted.org/packages/69/48/acbf292615c65f0604a0c6fc402ce6d8c991276e16c80c46a8f758fbd30c/MarkupSafe-2.1.5-cp310-cp310-win_amd64.whl", hash = "sha256:bf50cd79a75d181c9181df03572cdce0fbb75cc353bc350712073108cba98de5", size = 17213, upload-time = "2024-02-02T16:30:18.251Z" }, - { url = "https://files.pythonhosted.org/packages/11/e7/291e55127bb2ae67c64d66cef01432b5933859dfb7d6949daa721b89d0b3/MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:629ddd2ca402ae6dbedfceeba9c46d5f7b2a61d9749597d4307f943ef198fc1f", size = 18219, upload-time = "2024-02-02T16:30:19.988Z" }, - { url = "https://files.pythonhosted.org/packages/6b/cb/aed7a284c00dfa7c0682d14df85ad4955a350a21d2e3b06d8240497359bf/MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5b7b716f97b52c5a14bffdf688f971b2d5ef4029127f1ad7a513973cfd818df2", size = 14098, upload-time = "2024-02-02T16:30:21.063Z" }, - { url = "https://files.pythonhosted.org/packages/1c/cf/35fe557e53709e93feb65575c93927942087e9b97213eabc3fe9d5b25a55/MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6ec585f69cec0aa07d945b20805be741395e28ac1627333b1c5b0105962ffced", size = 29014, upload-time = "2024-02-02T16:30:22.926Z" }, - { url = "https://files.pythonhosted.org/packages/97/18/c30da5e7a0e7f4603abfc6780574131221d9148f323752c2755d48abad30/MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b91c037585eba9095565a3556f611e3cbfaa42ca1e865f7b8015fe5c7336d5a5", size = 28220, upload-time = "2024-02-02T16:30:24.76Z" }, - { url = "https://files.pythonhosted.org/packages/0c/40/2e73e7d532d030b1e41180807a80d564eda53babaf04d65e15c1cf897e40/MarkupSafe-2.1.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7502934a33b54030eaf1194c21c692a534196063db72176b0c4028e140f8f32c", size = 27756, upload-time = "2024-02-02T16:30:25.877Z" }, - { url = "https://files.pythonhosted.org/packages/18/46/5dca760547e8c59c5311b332f70605d24c99d1303dd9a6e1fc3ed0d73561/MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:0e397ac966fdf721b2c528cf028494e86172b4feba51d65f81ffd65c63798f3f", size = 33988, upload-time = "2024-02-02T16:30:26.935Z" }, - { url = "https://files.pythonhosted.org/packages/6d/c5/27febe918ac36397919cd4a67d5579cbbfa8da027fa1238af6285bb368ea/MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:c061bb86a71b42465156a3ee7bd58c8c2ceacdbeb95d05a99893e08b8467359a", size = 32718, upload-time = "2024-02-02T16:30:28.111Z" }, - { url = "https://files.pythonhosted.org/packages/f8/81/56e567126a2c2bc2684d6391332e357589a96a76cb9f8e5052d85cb0ead8/MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3a57fdd7ce31c7ff06cdfbf31dafa96cc533c21e443d57f5b1ecc6cdc668ec7f", size = 33317, upload-time = "2024-02-02T16:30:29.214Z" }, - { url = "https://files.pythonhosted.org/packages/00/0b/23f4b2470accb53285c613a3ab9ec19dc944eaf53592cb6d9e2af8aa24cc/MarkupSafe-2.1.5-cp311-cp311-win32.whl", hash = "sha256:397081c1a0bfb5124355710fe79478cdbeb39626492b15d399526ae53422b906", size = 16670, upload-time = "2024-02-02T16:30:30.915Z" }, - { url = "https://files.pythonhosted.org/packages/b7/a2/c78a06a9ec6d04b3445a949615c4c7ed86a0b2eb68e44e7541b9d57067cc/MarkupSafe-2.1.5-cp311-cp311-win_amd64.whl", hash = "sha256:2b7c57a4dfc4f16f7142221afe5ba4e093e09e728ca65c51f5620c9aaeb9a617", size = 17224, upload-time = "2024-02-02T16:30:32.09Z" }, - { url = "https://files.pythonhosted.org/packages/53/bd/583bf3e4c8d6a321938c13f49d44024dbe5ed63e0a7ba127e454a66da974/MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:8dec4936e9c3100156f8a2dc89c4b88d5c435175ff03413b443469c7c8c5f4d1", size = 18215, upload-time = "2024-02-02T16:30:33.081Z" }, - { url = "https://files.pythonhosted.org/packages/48/d6/e7cd795fc710292c3af3a06d80868ce4b02bfbbf370b7cee11d282815a2a/MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:3c6b973f22eb18a789b1460b4b91bf04ae3f0c4234a0a6aa6b0a92f6f7b951d4", size = 14069, upload-time = "2024-02-02T16:30:34.148Z" }, - { url = "https://files.pythonhosted.org/packages/51/b5/5d8ec796e2a08fc814a2c7d2584b55f889a55cf17dd1a90f2beb70744e5c/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ac07bad82163452a6884fe8fa0963fb98c2346ba78d779ec06bd7a6262132aee", size = 29452, upload-time = "2024-02-02T16:30:35.149Z" }, - { url = "https://files.pythonhosted.org/packages/0a/0d/2454f072fae3b5a137c119abf15465d1771319dfe9e4acbb31722a0fff91/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5", size = 28462, upload-time = "2024-02-02T16:30:36.166Z" }, - { url = "https://files.pythonhosted.org/packages/2d/75/fd6cb2e68780f72d47e6671840ca517bda5ef663d30ada7616b0462ad1e3/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ea3d8a3d18833cf4304cd2fc9cbb1efe188ca9b5efef2bdac7adc20594a0e46b", size = 27869, upload-time = "2024-02-02T16:30:37.834Z" }, - { url = "https://files.pythonhosted.org/packages/b0/81/147c477391c2750e8fc7705829f7351cf1cd3be64406edcf900dc633feb2/MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:d050b3361367a06d752db6ead6e7edeb0009be66bc3bae0ee9d97fb326badc2a", size = 33906, upload-time = "2024-02-02T16:30:39.366Z" }, - { url = "https://files.pythonhosted.org/packages/8b/ff/9a52b71839d7a256b563e85d11050e307121000dcebc97df120176b3ad93/MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:bec0a414d016ac1a18862a519e54b2fd0fc8bbfd6890376898a6c0891dd82e9f", size = 32296, upload-time = "2024-02-02T16:30:40.413Z" }, - { url = "https://files.pythonhosted.org/packages/88/07/2dc76aa51b481eb96a4c3198894f38b480490e834479611a4053fbf08623/MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:58c98fee265677f63a4385256a6d7683ab1832f3ddd1e66fe948d5880c21a169", size = 33038, upload-time = "2024-02-02T16:30:42.243Z" }, - { url = "https://files.pythonhosted.org/packages/96/0c/620c1fb3661858c0e37eb3cbffd8c6f732a67cd97296f725789679801b31/MarkupSafe-2.1.5-cp312-cp312-win32.whl", hash = "sha256:8590b4ae07a35970728874632fed7bd57b26b0102df2d2b233b6d9d82f6c62ad", size = 16572, upload-time = "2024-02-02T16:30:43.326Z" }, - { url = "https://files.pythonhosted.org/packages/3f/14/c3554d512d5f9100a95e737502f4a2323a1959f6d0d01e0d0997b35f7b10/MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl", hash = "sha256:823b65d8706e32ad2df51ed89496147a42a2a6e01c13cfb6ffb8b1e92bc910bb", size = 17127, upload-time = "2024-02-02T16:30:44.418Z" }, - { url = "https://files.pythonhosted.org/packages/f8/ff/2c942a82c35a49df5de3a630ce0a8456ac2969691b230e530ac12314364c/MarkupSafe-2.1.5-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:656f7526c69fac7f600bd1f400991cc282b417d17539a1b228617081106feb4a", size = 18192, upload-time = "2024-02-02T16:30:57.715Z" }, - { url = "https://files.pythonhosted.org/packages/4f/14/6f294b9c4f969d0c801a4615e221c1e084722ea6114ab2114189c5b8cbe0/MarkupSafe-2.1.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:97cafb1f3cbcd3fd2b6fbfb99ae11cdb14deea0736fc2b0952ee177f2b813a46", size = 14072, upload-time = "2024-02-02T16:30:58.844Z" }, - { url = "https://files.pythonhosted.org/packages/81/d4/fd74714ed30a1dedd0b82427c02fa4deec64f173831ec716da11c51a50aa/MarkupSafe-2.1.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f3fbcb7ef1f16e48246f704ab79d79da8a46891e2da03f8783a5b6fa41a9532", size = 26928, upload-time = "2024-02-02T16:30:59.922Z" }, - { url = "https://files.pythonhosted.org/packages/c7/bd/50319665ce81bb10e90d1cf76f9e1aa269ea6f7fa30ab4521f14d122a3df/MarkupSafe-2.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fa9db3f79de01457b03d4f01b34cf91bc0048eb2c3846ff26f66687c2f6d16ab", size = 26106, upload-time = "2024-02-02T16:31:01.582Z" }, - { url = "https://files.pythonhosted.org/packages/4c/6f/f2b0f675635b05f6afd5ea03c094557bdb8622fa8e673387444fe8d8e787/MarkupSafe-2.1.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffee1f21e5ef0d712f9033568f8344d5da8cc2869dbd08d87c84656e6a2d2f68", size = 25781, upload-time = "2024-02-02T16:31:02.71Z" }, - { url = "https://files.pythonhosted.org/packages/51/e0/393467cf899b34a9d3678e78961c2c8cdf49fb902a959ba54ece01273fb1/MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:5dedb4db619ba5a2787a94d877bc8ffc0566f92a01c0ef214865e54ecc9ee5e0", size = 30518, upload-time = "2024-02-02T16:31:04.392Z" }, - { url = "https://files.pythonhosted.org/packages/f6/02/5437e2ad33047290dafced9df741d9efc3e716b75583bbd73a9984f1b6f7/MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:30b600cf0a7ac9234b2638fbc0fb6158ba5bdcdf46aeb631ead21248b9affbc4", size = 29669, upload-time = "2024-02-02T16:31:05.53Z" }, - { url = "https://files.pythonhosted.org/packages/0e/7d/968284145ffd9d726183ed6237c77938c021abacde4e073020f920e060b2/MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8dd717634f5a044f860435c1d8c16a270ddf0ef8588d4887037c5028b859b0c3", size = 29933, upload-time = "2024-02-02T16:31:06.636Z" }, - { url = "https://files.pythonhosted.org/packages/bf/f3/ecb00fc8ab02b7beae8699f34db9357ae49d9f21d4d3de6f305f34fa949e/MarkupSafe-2.1.5-cp38-cp38-win32.whl", hash = "sha256:daa4ee5a243f0f20d528d939d06670a298dd39b1ad5f8a72a4275124a7819eff", size = 16656, upload-time = "2024-02-02T16:31:07.767Z" }, - { url = "https://files.pythonhosted.org/packages/92/21/357205f03514a49b293e214ac39de01fadd0970a6e05e4bf1ddd0ffd0881/MarkupSafe-2.1.5-cp38-cp38-win_amd64.whl", hash = "sha256:619bc166c4f2de5caa5a633b8b7326fbe98e0ccbfacabd87268a2b15ff73a029", size = 17206, upload-time = "2024-02-02T16:31:08.843Z" }, - { url = "https://files.pythonhosted.org/packages/0f/31/780bb297db036ba7b7bbede5e1d7f1e14d704ad4beb3ce53fb495d22bc62/MarkupSafe-2.1.5-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7a68b554d356a91cce1236aa7682dc01df0edba8d043fd1ce607c49dd3c1edcf", size = 18193, upload-time = "2024-02-02T16:31:10.155Z" }, - { url = "https://files.pythonhosted.org/packages/6c/77/d77701bbef72892affe060cdacb7a2ed7fd68dae3b477a8642f15ad3b132/MarkupSafe-2.1.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:db0b55e0f3cc0be60c1f19efdde9a637c32740486004f20d1cff53c3c0ece4d2", size = 14073, upload-time = "2024-02-02T16:31:11.442Z" }, - { url = "https://files.pythonhosted.org/packages/d9/a7/1e558b4f78454c8a3a0199292d96159eb4d091f983bc35ef258314fe7269/MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e53af139f8579a6d5f7b76549125f0d94d7e630761a2111bc431fd820e163b8", size = 26486, upload-time = "2024-02-02T16:31:12.488Z" }, - { url = "https://files.pythonhosted.org/packages/5f/5a/360da85076688755ea0cceb92472923086993e86b5613bbae9fbc14136b0/MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:17b950fccb810b3293638215058e432159d2b71005c74371d784862b7e4683f3", size = 25685, upload-time = "2024-02-02T16:31:13.726Z" }, - { url = "https://files.pythonhosted.org/packages/6a/18/ae5a258e3401f9b8312f92b028c54d7026a97ec3ab20bfaddbdfa7d8cce8/MarkupSafe-2.1.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4c31f53cdae6ecfa91a77820e8b151dba54ab528ba65dfd235c80b086d68a465", size = 25338, upload-time = "2024-02-02T16:31:14.812Z" }, - { url = "https://files.pythonhosted.org/packages/0b/cc/48206bd61c5b9d0129f4d75243b156929b04c94c09041321456fd06a876d/MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:bff1b4290a66b490a2f4719358c0cdcd9bafb6b8f061e45c7a2460866bf50c2e", size = 30439, upload-time = "2024-02-02T16:31:15.946Z" }, - { url = "https://files.pythonhosted.org/packages/d1/06/a41c112ab9ffdeeb5f77bc3e331fdadf97fa65e52e44ba31880f4e7f983c/MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:bc1667f8b83f48511b94671e0e441401371dfd0f0a795c7daa4a3cd1dde55bea", size = 29531, upload-time = "2024-02-02T16:31:17.13Z" }, - { url = "https://files.pythonhosted.org/packages/02/8c/ab9a463301a50dab04d5472e998acbd4080597abc048166ded5c7aa768c8/MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5049256f536511ee3f7e1b3f87d1d1209d327e818e6ae1365e8653d7e3abb6a6", size = 29823, upload-time = "2024-02-02T16:31:18.247Z" }, - { url = "https://files.pythonhosted.org/packages/bc/29/9bc18da763496b055d8e98ce476c8e718dcfd78157e17f555ce6dd7d0895/MarkupSafe-2.1.5-cp39-cp39-win32.whl", hash = "sha256:00e046b6dd71aa03a41079792f8473dc494d564611a8f89bbbd7cb93295ebdcf", size = 16658, upload-time = "2024-02-02T16:31:19.583Z" }, - { url = "https://files.pythonhosted.org/packages/f6/f8/4da07de16f10551ca1f640c92b5f316f9394088b183c6a57183df6de5ae4/MarkupSafe-2.1.5-cp39-cp39-win_amd64.whl", hash = "sha256:fa173ec60341d6bb97a89f5ea19c85c5643c1e7dedebc22f5181eb73573142c5", size = 17211, upload-time = "2024-02-02T16:31:20.96Z" }, -] - [[package]] name = "markupsafe" version = "3.0.2" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/b2/97/5d42485e71dfc078108a86d6de8fa46db44a1a9295e89c5d6d4a06e23a62/markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0", size = 20537, upload-time = "2024-10-18T15:21:54.129Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/04/90/d08277ce111dd22f77149fd1a5d4653eeb3b3eaacbdfcbae5afb2600eebd/MarkupSafe-3.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8", size = 14357, upload-time = "2024-10-18T15:20:51.44Z" }, @@ -2829,97 +1749,26 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b3/73/085399401383ce949f727afec55ec3abd76648d04b9f22e1c0e99cb4bec3/MarkupSafe-3.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:6e296a513ca3d94054c2c881cc913116e90fd030ad1c656b3869762b754f5f8a", size = 15506, upload-time = "2024-10-18T15:21:52.974Z" }, ] -[[package]] -name = "matplotlib" -version = "3.7.5" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "contourpy", version = "1.1.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "cycler", marker = "python_full_version < '3.9'" }, - { name = "fonttools", version = "4.57.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-resources", version = "6.4.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "kiwisolver", version = "1.4.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "numpy", version = "1.24.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "packaging", marker = "python_full_version < '3.9'" }, - { name = "pillow", marker = "python_full_version < '3.9'" }, - { name = "pyparsing", version = "3.1.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "python-dateutil", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/b6/f0/3836719cc3982fbba3b840d18a59db1d0ee9ac7986f24e8c0a092851b67b/matplotlib-3.7.5.tar.gz", hash = "sha256:1e5c971558ebc811aa07f54c7b7c677d78aa518ef4c390e14673a09e0860184a", size = 38098611, upload-time = "2024-02-16T10:50:56.19Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/f5/b0/3808e86c41e5d97822d77e89d7f3cb0890725845c050d87ec53732a8b150/matplotlib-3.7.5-cp310-cp310-macosx_10_12_universal2.whl", hash = "sha256:4a87b69cb1cb20943010f63feb0b2901c17a3b435f75349fd9865713bfa63925", size = 8322924, upload-time = "2024-02-16T10:48:06.184Z" }, - { url = "https://files.pythonhosted.org/packages/5b/05/726623be56391ba1740331ad9f1cd30e1adec61c179ddac134957a6dc2e7/matplotlib-3.7.5-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:d3ce45010fefb028359accebb852ca0c21bd77ec0f281952831d235228f15810", size = 7438436, upload-time = "2024-02-16T10:48:10.294Z" }, - { url = "https://files.pythonhosted.org/packages/15/83/89cdef49ef1e320060ec951ba33c132df211561d866c3ed144c81fd110b2/matplotlib-3.7.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fbea1e762b28400393d71be1a02144aa16692a3c4c676ba0178ce83fc2928fdd", size = 7341849, upload-time = "2024-02-16T10:48:13.249Z" }, - { url = "https://files.pythonhosted.org/packages/94/29/39fc4acdc296dd86e09cecb65c14966e1cf18e0f091b9cbd9bd3f0c19ee4/matplotlib-3.7.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ec0e1adc0ad70ba8227e957551e25a9d2995e319c29f94a97575bb90fa1d4469", size = 11354141, upload-time = "2024-02-16T10:48:16.963Z" }, - { url = "https://files.pythonhosted.org/packages/54/36/44c5eeb0d83ae1e3ed34d264d7adee947c4fd56c4a9464ce822de094995a/matplotlib-3.7.5-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6738c89a635ced486c8a20e20111d33f6398a9cbebce1ced59c211e12cd61455", size = 11457668, upload-time = "2024-02-16T10:48:21.339Z" }, - { url = "https://files.pythonhosted.org/packages/b7/e2/f68aeaedf0ef57cbb793637ee82e62e64ea26cee908db0fe4f8e24d502c0/matplotlib-3.7.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1210b7919b4ed94b5573870f316bca26de3e3b07ffdb563e79327dc0e6bba515", size = 11580088, upload-time = "2024-02-16T10:48:25.415Z" }, - { url = "https://files.pythonhosted.org/packages/d9/f7/7c88d34afc38943aa5e4e04d27fc9da5289a48c264c0d794f60c9cda0949/matplotlib-3.7.5-cp310-cp310-win32.whl", hash = "sha256:068ebcc59c072781d9dcdb82f0d3f1458271c2de7ca9c78f5bd672141091e9e1", size = 7339332, upload-time = "2024-02-16T10:48:29.319Z" }, - { url = "https://files.pythonhosted.org/packages/91/99/e5f6f7c9438279581c4a2308d264fe24dc98bb80e3b2719f797227e54ddc/matplotlib-3.7.5-cp310-cp310-win_amd64.whl", hash = "sha256:f098ffbaab9df1e3ef04e5a5586a1e6b1791380698e84938d8640961c79b1fc0", size = 7506405, upload-time = "2024-02-16T10:48:32.499Z" }, - { url = "https://files.pythonhosted.org/packages/5e/c6/45d0485e59d70b7a6a81eade5d0aed548b42cc65658c0ce0f813b9249165/matplotlib-3.7.5-cp311-cp311-macosx_10_12_universal2.whl", hash = "sha256:f65342c147572673f02a4abec2d5a23ad9c3898167df9b47c149f32ce61ca078", size = 8325506, upload-time = "2024-02-16T10:48:36.192Z" }, - { url = "https://files.pythonhosted.org/packages/0e/0a/83bd8589f3597745f624fbcc7da1140088b2f4160ca51c71553c561d0df5/matplotlib-3.7.5-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:4ddf7fc0e0dc553891a117aa083039088d8a07686d4c93fb8a810adca68810af", size = 7439905, upload-time = "2024-02-16T10:48:38.951Z" }, - { url = "https://files.pythonhosted.org/packages/84/c1/a7705b24f8f9b4d7ceea0002c13bae50cf9423f299f56d8c47a5cd2627d2/matplotlib-3.7.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0ccb830fc29442360d91be48527809f23a5dcaee8da5f4d9b2d5b867c1b087b8", size = 7342895, upload-time = "2024-02-16T10:48:41.61Z" }, - { url = "https://files.pythonhosted.org/packages/94/6e/55d7d8310c96a7459c883aa4be3f5a9338a108278484cbd5c95d480d1cef/matplotlib-3.7.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:efc6bb28178e844d1f408dd4d6341ee8a2e906fc9e0fa3dae497da4e0cab775d", size = 11358830, upload-time = "2024-02-16T10:48:44.984Z" }, - { url = "https://files.pythonhosted.org/packages/55/57/3b36afe104216db1cf2f3889c394b403ea87eda77c4815227c9524462ba8/matplotlib-3.7.5-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3b15c4c2d374f249f324f46e883340d494c01768dd5287f8bc00b65b625ab56c", size = 11462575, upload-time = "2024-02-16T10:48:48.437Z" }, - { url = "https://files.pythonhosted.org/packages/f3/0b/fabcf5f66b12fab5c4110d06a6c0fed875c7e63bc446403f58f9dadc9999/matplotlib-3.7.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3d028555421912307845e59e3de328260b26d055c5dac9b182cc9783854e98fb", size = 11584280, upload-time = "2024-02-16T10:48:53.022Z" }, - { url = "https://files.pythonhosted.org/packages/47/a9/1ad7df27a9da70b62109584632f83fe6ef45774701199c44d5777107c240/matplotlib-3.7.5-cp311-cp311-win32.whl", hash = "sha256:fe184b4625b4052fa88ef350b815559dd90cc6cc8e97b62f966e1ca84074aafa", size = 7340429, upload-time = "2024-02-16T10:48:56.505Z" }, - { url = "https://files.pythonhosted.org/packages/e3/b1/1b6c34b89173d6c206dc5a4028e8518b4dfee3569c13bdc0c88d0486cae7/matplotlib-3.7.5-cp311-cp311-win_amd64.whl", hash = "sha256:084f1f0f2f1010868c6f1f50b4e1c6f2fb201c58475494f1e5b66fed66093647", size = 7507112, upload-time = "2024-02-16T10:48:59.659Z" }, - { url = "https://files.pythonhosted.org/packages/75/dc/4e341a3ef36f3e7321aec0741317f12c7a23264be708a97972bf018c34af/matplotlib-3.7.5-cp312-cp312-macosx_10_12_universal2.whl", hash = "sha256:34bceb9d8ddb142055ff27cd7135f539f2f01be2ce0bafbace4117abe58f8fe4", size = 8323797, upload-time = "2024-02-16T10:49:02.872Z" }, - { url = "https://files.pythonhosted.org/packages/af/83/bbb482d678362ceb68cc59ec4fc705dde636025969361dac77be868541ef/matplotlib-3.7.5-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:c5a2134162273eb8cdfd320ae907bf84d171de948e62180fa372a3ca7cf0f433", size = 7439549, upload-time = "2024-02-16T10:49:05.743Z" }, - { url = "https://files.pythonhosted.org/packages/1a/ee/e49a92d9e369b2b9e4373894171cb4e641771cd7f81bde1d8b6fb8c60842/matplotlib-3.7.5-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:039ad54683a814002ff37bf7981aa1faa40b91f4ff84149beb53d1eb64617980", size = 7341788, upload-time = "2024-02-16T10:49:09.143Z" }, - { url = "https://files.pythonhosted.org/packages/48/79/89cb2fc5ddcfc3d440a739df04dbe6e4e72b1153d1ebd32b45d42eb71d27/matplotlib-3.7.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4d742ccd1b09e863b4ca58291728db645b51dab343eebb08d5d4b31b308296ce", size = 11356329, upload-time = "2024-02-16T10:49:12.156Z" }, - { url = "https://files.pythonhosted.org/packages/ff/25/84f181cdae5c9eba6fd1c2c35642aec47233425fe3b0d6fccdb323fb36e0/matplotlib-3.7.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:743b1c488ca6a2bc7f56079d282e44d236bf375968bfd1b7ba701fd4d0fa32d6", size = 11577813, upload-time = "2024-02-16T10:49:15.986Z" }, - { url = "https://files.pythonhosted.org/packages/9f/24/b2db065d40e58033b3350222fb8bbb0ffcb834029df9c1f9349dd9c7dd45/matplotlib-3.7.5-cp312-cp312-win_amd64.whl", hash = "sha256:fbf730fca3e1f23713bc1fae0a57db386e39dc81ea57dc305c67f628c1d7a342", size = 7507667, upload-time = "2024-02-16T10:49:19.6Z" }, - { url = "https://files.pythonhosted.org/packages/e3/72/50a38c8fd5dc845b06f8e71c9da802db44b81baabf4af8be78bb8a5622ea/matplotlib-3.7.5-cp38-cp38-macosx_10_12_universal2.whl", hash = "sha256:cfff9b838531698ee40e40ea1a8a9dc2c01edb400b27d38de6ba44c1f9a8e3d2", size = 8322659, upload-time = "2024-02-16T10:49:23.206Z" }, - { url = "https://files.pythonhosted.org/packages/b1/ea/129163dcd21db6da5d559a8160c4a74c1dc5f96ac246a3d4248b43c7648d/matplotlib-3.7.5-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:1dbcca4508bca7847fe2d64a05b237a3dcaec1f959aedb756d5b1c67b770c5ee", size = 7438408, upload-time = "2024-02-16T10:49:27.462Z" }, - { url = "https://files.pythonhosted.org/packages/aa/59/4d13e5b6298b1ca5525eea8c68d3806ae93ab6d0bb17ca9846aa3156b92b/matplotlib-3.7.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4cdf4ef46c2a1609a50411b66940b31778db1e4b73d4ecc2eaa40bd588979b13", size = 7341782, upload-time = "2024-02-16T10:49:32.173Z" }, - { url = "https://files.pythonhosted.org/packages/9e/c4/f562df04b08487731743511ff274ae5d31dce2ff3e5621f8b070d20ab54a/matplotlib-3.7.5-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:167200ccfefd1674b60e957186dfd9baf58b324562ad1a28e5d0a6b3bea77905", size = 9196487, upload-time = "2024-02-16T10:49:37.971Z" }, - { url = "https://files.pythonhosted.org/packages/30/33/cc27211d2ffeee4fd7402dca137b6e8a83f6dcae3d4be8d0ad5068555561/matplotlib-3.7.5-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:53e64522934df6e1818b25fd48cf3b645b11740d78e6ef765fbb5fa5ce080d02", size = 9213051, upload-time = "2024-02-16T10:49:43.916Z" }, - { url = "https://files.pythonhosted.org/packages/9b/9d/8bd37c86b79312c9dbcfa379dec32303f9b38e8456e0829d7e666a0e0a05/matplotlib-3.7.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d3e3bc79b2d7d615067bd010caff9243ead1fc95cf735c16e4b2583173f717eb", size = 11370807, upload-time = "2024-02-16T10:49:47.701Z" }, - { url = "https://files.pythonhosted.org/packages/c0/1e/b24a07a849c8d458f1b3724f49029f0dedf748bdedb4d5f69491314838b6/matplotlib-3.7.5-cp38-cp38-win32.whl", hash = "sha256:6b641b48c6819726ed47c55835cdd330e53747d4efff574109fd79b2d8a13748", size = 7340461, upload-time = "2024-02-16T10:49:51.597Z" }, - { url = "https://files.pythonhosted.org/packages/16/51/58b0b9de42fe1e665736d9286f88b5f1556a0e22bed8a71f468231761083/matplotlib-3.7.5-cp38-cp38-win_amd64.whl", hash = "sha256:f0b60993ed3488b4532ec6b697059897891927cbfc2b8d458a891b60ec03d9d7", size = 7507471, upload-time = "2024-02-16T10:49:54.353Z" }, - { url = "https://files.pythonhosted.org/packages/0d/00/17487e9e8949ca623af87f6c8767408efe7530b7e1f4d6897fa7fa940834/matplotlib-3.7.5-cp39-cp39-macosx_10_12_universal2.whl", hash = "sha256:090964d0afaff9c90e4d8de7836757e72ecfb252fb02884016d809239f715651", size = 8323175, upload-time = "2024-02-16T10:49:57.743Z" }, - { url = "https://files.pythonhosted.org/packages/6a/84/be0acd521fa9d6697657cf35878153f8009a42b4b75237aebc302559a8a9/matplotlib-3.7.5-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:9fc6fcfbc55cd719bc0bfa60bde248eb68cf43876d4c22864603bdd23962ba25", size = 7438737, upload-time = "2024-02-16T10:50:00.683Z" }, - { url = "https://files.pythonhosted.org/packages/17/39/175f36a6d68d0cf47a4fecbae9728048355df23c9feca8688f1476b198e6/matplotlib-3.7.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:5e7cc3078b019bb863752b8b60e8b269423000f1603cb2299608231996bd9d54", size = 7341916, upload-time = "2024-02-16T10:50:05.04Z" }, - { url = "https://files.pythonhosted.org/packages/36/c0/9a1c2a79f85c15d41b60877cbc333694ed80605e5c97a33880c4ecfd5bf1/matplotlib-3.7.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e4e9a868e8163abaaa8259842d85f949a919e1ead17644fb77a60427c90473c", size = 11352264, upload-time = "2024-02-16T10:50:08.955Z" }, - { url = "https://files.pythonhosted.org/packages/a6/39/b0204e0e7a899b0676733366a55ccafa723799b719bc7f2e85e5ecde26a0/matplotlib-3.7.5-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fa7ebc995a7d747dacf0a717d0eb3aa0f0c6a0e9ea88b0194d3a3cd241a1500f", size = 11454722, upload-time = "2024-02-16T10:50:13.231Z" }, - { url = "https://files.pythonhosted.org/packages/d8/39/64dd1d36c79e72e614977db338d180cf204cf658927c05a8ef2d47feb4c0/matplotlib-3.7.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3785bfd83b05fc0e0c2ae4c4a90034fe693ef96c679634756c50fe6efcc09856", size = 11576343, upload-time = "2024-02-16T10:50:17.626Z" }, - { url = "https://files.pythonhosted.org/packages/31/b4/e77bc11394d858bdf15e356980fceb4ac9604b0fa8212ef3ca4f1dc166b8/matplotlib-3.7.5-cp39-cp39-win32.whl", hash = "sha256:29b058738c104d0ca8806395f1c9089dfe4d4f0f78ea765c6c704469f3fffc81", size = 7340455, upload-time = "2024-02-16T10:50:21.448Z" }, - { url = "https://files.pythonhosted.org/packages/4a/84/081820c596b9555ecffc6819ee71f847f2fbb0d7c70a42c1eeaa54edf3e0/matplotlib-3.7.5-cp39-cp39-win_amd64.whl", hash = "sha256:fd4028d570fa4b31b7b165d4a685942ae9cdc669f33741e388c01857d9723eab", size = 7507711, upload-time = "2024-02-16T10:50:24.387Z" }, - { url = "https://files.pythonhosted.org/packages/27/6c/1bb10f3d6f337b9faa2e96a251bd87ba5fed85a608df95eb4d69acc109f0/matplotlib-3.7.5-pp38-pypy38_pp73-macosx_10_12_x86_64.whl", hash = "sha256:2a9a3f4d6a7f88a62a6a18c7e6a84aedcaf4faf0708b4ca46d87b19f1b526f88", size = 7397285, upload-time = "2024-02-16T10:50:27.375Z" }, - { url = "https://files.pythonhosted.org/packages/b2/36/66cfea213e9ba91cda9e257542c249ed235d49021af71c2e8007107d7d4c/matplotlib-3.7.5-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b9b3fd853d4a7f008a938df909b96db0b454225f935d3917520305b90680579c", size = 7552612, upload-time = "2024-02-16T10:50:30.65Z" }, - { url = "https://files.pythonhosted.org/packages/77/df/16655199bf984c37c6a816b854bc032b56aef521aadc04f27928422f3c91/matplotlib-3.7.5-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f0ad550da9f160737d7890217c5eeed4337d07e83ca1b2ca6535078f354e7675", size = 7515564, upload-time = "2024-02-16T10:50:33.589Z" }, - { url = "https://files.pythonhosted.org/packages/5b/c8/3534c3705a677b71abb6be33609ba129fdeae2ea4e76b2fd3ab62c86fab3/matplotlib-3.7.5-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:20da7924a08306a861b3f2d1da0d1aa9a6678e480cf8eacffe18b565af2813e7", size = 7521336, upload-time = "2024-02-16T10:50:36.4Z" }, - { url = "https://files.pythonhosted.org/packages/20/a0/c5c0d410798b387ed3a177a5a7eba21055dd9c41d4b15bd0861241a5a60e/matplotlib-3.7.5-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:b45c9798ea6bb920cb77eb7306409756a7fab9db9b463e462618e0559aecb30e", size = 7397931, upload-time = "2024-02-16T10:50:39.477Z" }, - { url = "https://files.pythonhosted.org/packages/c3/2f/9e9509727d4c7d1b8e2c88e9330a97d54a1dd20bd316a0c8d2f8b38c4513/matplotlib-3.7.5-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a99866267da1e561c7776fe12bf4442174b79aac1a47bd7e627c7e4d077ebd83", size = 7553224, upload-time = "2024-02-16T10:50:42.82Z" }, - { url = "https://files.pythonhosted.org/packages/89/0c/5f3e403dcf5c23799c92b0139dd00e41caf23983e9281f5bfeba3065e7d2/matplotlib-3.7.5-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2b6aa62adb6c268fc87d80f963aca39c64615c31830b02697743c95590ce3fbb", size = 7513250, upload-time = "2024-02-16T10:50:46.504Z" }, - { url = "https://files.pythonhosted.org/packages/87/e0/03eba0a8c3775ef910dbb3a287114a64c47abbcaeab2543c59957f155a86/matplotlib-3.7.5-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:e530ab6a0afd082d2e9c17eb1eb064a63c5b09bb607b2b74fa41adbe3e162286", size = 7521729, upload-time = "2024-02-16T10:50:50.063Z" }, -] - [[package]] name = "matplotlib" version = "3.9.4" source = { registry = "https://pypi.org/simple" } resolution-markers = [ - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", + "python_full_version < '3.10' and platform_machine == 'arm64' and sys_platform == 'darwin'", + "python_full_version < '3.10' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version < '3.10' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.10' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.10' and sys_platform != 'darwin' and sys_platform != 'linux')", ] dependencies = [ - { name = "contourpy", version = "1.3.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, - { name = "cycler", marker = "python_full_version == '3.9.*'" }, - { name = "fonttools", version = "4.58.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, - { name = "importlib-resources", version = "6.5.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, - { name = "kiwisolver", version = "1.4.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, - { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, - { name = "packaging", marker = "python_full_version == '3.9.*'" }, - { name = "pillow", marker = "python_full_version == '3.9.*'" }, - { name = "pyparsing", version = "3.2.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, - { name = "python-dateutil", marker = "python_full_version == '3.9.*'" }, + { name = "contourpy", version = "1.3.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, + { name = "cycler", marker = "python_full_version < '3.10'" }, + { name = "fonttools", marker = "python_full_version < '3.10'" }, + { name = "importlib-resources", marker = "python_full_version < '3.10'" }, + { name = "kiwisolver", version = "1.4.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, + { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, + { name = "packaging", marker = "python_full_version < '3.10'" }, + { name = "pillow", marker = "python_full_version < '3.10'" }, + { name = "pyparsing", marker = "python_full_version < '3.10'" }, + { name = "python-dateutil", marker = "python_full_version < '3.10'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/df/17/1747b4154034befd0ed33b52538f5eb7752d05bb51c5e2a31470c3bc7d52/matplotlib-3.9.4.tar.gz", hash = "sha256:1e00e8be7393cbdc6fedfa8a6fba02cf3e83814b285db1c60b906a023ba41bc3", size = 36106529, upload-time = "2024-12-13T05:56:34.184Z" } wheels = [ @@ -2983,13 +1832,13 @@ resolution-markers = [ dependencies = [ { name = "contourpy", version = "1.3.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "cycler", marker = "python_full_version >= '3.10'" }, - { name = "fonttools", version = "4.58.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, + { name = "fonttools", marker = "python_full_version >= '3.10'" }, { name = "kiwisolver", version = "1.4.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" }, { name = "numpy", version = "2.3.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "packaging", marker = "python_full_version >= '3.10'" }, { name = "pillow", marker = "python_full_version >= '3.10'" }, - { name = "pyparsing", version = "3.2.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, + { name = "pyparsing", marker = "python_full_version >= '3.10'" }, { name = "python-dateutil", marker = "python_full_version >= '3.10'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/26/91/d49359a21893183ed2a5b6c76bec40e0b1dcbf8ca148f864d134897cfc75/matplotlib-3.10.3.tar.gz", hash = "sha256:2f82d2c5bb7ae93aaaa4cd42aca65d76ce6376f83304fa3a630b569aca274df0", size = 34799811, upload-time = "2025-05-08T19:10:54.39Z" } @@ -3076,17 +1925,13 @@ name = "mike" version = "2.1.3" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "importlib-resources", version = "6.4.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-resources", version = "6.5.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "importlib-metadata" }, + { name = "importlib-resources" }, { name = "jinja2" }, { name = "mkdocs" }, - { name = "pyparsing", version = "3.1.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "pyparsing", version = "3.2.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "pyparsing" }, { name = "pyyaml" }, - { name = "pyyaml-env-tag", version = "0.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "pyyaml-env-tag", version = "1.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "pyyaml-env-tag" }, { name = "verspec" }, ] sdist = { url = "https://files.pythonhosted.org/packages/ab/f7/2933f1a1fb0e0f077d5d6a92c6c7f8a54e6128241f116dff4df8b6050bbf/mike-2.1.3.tar.gz", hash = "sha256:abd79b8ea483fb0275b7972825d3082e5ae67a41820f8d8a0dc7a3f49944e810", size = 38119, upload-time = "2024-08-13T05:02:14.167Z" } @@ -3099,8 +1944,7 @@ name = "mistune" version = "3.1.3" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "typing-extensions", version = "4.13.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, + { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/c4/79/bda47f7dd7c3c55770478d6d02c9960c430b0cf1773b72366ff89126ea31/mistune-3.1.3.tar.gz", hash = "sha256:a7035c21782b2becb6be62f8f25d3df81ccb4d6fa477a6525b15af06539f02a0", size = 94347, upload-time = "2025-03-19T14:27:24.955Z" } wheels = [ @@ -3116,69 +1960,31 @@ dependencies = [ { name = "click", version = "8.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "colorama", marker = "sys_platform == 'win32'" }, { name = "ghp-import" }, - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "importlib-metadata", marker = "python_full_version < '3.10'" }, { name = "jinja2" }, - { name = "markdown", version = "3.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "markdown", version = "3.8.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "markupsafe", version = "2.1.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "markupsafe", version = "3.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "markdown" }, + { name = "markupsafe" }, { name = "mergedeep" }, { name = "mkdocs-get-deps" }, { name = "packaging" }, { name = "pathspec" }, { name = "pyyaml" }, - { name = "pyyaml-env-tag", version = "0.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "pyyaml-env-tag", version = "1.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "watchdog", version = "4.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "watchdog", version = "6.0.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "pyyaml-env-tag" }, + { name = "watchdog" }, ] sdist = { url = "https://files.pythonhosted.org/packages/bc/c6/bbd4f061bd16b378247f12953ffcb04786a618ce5e904b8c5a01a0309061/mkdocs-1.6.1.tar.gz", hash = "sha256:7b432f01d928c084353ab39c57282f29f92136665bdd6abf7c1ec8d822ef86f2", size = 3889159, upload-time = "2024-08-30T12:24:06.899Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/22/5b/dbc6a8cddc9cfa9c4971d59fb12bb8d42e161b7e7f8cc89e49137c5b279c/mkdocs-1.6.1-py3-none-any.whl", hash = "sha256:db91759624d1647f3f34aa0c3f327dd2601beae39a366d6e064c03468d35c20e", size = 3864451, upload-time = "2024-08-30T12:24:05.054Z" }, ] -[[package]] -name = "mkdocs-autorefs" -version = "1.2.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "markdown", version = "3.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "markupsafe", version = "2.1.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "mkdocs", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/fb/ae/0f1154c614d6a8b8a36fff084e5b82af3a15f7d2060cf0dcdb1c53297a71/mkdocs_autorefs-1.2.0.tar.gz", hash = "sha256:a86b93abff653521bda71cf3fc5596342b7a23982093915cb74273f67522190f", size = 40262, upload-time = "2024-09-01T18:29:18.514Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/71/26/4d39d52ea2219604053a4d05b98e90d6a335511cc01806436ec4886b1028/mkdocs_autorefs-1.2.0-py3-none-any.whl", hash = "sha256:d588754ae89bd0ced0c70c06f58566a4ee43471eeeee5202427da7de9ef85a2f", size = 16522, upload-time = "2024-09-01T18:29:16.605Z" }, -] - [[package]] name = "mkdocs-autorefs" version = "1.4.2" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "markdown", version = "3.8.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "markupsafe", version = "3.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "mkdocs", marker = "python_full_version >= '3.9'" }, + { name = "markdown" }, + { name = "markupsafe" }, + { name = "mkdocs" }, ] sdist = { url = "https://files.pythonhosted.org/packages/47/0c/c9826f35b99c67fa3a7cddfa094c1a6c43fafde558c309c6e4403e5b37dc/mkdocs_autorefs-1.4.2.tar.gz", hash = "sha256:e2ebe1abd2b67d597ed19378c0fff84d73d1dbce411fce7a7cc6f161888b6749", size = 54961, upload-time = "2025-05-20T13:09:09.886Z" } wheels = [ @@ -3190,11 +1996,9 @@ name = "mkdocs-get-deps" version = "0.2.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "importlib-metadata", marker = "python_full_version < '3.10'" }, { name = "mergedeep" }, - { name = "platformdirs", version = "4.3.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "platformdirs", version = "4.3.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "platformdirs" }, { name = "pyyaml" }, ] sdist = { url = "https://files.pythonhosted.org/packages/98/f5/ed29cd50067784976f25ed0ed6fcd3c2ce9eb90650aa3b2796ddf7b6870b/mkdocs_get_deps-0.2.0.tar.gz", hash = "sha256:162b3d129c7fad9b19abfdcb9c1458a651628e4b1dea628ac68790fb3061c60c", size = 10239, upload-time = "2023-11-20T17:51:09.981Z" } @@ -3231,53 +2035,17 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/53/b6/106fcc15287e7228658fbd0ad9e8b0d775becced0a089cc39984641f4a0f/mkdocs_git_revision_date_localized_plugin-1.4.7-py3-none-any.whl", hash = "sha256:056c0a90242409148f1dc94d5c9d2c25b5b8ddd8de45489fa38f7fa7ccad2bc4", size = 25382, upload-time = "2025-05-28T18:26:18.907Z" }, ] -[[package]] -name = "mkdocs-jupyter" -version = "0.24.8" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "ipykernel", marker = "python_full_version < '3.9'" }, - { name = "jupytext", version = "1.17.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "mkdocs", marker = "python_full_version < '3.9'" }, - { name = "mkdocs-material", marker = "python_full_version < '3.9'" }, - { name = "nbconvert", marker = "python_full_version < '3.9'" }, - { name = "pygments", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/43/91/817bf07f4b1ce9b50d7d33e059e6cd5792951971a530b64665dd6cbf1324/mkdocs_jupyter-0.24.8.tar.gz", hash = "sha256:09a762f484d540d9c0e944d34b28cb536a32869e224b460e2fc791b143f76940", size = 1531510, upload-time = "2024-07-02T22:42:16.457Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e1/48/1e320da0e16e926ba4a9a8800df48963fce27b1287c8d1859041a2f85e26/mkdocs_jupyter-0.24.8-py3-none-any.whl", hash = "sha256:36438a0a653eee2c27c6a8f7006e645f18693699c9b8ac44ffde830ddb08fa16", size = 1444481, upload-time = "2024-07-02T22:42:14.242Z" }, -] - [[package]] name = "mkdocs-jupyter" version = "0.25.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "ipykernel", marker = "python_full_version >= '3.9'" }, - { name = "jupytext", version = "1.17.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "mkdocs", marker = "python_full_version >= '3.9'" }, - { name = "mkdocs-material", marker = "python_full_version >= '3.9'" }, - { name = "nbconvert", marker = "python_full_version >= '3.9'" }, - { name = "pygments", marker = "python_full_version >= '3.9'" }, + { name = "ipykernel" }, + { name = "jupytext" }, + { name = "mkdocs" }, + { name = "mkdocs-material" }, + { name = "nbconvert" }, + { name = "pygments" }, ] sdist = { url = "https://files.pythonhosted.org/packages/6c/23/6ffb8d2fd2117aa860a04c6fe2510b21bc3c3c085907ffdd851caba53152/mkdocs_jupyter-0.25.1.tar.gz", hash = "sha256:0e9272ff4947e0ec683c92423a4bfb42a26477c103ab1a6ab8277e2dcc8f7afe", size = 1626747, upload-time = "2024-10-15T14:56:32.373Z" } wheels = [ @@ -3290,18 +2058,15 @@ version = "9.6.15" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "babel" }, - { name = "backrefs", version = "5.7.post1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "backrefs", version = "5.9", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "backrefs" }, { name = "colorama" }, { name = "jinja2" }, - { name = "markdown", version = "3.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "markdown", version = "3.8.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "markdown" }, { name = "mkdocs" }, { name = "mkdocs-material-extensions" }, { name = "paginate" }, { name = "pygments" }, - { name = "pymdown-extensions", version = "10.15", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "pymdown-extensions", version = "10.16", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "pymdown-extensions" }, { name = "requests" }, ] sdist = { url = "https://files.pythonhosted.org/packages/95/c1/f804ba2db2ddc2183e900befe7dad64339a34fa935034e1ab405289d0a97/mkdocs_material-9.6.15.tar.gz", hash = "sha256:64adf8fa8dba1a17905b6aee1894a5aafd966d4aeb44a11088519b0f5ca4f1b5", size = 3951836, upload-time = "2025-07-01T10:14:15.671Z" } @@ -3311,8 +2076,7 @@ wheels = [ [package.optional-dependencies] imaging = [ - { name = "cairosvg", version = "2.7.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "cairosvg", version = "2.8.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "cairosvg" }, { name = "pillow" }, ] @@ -3325,192 +2089,57 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/5b/54/662a4743aa81d9582ee9339d4ffa3c8fd40a4965e033d77b9da9774d3960/mkdocs_material_extensions-1.3.1-py3-none-any.whl", hash = "sha256:adff8b62700b25cb77b53358dad940f3ef973dd6db797907c49e3c2ef3ab4e31", size = 8728, upload-time = "2023-11-22T19:09:43.465Z" }, ] -[[package]] -name = "mkdocstrings" -version = "0.26.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "click", version = "8.1.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jinja2", marker = "python_full_version < '3.9'" }, - { name = "markdown", version = "3.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "markupsafe", version = "2.1.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "mkdocs", marker = "python_full_version < '3.9'" }, - { name = "mkdocs-autorefs", version = "1.2.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "platformdirs", version = "4.3.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "pymdown-extensions", version = "10.15", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "typing-extensions", version = "4.13.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/e6/bf/170ff04de72227f715d67da32950c7b8434449f3805b2ec3dd1085db4d7c/mkdocstrings-0.26.1.tar.gz", hash = "sha256:bb8b8854d6713d5348ad05b069a09f3b79edbc6a0f33a34c6821141adb03fe33", size = 92677, upload-time = "2024-09-06T10:26:06.736Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/23/cc/8ba127aaee5d1e9046b0d33fa5b3d17da95a9d705d44902792e0569257fd/mkdocstrings-0.26.1-py3-none-any.whl", hash = "sha256:29738bfb72b4608e8e55cc50fb8a54f325dc7ebd2014e4e3881a49892d5983cf", size = 29643, upload-time = "2024-09-06T10:26:04.498Z" }, -] - [[package]] name = "mkdocstrings" version = "0.29.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, - { name = "jinja2", marker = "python_full_version >= '3.9'" }, - { name = "markdown", version = "3.8.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "markupsafe", version = "3.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "mkdocs", marker = "python_full_version >= '3.9'" }, - { name = "mkdocs-autorefs", version = "1.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "pymdown-extensions", version = "10.16", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "importlib-metadata", marker = "python_full_version < '3.10'" }, + { name = "jinja2" }, + { name = "markdown" }, + { name = "markupsafe" }, + { name = "mkdocs" }, + { name = "mkdocs-autorefs" }, + { name = "pymdown-extensions" }, ] sdist = { url = "https://files.pythonhosted.org/packages/41/e8/d22922664a627a0d3d7ff4a6ca95800f5dde54f411982591b4621a76225d/mkdocstrings-0.29.1.tar.gz", hash = "sha256:8722f8f8c5cd75da56671e0a0c1bbed1df9946c0cef74794d6141b34011abd42", size = 1212686, upload-time = "2025-03-31T08:33:11.997Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/98/14/22533a578bf8b187e05d67e2c1721ce10e3f526610eebaf7a149d557ea7a/mkdocstrings-0.29.1-py3-none-any.whl", hash = "sha256:37a9736134934eea89cbd055a513d40a020d87dfcae9e3052c2a6b8cd4af09b6", size = 1631075, upload-time = "2025-03-31T08:33:09.661Z" }, ] -[[package]] -name = "mkdocstrings-python" -version = "1.11.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "griffe", version = "1.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "mkdocs-autorefs", version = "1.2.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "mkdocstrings", version = "0.26.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/fc/ba/534c934cd0a809f51c91332d6ed278782ee4126b8ba8db02c2003f162b47/mkdocstrings_python-1.11.1.tar.gz", hash = "sha256:8824b115c5359304ab0b5378a91f6202324a849e1da907a3485b59208b797322", size = 166890, upload-time = "2024-09-03T17:20:54.904Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/2f/f2/2a2c48fda645ac6bbe73bcc974587a579092b6868e6ff8bc6d177f4db38a/mkdocstrings_python-1.11.1-py3-none-any.whl", hash = "sha256:a21a1c05acef129a618517bb5aae3e33114f569b11588b1e7af3e9d4061a71af", size = 109297, upload-time = "2024-09-03T17:20:52.621Z" }, -] - [[package]] name = "mkdocstrings-python" version = "1.16.12" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "griffe", version = "1.7.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "mkdocs-autorefs", version = "1.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "mkdocstrings", version = "0.29.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, + { name = "griffe" }, + { name = "mkdocs-autorefs" }, + { name = "mkdocstrings" }, + { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/bf/ed/b886f8c714fd7cccc39b79646b627dbea84cd95c46be43459ef46852caf0/mkdocstrings_python-1.16.12.tar.gz", hash = "sha256:9b9eaa066e0024342d433e332a41095c4e429937024945fea511afe58f63175d", size = 206065, upload-time = "2025-06-03T12:52:49.276Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/3b/dd/a24ee3de56954bfafb6ede7cd63c2413bb842cc48eb45e41c43a05a33074/mkdocstrings_python-1.16.12-py3-none-any.whl", hash = "sha256:22ded3a63b3d823d57457a70ff9860d5a4de9e8b1e482876fc9baabaf6f5f374", size = 124287, upload-time = "2025-06-03T12:52:47.819Z" }, ] -[[package]] -name = "more-itertools" -version = "10.5.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/51/78/65922308c4248e0eb08ebcbe67c95d48615cc6f27854b6f2e57143e9178f/more-itertools-10.5.0.tar.gz", hash = "sha256:5482bfef7849c25dc3c6dd53a6173ae4795da2a41a80faea6700d9f5846c5da6", size = 121020, upload-time = "2024-09-05T15:28:22.081Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/48/7e/3a64597054a70f7c86eb0a7d4fc315b8c1ab932f64883a297bdffeb5f967/more_itertools-10.5.0-py3-none-any.whl", hash = "sha256:037b0d3203ce90cca8ab1defbbdac29d5f993fc20131f3664dc8d6acfa872aef", size = 60952, upload-time = "2024-09-05T15:28:20.141Z" }, -] - [[package]] name = "more-itertools" version = "10.7.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/ce/a0/834b0cebabbfc7e311f30b46c8188790a37f89fc8d756660346fe5abfd09/more_itertools-10.7.0.tar.gz", hash = "sha256:9fddd5403be01a94b204faadcff459ec3568cf110265d3c54323e1e866ad29d3", size = 127671, upload-time = "2025-04-22T14:17:41.838Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/2b/9f/7ba6f94fc1e9ac3d2b853fdff3035fb2fa5afbed898c4a72b8a020610594/more_itertools-10.7.0-py3-none-any.whl", hash = "sha256:d43980384673cb07d2f7d2d918c616b30c659c089ee23953f601d6609c67510e", size = 65278, upload-time = "2025-04-22T14:17:40.49Z" }, ] -[[package]] -name = "nbclient" -version = "0.10.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "jupyter-client", marker = "python_full_version < '3.9'" }, - { name = "jupyter-core", marker = "python_full_version < '3.9'" }, - { name = "nbformat", marker = "python_full_version < '3.9'" }, - { name = "traitlets", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/06/db/25929926860ba8a3f6123d2d0a235e558e0e4be7b46e9db063a7dfefa0a2/nbclient-0.10.1.tar.gz", hash = "sha256:3e93e348ab27e712acd46fccd809139e356eb9a31aab641d1a7991a6eb4e6f68", size = 62273, upload-time = "2024-11-29T08:28:38.47Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/26/1a/ed6d1299b1a00c1af4a033fdee565f533926d819e084caf0d2832f6f87c6/nbclient-0.10.1-py3-none-any.whl", hash = "sha256:949019b9240d66897e442888cfb618f69ef23dc71c01cb5fced8499c2cfc084d", size = 25344, upload-time = "2024-11-29T08:28:21.844Z" }, -] - [[package]] name = "nbclient" version = "0.10.2" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "jupyter-client", marker = "python_full_version >= '3.9'" }, - { name = "jupyter-core", marker = "python_full_version >= '3.9'" }, - { name = "nbformat", marker = "python_full_version >= '3.9'" }, - { name = "traitlets", marker = "python_full_version >= '3.9'" }, + { name = "jupyter-client" }, + { name = "jupyter-core" }, + { name = "nbformat" }, + { name = "traitlets" }, ] sdist = { url = "https://files.pythonhosted.org/packages/87/66/7ffd18d58eae90d5721f9f39212327695b749e23ad44b3881744eaf4d9e8/nbclient-0.10.2.tar.gz", hash = "sha256:90b7fc6b810630db87a6d0c2250b1f0ab4cf4d3c27a299b0cde78a4ed3fd9193", size = 62424, upload-time = "2024-12-19T10:32:27.164Z" } wheels = [ @@ -3523,19 +2152,15 @@ version = "7.16.6" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "beautifulsoup4" }, - { name = "bleach", version = "6.1.0", source = { registry = "https://pypi.org/simple" }, extra = ["css"], marker = "python_full_version < '3.9'" }, - { name = "bleach", version = "6.2.0", source = { registry = "https://pypi.org/simple" }, extra = ["css"], marker = "python_full_version >= '3.9'" }, + { name = "bleach", extra = ["css"] }, { name = "defusedxml" }, - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "importlib-metadata", marker = "python_full_version < '3.10'" }, { name = "jinja2" }, { name = "jupyter-core" }, { name = "jupyterlab-pygments" }, - { name = "markupsafe", version = "2.1.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "markupsafe", version = "3.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "markupsafe" }, { name = "mistune" }, - { name = "nbclient", version = "0.10.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "nbclient", version = "0.10.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "nbclient" }, { name = "nbformat" }, { name = "packaging" }, { name = "pandocfilters" }, @@ -3553,8 +2178,7 @@ version = "5.10.4" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "fastjsonschema" }, - { name = "jsonschema", version = "4.23.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jsonschema", version = "4.24.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "jsonschema" }, { name = "jupyter-core" }, { name = "traitlets" }, ] @@ -3603,51 +2227,16 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/23/fc/8ce756c032c70ae3dd1d48a3552577a325475af2a2f629604b44f571165c/nh3-0.2.21-cp38-abi3-win_amd64.whl", hash = "sha256:bb0014948f04d7976aabae43fcd4cb7f551f9f8ce785a4c9ef66e6c2590f8629", size = 535283, upload-time = "2025-02-25T13:38:43.355Z" }, ] -[[package]] -name = "notebook" -version = "7.3.3" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "jupyter-server", version = "2.14.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jupyterlab", version = "4.3.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jupyterlab-server", marker = "python_full_version < '3.9'" }, - { name = "notebook-shim", marker = "python_full_version < '3.9'" }, - { name = "tornado", version = "6.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/71/0f/7781fed05f79d1047c039dfd17fbd6e6670bcf5ad330baa997bcc62525b5/notebook-7.3.3.tar.gz", hash = "sha256:707a313fb882d35f921989eb3d204de942ed5132a44e4aa1fe0e8f24bb9dc25d", size = 12758099, upload-time = "2025-03-14T13:40:57.001Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/f2/bf/5e5fcf79c559600b738d7577c8360bfd4cfa705400af06f23b3a049e44b6/notebook-7.3.3-py3-none-any.whl", hash = "sha256:b193df0878956562d5171c8e25c9252b8e86c9fcc16163b8ee3fe6c5e3f422f7", size = 13142886, upload-time = "2025-03-14T13:40:52.754Z" }, -] - [[package]] name = "notebook" version = "7.4.4" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "jupyter-server", version = "2.16.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "jupyterlab", version = "4.4.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "jupyterlab-server", marker = "python_full_version >= '3.9'" }, - { name = "notebook-shim", marker = "python_full_version >= '3.9'" }, - { name = "tornado", version = "6.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "jupyter-server" }, + { name = "jupyterlab" }, + { name = "jupyterlab-server" }, + { name = "notebook-shim" }, + { name = "tornado" }, ] sdist = { url = "https://files.pythonhosted.org/packages/b1/4e/a40b5a94eb01fc51746db7854296d88b84905ab18ee0fcef853a60d708a3/notebook-7.4.4.tar.gz", hash = "sha256:392fd501e266f2fb3466c6fcd3331163a2184968cb5c5accf90292e01dfe528c", size = 13883628, upload-time = "2025-06-30T13:04:18.099Z" } wheels = [ @@ -3659,62 +2248,21 @@ name = "notebook-shim" version = "0.2.4" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "jupyter-server", version = "2.14.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jupyter-server", version = "2.16.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "jupyter-server" }, ] sdist = { url = "https://files.pythonhosted.org/packages/54/d2/92fa3243712b9a3e8bafaf60aac366da1cada3639ca767ff4b5b3654ec28/notebook_shim-0.2.4.tar.gz", hash = "sha256:b4b2cfa1b65d98307ca24361f5b30fe785b53c3fd07b7a47e89acb5e6ac638cb", size = 13167, upload-time = "2024-02-14T23:35:18.353Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/f9/33/bd5b9137445ea4b680023eb0469b2bb969d61303dedb2aac6560ff3d14a1/notebook_shim-0.2.4-py3-none-any.whl", hash = "sha256:411a5be4e9dc882a074ccbcae671eda64cceb068767e9a3419096986560e1cef", size = 13307, upload-time = "2024-02-14T23:35:16.286Z" }, ] -[[package]] -name = "numpy" -version = "1.24.4" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/a4/9b/027bec52c633f6556dba6b722d9a0befb40498b9ceddd29cbe67a45a127c/numpy-1.24.4.tar.gz", hash = "sha256:80f5e3a4e498641401868df4208b74581206afbee7cf7b8329daae82676d9463", size = 10911229, upload-time = "2023-06-26T13:39:33.218Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/6b/80/6cdfb3e275d95155a34659163b83c09e3a3ff9f1456880bec6cc63d71083/numpy-1.24.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c0bfb52d2169d58c1cdb8cc1f16989101639b34c7d3ce60ed70b19c63eba0b64", size = 19789140, upload-time = "2023-06-26T13:22:33.184Z" }, - { url = "https://files.pythonhosted.org/packages/64/5f/3f01d753e2175cfade1013eea08db99ba1ee4bdb147ebcf3623b75d12aa7/numpy-1.24.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ed094d4f0c177b1b8e7aa9cba7d6ceed51c0e569a5318ac0ca9a090680a6a1b1", size = 13854297, upload-time = "2023-06-26T13:22:59.541Z" }, - { url = "https://files.pythonhosted.org/packages/5a/b3/2f9c21d799fa07053ffa151faccdceeb69beec5a010576b8991f614021f7/numpy-1.24.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:79fc682a374c4a8ed08b331bef9c5f582585d1048fa6d80bc6c35bc384eee9b4", size = 13995611, upload-time = "2023-06-26T13:23:22.167Z" }, - { url = "https://files.pythonhosted.org/packages/10/be/ae5bf4737cb79ba437879915791f6f26d92583c738d7d960ad94e5c36adf/numpy-1.24.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7ffe43c74893dbf38c2b0a1f5428760a1a9c98285553c89e12d70a96a7f3a4d6", size = 17282357, upload-time = "2023-06-26T13:23:51.446Z" }, - { url = "https://files.pythonhosted.org/packages/c0/64/908c1087be6285f40e4b3e79454552a701664a079321cff519d8c7051d06/numpy-1.24.4-cp310-cp310-win32.whl", hash = "sha256:4c21decb6ea94057331e111a5bed9a79d335658c27ce2adb580fb4d54f2ad9bc", size = 12429222, upload-time = "2023-06-26T13:24:13.849Z" }, - { url = "https://files.pythonhosted.org/packages/22/55/3d5a7c1142e0d9329ad27cece17933b0e2ab4e54ddc5c1861fbfeb3f7693/numpy-1.24.4-cp310-cp310-win_amd64.whl", hash = "sha256:b4bea75e47d9586d31e892a7401f76e909712a0fd510f58f5337bea9572c571e", size = 14841514, upload-time = "2023-06-26T13:24:38.129Z" }, - { url = "https://files.pythonhosted.org/packages/a9/cc/5ed2280a27e5dab12994c884f1f4d8c3bd4d885d02ae9e52a9d213a6a5e2/numpy-1.24.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f136bab9c2cfd8da131132c2cf6cc27331dd6fae65f95f69dcd4ae3c3639c810", size = 19775508, upload-time = "2023-06-26T13:25:08.882Z" }, - { url = "https://files.pythonhosted.org/packages/c0/bc/77635c657a3668cf652806210b8662e1aff84b818a55ba88257abf6637a8/numpy-1.24.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e2926dac25b313635e4d6cf4dc4e51c8c0ebfed60b801c799ffc4c32bf3d1254", size = 13840033, upload-time = "2023-06-26T13:25:33.417Z" }, - { url = "https://files.pythonhosted.org/packages/a7/4c/96cdaa34f54c05e97c1c50f39f98d608f96f0677a6589e64e53104e22904/numpy-1.24.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:222e40d0e2548690405b0b3c7b21d1169117391c2e82c378467ef9ab4c8f0da7", size = 13991951, upload-time = "2023-06-26T13:25:55.725Z" }, - { url = "https://files.pythonhosted.org/packages/22/97/dfb1a31bb46686f09e68ea6ac5c63fdee0d22d7b23b8f3f7ea07712869ef/numpy-1.24.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7215847ce88a85ce39baf9e89070cb860c98fdddacbaa6c0da3ffb31b3350bd5", size = 17278923, upload-time = "2023-06-26T13:26:25.658Z" }, - { url = "https://files.pythonhosted.org/packages/35/e2/76a11e54139654a324d107da1d98f99e7aa2a7ef97cfd7c631fba7dbde71/numpy-1.24.4-cp311-cp311-win32.whl", hash = "sha256:4979217d7de511a8d57f4b4b5b2b965f707768440c17cb70fbf254c4b225238d", size = 12422446, upload-time = "2023-06-26T13:26:49.302Z" }, - { url = "https://files.pythonhosted.org/packages/d8/ec/ebef2f7d7c28503f958f0f8b992e7ce606fb74f9e891199329d5f5f87404/numpy-1.24.4-cp311-cp311-win_amd64.whl", hash = "sha256:b7b1fc9864d7d39e28f41d089bfd6353cb5f27ecd9905348c24187a768c79694", size = 14834466, upload-time = "2023-06-26T13:27:16.029Z" }, - { url = "https://files.pythonhosted.org/packages/11/10/943cfb579f1a02909ff96464c69893b1d25be3731b5d3652c2e0cf1281ea/numpy-1.24.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1452241c290f3e2a312c137a9999cdbf63f78864d63c79039bda65ee86943f61", size = 19780722, upload-time = "2023-06-26T13:27:49.573Z" }, - { url = "https://files.pythonhosted.org/packages/a7/ae/f53b7b265fdc701e663fbb322a8e9d4b14d9cb7b2385f45ddfabfc4327e4/numpy-1.24.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:04640dab83f7c6c85abf9cd729c5b65f1ebd0ccf9de90b270cd61935eef0197f", size = 13843102, upload-time = "2023-06-26T13:28:12.288Z" }, - { url = "https://files.pythonhosted.org/packages/25/6f/2586a50ad72e8dbb1d8381f837008a0321a3516dfd7cb57fc8cf7e4bb06b/numpy-1.24.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a5425b114831d1e77e4b5d812b69d11d962e104095a5b9c3b641a218abcc050e", size = 14039616, upload-time = "2023-06-26T13:28:35.659Z" }, - { url = "https://files.pythonhosted.org/packages/98/5d/5738903efe0ecb73e51eb44feafba32bdba2081263d40c5043568ff60faf/numpy-1.24.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd80e219fd4c71fc3699fc1dadac5dcf4fd882bfc6f7ec53d30fa197b8ee22dc", size = 17316263, upload-time = "2023-06-26T13:29:09.272Z" }, - { url = "https://files.pythonhosted.org/packages/d1/57/8d328f0b91c733aa9aa7ee540dbc49b58796c862b4fbcb1146c701e888da/numpy-1.24.4-cp38-cp38-win32.whl", hash = "sha256:4602244f345453db537be5314d3983dbf5834a9701b7723ec28923e2889e0bb2", size = 12455660, upload-time = "2023-06-26T13:29:33.434Z" }, - { url = "https://files.pythonhosted.org/packages/69/65/0d47953afa0ad569d12de5f65d964321c208492064c38fe3b0b9744f8d44/numpy-1.24.4-cp38-cp38-win_amd64.whl", hash = "sha256:692f2e0f55794943c5bfff12b3f56f99af76f902fc47487bdfe97856de51a706", size = 14868112, upload-time = "2023-06-26T13:29:58.385Z" }, - { url = "https://files.pythonhosted.org/packages/9a/cd/d5b0402b801c8a8b56b04c1e85c6165efab298d2f0ab741c2406516ede3a/numpy-1.24.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:2541312fbf09977f3b3ad449c4e5f4bb55d0dbf79226d7724211acc905049400", size = 19816549, upload-time = "2023-06-26T13:30:36.976Z" }, - { url = "https://files.pythonhosted.org/packages/14/27/638aaa446f39113a3ed38b37a66243e21b38110d021bfcb940c383e120f2/numpy-1.24.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9667575fb6d13c95f1b36aca12c5ee3356bf001b714fc354eb5465ce1609e62f", size = 13879950, upload-time = "2023-06-26T13:31:01.787Z" }, - { url = "https://files.pythonhosted.org/packages/8f/27/91894916e50627476cff1a4e4363ab6179d01077d71b9afed41d9e1f18bf/numpy-1.24.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f3a86ed21e4f87050382c7bc96571755193c4c1392490744ac73d660e8f564a9", size = 14030228, upload-time = "2023-06-26T13:31:26.696Z" }, - { url = "https://files.pythonhosted.org/packages/7a/7c/d7b2a0417af6428440c0ad7cb9799073e507b1a465f827d058b826236964/numpy-1.24.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d11efb4dbecbdf22508d55e48d9c8384db795e1b7b51ea735289ff96613ff74d", size = 17311170, upload-time = "2023-06-26T13:31:56.615Z" }, - { url = "https://files.pythonhosted.org/packages/18/9d/e02ace5d7dfccee796c37b995c63322674daf88ae2f4a4724c5dd0afcc91/numpy-1.24.4-cp39-cp39-win32.whl", hash = "sha256:6620c0acd41dbcb368610bb2f4d83145674040025e5536954782467100aa8835", size = 12454918, upload-time = "2023-06-26T13:32:16.8Z" }, - { url = "https://files.pythonhosted.org/packages/63/38/6cc19d6b8bfa1d1a459daf2b3fe325453153ca7019976274b6f33d8b5663/numpy-1.24.4-cp39-cp39-win_amd64.whl", hash = "sha256:befe2bf740fd8373cf56149a5c23a0f601e82869598d41f8e188a0e9869926f8", size = 14867441, upload-time = "2023-06-26T13:32:40.521Z" }, - { url = "https://files.pythonhosted.org/packages/a4/fd/8dff40e25e937c94257455c237b9b6bf5a30d42dd1cc11555533be099492/numpy-1.24.4-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:31f13e25b4e304632a4619d0e0777662c2ffea99fcae2029556b17d8ff958aef", size = 19156590, upload-time = "2023-06-26T13:33:10.36Z" }, - { url = "https://files.pythonhosted.org/packages/42/e7/4bf953c6e05df90c6d351af69966384fed8e988d0e8c54dad7103b59f3ba/numpy-1.24.4-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:95f7ac6540e95bc440ad77f56e520da5bf877f87dca58bd095288dce8940532a", size = 16705744, upload-time = "2023-06-26T13:33:36.703Z" }, - { url = "https://files.pythonhosted.org/packages/fc/dd/9106005eb477d022b60b3817ed5937a43dad8fd1f20b0610ea8a32fcb407/numpy-1.24.4-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:e98f220aa76ca2a977fe435f5b04d7b3470c0a2e6312907b37ba6068f26787f2", size = 14734290, upload-time = "2023-06-26T13:34:05.409Z" }, -] - [[package]] name = "numpy" version = "2.0.2" source = { registry = "https://pypi.org/simple" } resolution-markers = [ - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", + "python_full_version < '3.10' and platform_machine == 'arm64' and sys_platform == 'darwin'", + "python_full_version < '3.10' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version < '3.10' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.10' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.10' and sys_platform != 'darwin' and sys_platform != 'linux')", ] sdist = { url = "https://files.pythonhosted.org/packages/a9/75/10dd1f8116a8b796cb2c737b674e02d02e80454bda953fa7e65d8c12b016/numpy-2.0.2.tar.gz", hash = "sha256:883c987dee1880e2a864ab0dc9892292582510604156762362d9326444636e78", size = 18902015, upload-time = "2024-08-26T20:19:40.945Z" } wheels = [ @@ -3902,8 +2450,7 @@ name = "opencv-python" version = "4.11.0.86" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "numpy", version = "1.24.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" }, { name = "numpy", version = "2.3.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, ] @@ -3944,74 +2491,17 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/90/96/04b8e52da071d28f5e21a805b19cb9390aa17a47462ac87f5e2696b9566d/paginate-0.5.7-py2.py3-none-any.whl", hash = "sha256:b885e2af73abcf01d9559fd5216b57ef722f8c42affbb63942377668e35c7591", size = 13746, upload-time = "2024-08-25T14:17:22.55Z" }, ] -[[package]] -name = "pandas" -version = "2.0.3" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "numpy", version = "1.24.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "python-dateutil", marker = "python_full_version < '3.9'" }, - { name = "pytz", marker = "python_full_version < '3.9'" }, - { name = "tzdata", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/b1/a7/824332581e258b5aa4f3763ecb2a797e5f9a54269044ba2e50ac19936b32/pandas-2.0.3.tar.gz", hash = "sha256:c02f372a88e0d17f36d3093a644c73cfc1788e876a7c4bcb4020a77512e2043c", size = 5284455, upload-time = "2023-06-28T23:19:33.371Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/3c/b2/0d4a5729ce1ce11630c4fc5d5522a33b967b3ca146c210f58efde7c40e99/pandas-2.0.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e4c7c9f27a4185304c7caf96dc7d91bc60bc162221152de697c98eb0b2648dd8", size = 11760908, upload-time = "2023-06-28T23:15:57.001Z" }, - { url = "https://files.pythonhosted.org/packages/4a/f6/f620ca62365d83e663a255a41b08d2fc2eaf304e0b8b21bb6d62a7390fe3/pandas-2.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f167beed68918d62bffb6ec64f2e1d8a7d297a038f86d4aed056b9493fca407f", size = 10823486, upload-time = "2023-06-28T23:16:06.863Z" }, - { url = "https://files.pythonhosted.org/packages/c2/59/cb4234bc9b968c57e81861b306b10cd8170272c57b098b724d3de5eda124/pandas-2.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ce0c6f76a0f1ba361551f3e6dceaff06bde7514a374aa43e33b588ec10420183", size = 11571897, upload-time = "2023-06-28T23:16:14.208Z" }, - { url = "https://files.pythonhosted.org/packages/e3/59/35a2892bf09ded9c1bf3804461efe772836a5261ef5dfb4e264ce813ff99/pandas-2.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba619e410a21d8c387a1ea6e8a0e49bb42216474436245718d7f2e88a2f8d7c0", size = 12306421, upload-time = "2023-06-28T23:16:23.26Z" }, - { url = "https://files.pythonhosted.org/packages/94/71/3a0c25433c54bb29b48e3155b959ac78f4c4f2f06f94d8318aac612cb80f/pandas-2.0.3-cp310-cp310-win32.whl", hash = "sha256:3ef285093b4fe5058eefd756100a367f27029913760773c8bf1d2d8bebe5d210", size = 9540792, upload-time = "2023-06-28T23:16:30.876Z" }, - { url = "https://files.pythonhosted.org/packages/ed/30/b97456e7063edac0e5a405128065f0cd2033adfe3716fb2256c186bd41d0/pandas-2.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:9ee1a69328d5c36c98d8e74db06f4ad518a1840e8ccb94a4ba86920986bb617e", size = 10664333, upload-time = "2023-06-28T23:16:39.209Z" }, - { url = "https://files.pythonhosted.org/packages/b3/92/a5e5133421b49e901a12e02a6a7ef3a0130e10d13db8cb657fdd0cba3b90/pandas-2.0.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b084b91d8d66ab19f5bb3256cbd5ea661848338301940e17f4492b2ce0801fe8", size = 11645672, upload-time = "2023-06-28T23:16:47.601Z" }, - { url = "https://files.pythonhosted.org/packages/8f/bb/aea1fbeed5b474cb8634364718abe9030d7cc7a30bf51f40bd494bbc89a2/pandas-2.0.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:37673e3bdf1551b95bf5d4ce372b37770f9529743d2498032439371fc7b7eb26", size = 10693229, upload-time = "2023-06-28T23:16:56.397Z" }, - { url = "https://files.pythonhosted.org/packages/d6/90/e7d387f1a416b14e59290baa7a454a90d719baebbf77433ff1bdcc727800/pandas-2.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b9cb1e14fdb546396b7e1b923ffaeeac24e4cedd14266c3497216dd4448e4f2d", size = 11581591, upload-time = "2023-06-28T23:17:04.234Z" }, - { url = "https://files.pythonhosted.org/packages/d0/28/88b81881c056376254618fad622a5e94b5126db8c61157ea1910cd1c040a/pandas-2.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d9cd88488cceb7635aebb84809d087468eb33551097d600c6dad13602029c2df", size = 12219370, upload-time = "2023-06-28T23:17:11.783Z" }, - { url = "https://files.pythonhosted.org/packages/e4/a5/212b9039e25bf8ebb97e417a96660e3dc925dacd3f8653d531b8f7fd9be4/pandas-2.0.3-cp311-cp311-win32.whl", hash = "sha256:694888a81198786f0e164ee3a581df7d505024fbb1f15202fc7db88a71d84ebd", size = 9482935, upload-time = "2023-06-28T23:17:21.376Z" }, - { url = "https://files.pythonhosted.org/packages/9e/71/756a1be6bee0209d8c0d8c5e3b9fc72c00373f384a4017095ec404aec3ad/pandas-2.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:6a21ab5c89dcbd57f78d0ae16630b090eec626360085a4148693def5452d8a6b", size = 10607692, upload-time = "2023-06-28T23:17:28.824Z" }, - { url = "https://files.pythonhosted.org/packages/78/a8/07dd10f90ca915ed914853cd57f79bfc22e1ef4384ab56cb4336d2fc1f2a/pandas-2.0.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9e4da0d45e7f34c069fe4d522359df7d23badf83abc1d1cef398895822d11061", size = 11653303, upload-time = "2023-06-28T23:17:36.329Z" }, - { url = "https://files.pythonhosted.org/packages/53/c3/f8e87361f7fdf42012def602bfa2a593423c729f5cb7c97aed7f51be66ac/pandas-2.0.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:32fca2ee1b0d93dd71d979726b12b61faa06aeb93cf77468776287f41ff8fdc5", size = 10710932, upload-time = "2023-06-28T23:17:49.875Z" }, - { url = "https://files.pythonhosted.org/packages/a7/87/828d50c81ce0f434163bf70b925a0eec6076808e0bca312a79322b141f66/pandas-2.0.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:258d3624b3ae734490e4d63c430256e716f488c4fcb7c8e9bde2d3aa46c29089", size = 11684018, upload-time = "2023-06-28T23:18:05.845Z" }, - { url = "https://files.pythonhosted.org/packages/f8/7f/5b047effafbdd34e52c9e2d7e44f729a0655efafb22198c45cf692cdc157/pandas-2.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eae3dc34fa1aa7772dd3fc60270d13ced7346fcbcfee017d3132ec625e23bb0", size = 12353723, upload-time = "2023-06-28T23:18:17.631Z" }, - { url = "https://files.pythonhosted.org/packages/ea/ae/26a2eda7fa581347d69e51f93892493b2074ef3352ac71033c9f32c52389/pandas-2.0.3-cp38-cp38-win32.whl", hash = "sha256:f3421a7afb1a43f7e38e82e844e2bca9a6d793d66c1a7f9f0ff39a795bbc5e02", size = 9646403, upload-time = "2023-06-28T23:18:24.328Z" }, - { url = "https://files.pythonhosted.org/packages/c3/6c/ea362eef61f05553aaf1a24b3e96b2d0603f5dc71a3bd35688a24ed88843/pandas-2.0.3-cp38-cp38-win_amd64.whl", hash = "sha256:69d7f3884c95da3a31ef82b7618af5710dba95bb885ffab339aad925c3e8ce78", size = 10777638, upload-time = "2023-06-28T23:18:30.947Z" }, - { url = "https://files.pythonhosted.org/packages/f8/c7/cfef920b7b457dff6928e824896cb82367650ea127d048ee0b820026db4f/pandas-2.0.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5247fb1ba347c1261cbbf0fcfba4a3121fbb4029d95d9ef4dc45406620b25c8b", size = 11834160, upload-time = "2023-06-28T23:18:40.332Z" }, - { url = "https://files.pythonhosted.org/packages/6c/1c/689c9d99bc4e5d366a5fd871f0bcdee98a6581e240f96b78d2d08f103774/pandas-2.0.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:81af086f4543c9d8bb128328b5d32e9986e0c84d3ee673a2ac6fb57fd14f755e", size = 10862752, upload-time = "2023-06-28T23:18:50.016Z" }, - { url = "https://files.pythonhosted.org/packages/cc/b8/4d082f41c27c95bf90485d1447b647cc7e5680fea75e315669dc6e4cb398/pandas-2.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1994c789bf12a7c5098277fb43836ce090f1073858c10f9220998ac74f37c69b", size = 11715852, upload-time = "2023-06-28T23:19:00.594Z" }, - { url = "https://files.pythonhosted.org/packages/9e/0d/91a9fd2c202f2b1d97a38ab591890f86480ecbb596cbc56d035f6f23fdcc/pandas-2.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5ec591c48e29226bcbb316e0c1e9423622bc7a4eaf1ef7c3c9fa1a3981f89641", size = 12398496, upload-time = "2023-06-28T23:19:11.78Z" }, - { url = "https://files.pythonhosted.org/packages/26/7d/d8aa0a2c4f3f5f8ea59fb946c8eafe8f508090ca73e2b08a9af853c1103e/pandas-2.0.3-cp39-cp39-win32.whl", hash = "sha256:04dbdbaf2e4d46ca8da896e1805bc04eb85caa9a82e259e8eed00254d5e0c682", size = 9630766, upload-time = "2023-06-28T23:19:18.182Z" }, - { url = "https://files.pythonhosted.org/packages/9a/f2/0ad053856debbe90c83de1b4f05915f85fd2146f20faf9daa3b320d36df3/pandas-2.0.3-cp39-cp39-win_amd64.whl", hash = "sha256:1168574b036cd8b93abc746171c9b4f1b83467438a5e45909fed645cf8692dbc", size = 10755902, upload-time = "2023-06-28T23:19:25.151Z" }, -] - [[package]] name = "pandas" version = "2.3.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" }, { name = "numpy", version = "2.3.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, - { name = "python-dateutil", marker = "python_full_version >= '3.9'" }, - { name = "pytz", marker = "python_full_version >= '3.9'" }, - { name = "tzdata", marker = "python_full_version >= '3.9'" }, + { name = "python-dateutil" }, + { name = "pytz" }, + { name = "tzdata" }, ] sdist = { url = "https://files.pythonhosted.org/packages/d1/6f/75aa71f8a14267117adeeed5d21b204770189c0a0025acbdc03c337b28fc/pandas-2.3.1.tar.gz", hash = "sha256:0a95b9ac964fe83ce317827f80304d37388ea77616b1425f0ae41c9d2d0d7bb2", size = 4487493, upload-time = "2025-07-07T19:20:04.079Z" } wheels = [ @@ -4097,15 +2587,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/9e/c3/059298687310d527a58bb01f3b1965787ee3b40dce76752eda8b44e9a2c5/pexpect-4.9.0-py2.py3-none-any.whl", hash = "sha256:7236d1e080e4936be2dc3e326cec0af72acf9212a7e1d060210e70a47e253523", size = 63772, upload-time = "2023-11-25T06:56:14.81Z" }, ] -[[package]] -name = "pickleshare" -version = "0.7.5" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d8/b6/df3c1c9b616e9c0edbc4fbab6ddd09df9535849c64ba51fcb6531c32d4d8/pickleshare-0.7.5.tar.gz", hash = "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca", size = 6161, upload-time = "2018-09-25T19:17:37.249Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl", hash = "sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56", size = 6877, upload-time = "2018-09-25T19:17:35.817Z" }, -] - [[package]] name = "pillow" version = "10.4.0" @@ -4156,16 +2637,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7b/f9/cfaa5082ca9bc4a6de66ffe1c12c2d90bf09c309a5f52b27759a596900e7/pillow-10.4.0-cp313-cp313-win32.whl", hash = "sha256:551d3fd6e9dc15e4c1eb6fc4ba2b39c0c7933fa113b220057a34f4bb3268a060", size = 2235603, upload-time = "2024-07-01T09:47:03.918Z" }, { url = "https://files.pythonhosted.org/packages/01/6a/30ff0eef6e0c0e71e55ded56a38d4859bf9d3634a94a88743897b5f96936/pillow-10.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:030abdbe43ee02e0de642aee345efa443740aa4d828bfe8e2eb11922ea6a21ea", size = 2554972, upload-time = "2024-07-01T09:47:06.152Z" }, { url = "https://files.pythonhosted.org/packages/48/2c/2e0a52890f269435eee38b21c8218e102c621fe8d8df8b9dd06fabf879ba/pillow-10.4.0-cp313-cp313-win_arm64.whl", hash = "sha256:5b001114dd152cfd6b23befeb28d7aee43553e2402c9f159807bf55f33af8a8d", size = 2243375, upload-time = "2024-07-01T09:47:09.065Z" }, - { url = "https://files.pythonhosted.org/packages/56/70/f40009702a477ce87d8d9faaa4de51d6562b3445d7a314accd06e4ffb01d/pillow-10.4.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:8d4d5063501b6dd4024b8ac2f04962d661222d120381272deea52e3fc52d3736", size = 3509213, upload-time = "2024-07-01T09:47:11.662Z" }, - { url = "https://files.pythonhosted.org/packages/10/43/105823d233c5e5d31cea13428f4474ded9d961652307800979a59d6a4276/pillow-10.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7c1ee6f42250df403c5f103cbd2768a28fe1a0ea1f0f03fe151c8741e1469c8b", size = 3375883, upload-time = "2024-07-01T09:47:14.453Z" }, - { url = "https://files.pythonhosted.org/packages/3c/ad/7850c10bac468a20c918f6a5dbba9ecd106ea1cdc5db3c35e33a60570408/pillow-10.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b15e02e9bb4c21e39876698abf233c8c579127986f8207200bc8a8f6bb27acf2", size = 4330810, upload-time = "2024-07-01T09:47:16.695Z" }, - { url = "https://files.pythonhosted.org/packages/84/4c/69bbed9e436ac22f9ed193a2b64f64d68fcfbc9f4106249dc7ed4889907b/pillow-10.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a8d4bade9952ea9a77d0c3e49cbd8b2890a399422258a77f357b9cc9be8d680", size = 4444341, upload-time = "2024-07-01T09:47:19.334Z" }, - { url = "https://files.pythonhosted.org/packages/8f/4f/c183c63828a3f37bf09644ce94cbf72d4929b033b109160a5379c2885932/pillow-10.4.0-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:43efea75eb06b95d1631cb784aa40156177bf9dd5b4b03ff38979e048258bc6b", size = 4356005, upload-time = "2024-07-01T09:47:21.805Z" }, - { url = "https://files.pythonhosted.org/packages/fb/ad/435fe29865f98a8fbdc64add8875a6e4f8c97749a93577a8919ec6f32c64/pillow-10.4.0-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:950be4d8ba92aca4b2bb0741285a46bfae3ca699ef913ec8416c1b78eadd64cd", size = 4525201, upload-time = "2024-07-01T09:47:24.457Z" }, - { url = "https://files.pythonhosted.org/packages/80/74/be8bf8acdfd70e91f905a12ae13cfb2e17c0f1da745c40141e26d0971ff5/pillow-10.4.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:d7480af14364494365e89d6fddc510a13e5a2c3584cb19ef65415ca57252fb84", size = 4460635, upload-time = "2024-07-01T09:47:26.841Z" }, - { url = "https://files.pythonhosted.org/packages/e4/90/763616e66dc9ad59c9b7fb58f863755e7934ef122e52349f62c7742b82d3/pillow-10.4.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:73664fe514b34c8f02452ffb73b7a92c6774e39a647087f83d67f010eb9a0cf0", size = 4590283, upload-time = "2024-07-01T09:47:29.247Z" }, - { url = "https://files.pythonhosted.org/packages/69/66/03002cb5b2c27bb519cba63b9f9aa3709c6f7a5d3b285406c01f03fb77e5/pillow-10.4.0-cp38-cp38-win32.whl", hash = "sha256:e88d5e6ad0d026fba7bdab8c3f225a69f063f116462c49892b0149e21b6c0a0e", size = 2235185, upload-time = "2024-07-01T09:47:32.205Z" }, - { url = "https://files.pythonhosted.org/packages/f2/75/3cb820b2812405fc7feb3d0deb701ef0c3de93dc02597115e00704591bc9/pillow-10.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:5161eef006d335e46895297f642341111945e2c1c899eb406882a6c61a4357ab", size = 2554594, upload-time = "2024-07-01T09:47:34.285Z" }, { url = "https://files.pythonhosted.org/packages/31/85/955fa5400fa8039921f630372cfe5056eed6e1b8e0430ee4507d7de48832/pillow-10.4.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:0ae24a547e8b711ccaaf99c9ae3cd975470e1a30caa80a6aaee9a2f19c05701d", size = 3509283, upload-time = "2024-07-01T09:47:36.394Z" }, { url = "https://files.pythonhosted.org/packages/23/9c/343827267eb28d41cd82b4180d33b10d868af9077abcec0af9793aa77d2d/pillow-10.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:298478fe4f77a4408895605f3482b6cc6222c018b2ce565c2b6b9c354ac3229b", size = 3375691, upload-time = "2024-07-01T09:47:38.853Z" }, { url = "https://files.pythonhosted.org/packages/60/a3/7ebbeabcd341eab722896d1a5b59a3df98c4b4d26cf4b0385f8aa94296f7/pillow-10.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:134ace6dc392116566980ee7436477d844520a26a4b1bd4053f6f47d096997fd", size = 4328295, upload-time = "2024-07-01T09:47:41.765Z" }, @@ -4193,121 +2664,28 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/37/ae/2dbfc38cc4fd14aceea14bc440d5151b21f64c4c3ba3f6f4191610b7ee5d/pillow-10.4.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:cfdd747216947628af7b259d274771d84db2268ca062dd5faf373639d00113a3", size = 2554652, upload-time = "2024-07-01T09:48:38.789Z" }, ] -[[package]] -name = "pkgutil-resolve-name" -version = "1.3.10" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/70/f2/f2891a9dc37398696ddd945012b90ef8d0a034f0012e3f83c3f7a70b0f79/pkgutil_resolve_name-1.3.10.tar.gz", hash = "sha256:357d6c9e6a755653cfd78893817c0853af365dd51ec97f3d358a819373bbd174", size = 5054, upload-time = "2021-07-21T08:19:05.096Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/c9/5c/3d4882ba113fd55bdba9326c1e4c62a15e674a2501de4869e6bd6301f87e/pkgutil_resolve_name-1.3.10-py3-none-any.whl", hash = "sha256:ca27cc078d25c5ad71a9de0a7a330146c4e014c2462d9af19c6b828280649c5e", size = 4734, upload-time = "2021-07-21T08:19:03.106Z" }, -] - -[[package]] -name = "platformdirs" -version = "4.3.6" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/13/fc/128cc9cb8f03208bdbf93d3aa862e16d376844a14f9a0ce5cf4507372de4/platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907", size = 21302, upload-time = "2024-09-17T19:06:50.688Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/3c/a6/bc1012356d8ece4d66dd75c4b9fc6c1f6650ddd5991e421177d9f8f671be/platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb", size = 18439, upload-time = "2024-09-17T19:06:49.212Z" }, -] - [[package]] name = "platformdirs" version = "4.3.8" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/fe/8b/3c73abc9c759ecd3f1f7ceff6685840859e8070c4d947c93fae71f6a0bf2/platformdirs-4.3.8.tar.gz", hash = "sha256:3d512d96e16bcb959a814c9f348431070822a6496326a4be0911c40b5a74c2bc", size = 21362, upload-time = "2025-05-07T22:47:42.121Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/fe/39/979e8e21520d4e47a0bbe349e2713c0aac6f3d853d0e5b34d76206c439aa/platformdirs-4.3.8-py3-none-any.whl", hash = "sha256:ff7059bb7eb1179e2685604f4aaf157cfd9535242bd23742eadc3c13542139b4", size = 18567, upload-time = "2025-05-07T22:47:40.376Z" }, ] -[[package]] -name = "pluggy" -version = "1.5.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/96/2d/02d4312c973c6050a18b314a5ad0b3210edb65a906f868e31c111dede4a6/pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1", size = 67955, upload-time = "2024-04-20T21:34:42.531Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669", size = 20556, upload-time = "2024-04-20T21:34:40.434Z" }, -] - [[package]] name = "pluggy" version = "1.6.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" }, ] -[[package]] -name = "prometheus-client" -version = "0.21.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/62/14/7d0f567991f3a9af8d1cd4f619040c93b68f09a02b6d0b6ab1b2d1ded5fe/prometheus_client-0.21.1.tar.gz", hash = "sha256:252505a722ac04b0456be05c05f75f45d760c2911ffc45f2a06bcaed9f3ae3fb", size = 78551, upload-time = "2024-12-03T14:59:12.164Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/ff/c2/ab7d37426c179ceb9aeb109a85cda8948bb269b7561a0be870cc656eefe4/prometheus_client-0.21.1-py3-none-any.whl", hash = "sha256:594b45c410d6f4f8888940fe80b5cc2521b305a1fafe1c58609ef715a001f301", size = 54682, upload-time = "2024-12-03T14:59:10.935Z" }, -] - [[package]] name = "prometheus-client" version = "0.22.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/5e/cf/40dde0a2be27cc1eb41e333d1a674a74ce8b8b0457269cc640fd42b07cf7/prometheus_client-0.22.1.tar.gz", hash = "sha256:190f1331e783cf21eb60bca559354e0a4d4378facecf78f5428c39b675d20d28", size = 69746, upload-time = "2025-06-02T14:29:01.152Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/32/ae/ec06af4fe3ee72d16973474f122541746196aaa16cea6f66d18b963c6177/prometheus_client-0.22.1-py3-none-any.whl", hash = "sha256:cca895342e308174341b2cbf99a56bef291fbc0ef7b9e5412a0f26d653ba7094", size = 58694, upload-time = "2025-06-02T14:29:00.068Z" }, @@ -4376,127 +2754,35 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217, upload-time = "2025-06-21T13:39:07.939Z" }, ] -[[package]] -name = "pymdown-extensions" -version = "10.15" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "markdown", version = "3.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "pyyaml", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/08/92/a7296491dbf5585b3a987f3f3fc87af0e632121ff3e490c14b5f2d2b4eb5/pymdown_extensions-10.15.tar.gz", hash = "sha256:0e5994e32155f4b03504f939e501b981d306daf7ec2aa1cd2eb6bd300784f8f7", size = 852320, upload-time = "2025-04-27T23:48:29.183Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/a7/d1/c54e608505776ce4e7966d03358ae635cfd51dff1da6ee421c090dbc797b/pymdown_extensions-10.15-py3-none-any.whl", hash = "sha256:46e99bb272612b0de3b7e7caf6da8dd5f4ca5212c0b273feb9304e236c484e5f", size = 265845, upload-time = "2025-04-27T23:48:27.359Z" }, -] - [[package]] name = "pymdown-extensions" version = "10.16" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "markdown", version = "3.8.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "pyyaml", marker = "python_full_version >= '3.9'" }, + { name = "markdown" }, + { name = "pyyaml" }, ] sdist = { url = "https://files.pythonhosted.org/packages/1a/0a/c06b542ac108bfc73200677309cd9188a3a01b127a63f20cadc18d873d88/pymdown_extensions-10.16.tar.gz", hash = "sha256:71dac4fca63fabeffd3eb9038b756161a33ec6e8d230853d3cecf562155ab3de", size = 853197, upload-time = "2025-06-21T17:56:36.974Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/98/d4/10bb14004d3c792811e05e21b5e5dcae805aacb739bd12a0540967b99592/pymdown_extensions-10.16-py3-none-any.whl", hash = "sha256:f5dd064a4db588cb2d95229fc4ee63a1b16cc8b4d0e6145c0899ed8723da1df2", size = 266143, upload-time = "2025-06-21T17:56:35.356Z" }, ] -[[package]] -name = "pyparsing" -version = "3.1.4" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/83/08/13f3bce01b2061f2bbd582c9df82723de943784cf719a35ac886c652043a/pyparsing-3.1.4.tar.gz", hash = "sha256:f86ec8d1a83f11977c9a6ea7598e8c27fc5cddfa5b07ea2241edbbde1d7bc032", size = 900231, upload-time = "2024-08-25T15:00:47.416Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e5/0c/0e3c05b1c87bb6a1c76d281b0f35e78d2d80ac91b5f8f524cebf77f51049/pyparsing-3.1.4-py3-none-any.whl", hash = "sha256:a6a7ee4235a3f944aa1fa2249307708f893fe5717dc603503c6c7969c070fb7c", size = 104100, upload-time = "2024-08-25T15:00:45.361Z" }, -] - [[package]] name = "pyparsing" version = "3.2.3" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/bb/22/f1129e69d94ffff626bdb5c835506b3a5b4f3d070f17ea295e12c2c6f60f/pyparsing-3.2.3.tar.gz", hash = "sha256:b9c13f1ab8b3b542f72e28f634bad4de758ab3ce4546e4301970ad6fa77c38be", size = 1088608, upload-time = "2025-03-25T05:01:28.114Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/05/e7/df2285f3d08fee213f2d041540fa4fc9ca6c2d44cf36d3a035bf2a8d2bcc/pyparsing-3.2.3-py3-none-any.whl", hash = "sha256:a749938e02d6fd0b59b356ca504a24982314bb090c383e3cf201c95ef7e2bfcf", size = 111120, upload-time = "2025-03-25T05:01:24.908Z" }, ] -[[package]] -name = "pyproject-api" -version = "1.8.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "packaging", marker = "python_full_version < '3.9'" }, - { name = "tomli", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/bb/19/441e0624a8afedd15bbcce96df1b80479dd0ff0d965f5ce8fde4f2f6ffad/pyproject_api-1.8.0.tar.gz", hash = "sha256:77b8049f2feb5d33eefcc21b57f1e279636277a8ac8ad6b5871037b243778496", size = 22340, upload-time = "2024-09-18T23:18:37.805Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/ba/f4/3c4ddfcc0c19c217c6de513842d286de8021af2f2ab79bbb86c00342d778/pyproject_api-1.8.0-py3-none-any.whl", hash = "sha256:3d7d347a047afe796fd5d1885b1e391ba29be7169bd2f102fcd378f04273d228", size = 13100, upload-time = "2024-09-18T23:18:35.927Z" }, -] - [[package]] name = "pyproject-api" version = "1.9.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "packaging", marker = "python_full_version >= '3.9'" }, - { name = "tomli", marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, + { name = "packaging" }, + { name = "tomli", marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/19/fd/437901c891f58a7b9096511750247535e891d2d5a5a6eefbc9386a2b41d5/pyproject_api-1.9.1.tar.gz", hash = "sha256:43c9918f49daab37e302038fc1aed54a8c7a91a9fa935d00b9a485f37e0f5335", size = 22710, upload-time = "2025-05-12T14:41:58.025Z" } wheels = [ @@ -4512,54 +2798,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/bd/24/12818598c362d7f300f18e74db45963dbcb85150324092410c8b49405e42/pyproject_hooks-1.2.0-py3-none-any.whl", hash = "sha256:9e5c6bfa8dcc30091c74b0cf803c81fdd29d94f01992a7707bc97babb1141913", size = 10216, upload-time = "2024-09-29T09:24:11.978Z" }, ] -[[package]] -name = "pytest" -version = "8.3.5" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "colorama", marker = "python_full_version < '3.9' and sys_platform == 'win32'" }, - { name = "exceptiongroup", marker = "python_full_version < '3.9'" }, - { name = "iniconfig", marker = "python_full_version < '3.9'" }, - { name = "packaging", marker = "python_full_version < '3.9'" }, - { name = "pluggy", version = "1.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "tomli", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/ae/3c/c9d525a414d506893f0cd8a8d0de7706446213181570cdbd766691164e40/pytest-8.3.5.tar.gz", hash = "sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845", size = 1450891, upload-time = "2025-03-02T12:54:54.503Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/30/3d/64ad57c803f1fa1e963a7946b6e0fea4a70df53c1a7fed304586539c2bac/pytest-8.3.5-py3-none-any.whl", hash = "sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820", size = 343634, upload-time = "2025-03-02T12:54:52.069Z" }, -] - [[package]] name = "pytest" version = "8.4.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "colorama", marker = "python_full_version >= '3.9' and sys_platform == 'win32'" }, - { name = "exceptiongroup", marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, - { name = "iniconfig", marker = "python_full_version >= '3.9'" }, - { name = "packaging", marker = "python_full_version >= '3.9'" }, - { name = "pluggy", version = "1.6.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "pygments", marker = "python_full_version >= '3.9'" }, - { name = "tomli", marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "exceptiongroup", marker = "python_full_version < '3.11'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, + { name = "pygments" }, + { name = "tomli", marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/08/ba/45911d754e8eba3d5a841a5ce61a65a685ff1798421ac054f85aa8747dfb/pytest-8.4.1.tar.gz", hash = "sha256:7c67fd69174877359ed9371ec3af8a3d2b04741818c51e5e99cc1742251fa93c", size = 1517714, upload-time = "2025-06-18T05:48:06.109Z" } wheels = [ @@ -4583,8 +2833,7 @@ name = "python-json-logger" version = "3.3.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "typing-extensions", version = "4.13.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "typing-extensions", marker = "python_full_version < '3.10'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/9e/de/d3144a0bceede957f961e975f3752760fbe390d57fbe194baf709d8f1f7b/python_json_logger-3.3.0.tar.gz", hash = "sha256:12b7e74b17775e7d565129296105bbe3910842d9d0eb083fc83a6a617aa8df84", size = 16642, upload-time = "2025-03-07T07:08:27.301Z" } wheels = [ @@ -4617,8 +2866,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/1c/09/9c1b978ffc4ae53999e89c19c77ba882d9fce476729f23ef55211ea1c034/pywin32-310-cp313-cp313-win32.whl", hash = "sha256:5d241a659c496ada3253cd01cfaa779b048e90ce4b2b38cd44168ad555ce74ab", size = 8794384, upload-time = "2025-03-17T00:56:04.383Z" }, { url = "https://files.pythonhosted.org/packages/45/3c/b4640f740ffebadd5d34df35fecba0e1cfef8fde9f3e594df91c28ad9b50/pywin32-310-cp313-cp313-win_amd64.whl", hash = "sha256:667827eb3a90208ddbdcc9e860c81bde63a135710e21e4cb3348968e4bd5249e", size = 9503039, upload-time = "2025-03-17T00:56:06.207Z" }, { url = "https://files.pythonhosted.org/packages/b4/f4/f785020090fb050e7fb6d34b780f2231f302609dc964672f72bfaeb59a28/pywin32-310-cp313-cp313-win_arm64.whl", hash = "sha256:e308f831de771482b7cf692a1f308f8fca701b2d8f9dde6cc440c7da17e47b33", size = 8458152, upload-time = "2025-03-17T00:56:07.819Z" }, - { url = "https://files.pythonhosted.org/packages/46/65/9c5b79424e344b976394f2b1bb4bedfa4cd013143b72b301a66e4b8943fe/pywin32-310-cp38-cp38-win32.whl", hash = "sha256:0867beb8addefa2e3979d4084352e4ac6e991ca45373390775f7084cc0209b9c", size = 8853889, upload-time = "2025-03-17T00:55:38.177Z" }, - { url = "https://files.pythonhosted.org/packages/0c/3b/05f848971b3a44b35cd48ea0c6c648745be8bc5a3fc9f4df6f135c7f1e07/pywin32-310-cp38-cp38-win_amd64.whl", hash = "sha256:30f0a9b3138fb5e07eb4973b7077e1883f558e40c578c6925acc7a94c34eaa36", size = 9609017, upload-time = "2025-03-17T00:55:40.483Z" }, { url = "https://files.pythonhosted.org/packages/a2/cd/d09d434630edb6a0c44ad5079611279a67530296cfe0451e003de7f449ff/pywin32-310-cp39-cp39-win32.whl", hash = "sha256:851c8d927af0d879221e616ae1f66145253537bbdd321a77e8ef701b443a9a1a", size = 8848099, upload-time = "2025-03-17T00:55:42.415Z" }, { url = "https://files.pythonhosted.org/packages/93/ff/2a8c10315ffbdee7b3883ac0d1667e267ca8b3f6f640d81d43b87a82c0c7/pywin32-310-cp39-cp39-win_amd64.whl", hash = "sha256:96867217335559ac619f00ad70e513c0fcf84b8a3af9fc2bba3b59b97da70475", size = 9602031, upload-time = "2025-03-17T00:55:44.512Z" }, ] @@ -4632,32 +2879,10 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/de/3d/8161f7711c017e01ac9f008dfddd9410dff3674334c233bde66e7ba65bbf/pywin32_ctypes-0.2.3-py3-none-any.whl", hash = "sha256:8a1513379d709975552d202d942d9837758905c8d01eb82b8bcc30918929e7b8", size = 30756, upload-time = "2024-08-14T10:15:33.187Z" }, ] -[[package]] -name = "pywinpty" -version = "2.0.14" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/f1/82/90f8750423cba4b9b6c842df227609fb60704482d7abf6dd47e2babc055a/pywinpty-2.0.14.tar.gz", hash = "sha256:18bd9529e4a5daf2d9719aa17788ba6013e594ae94c5a0c27e83df3278b0660e", size = 27769, upload-time = "2024-10-17T16:01:43.197Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/07/09/56376af256eab8cc5f8982a3b138d387136eca27fa1a8a68660e8ed59e4b/pywinpty-2.0.14-cp310-none-win_amd64.whl", hash = "sha256:0b149c2918c7974f575ba79f5a4aad58bd859a52fa9eb1296cc22aa412aa411f", size = 1397115, upload-time = "2024-10-17T16:04:46.736Z" }, - { url = "https://files.pythonhosted.org/packages/be/e2/af1a99c0432e4e58c9ac8e334ee191790ec9793d33559189b9d2069bdc1d/pywinpty-2.0.14-cp311-none-win_amd64.whl", hash = "sha256:cf2a43ac7065b3e0dc8510f8c1f13a75fb8fde805efa3b8cff7599a1ef497bc7", size = 1397223, upload-time = "2024-10-17T16:04:33.08Z" }, - { url = "https://files.pythonhosted.org/packages/ad/79/759ae767a3b78d340446efd54dd1fe4f7dafa4fc7be96ed757e44bcdba54/pywinpty-2.0.14-cp312-none-win_amd64.whl", hash = "sha256:55dad362ef3e9408ade68fd173e4f9032b3ce08f68cfe7eacb2c263ea1179737", size = 1397207, upload-time = "2024-10-17T16:04:14.633Z" }, - { url = "https://files.pythonhosted.org/packages/7d/34/b77b3c209bf2eaa6455390c8d5449241637f5957f41636a2204065d52bfa/pywinpty-2.0.14-cp313-none-win_amd64.whl", hash = "sha256:074fb988a56ec79ca90ed03a896d40707131897cefb8f76f926e3834227f2819", size = 1396698, upload-time = "2024-10-17T16:04:15.172Z" }, - { url = "https://files.pythonhosted.org/packages/d8/ef/85e1b0ef7864fa2c579b1c1efce92c5f6fa238c8e73cf9f53deee08f8605/pywinpty-2.0.14-cp39-none-win_amd64.whl", hash = "sha256:5725fd56f73c0531ec218663bd8c8ff5acc43c78962fab28564871b5fce053fd", size = 1397396, upload-time = "2024-10-17T16:05:30.319Z" }, -] - [[package]] name = "pywinpty" version = "2.0.15" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/2d/7c/917f9c4681bb8d34bfbe0b79d36bbcd902651aeab48790df3d30ba0202fb/pywinpty-2.0.15.tar.gz", hash = "sha256:312cf39153a8736c617d45ce8b6ad6cd2107de121df91c455b10ce6bba7a39b2", size = 29017, upload-time = "2025-02-03T21:53:23.265Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/a6/b7/855db919ae526d2628f3f2e6c281c4cdff7a9a8af51bb84659a9f07b1861/pywinpty-2.0.15-cp310-cp310-win_amd64.whl", hash = "sha256:8e7f5de756a615a38b96cd86fa3cd65f901ce54ce147a3179c45907fa11b4c4e", size = 1405161, upload-time = "2025-02-03T21:56:25.008Z" }, @@ -4710,13 +2935,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/fe/0f/25911a9f080464c59fab9027482f822b86bf0608957a5fcc6eaac85aa515/PyYAML-6.0.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:68ccc6023a3400877818152ad9a1033e3db8625d899c72eacb5a668902e4d652", size = 751597, upload-time = "2024-08-06T20:32:56.985Z" }, { url = "https://files.pythonhosted.org/packages/14/0d/e2c3b43bbce3cf6bd97c840b46088a3031085179e596d4929729d8d68270/PyYAML-6.0.2-cp313-cp313-win32.whl", hash = "sha256:bc2fa7c6b47d6bc618dd7fb02ef6fdedb1090ec036abab80d4681424b84c1183", size = 140527, upload-time = "2024-08-06T20:33:03.001Z" }, { url = "https://files.pythonhosted.org/packages/fa/de/02b54f42487e3d3c6efb3f89428677074ca7bf43aae402517bc7cca949f3/PyYAML-6.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:8388ee1976c416731879ac16da0aff3f63b286ffdd57cdeb95f3f2e085687563", size = 156446, upload-time = "2024-08-06T20:33:04.33Z" }, - { url = "https://files.pythonhosted.org/packages/74/d9/323a59d506f12f498c2097488d80d16f4cf965cee1791eab58b56b19f47a/PyYAML-6.0.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:24471b829b3bf607e04e88d79542a9d48bb037c2267d7927a874e6c205ca7e9a", size = 183218, upload-time = "2024-08-06T20:33:06.411Z" }, - { url = "https://files.pythonhosted.org/packages/74/cc/20c34d00f04d785f2028737e2e2a8254e1425102e730fee1d6396f832577/PyYAML-6.0.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7fded462629cfa4b685c5416b949ebad6cec74af5e2d42905d41e257e0869f5", size = 728067, upload-time = "2024-08-06T20:33:07.879Z" }, - { url = "https://files.pythonhosted.org/packages/20/52/551c69ca1501d21c0de51ddafa8c23a0191ef296ff098e98358f69080577/PyYAML-6.0.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d84a1718ee396f54f3a086ea0a66d8e552b2ab2017ef8b420e92edbc841c352d", size = 757812, upload-time = "2024-08-06T20:33:12.542Z" }, - { url = "https://files.pythonhosted.org/packages/fd/7f/2c3697bba5d4aa5cc2afe81826d73dfae5f049458e44732c7a0938baa673/PyYAML-6.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9056c1ecd25795207ad294bcf39f2db3d845767be0ea6e6a34d856f006006083", size = 746531, upload-time = "2024-08-06T20:33:14.391Z" }, - { url = "https://files.pythonhosted.org/packages/8c/ab/6226d3df99900e580091bb44258fde77a8433511a86883bd4681ea19a858/PyYAML-6.0.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:82d09873e40955485746739bcb8b4586983670466c23382c19cffecbf1fd8706", size = 800820, upload-time = "2024-08-06T20:33:16.586Z" }, - { url = "https://files.pythonhosted.org/packages/a0/99/a9eb0f3e710c06c5d922026f6736e920d431812ace24aae38228d0d64b04/PyYAML-6.0.2-cp38-cp38-win32.whl", hash = "sha256:43fa96a3ca0d6b1812e01ced1044a003533c47f6ee8aca31724f78e93ccc089a", size = 145514, upload-time = "2024-08-06T20:33:22.414Z" }, - { url = "https://files.pythonhosted.org/packages/75/8a/ee831ad5fafa4431099aa4e078d4c8efd43cd5e48fbc774641d233b683a9/PyYAML-6.0.2-cp38-cp38-win_amd64.whl", hash = "sha256:01179a4a8559ab5de078078f37e5c1a30d76bb88519906844fd7bdea1b7729ff", size = 162702, upload-time = "2024-08-06T20:33:23.813Z" }, { url = "https://files.pythonhosted.org/packages/65/d8/b7a1db13636d7fb7d4ff431593c510c8b8fca920ade06ca8ef20015493c5/PyYAML-6.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:688ba32a1cffef67fd2e9398a2efebaea461578b0923624778664cc1c914db5d", size = 184777, upload-time = "2024-08-06T20:33:25.896Z" }, { url = "https://files.pythonhosted.org/packages/0a/02/6ec546cd45143fdf9840b2c6be8d875116a64076218b61d68e12548e5839/PyYAML-6.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a8786accb172bd8afb8be14490a16625cbc387036876ab6ba70912730faf8e1f", size = 172318, upload-time = "2024-08-06T20:33:27.212Z" }, { url = "https://files.pythonhosted.org/packages/0e/9a/8cc68be846c972bda34f6c2a93abb644fb2476f4dcc924d52175786932c9/PyYAML-6.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d8e03406cac8513435335dbab54c0d385e4a49e4945d2909a581c83647ca0290", size = 720891, upload-time = "2024-08-06T20:33:28.974Z" }, @@ -4728,43 +2946,12 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/19/87/5124b1c1f2412bb95c59ec481eaf936cd32f0fe2a7b16b97b81c4c017a6a/PyYAML-6.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:39693e1f8320ae4f43943590b49779ffb98acb81f788220ea932a6b6c51004d8", size = 162312, upload-time = "2024-08-06T20:33:49.073Z" }, ] -[[package]] -name = "pyyaml-env-tag" -version = "0.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "pyyaml", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/fb/8e/da1c6c58f751b70f8ceb1eb25bc25d524e8f14fe16edcce3f4e3ba08629c/pyyaml_env_tag-0.1.tar.gz", hash = "sha256:70092675bda14fdec33b31ba77e7543de9ddc88f2e5b99160396572d11525bdb", size = 5631, upload-time = "2020-11-12T02:38:26.239Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/5a/66/bbb1dd374f5c870f59c5bb1db0e18cbe7fa739415a24cbd95b2d1f5ae0c4/pyyaml_env_tag-0.1-py3-none-any.whl", hash = "sha256:af31106dec8a4d68c60207c1886031cbf839b68aa7abccdb19868200532c2069", size = 3911, upload-time = "2020-11-12T02:38:24.638Z" }, -] - [[package]] name = "pyyaml-env-tag" version = "1.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "pyyaml", marker = "python_full_version >= '3.9'" }, + { name = "pyyaml" }, ] sdist = { url = "https://files.pythonhosted.org/packages/eb/2e/79c822141bfd05a853236b504869ebc6b70159afc570e1d5a20641782eaa/pyyaml_env_tag-1.1.tar.gz", hash = "sha256:2eb38b75a2d21ee0475d6d97ec19c63287a7e140231e4214969d0eac923cd7ff", size = 5737, upload-time = "2025-05-13T15:24:01.64Z" } wheels = [ @@ -4819,15 +3006,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/64/39/dc2db178c26a42228c5ac94a9cc595030458aa64c8d796a7727947afbf55/pyzmq-27.0.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:20d5cb29e8c5f76a127c75b6e7a77e846bc4b655c373baa098c26a61b7ecd0ef", size = 1885199, upload-time = "2025-06-13T14:07:57.166Z" }, { url = "https://files.pythonhosted.org/packages/c7/21/dae7b06a1f8cdee5d8e7a63d99c5d129c401acc40410bef2cbf42025e26f/pyzmq-27.0.0-cp313-cp313t-win32.whl", hash = "sha256:a20528da85c7ac7a19b7384e8c3f8fa707841fd85afc4ed56eda59d93e3d98ad", size = 575439, upload-time = "2025-06-13T14:07:58.959Z" }, { url = "https://files.pythonhosted.org/packages/eb/bc/1709dc55f0970cf4cb8259e435e6773f9946f41a045c2cb90e870b7072da/pyzmq-27.0.0-cp313-cp313t-win_amd64.whl", hash = "sha256:d8229f2efece6a660ee211d74d91dbc2a76b95544d46c74c615e491900dc107f", size = 639933, upload-time = "2025-06-13T14:08:00.777Z" }, - { url = "https://files.pythonhosted.org/packages/f2/b3/22246a851440818b0d3e090374dcfa946df05d1a6aa04753c1766c658731/pyzmq-27.0.0-cp38-cp38-macosx_10_15_universal2.whl", hash = "sha256:f4162dbbd9c5c84fb930a36f290b08c93e35fce020d768a16fc8891a2f72bab8", size = 1331592, upload-time = "2025-06-13T14:08:02.158Z" }, - { url = "https://files.pythonhosted.org/packages/2e/3d/2117f17ab0df09746ae9c4206a7d6462a8c2c12e60ec17a9eb5b89163784/pyzmq-27.0.0-cp38-cp38-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:4e7d0a8d460fba526cc047333bdcbf172a159b8bd6be8c3eb63a416ff9ba1477", size = 906951, upload-time = "2025-06-13T14:08:04.064Z" }, - { url = "https://files.pythonhosted.org/packages/71/42/710a69e2080429379116e51b5171a3a0c49ca52e3baa32b90bfe9bf28bae/pyzmq-27.0.0-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:29f44e3c26b9783816ba9ce274110435d8f5b19bbd82f7a6c7612bb1452a3597", size = 863706, upload-time = "2025-06-13T14:08:06.005Z" }, - { url = "https://files.pythonhosted.org/packages/5a/19/dbff1b4a6aca1a83b0840f84c3ae926a19c0771b54e18a89683e1f0f74f0/pyzmq-27.0.0-cp38-cp38-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6e435540fa1da54667f0026cf1e8407fe6d8a11f1010b7f06b0b17214ebfcf5e", size = 668309, upload-time = "2025-06-13T14:08:07.811Z" }, - { url = "https://files.pythonhosted.org/packages/7b/b8/67762cafb1cd6c106e25c550e6e6d6f08b2c80817ebcd205a663c6537936/pyzmq-27.0.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:51f5726de3532b8222e569990c8aa34664faa97038304644679a51d906e60c6e", size = 1657313, upload-time = "2025-06-13T14:08:09.238Z" }, - { url = "https://files.pythonhosted.org/packages/77/55/6ba61edd52392bce073ba6887110c3312eaa76b5d06245db92f2c24718d2/pyzmq-27.0.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:42c7555123679637c99205b1aa9e8f7d90fe29d4c243c719e347d4852545216c", size = 2034552, upload-time = "2025-06-13T14:08:11.46Z" }, - { url = "https://files.pythonhosted.org/packages/41/49/6fa93097c8e8f44af6c06d5783a2f07fa33644bbd073b2c36347d094676e/pyzmq-27.0.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:a979b7cf9e33d86c4949df527a3018767e5f53bc3b02adf14d4d8db1db63ccc0", size = 1894114, upload-time = "2025-06-13T14:08:12.98Z" }, - { url = "https://files.pythonhosted.org/packages/a0/fa/967b2427bb0cadcc3a1530db2f88dfbfd46d781df2a386a096d7524df6cf/pyzmq-27.0.0-cp38-cp38-win32.whl", hash = "sha256:26b72c5ae20bf59061c3570db835edb81d1e0706ff141747055591c4b41193f8", size = 568222, upload-time = "2025-06-13T14:08:14.432Z" }, - { url = "https://files.pythonhosted.org/packages/b7/11/20bbfcc6395d5f2f5247aa88fef477f907f8139913666aec2a17af7ccaf1/pyzmq-27.0.0-cp38-cp38-win_amd64.whl", hash = "sha256:55a0155b148fe0428285a30922f7213539aa84329a5ad828bca4bbbc665c70a4", size = 629837, upload-time = "2025-06-13T14:08:15.818Z" }, { url = "https://files.pythonhosted.org/packages/19/dc/95210fe17e5d7dba89bd663e1d88f50a8003f296284731b09f1d95309a42/pyzmq-27.0.0-cp39-cp39-macosx_10_15_universal2.whl", hash = "sha256:100f6e5052ba42b2533011d34a018a5ace34f8cac67cb03cfa37c8bdae0ca617", size = 1330656, upload-time = "2025-06-13T14:08:17.414Z" }, { url = "https://files.pythonhosted.org/packages/d3/7e/63f742b578316258e03ecb393d35c0964348d80834bdec8a100ed7bb9c91/pyzmq-27.0.0-cp39-cp39-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:bf6c6b061efd00404b9750e2cfbd9507492c8d4b3721ded76cb03786131be2ed", size = 906522, upload-time = "2025-06-13T14:08:18.945Z" }, { url = "https://files.pythonhosted.org/packages/1f/bf/f0b2b67f5a9bfe0fbd0e978a2becd901f802306aa8e29161cb0963094352/pyzmq-27.0.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ee05728c0b0b2484a9fc20466fa776fffb65d95f7317a3419985b8c908563861", size = 863545, upload-time = "2025-06-13T14:08:20.386Z" }, @@ -4848,11 +3026,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ab/ba/64af397e0f421453dc68e31d5e0784d554bf39013a2de0872056e96e58af/pyzmq-27.0.0-pp311-pypy311_pp73-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:14fe7aaac86e4e93ea779a821967360c781d7ac5115b3f1a171ced77065a0174", size = 567400, upload-time = "2025-06-13T14:08:46.855Z" }, { url = "https://files.pythonhosted.org/packages/63/87/ec956cbe98809270b59a22891d5758edae147a258e658bf3024a8254c855/pyzmq-27.0.0-pp311-pypy311_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6ad0562d4e6abb785be3e4dd68599c41be821b521da38c402bc9ab2a8e7ebc7e", size = 747031, upload-time = "2025-06-13T14:08:48.419Z" }, { url = "https://files.pythonhosted.org/packages/be/8a/4a3764a68abc02e2fbb0668d225b6fda5cd39586dd099cee8b2ed6ab0452/pyzmq-27.0.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:9df43a2459cd3a3563404c1456b2c4c69564daa7dbaf15724c09821a3329ce46", size = 544726, upload-time = "2025-06-13T14:08:49.903Z" }, - { url = "https://files.pythonhosted.org/packages/2c/be/0351cdff40fb2edb27ee539927a33ac6e57eedc49c7df83ec12fc8af713d/pyzmq-27.0.0-pp38-pypy38_pp73-macosx_10_15_x86_64.whl", hash = "sha256:8c86ea8fe85e2eb0ffa00b53192c401477d5252f6dd1db2e2ed21c1c30d17e5e", size = 835930, upload-time = "2025-06-13T14:08:51.366Z" }, - { url = "https://files.pythonhosted.org/packages/0a/28/066bf1513ce1295d8c97b89cd6ef635d76dfef909678cca766491b5dc228/pyzmq-27.0.0-pp38-pypy38_pp73-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:c45fee3968834cd291a13da5fac128b696c9592a9493a0f7ce0b47fa03cc574d", size = 799870, upload-time = "2025-06-13T14:08:53.041Z" }, - { url = "https://files.pythonhosted.org/packages/56/0d/2987f3aaaf3fc46cf68a7dfdc162b97ab6d03c2c36ba1c7066cae1b802f1/pyzmq-27.0.0-pp38-pypy38_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:cae73bb6898c4e045fbed5024cb587e4110fddb66f6163bcab5f81f9d4b9c496", size = 758369, upload-time = "2025-06-13T14:08:54.579Z" }, - { url = "https://files.pythonhosted.org/packages/71/3f/b87443f4b9f9a6b5ac0fb50878272bdfc08ed620273098a6658290747d95/pyzmq-27.0.0-pp38-pypy38_pp73-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:26d542258c7a1f35a9cff3d887687d3235006134b0ac1c62a6fe1ad3ac10440e", size = 567393, upload-time = "2025-06-13T14:08:56.098Z" }, - { url = "https://files.pythonhosted.org/packages/bf/27/dad5a16cc1a94af54e5105ef9c1970bdea015aaed09b089ff95e6a4498fd/pyzmq-27.0.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:04cd50ef3b28e35ced65740fb9956a5b3f77a6ff32fcd887e3210433f437dd0f", size = 544723, upload-time = "2025-06-13T14:08:57.651Z" }, { url = "https://files.pythonhosted.org/packages/03/f6/11b2a6c8cd13275c31cddc3f89981a1b799a3c41dec55289fa18dede96b5/pyzmq-27.0.0-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:39ddd3ba0a641f01d8f13a3cfd4c4924eb58e660d8afe87e9061d6e8ca6f7ac3", size = 835944, upload-time = "2025-06-13T14:08:59.189Z" }, { url = "https://files.pythonhosted.org/packages/73/34/aa39076f4e07ae1912fa4b966fe24e831e01d736d4c1c7e8a3aa28a555b5/pyzmq-27.0.0-pp39-pypy39_pp73-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:8ca7e6a0388dd9e1180b14728051068f4efe83e0d2de058b5ff92c63f399a73f", size = 799869, upload-time = "2025-06-13T14:09:00.758Z" }, { url = "https://files.pythonhosted.org/packages/65/f3/81ed6b3dd242408ee79c0d8a88734644acf208baee8666ecd7e52664cf55/pyzmq-27.0.0-pp39-pypy39_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:2524c40891be6a3106885a3935d58452dd83eb7a5742a33cc780a1ad4c49dec0", size = 758371, upload-time = "2025-06-13T14:09:02.461Z" }, @@ -4860,93 +3033,28 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/51/8b/619a9ee2fa4d3c724fbadde946427735ade64da03894b071bbdc3b789d83/pyzmq-27.0.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:096af9e133fec3a72108ddefba1e42985cb3639e9de52cfd336b6fc23aa083e9", size = 544715, upload-time = "2025-06-13T14:09:05.579Z" }, ] -[[package]] -name = "readme-renderer" -version = "43.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "docutils", version = "0.20.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "nh3", marker = "python_full_version < '3.9'" }, - { name = "pygments", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/fe/b5/536c775084d239df6345dccf9b043419c7e3308bc31be4c7882196abc62e/readme_renderer-43.0.tar.gz", hash = "sha256:1818dd28140813509eeed8d62687f7cd4f7bad90d4db586001c5dc09d4fde311", size = 31768, upload-time = "2024-02-26T16:10:59.415Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/45/be/3ea20dc38b9db08387cf97997a85a7d51527ea2057d71118feb0aa8afa55/readme_renderer-43.0-py3-none-any.whl", hash = "sha256:19db308d86ecd60e5affa3b2a98f017af384678c63c88e5d4556a380e674f3f9", size = 13301, upload-time = "2024-02-26T16:10:57.945Z" }, -] - [[package]] name = "readme-renderer" version = "44.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "docutils", version = "0.21.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "nh3", marker = "python_full_version >= '3.9'" }, - { name = "pygments", marker = "python_full_version >= '3.9'" }, + { name = "docutils" }, + { name = "nh3" }, + { name = "pygments" }, ] sdist = { url = "https://files.pythonhosted.org/packages/5a/a9/104ec9234c8448c4379768221ea6df01260cd6c2ce13182d4eac531c8342/readme_renderer-44.0.tar.gz", hash = "sha256:8712034eabbfa6805cacf1402b4eeb2a73028f72d1166d6f5cb7f9c047c5d1e1", size = 32056, upload-time = "2024-07-08T15:00:57.805Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/e1/67/921ec3024056483db83953ae8e48079ad62b92db7880013ca77632921dd0/readme_renderer-44.0-py3-none-any.whl", hash = "sha256:2fbca89b81a08526aadf1357a8c2ae889ec05fb03f5da67f9769c9a592166151", size = 13310, upload-time = "2024-07-08T15:00:56.577Z" }, ] -[[package]] -name = "referencing" -version = "0.35.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "attrs", marker = "python_full_version < '3.9'" }, - { name = "rpds-py", version = "0.20.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/99/5b/73ca1f8e72fff6fa52119dbd185f73a907b1989428917b24cff660129b6d/referencing-0.35.1.tar.gz", hash = "sha256:25b42124a6c8b632a425174f24087783efb348a6f1e0008e63cd4466fedf703c", size = 62991, upload-time = "2024-05-01T20:26:04.574Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b7/59/2056f61236782a2c86b33906c025d4f4a0b17be0161b63b70fd9e8775d36/referencing-0.35.1-py3-none-any.whl", hash = "sha256:eda6d3234d62814d1c64e305c1331c9a3a6132da475ab6382eaa997b21ee75de", size = 26684, upload-time = "2024-05-01T20:26:02.078Z" }, -] - [[package]] name = "referencing" version = "0.36.2" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "attrs", marker = "python_full_version >= '3.9'" }, - { name = "rpds-py", version = "0.26.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9' and python_full_version < '3.13'" }, + { name = "attrs" }, + { name = "rpds-py" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/2f/db/98b5c277be99dd18bfd91dd04e1b759cad18d1a338188c936e92f921c7e2/referencing-0.36.2.tar.gz", hash = "sha256:df2e89862cd09deabbdba16944cc3f10feb6b3e6f18e902f7cc25609a34775aa", size = 74744, upload-time = "2025-01-25T08:48:16.138Z" } wheels = [ @@ -4961,8 +3069,7 @@ dependencies = [ { name = "certifi" }, { name = "charset-normalizer" }, { name = "idna" }, - { name = "urllib3", version = "2.2.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "urllib3", version = "2.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "urllib3" }, ] sdist = { url = "https://files.pythonhosted.org/packages/e1/0a/929373653770d8a0d7ea76c37de6e41f11eb07559b103b1c02cafb3f7cf8/requests-2.32.4.tar.gz", hash = "sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422", size = 135258, upload-time = "2025-06-09T16:43:07.34Z" } wheels = [ @@ -5018,147 +3125,17 @@ source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "markdown-it-py" }, { name = "pygments" }, - { name = "typing-extensions", version = "4.13.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, + { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/a1/53/830aa4c3066a8ab0ae9a9955976fb770fe9c6102117c8ec4ab3ea62d89e8/rich-14.0.0.tar.gz", hash = "sha256:82f1bc23a6a21ebca4ae0c45af9bdbc492ed20231dcb63f297d6d1021a9d5725", size = 224078, upload-time = "2025-03-30T14:15:14.23Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/0d/9b/63f4c7ebc259242c89b3acafdb37b41d1185c07ff0011164674e9076b491/rich-14.0.0-py3-none-any.whl", hash = "sha256:1c9491e1951aac09caffd42f448ee3d04e58923ffe14993f6e83068dc395d7e0", size = 243229, upload-time = "2025-03-30T14:15:12.283Z" }, ] -[[package]] -name = "rpds-py" -version = "0.20.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/25/cb/8e919951f55d109d658f81c9b49d0cc3b48637c50792c5d2e77032b8c5da/rpds_py-0.20.1.tar.gz", hash = "sha256:e1791c4aabd117653530dccd24108fa03cc6baf21f58b950d0a73c3b3b29a350", size = 25931, upload-time = "2024-10-31T14:30:20.522Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/ae/0e/d7e7e9280988a7bc56fd326042baca27f4f55fad27dc8aa64e5e0e894e5d/rpds_py-0.20.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:a649dfd735fff086e8a9d0503a9f0c7d01b7912a333c7ae77e1515c08c146dad", size = 327335, upload-time = "2024-10-31T14:26:20.076Z" }, - { url = "https://files.pythonhosted.org/packages/4c/72/027185f213d53ae66765c575229829b202fbacf3d55fe2bd9ff4e29bb157/rpds_py-0.20.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f16bc1334853e91ddaaa1217045dd7be166170beec337576818461268a3de67f", size = 318250, upload-time = "2024-10-31T14:26:22.17Z" }, - { url = "https://files.pythonhosted.org/packages/2b/e7/b4eb3e6ff541c83d3b46f45f855547e412ab60c45bef64520fafb00b9b42/rpds_py-0.20.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:14511a539afee6f9ab492b543060c7491c99924314977a55c98bfa2ee29ce78c", size = 361206, upload-time = "2024-10-31T14:26:24.746Z" }, - { url = "https://files.pythonhosted.org/packages/e7/80/cb9a4b4cad31bcaa37f38dae7a8be861f767eb2ca4f07a146b5ffcfbee09/rpds_py-0.20.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3ccb8ac2d3c71cda472b75af42818981bdacf48d2e21c36331b50b4f16930163", size = 369921, upload-time = "2024-10-31T14:26:28.137Z" }, - { url = "https://files.pythonhosted.org/packages/95/1b/463b11e7039e18f9e778568dbf7338c29bbc1f8996381115201c668eb8c8/rpds_py-0.20.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c142b88039b92e7e0cb2552e8967077e3179b22359e945574f5e2764c3953dcf", size = 403673, upload-time = "2024-10-31T14:26:31.42Z" }, - { url = "https://files.pythonhosted.org/packages/86/98/1ef4028e9d5b76470bf7f8f2459be07ac5c9621270a2a5e093f8d8a8cc2c/rpds_py-0.20.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f19169781dddae7478a32301b499b2858bc52fc45a112955e798ee307e294977", size = 430267, upload-time = "2024-10-31T14:26:33.148Z" }, - { url = "https://files.pythonhosted.org/packages/25/8e/41d7e3e6d3a4a6c94375020477705a3fbb6515717901ab8f94821cf0a0d9/rpds_py-0.20.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13c56de6518e14b9bf6edde23c4c39dac5b48dcf04160ea7bce8fca8397cdf86", size = 360569, upload-time = "2024-10-31T14:26:35.151Z" }, - { url = "https://files.pythonhosted.org/packages/4f/6a/8839340464d4e1bbfaf0482e9d9165a2309c2c17427e4dcb72ce3e5cc5d6/rpds_py-0.20.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:925d176a549f4832c6f69fa6026071294ab5910e82a0fe6c6228fce17b0706bd", size = 382584, upload-time = "2024-10-31T14:26:37.444Z" }, - { url = "https://files.pythonhosted.org/packages/64/96/7a7f938d3796a6a3ec08ed0e8a5ecd436fbd516a3684ab1fa22d46d6f6cc/rpds_py-0.20.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:78f0b6877bfce7a3d1ff150391354a410c55d3cdce386f862926a4958ad5ab7e", size = 546560, upload-time = "2024-10-31T14:26:40.679Z" }, - { url = "https://files.pythonhosted.org/packages/15/c7/19fb4f1247a3c90a99eca62909bf76ee988f9b663e47878a673d9854ec5c/rpds_py-0.20.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:3dd645e2b0dcb0fd05bf58e2e54c13875847687d0b71941ad2e757e5d89d4356", size = 549359, upload-time = "2024-10-31T14:26:42.71Z" }, - { url = "https://files.pythonhosted.org/packages/d2/4c/445eb597a39a883368ea2f341dd6e48a9d9681b12ebf32f38a827b30529b/rpds_py-0.20.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:4f676e21db2f8c72ff0936f895271e7a700aa1f8d31b40e4e43442ba94973899", size = 527567, upload-time = "2024-10-31T14:26:45.402Z" }, - { url = "https://files.pythonhosted.org/packages/4f/71/4c44643bffbcb37311fc7fe221bcf139c8d660bc78f746dd3a05741372c8/rpds_py-0.20.1-cp310-none-win32.whl", hash = "sha256:648386ddd1e19b4a6abab69139b002bc49ebf065b596119f8f37c38e9ecee8ff", size = 200412, upload-time = "2024-10-31T14:26:49.634Z" }, - { url = "https://files.pythonhosted.org/packages/f4/33/9d0529d74099e090ec9ab15eb0a049c56cca599eaaca71bfedbdbca656a9/rpds_py-0.20.1-cp310-none-win_amd64.whl", hash = "sha256:d9ecb51120de61e4604650666d1f2b68444d46ae18fd492245a08f53ad2b7711", size = 218563, upload-time = "2024-10-31T14:26:51.639Z" }, - { url = "https://files.pythonhosted.org/packages/a0/2e/a6ded84019a05b8f23e0fe6a632f62ae438a8c5e5932d3dfc90c73418414/rpds_py-0.20.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:762703bdd2b30983c1d9e62b4c88664df4a8a4d5ec0e9253b0231171f18f6d75", size = 327194, upload-time = "2024-10-31T14:26:54.135Z" }, - { url = "https://files.pythonhosted.org/packages/68/11/d3f84c69de2b2086be3d6bd5e9d172825c096b13842ab7e5f8f39f06035b/rpds_py-0.20.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0b581f47257a9fce535c4567782a8976002d6b8afa2c39ff616edf87cbeff712", size = 318126, upload-time = "2024-10-31T14:26:56.089Z" }, - { url = "https://files.pythonhosted.org/packages/18/c0/13f1bce9c901511e5e4c0b77a99dbb946bb9a177ca88c6b480e9cb53e304/rpds_py-0.20.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:842c19a6ce894493563c3bd00d81d5100e8e57d70209e84d5491940fdb8b9e3a", size = 361119, upload-time = "2024-10-31T14:26:58.354Z" }, - { url = "https://files.pythonhosted.org/packages/06/31/3bd721575671f22a37476c2d7b9e34bfa5185bdcee09f7fedde3b29f3adb/rpds_py-0.20.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:42cbde7789f5c0bcd6816cb29808e36c01b960fb5d29f11e052215aa85497c93", size = 369532, upload-time = "2024-10-31T14:27:00.155Z" }, - { url = "https://files.pythonhosted.org/packages/20/22/3eeb0385f33251b4fd0f728e6a3801dc8acc05e714eb7867cefe635bf4ab/rpds_py-0.20.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6c8e9340ce5a52f95fa7d3b552b35c7e8f3874d74a03a8a69279fd5fca5dc751", size = 403703, upload-time = "2024-10-31T14:27:02.072Z" }, - { url = "https://files.pythonhosted.org/packages/10/e1/8dde6174e7ac5b9acd3269afca2e17719bc7e5088c68f44874d2ad9e4560/rpds_py-0.20.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8ba6f89cac95c0900d932c9efb7f0fb6ca47f6687feec41abcb1bd5e2bd45535", size = 429868, upload-time = "2024-10-31T14:27:04.453Z" }, - { url = "https://files.pythonhosted.org/packages/19/51/a3cc1a5238acfc2582033e8934d034301f9d4931b9bf7c7ccfabc4ca0880/rpds_py-0.20.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a916087371afd9648e1962e67403c53f9c49ca47b9680adbeef79da3a7811b0", size = 360539, upload-time = "2024-10-31T14:27:07.048Z" }, - { url = "https://files.pythonhosted.org/packages/cd/8c/3c87471a44bd4114e2b0aec90f298f6caaac4e8db6af904d5dd2279f5c61/rpds_py-0.20.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:200a23239781f46149e6a415f1e870c5ef1e712939fe8fa63035cd053ac2638e", size = 382467, upload-time = "2024-10-31T14:27:08.647Z" }, - { url = "https://files.pythonhosted.org/packages/d0/9b/95073fe3e0f130e6d561e106818b6568ef1f2df3352e7f162ab912da837c/rpds_py-0.20.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:58b1d5dd591973d426cbb2da5e27ba0339209832b2f3315928c9790e13f159e8", size = 546669, upload-time = "2024-10-31T14:27:10.626Z" }, - { url = "https://files.pythonhosted.org/packages/de/4c/7ab3669e02bb06fedebcfd64d361b7168ba39dfdf385e4109440f2e7927b/rpds_py-0.20.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:6b73c67850ca7cae0f6c56f71e356d7e9fa25958d3e18a64927c2d930859b8e4", size = 549304, upload-time = "2024-10-31T14:27:14.114Z" }, - { url = "https://files.pythonhosted.org/packages/f1/e8/ad5da336cd42adbdafe0ecd40dcecdae01fd3d703c621c7637615a008d3a/rpds_py-0.20.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:d8761c3c891cc51e90bc9926d6d2f59b27beaf86c74622c8979380a29cc23ac3", size = 527637, upload-time = "2024-10-31T14:27:15.887Z" }, - { url = "https://files.pythonhosted.org/packages/02/f1/1b47b9e5b941c2659c9b7e4ef41b6f07385a6500c638fa10c066e4616ecb/rpds_py-0.20.1-cp311-none-win32.whl", hash = "sha256:cd945871335a639275eee904caef90041568ce3b42f402c6959b460d25ae8732", size = 200488, upload-time = "2024-10-31T14:27:18.666Z" }, - { url = "https://files.pythonhosted.org/packages/85/f6/c751c1adfa31610055acfa1cc667cf2c2d7011a73070679c448cf5856905/rpds_py-0.20.1-cp311-none-win_amd64.whl", hash = "sha256:7e21b7031e17c6b0e445f42ccc77f79a97e2687023c5746bfb7a9e45e0921b84", size = 218475, upload-time = "2024-10-31T14:27:20.13Z" }, - { url = "https://files.pythonhosted.org/packages/e7/10/4e8dcc08b58a548098dbcee67a4888751a25be7a6dde0a83d4300df48bfa/rpds_py-0.20.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:36785be22066966a27348444b40389f8444671630063edfb1a2eb04318721e17", size = 329749, upload-time = "2024-10-31T14:27:21.968Z" }, - { url = "https://files.pythonhosted.org/packages/d2/e4/61144f3790e12fd89e6153d77f7915ad26779735fef8ee9c099cba6dfb4a/rpds_py-0.20.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:142c0a5124d9bd0e2976089484af5c74f47bd3298f2ed651ef54ea728d2ea42c", size = 321032, upload-time = "2024-10-31T14:27:24.397Z" }, - { url = "https://files.pythonhosted.org/packages/fa/e0/99205aabbf3be29ef6c58ef9b08feed51ba6532fdd47461245cb58dd9897/rpds_py-0.20.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dbddc10776ca7ebf2a299c41a4dde8ea0d8e3547bfd731cb87af2e8f5bf8962d", size = 363931, upload-time = "2024-10-31T14:27:26.05Z" }, - { url = "https://files.pythonhosted.org/packages/ac/bd/bce2dddb518b13a7e77eed4be234c9af0c9c6d403d01c5e6ae8eb447ab62/rpds_py-0.20.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:15a842bb369e00295392e7ce192de9dcbf136954614124a667f9f9f17d6a216f", size = 373343, upload-time = "2024-10-31T14:27:27.864Z" }, - { url = "https://files.pythonhosted.org/packages/43/15/112b7c553066cb91264691ba7fb119579c440a0ae889da222fa6fc0d411a/rpds_py-0.20.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:be5ef2f1fc586a7372bfc355986226484e06d1dc4f9402539872c8bb99e34b01", size = 406304, upload-time = "2024-10-31T14:27:29.776Z" }, - { url = "https://files.pythonhosted.org/packages/af/8d/2da52aef8ae5494a382b0c0025ba5b68f2952db0f2a4c7534580e8ca83cc/rpds_py-0.20.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dbcf360c9e3399b056a238523146ea77eeb2a596ce263b8814c900263e46031a", size = 423022, upload-time = "2024-10-31T14:27:31.547Z" }, - { url = "https://files.pythonhosted.org/packages/c8/1b/f23015cb293927c93bdb4b94a48bfe77ad9d57359c75db51f0ff0cf482ff/rpds_py-0.20.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ecd27a66740ffd621d20b9a2f2b5ee4129a56e27bfb9458a3bcc2e45794c96cb", size = 364937, upload-time = "2024-10-31T14:27:33.447Z" }, - { url = "https://files.pythonhosted.org/packages/7b/8b/6da8636b2ea2e2f709e56656e663b6a71ecd9a9f9d9dc21488aade122026/rpds_py-0.20.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d0b937b2a1988f184a3e9e577adaa8aede21ec0b38320d6009e02bd026db04fa", size = 386301, upload-time = "2024-10-31T14:27:35.8Z" }, - { url = "https://files.pythonhosted.org/packages/20/af/2ae192797bffd0d6d558145b5a36e7245346ff3e44f6ddcb82f0eb8512d4/rpds_py-0.20.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6889469bfdc1eddf489729b471303739bf04555bb151fe8875931f8564309afc", size = 549452, upload-time = "2024-10-31T14:27:38.316Z" }, - { url = "https://files.pythonhosted.org/packages/07/dd/9f6520712a5108cd7d407c9db44a3d59011b385c58e320d58ebf67757a9e/rpds_py-0.20.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:19b73643c802f4eaf13d97f7855d0fb527fbc92ab7013c4ad0e13a6ae0ed23bd", size = 554370, upload-time = "2024-10-31T14:27:40.111Z" }, - { url = "https://files.pythonhosted.org/packages/5e/0e/b1bdc7ea0db0946d640ab8965146099093391bb5d265832994c47461e3c5/rpds_py-0.20.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3c6afcf2338e7f374e8edc765c79fbcb4061d02b15dd5f8f314a4af2bdc7feb5", size = 530940, upload-time = "2024-10-31T14:27:42.074Z" }, - { url = "https://files.pythonhosted.org/packages/ae/d3/ffe907084299484fab60a7955f7c0e8a295c04249090218c59437010f9f4/rpds_py-0.20.1-cp312-none-win32.whl", hash = "sha256:dc73505153798c6f74854aba69cc75953888cf9866465196889c7cdd351e720c", size = 203164, upload-time = "2024-10-31T14:27:44.578Z" }, - { url = "https://files.pythonhosted.org/packages/1f/ba/9cbb57423c4bfbd81c473913bebaed151ad4158ee2590a4e4b3e70238b48/rpds_py-0.20.1-cp312-none-win_amd64.whl", hash = "sha256:8bbe951244a838a51289ee53a6bae3a07f26d4e179b96fc7ddd3301caf0518eb", size = 220750, upload-time = "2024-10-31T14:27:46.411Z" }, - { url = "https://files.pythonhosted.org/packages/b5/01/fee2e1d1274c92fff04aa47d805a28d62c2aa971d1f49f5baea1c6e670d9/rpds_py-0.20.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:6ca91093a4a8da4afae7fe6a222c3b53ee4eef433ebfee4d54978a103435159e", size = 329359, upload-time = "2024-10-31T14:27:48.866Z" }, - { url = "https://files.pythonhosted.org/packages/b0/cf/4aeffb02b7090029d7aeecbffb9a10e1c80f6f56d7e9a30e15481dc4099c/rpds_py-0.20.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:b9c2fe36d1f758b28121bef29ed1dee9b7a2453e997528e7d1ac99b94892527c", size = 320543, upload-time = "2024-10-31T14:27:51.354Z" }, - { url = "https://files.pythonhosted.org/packages/17/69/85cf3429e9ccda684ba63ff36b5866d5f9451e921cc99819341e19880334/rpds_py-0.20.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f009c69bc8c53db5dfab72ac760895dc1f2bc1b62ab7408b253c8d1ec52459fc", size = 363107, upload-time = "2024-10-31T14:27:53.196Z" }, - { url = "https://files.pythonhosted.org/packages/ef/de/7df88dea9c3eeb832196d23b41f0f6fc5f9a2ee9b2080bbb1db8731ead9c/rpds_py-0.20.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:6740a3e8d43a32629bb9b009017ea5b9e713b7210ba48ac8d4cb6d99d86c8ee8", size = 372027, upload-time = "2024-10-31T14:27:55.244Z" }, - { url = "https://files.pythonhosted.org/packages/d1/b8/88675399d2038580743c570a809c43a900e7090edc6553f8ffb66b23c965/rpds_py-0.20.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:32b922e13d4c0080d03e7b62991ad7f5007d9cd74e239c4b16bc85ae8b70252d", size = 405031, upload-time = "2024-10-31T14:27:57.688Z" }, - { url = "https://files.pythonhosted.org/packages/e1/aa/cca639f6d17caf00bab51bdc70fcc0bdda3063e5662665c4fdf60443c474/rpds_py-0.20.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:fe00a9057d100e69b4ae4a094203a708d65b0f345ed546fdef86498bf5390982", size = 422271, upload-time = "2024-10-31T14:27:59.526Z" }, - { url = "https://files.pythonhosted.org/packages/c4/07/bf8a949d2ec4626c285579c9d6b356c692325f1a4126e947736b416e1fc4/rpds_py-0.20.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:49fe9b04b6fa685bd39237d45fad89ba19e9163a1ccaa16611a812e682913496", size = 363625, upload-time = "2024-10-31T14:28:01.915Z" }, - { url = "https://files.pythonhosted.org/packages/11/f0/06675c6a58d6ce34547879138810eb9aab0c10e5607ea6c2e4dc56b703c8/rpds_py-0.20.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:aa7ac11e294304e615b43f8c441fee5d40094275ed7311f3420d805fde9b07b4", size = 385906, upload-time = "2024-10-31T14:28:03.796Z" }, - { url = "https://files.pythonhosted.org/packages/bf/ac/2d1f50374eb8e41030fad4e87f81751e1c39e3b5d4bee8c5618830d8a6ac/rpds_py-0.20.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:6aa97af1558a9bef4025f8f5d8c60d712e0a3b13a2fe875511defc6ee77a1ab7", size = 549021, upload-time = "2024-10-31T14:28:05.704Z" }, - { url = "https://files.pythonhosted.org/packages/f7/d4/a7d70a7cc71df772eeadf4bce05e32e780a9fe44a511a5b091c7a85cb767/rpds_py-0.20.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:483b29f6f7ffa6af845107d4efe2e3fa8fb2693de8657bc1849f674296ff6a5a", size = 553800, upload-time = "2024-10-31T14:28:07.684Z" }, - { url = "https://files.pythonhosted.org/packages/87/81/dc30bc449ccba63ad23a0f6633486d4e0e6955f45f3715a130dacabd6ad0/rpds_py-0.20.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:37fe0f12aebb6a0e3e17bb4cd356b1286d2d18d2e93b2d39fe647138458b4bcb", size = 531076, upload-time = "2024-10-31T14:28:10.545Z" }, - { url = "https://files.pythonhosted.org/packages/50/80/fb62ab48f3b5cfe704ead6ad372da1922ddaa76397055e02eb507054c979/rpds_py-0.20.1-cp313-none-win32.whl", hash = "sha256:a624cc00ef2158e04188df5e3016385b9353638139a06fb77057b3498f794782", size = 202804, upload-time = "2024-10-31T14:28:12.877Z" }, - { url = "https://files.pythonhosted.org/packages/d9/30/a3391e76d0b3313f33bdedd394a519decae3a953d2943e3dabf80ae32447/rpds_py-0.20.1-cp313-none-win_amd64.whl", hash = "sha256:b71b8666eeea69d6363248822078c075bac6ed135faa9216aa85f295ff009b1e", size = 220502, upload-time = "2024-10-31T14:28:14.597Z" }, - { url = "https://files.pythonhosted.org/packages/53/ef/b1883734ea0cd9996de793cdc38c32a28143b04911d1e570090acd8a9162/rpds_py-0.20.1-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:5b48e790e0355865197ad0aca8cde3d8ede347831e1959e158369eb3493d2191", size = 327757, upload-time = "2024-10-31T14:28:16.323Z" }, - { url = "https://files.pythonhosted.org/packages/54/63/47d34dc4ddb3da73e78e10c9009dcf8edc42d355a221351c05c822c2a50b/rpds_py-0.20.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:3e310838a5801795207c66c73ea903deda321e6146d6f282e85fa7e3e4854804", size = 318785, upload-time = "2024-10-31T14:28:18.381Z" }, - { url = "https://files.pythonhosted.org/packages/f7/e1/d6323be4afbe3013f28725553b7bfa80b3f013f91678af258f579f8ea8f9/rpds_py-0.20.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2249280b870e6a42c0d972339e9cc22ee98730a99cd7f2f727549af80dd5a963", size = 361511, upload-time = "2024-10-31T14:28:20.292Z" }, - { url = "https://files.pythonhosted.org/packages/ab/d3/c40e4d9ecd571f0f50fe69bc53fe608d7b2c49b30738b480044990260838/rpds_py-0.20.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e79059d67bea28b53d255c1437b25391653263f0e69cd7dec170d778fdbca95e", size = 370201, upload-time = "2024-10-31T14:28:22.314Z" }, - { url = "https://files.pythonhosted.org/packages/f1/b6/96a4a9977a8a06c2c49d90aa571346aff1642abf15066a39a0b4817bf049/rpds_py-0.20.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2b431c777c9653e569986ecf69ff4a5dba281cded16043d348bf9ba505486f36", size = 403866, upload-time = "2024-10-31T14:28:24.135Z" }, - { url = "https://files.pythonhosted.org/packages/cd/8f/702b52287949314b498a311f92b5ee0ba30c702a27e0e6b560e2da43b8d5/rpds_py-0.20.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:da584ff96ec95e97925174eb8237e32f626e7a1a97888cdd27ee2f1f24dd0ad8", size = 430163, upload-time = "2024-10-31T14:28:26.021Z" }, - { url = "https://files.pythonhosted.org/packages/c4/ce/af016c81fda833bf125b20d1677d816f230cad2ab189f46bcbfea3c7a375/rpds_py-0.20.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:02a0629ec053fc013808a85178524e3cb63a61dbc35b22499870194a63578fb9", size = 360776, upload-time = "2024-10-31T14:28:27.852Z" }, - { url = "https://files.pythonhosted.org/packages/08/a7/988e179c9bef55821abe41762228d65077e0570ca75c9efbcd1bc6e263b4/rpds_py-0.20.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:fbf15aff64a163db29a91ed0868af181d6f68ec1a3a7d5afcfe4501252840bad", size = 383008, upload-time = "2024-10-31T14:28:30.029Z" }, - { url = "https://files.pythonhosted.org/packages/96/b0/e4077f7f1b9622112ae83254aedfb691490278793299bc06dcf54ec8c8e4/rpds_py-0.20.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:07924c1b938798797d60c6308fa8ad3b3f0201802f82e4a2c41bb3fafb44cc28", size = 546371, upload-time = "2024-10-31T14:28:33.062Z" }, - { url = "https://files.pythonhosted.org/packages/e4/5e/1d4dd08ec0352cfe516ea93ea1993c2f656f893c87dafcd9312bd07f65f7/rpds_py-0.20.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:4a5a844f68776a7715ecb30843b453f07ac89bad393431efbf7accca3ef599c1", size = 549809, upload-time = "2024-10-31T14:28:35.285Z" }, - { url = "https://files.pythonhosted.org/packages/57/ac/a716b4729ff23ec034b7d2ff76a86e6f0753c4098401bdfdf55b2efe90e6/rpds_py-0.20.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:518d2ca43c358929bf08f9079b617f1c2ca6e8848f83c1225c88caeac46e6cbc", size = 528492, upload-time = "2024-10-31T14:28:37.516Z" }, - { url = "https://files.pythonhosted.org/packages/e0/ed/a0b58a9ecef79918169eacdabd14eb4c5c86ce71184ed56b80c6eb425828/rpds_py-0.20.1-cp38-none-win32.whl", hash = "sha256:3aea7eed3e55119635a74bbeb80b35e776bafccb70d97e8ff838816c124539f1", size = 200512, upload-time = "2024-10-31T14:28:39.484Z" }, - { url = "https://files.pythonhosted.org/packages/5f/c3/222e25124283afc76c473fcd2c547e82ec57683fa31cb4d6c6eb44e5d57a/rpds_py-0.20.1-cp38-none-win_amd64.whl", hash = "sha256:7dca7081e9a0c3b6490a145593f6fe3173a94197f2cb9891183ef75e9d64c425", size = 218627, upload-time = "2024-10-31T14:28:41.479Z" }, - { url = "https://files.pythonhosted.org/packages/d6/87/e7e0fcbfdc0d0e261534bcc885f6ae6253095b972e32f8b8b1278c78a2a9/rpds_py-0.20.1-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:b41b6321805c472f66990c2849e152aff7bc359eb92f781e3f606609eac877ad", size = 327867, upload-time = "2024-10-31T14:28:44.167Z" }, - { url = "https://files.pythonhosted.org/packages/93/a0/17836b7961fc82586e9b818abdee2a27e2e605a602bb8c0d43f02092f8c2/rpds_py-0.20.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0a90c373ea2975519b58dece25853dbcb9779b05cc46b4819cb1917e3b3215b6", size = 318893, upload-time = "2024-10-31T14:28:46.753Z" }, - { url = "https://files.pythonhosted.org/packages/dc/03/deb81d8ea3a8b974e7b03cfe8c8c26616ef8f4980dd430d8dd0a2f1b4d8e/rpds_py-0.20.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:16d4477bcb9fbbd7b5b0e4a5d9b493e42026c0bf1f06f723a9353f5153e75d30", size = 361664, upload-time = "2024-10-31T14:28:49.782Z" }, - { url = "https://files.pythonhosted.org/packages/16/49/d9938603731745c7b6babff97ca61ff3eb4619e7128b5ab0111ad4e91d6d/rpds_py-0.20.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:84b8382a90539910b53a6307f7c35697bc7e6ffb25d9c1d4e998a13e842a5e83", size = 369796, upload-time = "2024-10-31T14:28:52.263Z" }, - { url = "https://files.pythonhosted.org/packages/87/d2/480b36c69cdc373853401b6aab6a281cf60f6d72b1545d82c0d23d9dd77c/rpds_py-0.20.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4888e117dd41b9d34194d9e31631af70d3d526efc363085e3089ab1a62c32ed1", size = 403860, upload-time = "2024-10-31T14:28:54.388Z" }, - { url = "https://files.pythonhosted.org/packages/31/7c/f6d909cb57761293308dbef14f1663d84376f2e231892a10aafc57b42037/rpds_py-0.20.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5265505b3d61a0f56618c9b941dc54dc334dc6e660f1592d112cd103d914a6db", size = 430793, upload-time = "2024-10-31T14:28:56.811Z" }, - { url = "https://files.pythonhosted.org/packages/d4/62/c9bd294c4b5f84d9cc2c387b548ae53096ad7e71ac5b02b6310e9dc85aa4/rpds_py-0.20.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e75ba609dba23f2c95b776efb9dd3f0b78a76a151e96f96cc5b6b1b0004de66f", size = 360927, upload-time = "2024-10-31T14:28:58.868Z" }, - { url = "https://files.pythonhosted.org/packages/c1/a7/15d927d83a44da8307a432b1cac06284b6657706d099a98cc99fec34ad51/rpds_py-0.20.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1791ff70bc975b098fe6ecf04356a10e9e2bd7dc21fa7351c1742fdeb9b4966f", size = 382660, upload-time = "2024-10-31T14:29:01.261Z" }, - { url = "https://files.pythonhosted.org/packages/4c/28/0630719c18456238bb07d59c4302fed50a13aa8035ec23dbfa80d116f9bc/rpds_py-0.20.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:d126b52e4a473d40232ec2052a8b232270ed1f8c9571aaf33f73a14cc298c24f", size = 546888, upload-time = "2024-10-31T14:29:03.923Z" }, - { url = "https://files.pythonhosted.org/packages/b9/75/3c9bda11b9c15d680b315f898af23825159314d4b56568f24b53ace8afcd/rpds_py-0.20.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:c14937af98c4cc362a1d4374806204dd51b1e12dded1ae30645c298e5a5c4cb1", size = 550088, upload-time = "2024-10-31T14:29:07.107Z" }, - { url = "https://files.pythonhosted.org/packages/70/f1/8fe7d04c194218171220a412057429defa9e2da785de0777c4d39309337e/rpds_py-0.20.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:3d089d0b88996df627693639d123c8158cff41c0651f646cd8fd292c7da90eaf", size = 528270, upload-time = "2024-10-31T14:29:09.933Z" }, - { url = "https://files.pythonhosted.org/packages/d6/62/41b0020f4b00af042b008e679dbe25a2f5bce655139a81f8b812f9068e52/rpds_py-0.20.1-cp39-none-win32.whl", hash = "sha256:653647b8838cf83b2e7e6a0364f49af96deec64d2a6578324db58380cff82aca", size = 200658, upload-time = "2024-10-31T14:29:12.234Z" }, - { url = "https://files.pythonhosted.org/packages/05/01/e64bb8889f2dcc951e53de33d8b8070456397ae4e10edc35e6cb9908f5c8/rpds_py-0.20.1-cp39-none-win_amd64.whl", hash = "sha256:fa41a64ac5b08b292906e248549ab48b69c5428f3987b09689ab2441f267d04d", size = 218883, upload-time = "2024-10-31T14:29:14.846Z" }, - { url = "https://files.pythonhosted.org/packages/b6/fa/7959429e69569d0f6e7d27f80451402da0409349dd2b07f6bcbdd5fad2d3/rpds_py-0.20.1-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:7a07ced2b22f0cf0b55a6a510078174c31b6d8544f3bc00c2bcee52b3d613f74", size = 328209, upload-time = "2024-10-31T14:29:17.44Z" }, - { url = "https://files.pythonhosted.org/packages/25/97/5dfdb091c30267ff404d2fd9e70c7a6d6ffc65ca77fffe9456e13b719066/rpds_py-0.20.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:68cb0a499f2c4a088fd2f521453e22ed3527154136a855c62e148b7883b99f9a", size = 319499, upload-time = "2024-10-31T14:29:19.527Z" }, - { url = "https://files.pythonhosted.org/packages/7c/98/cf2608722400f5f9bb4c82aa5ac09026f3ac2ebea9d4059d3533589ed0b6/rpds_py-0.20.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fa3060d885657abc549b2a0f8e1b79699290e5d83845141717c6c90c2df38311", size = 361795, upload-time = "2024-10-31T14:29:22.395Z" }, - { url = "https://files.pythonhosted.org/packages/89/de/0e13dd43c785c60e63933e96fbddda0b019df6862f4d3019bb49c3861131/rpds_py-0.20.1-pp310-pypy310_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:95f3b65d2392e1c5cec27cff08fdc0080270d5a1a4b2ea1d51d5f4a2620ff08d", size = 370604, upload-time = "2024-10-31T14:29:25.552Z" }, - { url = "https://files.pythonhosted.org/packages/8a/fc/fe3c83c77f82b8059eeec4e998064913d66212b69b3653df48f58ad33d3d/rpds_py-0.20.1-pp310-pypy310_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2cc3712a4b0b76a1d45a9302dd2f53ff339614b1c29603a911318f2357b04dd2", size = 404177, upload-time = "2024-10-31T14:29:27.82Z" }, - { url = "https://files.pythonhosted.org/packages/94/30/5189518bfb80a41f664daf32b46645c7fbdcc89028a0f1bfa82e806e0fbb/rpds_py-0.20.1-pp310-pypy310_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5d4eea0761e37485c9b81400437adb11c40e13ef513375bbd6973e34100aeb06", size = 430108, upload-time = "2024-10-31T14:29:30.768Z" }, - { url = "https://files.pythonhosted.org/packages/67/0e/6f069feaff5c298375cd8c55e00ecd9bd79c792ce0893d39448dc0097857/rpds_py-0.20.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7f5179583d7a6cdb981151dd349786cbc318bab54963a192692d945dd3f6435d", size = 361184, upload-time = "2024-10-31T14:29:32.993Z" }, - { url = "https://files.pythonhosted.org/packages/27/9f/ce3e2ae36f392c3ef1988c06e9e0b4c74f64267dad7c223003c34da11adb/rpds_py-0.20.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2fbb0ffc754490aff6dabbf28064be47f0f9ca0b9755976f945214965b3ace7e", size = 384140, upload-time = "2024-10-31T14:29:35.356Z" }, - { url = "https://files.pythonhosted.org/packages/5f/d5/89d44504d0bc7a1135062cb520a17903ff002f458371b8d9160af3b71e52/rpds_py-0.20.1-pp310-pypy310_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:a94e52537a0e0a85429eda9e49f272ada715506d3b2431f64b8a3e34eb5f3e75", size = 546589, upload-time = "2024-10-31T14:29:37.711Z" }, - { url = "https://files.pythonhosted.org/packages/8f/8f/e1c2db4fcca3947d9a28ec9553700b4dc8038f0eff575f579e75885b0661/rpds_py-0.20.1-pp310-pypy310_pp73-musllinux_1_2_i686.whl", hash = "sha256:92b68b79c0da2a980b1c4197e56ac3dd0c8a149b4603747c4378914a68706979", size = 550059, upload-time = "2024-10-31T14:29:40.342Z" }, - { url = "https://files.pythonhosted.org/packages/67/29/00a9e986df36721b5def82fff60995c1ee8827a7d909a6ec8929fb4cc668/rpds_py-0.20.1-pp310-pypy310_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:93da1d3db08a827eda74356f9f58884adb254e59b6664f64cc04cdff2cc19b0d", size = 529131, upload-time = "2024-10-31T14:29:42.993Z" }, - { url = "https://files.pythonhosted.org/packages/a3/32/95364440560ec476b19c6a2704259e710c223bf767632ebaa72cc2a1760f/rpds_py-0.20.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:754bbed1a4ca48479e9d4182a561d001bbf81543876cdded6f695ec3d465846b", size = 219677, upload-time = "2024-10-31T14:29:45.332Z" }, - { url = "https://files.pythonhosted.org/packages/ed/bf/ad8492e972c90a3d48a38e2b5095c51a8399d5b57e83f2d5d1649490f72b/rpds_py-0.20.1-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:ca449520e7484534a2a44faf629362cae62b660601432d04c482283c47eaebab", size = 328046, upload-time = "2024-10-31T14:29:48.968Z" }, - { url = "https://files.pythonhosted.org/packages/75/fd/84f42386165d6d555acb76c6d39c90b10c9dcf25116daf4f48a0a9d6867a/rpds_py-0.20.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:9c4cb04a16b0f199a8c9bf807269b2f63b7b5b11425e4a6bd44bd6961d28282c", size = 319306, upload-time = "2024-10-31T14:29:51.212Z" }, - { url = "https://files.pythonhosted.org/packages/6c/8a/abcd5119a0573f9588ad71a3fde3c07ddd1d1393cfee15a6ba7495c256f1/rpds_py-0.20.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bb63804105143c7e24cee7db89e37cb3f3941f8e80c4379a0b355c52a52b6780", size = 362558, upload-time = "2024-10-31T14:29:53.551Z" }, - { url = "https://files.pythonhosted.org/packages/9d/65/1c2bb10afd4bd32800227a658ae9097bc1d08a4e5048a57a9bd2efdf6306/rpds_py-0.20.1-pp39-pypy39_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:55cd1fa4ecfa6d9f14fbd97ac24803e6f73e897c738f771a9fe038f2f11ff07c", size = 370811, upload-time = "2024-10-31T14:29:56.672Z" }, - { url = "https://files.pythonhosted.org/packages/6c/ee/f4bab2b9e51ced30351cfd210647885391463ae682028c79760e7db28e4e/rpds_py-0.20.1-pp39-pypy39_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0f8f741b6292c86059ed175d80eefa80997125b7c478fb8769fd9ac8943a16c0", size = 404660, upload-time = "2024-10-31T14:29:59.276Z" }, - { url = "https://files.pythonhosted.org/packages/48/0f/9d04d0939682f0c97be827fc51ff986555ffb573e6781bd5132441f0ce25/rpds_py-0.20.1-pp39-pypy39_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0fc212779bf8411667234b3cdd34d53de6c2b8b8b958e1e12cb473a5f367c338", size = 430490, upload-time = "2024-10-31T14:30:01.543Z" }, - { url = "https://files.pythonhosted.org/packages/0d/f2/e9b90fd8416d59941b6a12f2c2e1d898b63fd092f5a7a6f98236cb865764/rpds_py-0.20.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0ad56edabcdb428c2e33bbf24f255fe2b43253b7d13a2cdbf05de955217313e6", size = 361448, upload-time = "2024-10-31T14:30:04.294Z" }, - { url = "https://files.pythonhosted.org/packages/0b/83/1cc776dce7bedb17d6f4ea62eafccee8a57a4678f4fac414ab69fb9b6b0b/rpds_py-0.20.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:0a3a1e9ee9728b2c1734f65d6a1d376c6f2f6fdcc13bb007a08cc4b1ff576dc5", size = 383681, upload-time = "2024-10-31T14:30:07.717Z" }, - { url = "https://files.pythonhosted.org/packages/17/5c/e0cdd6b0a8373fdef3667af2778dd9ff3abf1bbb9c7bd92c603c91440eb0/rpds_py-0.20.1-pp39-pypy39_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:e13de156137b7095442b288e72f33503a469aa1980ed856b43c353ac86390519", size = 546203, upload-time = "2024-10-31T14:30:10.156Z" }, - { url = "https://files.pythonhosted.org/packages/1b/a8/81fc9cbc01e7ef6d10652aedc1de4e8473934773e2808ba49094e03575df/rpds_py-0.20.1-pp39-pypy39_pp73-musllinux_1_2_i686.whl", hash = "sha256:07f59760ef99f31422c49038964b31c4dfcfeb5d2384ebfc71058a7c9adae2d2", size = 549855, upload-time = "2024-10-31T14:30:13.691Z" }, - { url = "https://files.pythonhosted.org/packages/b3/87/99648693d3c1bbce088119bc61ecaab62e5f9c713894edc604ffeca5ae88/rpds_py-0.20.1-pp39-pypy39_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:59240685e7da61fb78f65a9f07f8108e36a83317c53f7b276b4175dc44151684", size = 528625, upload-time = "2024-10-31T14:30:16.191Z" }, - { url = "https://files.pythonhosted.org/packages/05/c3/10c68a08849f1fa45d205e54141fa75d316013e3d701ef01770ee1220bb8/rpds_py-0.20.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:83cba698cfb3c2c5a7c3c6bac12fe6c6a51aae69513726be6411076185a8b24a", size = 219991, upload-time = "2024-10-31T14:30:18.49Z" }, -] - [[package]] name = "rpds-py" version = "0.26.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/a5/aa/4456d84bbb54adc6a916fb10c9b374f78ac840337644e4a5eda229c81275/rpds_py-0.26.0.tar.gz", hash = "sha256:20dae58a859b0906f0685642e591056f1e787f3a8b39c8e8749a45dc7d26bdb0", size = 27385, upload-time = "2025-07-01T15:57:13.958Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/b9/31/1459645f036c3dfeacef89e8e5825e430c77dde8489f3b99eaafcd4a60f5/rpds_py-0.26.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:4c70c70f9169692b36307a95f3d8c0a9fcd79f7b4a383aad5eaa0e9718b79b37", size = 372466, upload-time = "2025-07-01T15:53:40.55Z" }, @@ -5306,53 +3283,17 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/2c/07/c554b6ed0064b6e0350a622714298e930b3cf5a3d445a2e25c412268abcf/rpds_py-0.26.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:69a607203441e07e9a8a529cff1d5b73f6a160f22db1097211e6212a68567d11", size = 232048, upload-time = "2025-07-01T15:57:12.473Z" }, ] -[[package]] -name = "scipy" -version = "1.10.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "numpy", version = "1.24.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/84/a9/2bf119f3f9cff1f376f924e39cfae18dec92a1514784046d185731301281/scipy-1.10.1.tar.gz", hash = "sha256:2cf9dfb80a7b4589ba4c40ce7588986d6d5cebc5457cad2c2880f6bc2d42f3a5", size = 42407997, upload-time = "2023-02-19T21:20:13.395Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/0a/ac/b1f1bbf7b01d96495f35be003b881f10f85bf6559efb6e9578da832c2140/scipy-1.10.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e7354fd7527a4b0377ce55f286805b34e8c54b91be865bac273f527e1b839019", size = 35093243, upload-time = "2023-02-19T20:33:55.754Z" }, - { url = "https://files.pythonhosted.org/packages/ea/e5/452086ebed676ce4000ceb5eeeb0ee4f8c6f67c7e70fb9323a370ff95c1f/scipy-1.10.1-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:4b3f429188c66603a1a5c549fb414e4d3bdc2a24792e061ffbd607d3d75fd84e", size = 28772969, upload-time = "2023-02-19T20:34:39.318Z" }, - { url = "https://files.pythonhosted.org/packages/04/0b/a1b119c869b79a2ab459b7f9fd7e2dea75a9c7d432e64e915e75586bd00b/scipy-1.10.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1553b5dcddd64ba9a0d95355e63fe6c3fc303a8fd77c7bc91e77d61363f7433f", size = 30886961, upload-time = "2023-02-19T20:35:33.724Z" }, - { url = "https://files.pythonhosted.org/packages/1f/4b/3bacad9a166350cb2e518cea80ab891016933cc1653f15c90279512c5fa9/scipy-1.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4c0ff64b06b10e35215abce517252b375e580a6125fd5fdf6421b98efbefb2d2", size = 34422544, upload-time = "2023-02-19T20:37:03.859Z" }, - { url = "https://files.pythonhosted.org/packages/ec/e3/b06ac3738bf365e89710205a471abe7dceec672a51c244b469bc5d1291c7/scipy-1.10.1-cp310-cp310-win_amd64.whl", hash = "sha256:fae8a7b898c42dffe3f7361c40d5952b6bf32d10c4569098d276b4c547905ee1", size = 42484848, upload-time = "2023-02-19T20:39:09.467Z" }, - { url = "https://files.pythonhosted.org/packages/e7/53/053cd3669be0d474deae8fe5f757bff4c4f480b8a410231e0631c068873d/scipy-1.10.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0f1564ea217e82c1bbe75ddf7285ba0709ecd503f048cb1236ae9995f64217bd", size = 35003170, upload-time = "2023-02-19T20:40:53.274Z" }, - { url = "https://files.pythonhosted.org/packages/0d/3e/d05b9de83677195886fb79844fcca19609a538db63b1790fa373155bc3cf/scipy-1.10.1-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:d925fa1c81b772882aa55bcc10bf88324dadb66ff85d548c71515f6689c6dac5", size = 28717513, upload-time = "2023-02-19T20:42:20.82Z" }, - { url = "https://files.pythonhosted.org/packages/a5/3d/b69746c50e44893da57a68457da3d7e5bb75f6a37fbace3769b70d017488/scipy-1.10.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aaea0a6be54462ec027de54fca511540980d1e9eea68b2d5c1dbfe084797be35", size = 30687257, upload-time = "2023-02-19T20:43:48.139Z" }, - { url = "https://files.pythonhosted.org/packages/21/cd/fe2d4af234b80dc08c911ce63fdaee5badcdde3e9bcd9a68884580652ef0/scipy-1.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15a35c4242ec5f292c3dd364a7c71a61be87a3d4ddcc693372813c0b73c9af1d", size = 34124096, upload-time = "2023-02-19T20:45:27.415Z" }, - { url = "https://files.pythonhosted.org/packages/65/76/903324159e4a3566e518c558aeb21571d642f781d842d8dd0fd9c6b0645a/scipy-1.10.1-cp311-cp311-win_amd64.whl", hash = "sha256:43b8e0bcb877faf0abfb613d51026cd5cc78918e9530e375727bf0625c82788f", size = 42238704, upload-time = "2023-02-19T20:47:26.366Z" }, - { url = "https://files.pythonhosted.org/packages/a0/e3/37508a11dae501349d7c16e4dd18c706a023629eedc650ee094593887a89/scipy-1.10.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5678f88c68ea866ed9ebe3a989091088553ba12c6090244fdae3e467b1139c35", size = 35041063, upload-time = "2023-02-19T20:49:02.296Z" }, - { url = "https://files.pythonhosted.org/packages/93/4a/50c436de1353cce8b66b26e49a687f10b91fe7465bf34e4565d810153003/scipy-1.10.1-cp38-cp38-macosx_12_0_arm64.whl", hash = "sha256:39becb03541f9e58243f4197584286e339029e8908c46f7221abeea4b749fa88", size = 28797694, upload-time = "2023-02-19T20:50:19.381Z" }, - { url = "https://files.pythonhosted.org/packages/d2/b5/ff61b79ad0ebd15d87ade10e0f4e80114dd89fac34a5efade39e99048c91/scipy-1.10.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bce5869c8d68cf383ce240e44c1d9ae7c06078a9396df68ce88a1230f93a30c1", size = 31024657, upload-time = "2023-02-19T20:51:49.175Z" }, - { url = "https://files.pythonhosted.org/packages/69/f0/fb07a9548e48b687b8bf2fa81d71aba9cfc548d365046ca1c791e24db99d/scipy-1.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:07c3457ce0b3ad5124f98a86533106b643dd811dd61b548e78cf4c8786652f6f", size = 34540352, upload-time = "2023-02-19T20:53:30.821Z" }, - { url = "https://files.pythonhosted.org/packages/32/8e/7f403535ddf826348c9b8417791e28712019962f7e90ff845896d6325d09/scipy-1.10.1-cp38-cp38-win_amd64.whl", hash = "sha256:049a8bbf0ad95277ffba9b3b7d23e5369cc39e66406d60422c8cfef40ccc8415", size = 42215036, upload-time = "2023-02-19T20:55:09.639Z" }, - { url = "https://files.pythonhosted.org/packages/d9/7d/78b8035bc93c869b9f17261c87aae97a9cdb937f65f0d453c2831aa172fc/scipy-1.10.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:cd9f1027ff30d90618914a64ca9b1a77a431159df0e2a195d8a9e8a04c78abf9", size = 35158611, upload-time = "2023-02-19T20:56:02.715Z" }, - { url = "https://files.pythonhosted.org/packages/e7/f0/55d81813b1a4cb79ce7dc8290eac083bf38bfb36e1ada94ea13b7b1a5f79/scipy-1.10.1-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:79c8e5a6c6ffaf3a2262ef1be1e108a035cf4f05c14df56057b64acc5bebffb6", size = 28902591, upload-time = "2023-02-19T20:56:45.728Z" }, - { url = "https://files.pythonhosted.org/packages/77/d1/722c457b319eed1d642e0a14c9be37eb475f0e6ed1f3401fa480d5d6d36e/scipy-1.10.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:51af417a000d2dbe1ec6c372dfe688e041a7084da4fdd350aeb139bd3fb55353", size = 30960654, upload-time = "2023-02-19T20:57:32.091Z" }, - { url = "https://files.pythonhosted.org/packages/5d/30/b2a2a5bf1a3beefb7609fb871dcc6aef7217c69cef19a4631b7ab5622a8a/scipy-1.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1b4735d6c28aad3cdcf52117e0e91d6b39acd4272f3f5cd9907c24ee931ad601", size = 34458863, upload-time = "2023-02-19T20:58:23.601Z" }, - { url = "https://files.pythonhosted.org/packages/35/20/0ec6246bbb43d18650c9a7cad6602e1a84fd8f9564a9b84cc5faf1e037d0/scipy-1.10.1-cp39-cp39-win_amd64.whl", hash = "sha256:7ff7f37b1bf4417baca958d254e8e2875d0cc23aaadbe65b3d5b3077b0eb23ea", size = 42509516, upload-time = "2023-02-19T20:59:26.296Z" }, -] - [[package]] name = "scipy" version = "1.13.1" source = { registry = "https://pypi.org/simple" } resolution-markers = [ - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", + "python_full_version < '3.10' and platform_machine == 'arm64' and sys_platform == 'darwin'", + "python_full_version < '3.10' and platform_machine == 'aarch64' and sys_platform == 'linux'", + "(python_full_version < '3.10' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.10' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.10' and sys_platform != 'darwin' and sys_platform != 'linux')", ] dependencies = [ - { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/ae/00/48c2f661e2816ccf2ecd77982f6605b2950afe60f60a52b4cbbc2504aa8f/scipy-1.13.1.tar.gz", hash = "sha256:095a87a0312b08dfd6a6155cbbd310a8c51800fc931b8c0b84003014b874ed3c", size = 57210720, upload-time = "2024-05-23T03:29:26.079Z" } wheels = [ @@ -5520,38 +3461,10 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/40/b0/4562db6223154aa4e22f939003cb92514c79f3d4dccca3444253fd17f902/Send2Trash-1.8.3-py3-none-any.whl", hash = "sha256:0c31227e0bd08961c7665474a3d1ef7193929fedda4233843689baa056be46c9", size = 18072, upload-time = "2024-04-07T00:01:07.438Z" }, ] -[[package]] -name = "setuptools" -version = "75.3.2" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/5c/01/771ea46cce201dd42cff043a5eea929d1c030fb3d1c2ee2729d02ca7814c/setuptools-75.3.2.tar.gz", hash = "sha256:3c1383e1038b68556a382c1e8ded8887cd20141b0eb5708a6c8d277de49364f5", size = 1354489, upload-time = "2025-03-12T00:02:19.004Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/15/65/3f0dba35760d902849d39d38c0a72767794b1963227b69a587f8a336d08c/setuptools-75.3.2-py3-none-any.whl", hash = "sha256:90ab613b6583fc02d5369cbca13ea26ea0e182d1df2d943ee9cbe81d4c61add9", size = 1251198, upload-time = "2025-03-12T00:02:17.554Z" }, -] - [[package]] name = "setuptools" version = "80.9.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/18/5d/3bf57dcd21979b887f014ea83c24ae194cfcd12b9e0fda66b957c69d1fca/setuptools-80.9.0.tar.gz", hash = "sha256:f36b47402ecde768dbfafc46e8e4207b4360c654f1f3bb84475f0a28628fb19c", size = 1319958, upload-time = "2025-05-27T00:56:51.443Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/a3/dc/17031897dae0efacfea57dfd3a82fdd2a2aeb58e0ff71b77b87e44edc772/setuptools-80.9.0-py3-none-any.whl", hash = "sha256:062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922", size = 1201486, upload-time = "2025-05-27T00:56:49.664Z" }, @@ -5613,19 +3526,16 @@ version = "0.26.0rc7" source = { editable = "." } dependencies = [ { name = "defusedxml" }, - { name = "matplotlib", version = "3.7.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "matplotlib", version = "3.9.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "matplotlib", version = "3.9.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "matplotlib", version = "3.10.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, - { name = "numpy", version = "1.24.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" }, { name = "numpy", version = "2.3.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "opencv-python" }, { name = "pillow" }, { name = "pyyaml" }, { name = "requests" }, - { name = "scipy", version = "1.10.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "scipy", version = "1.13.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, + { name = "scipy", version = "1.13.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "scipy", version = "1.15.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" }, { name = "scipy", version = "1.16.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "tqdm" }, @@ -5633,8 +3543,7 @@ dependencies = [ [package.optional-dependencies] metrics = [ - { name = "pandas", version = "2.0.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "pandas", version = "2.3.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "pandas" }, ] [package.dev-dependencies] @@ -5644,30 +3553,22 @@ build = [ { name = "wheel" }, ] dev = [ - { name = "docutils", version = "0.20.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "docutils", version = "0.21.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "docutils" }, { name = "ipywidgets" }, - { name = "jupytext", version = "1.17.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "jupytext", version = "1.17.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "jupytext" }, { name = "nbconvert" }, - { name = "notebook", version = "7.3.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "notebook", version = "7.4.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "pytest", version = "8.3.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "pytest", version = "8.4.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "tox", version = "4.25.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "tox", version = "4.27.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "notebook" }, + { name = "pytest" }, + { name = "tox" }, ] docs = [ { name = "mike" }, { name = "mkdocs-git-committers-plugin-2", marker = "python_full_version < '4'" }, { name = "mkdocs-git-revision-date-localized-plugin" }, - { name = "mkdocs-jupyter", version = "0.24.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "mkdocs-jupyter", version = "0.25.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "mkdocs-jupyter" }, { name = "mkdocs-material", extra = ["imaging"] }, - { name = "mkdocstrings", version = "0.26.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "mkdocstrings", version = "0.29.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "mkdocstrings-python", version = "1.11.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "mkdocstrings-python", version = "1.16.12", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "mkdocstrings" }, + { name = "mkdocstrings-python" }, ] [package.metadata] @@ -5702,7 +3603,7 @@ dev = [ ] docs = [ { name = "mike", specifier = ">=2.0.0" }, - { name = "mkdocs-git-committers-plugin-2", marker = "python_full_version >= '3.8' and python_full_version < '4'", specifier = ">=2.4.1" }, + { name = "mkdocs-git-committers-plugin-2", marker = "python_full_version >= '3.9' and python_full_version < '4'", specifier = ">=2.4.1" }, { name = "mkdocs-git-revision-date-localized-plugin", specifier = ">=1.2.4" }, { name = "mkdocs-jupyter", specifier = ">=0.24.3" }, { name = "mkdocs-material", extras = ["imaging"], specifier = ">=9.5.5" }, @@ -5716,53 +3617,20 @@ version = "0.18.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "ptyprocess", marker = "os_name != 'nt'" }, - { name = "pywinpty", version = "2.0.14", source = { registry = "https://pypi.org/simple" }, marker = "(python_full_version < '3.9' and os_name == 'nt' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and os_name == 'nt' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and os_name == 'nt' and sys_platform != 'darwin' and sys_platform != 'linux')" }, - { name = "pywinpty", version = "2.0.15", source = { registry = "https://pypi.org/simple" }, marker = "(python_full_version == '3.9.*' and os_name == 'nt' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version >= '3.9' and os_name == 'nt' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.9' and os_name == 'nt' and sys_platform != 'darwin' and sys_platform != 'linux')" }, - { name = "tornado", version = "6.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "tornado", version = "6.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "pywinpty", marker = "(python_full_version < '3.10' and os_name == 'nt' and platform_machine != 'arm64' and sys_platform == 'darwin') or (os_name == 'nt' and platform_machine != 'aarch64' and sys_platform == 'linux') or (os_name == 'nt' and sys_platform != 'darwin' and sys_platform != 'linux')" }, + { name = "tornado" }, ] sdist = { url = "https://files.pythonhosted.org/packages/8a/11/965c6fd8e5cc254f1fe142d547387da17a8ebfd75a3455f637c663fb38a0/terminado-0.18.1.tar.gz", hash = "sha256:de09f2c4b85de4765f7714688fff57d3e75bad1f909b589fde880460c753fd2e", size = 32701, upload-time = "2024-03-12T14:34:39.026Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/6a/9e/2064975477fdc887e47ad42157e214526dcad8f317a948dee17e1659a62f/terminado-0.18.1-py3-none-any.whl", hash = "sha256:a4468e1b37bb318f8a86514f65814e1afc977cf29b3992a4500d9dd305dcceb0", size = 14154, upload-time = "2024-03-12T14:34:36.569Z" }, ] -[[package]] -name = "tinycss2" -version = "1.2.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "webencodings", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/75/be/24179dfaa1d742c9365cbd0e3f0edc5d3aa3abad415a2327c5a6ff8ca077/tinycss2-1.2.1.tar.gz", hash = "sha256:8cff3a8f066c2ec677c06dbc7b45619804a6938478d9d73c284b29d14ecb0627", size = 65957, upload-time = "2022-10-18T07:04:56.49Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/da/99/fd23634d6962c2791fb8cb6ccae1f05dcbfc39bce36bba8b1c9a8d92eae8/tinycss2-1.2.1-py3-none-any.whl", hash = "sha256:2b80a96d41e7c3914b8cda8bc7f705a4d9c49275616e886103dd839dfc847847", size = 21824, upload-time = "2022-10-18T07:04:54.003Z" }, -] - [[package]] name = "tinycss2" version = "1.4.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "webencodings", marker = "python_full_version >= '3.9'" }, + { name = "webencodings" }, ] sdist = { url = "https://files.pythonhosted.org/packages/7a/fd/7a5ee21fd08ff70d3d33a5781c255cbe779659bd03278feb98b19ee550f4/tinycss2-1.4.0.tar.gz", hash = "sha256:10c0972f6fc0fbee87c3edb76549357415e94548c1ae10ebccdea16fb404a9b7", size = 87085, upload-time = "2024-10-24T14:58:29.895Z" } wheels = [ @@ -5808,47 +3676,10 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/6e/c2/61d3e0f47e2b74ef40a68b9e6ad5984f6241a942f7cd3bbfbdbd03861ea9/tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc", size = 14257, upload-time = "2024-11-27T22:38:35.385Z" }, ] -[[package]] -name = "tornado" -version = "6.4.2" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/59/45/a0daf161f7d6f36c3ea5fc0c2de619746cc3dd4c76402e9db545bd920f63/tornado-6.4.2.tar.gz", hash = "sha256:92bad5b4746e9879fd7bf1eb21dce4e3fc5128d71601f80005afa39237ad620b", size = 501135, upload-time = "2024-11-22T03:06:38.036Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/26/7e/71f604d8cea1b58f82ba3590290b66da1e72d840aeb37e0d5f7291bd30db/tornado-6.4.2-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:e828cce1123e9e44ae2a50a9de3055497ab1d0aeb440c5ac23064d9e44880da1", size = 436299, upload-time = "2024-11-22T03:06:20.162Z" }, - { url = "https://files.pythonhosted.org/packages/96/44/87543a3b99016d0bf54fdaab30d24bf0af2e848f1d13d34a3a5380aabe16/tornado-6.4.2-cp38-abi3-macosx_10_9_x86_64.whl", hash = "sha256:072ce12ada169c5b00b7d92a99ba089447ccc993ea2143c9ede887e0937aa803", size = 434253, upload-time = "2024-11-22T03:06:22.39Z" }, - { url = "https://files.pythonhosted.org/packages/cb/fb/fdf679b4ce51bcb7210801ef4f11fdac96e9885daa402861751353beea6e/tornado-6.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a017d239bd1bb0919f72af256a970624241f070496635784d9bf0db640d3fec", size = 437602, upload-time = "2024-11-22T03:06:24.214Z" }, - { url = "https://files.pythonhosted.org/packages/4f/3b/e31aeffffc22b475a64dbeb273026a21b5b566f74dee48742817626c47dc/tornado-6.4.2-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c36e62ce8f63409301537222faffcef7dfc5284f27eec227389f2ad11b09d946", size = 436972, upload-time = "2024-11-22T03:06:25.559Z" }, - { url = "https://files.pythonhosted.org/packages/22/55/b78a464de78051a30599ceb6983b01d8f732e6f69bf37b4ed07f642ac0fc/tornado-6.4.2-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bca9eb02196e789c9cb5c3c7c0f04fb447dc2adffd95265b2c7223a8a615ccbf", size = 437173, upload-time = "2024-11-22T03:06:27.584Z" }, - { url = "https://files.pythonhosted.org/packages/79/5e/be4fb0d1684eb822c9a62fb18a3e44a06188f78aa466b2ad991d2ee31104/tornado-6.4.2-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:304463bd0772442ff4d0f5149c6f1c2135a1fae045adf070821c6cdc76980634", size = 437892, upload-time = "2024-11-22T03:06:28.933Z" }, - { url = "https://files.pythonhosted.org/packages/f5/33/4f91fdd94ea36e1d796147003b490fe60a0215ac5737b6f9c65e160d4fe0/tornado-6.4.2-cp38-abi3-musllinux_1_2_i686.whl", hash = "sha256:c82c46813ba483a385ab2a99caeaedf92585a1f90defb5693351fa7e4ea0bf73", size = 437334, upload-time = "2024-11-22T03:06:30.428Z" }, - { url = "https://files.pythonhosted.org/packages/2b/ae/c1b22d4524b0e10da2f29a176fb2890386f7bd1f63aacf186444873a88a0/tornado-6.4.2-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:932d195ca9015956fa502c6b56af9eb06106140d844a335590c1ec7f5277d10c", size = 437261, upload-time = "2024-11-22T03:06:32.458Z" }, - { url = "https://files.pythonhosted.org/packages/b5/25/36dbd49ab6d179bcfc4c6c093a51795a4f3bed380543a8242ac3517a1751/tornado-6.4.2-cp38-abi3-win32.whl", hash = "sha256:2876cef82e6c5978fde1e0d5b1f919d756968d5b4282418f3146b79b58556482", size = 438463, upload-time = "2024-11-22T03:06:34.71Z" }, - { url = "https://files.pythonhosted.org/packages/61/cc/58b1adeb1bb46228442081e746fcdbc4540905c87e8add7c277540934edb/tornado-6.4.2-cp38-abi3-win_amd64.whl", hash = "sha256:908b71bf3ff37d81073356a5fadcc660eb10c1476ee6e2725588626ce7e5ca38", size = 438907, upload-time = "2024-11-22T03:06:36.71Z" }, -] - [[package]] name = "tornado" version = "6.5.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/51/89/c72771c81d25d53fe33e3dca61c233b665b2780f21820ba6fd2c6793c12b/tornado-6.5.1.tar.gz", hash = "sha256:84ceece391e8eb9b2b95578db65e920d2a61070260594819589609ba9bc6308c", size = 509934, upload-time = "2025-05-22T18:15:38.788Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/77/89/f4532dee6843c9e0ebc4e28d4be04c67f54f60813e4bf73d595fe7567452/tornado-6.5.1-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:d50065ba7fd11d3bd41bcad0825227cc9a95154bad83239357094c36708001f7", size = 441948, upload-time = "2025-05-22T18:15:20.862Z" }, @@ -5864,63 +3695,22 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/55/a7/535c44c7bea4578e48281d83c615219f3ab19e6abc67625ef637c73987be/tornado-6.5.1-cp39-abi3-win_arm64.whl", hash = "sha256:02420a0eb7bf617257b9935e2b754d1b63897525d8a289c9d65690d580b4dcf7", size = 443596, upload-time = "2025-05-22T18:15:37.433Z" }, ] -[[package]] -name = "tox" -version = "4.25.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -dependencies = [ - { name = "cachetools", version = "5.5.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "chardet", marker = "python_full_version < '3.9'" }, - { name = "colorama", marker = "python_full_version < '3.9'" }, - { name = "filelock", version = "3.16.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "packaging", marker = "python_full_version < '3.9'" }, - { name = "platformdirs", version = "4.3.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "pluggy", version = "1.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "pyproject-api", version = "1.8.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "tomli", marker = "python_full_version < '3.9'" }, - { name = "typing-extensions", version = "4.13.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "virtualenv", marker = "python_full_version < '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/fe/87/692478f0a194f1cad64803692642bd88c12c5b64eee16bf178e4a32e979c/tox-4.25.0.tar.gz", hash = "sha256:dd67f030317b80722cf52b246ff42aafd3ed27ddf331c415612d084304cf5e52", size = 196255, upload-time = "2025-03-27T15:13:37.519Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/f9/38/33348de6fc4b1afb3d76d8485c8aecbdabcfb3af8da53d40c792332e2b37/tox-4.25.0-py3-none-any.whl", hash = "sha256:4dfdc7ba2cc6fdc6688dde1b21e7b46ff6c41795fb54586c91a3533317b5255c", size = 172420, upload-time = "2025-03-27T15:13:35.703Z" }, -] - [[package]] name = "tox" version = "4.27.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] dependencies = [ - { name = "cachetools", version = "6.1.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "chardet", marker = "python_full_version >= '3.9'" }, - { name = "colorama", marker = "python_full_version >= '3.9'" }, - { name = "filelock", version = "3.18.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "packaging", marker = "python_full_version >= '3.9'" }, - { name = "platformdirs", version = "4.3.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "pluggy", version = "1.6.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "pyproject-api", version = "1.9.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "tomli", marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, - { name = "typing-extensions", version = "4.14.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9' and python_full_version < '3.11'" }, - { name = "virtualenv", marker = "python_full_version >= '3.9'" }, + { name = "cachetools" }, + { name = "chardet" }, + { name = "colorama" }, + { name = "filelock" }, + { name = "packaging" }, + { name = "platformdirs" }, + { name = "pluggy" }, + { name = "pyproject-api" }, + { name = "tomli", marker = "python_full_version < '3.11'" }, + { name = "typing-extensions", marker = "python_full_version < '3.11'" }, + { name = "virtualenv" }, ] sdist = { url = "https://files.pythonhosted.org/packages/a5/b7/19c01717747076f63c54d871ada081cd711a7c9a7572f2225675c3858b94/tox-4.27.0.tar.gz", hash = "sha256:b97d5ecc0c0d5755bcc5348387fef793e1bfa68eb33746412f4c60881d7f5f57", size = 198351, upload-time = "2025-06-17T15:17:50.585Z" } wheels = [ @@ -5954,94 +3744,34 @@ version = "6.1.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "id" }, - { name = "importlib-metadata", version = "8.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "importlib-metadata", version = "8.7.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, - { name = "keyring", version = "25.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9' and platform_machine != 'ppc64le' and platform_machine != 's390x'" }, - { name = "keyring", version = "25.6.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9' and platform_machine != 'ppc64le' and platform_machine != 's390x'" }, + { name = "importlib-metadata", marker = "python_full_version < '3.10'" }, + { name = "keyring", marker = "platform_machine != 'ppc64le' and platform_machine != 's390x'" }, { name = "packaging" }, - { name = "readme-renderer", version = "43.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "readme-renderer", version = "44.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "readme-renderer" }, { name = "requests" }, { name = "requests-toolbelt" }, { name = "rfc3986" }, { name = "rich" }, - { name = "urllib3", version = "2.2.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "urllib3", version = "2.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "urllib3" }, ] sdist = { url = "https://files.pythonhosted.org/packages/c8/a2/6df94fc5c8e2170d21d7134a565c3a8fb84f9797c1dd65a5976aaf714418/twine-6.1.0.tar.gz", hash = "sha256:be324f6272eff91d07ee93f251edf232fc647935dd585ac003539b42404a8dbd", size = 168404, upload-time = "2025-01-21T18:45:26.758Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/7c/b6/74e927715a285743351233f33ea3c684528a0d374d2e43ff9ce9585b73fe/twine-6.1.0-py3-none-any.whl", hash = "sha256:a47f973caf122930bf0fbbf17f80b83bc1602c9ce393c7845f289a3001dc5384", size = 40791, upload-time = "2025-01-21T18:45:24.584Z" }, ] -[[package]] -name = "types-python-dateutil" -version = "2.9.0.20241206" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/a9/60/47d92293d9bc521cd2301e423a358abfac0ad409b3a1606d8fbae1321961/types_python_dateutil-2.9.0.20241206.tar.gz", hash = "sha256:18f493414c26ffba692a72369fea7a154c502646301ebfe3d56a04b3767284cb", size = 13802, upload-time = "2024-12-06T02:56:41.019Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/0f/b3/ca41df24db5eb99b00d97f89d7674a90cb6b3134c52fb8121b6d8d30f15c/types_python_dateutil-2.9.0.20241206-py3-none-any.whl", hash = "sha256:e248a4bc70a486d3e3ec84d0dc30eec3a5f979d6e7ee4123ae043eedbb987f53", size = 14384, upload-time = "2024-12-06T02:56:39.412Z" }, -] - [[package]] name = "types-python-dateutil" version = "2.9.0.20250708" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/c9/95/6bdde7607da2e1e99ec1c1672a759d42f26644bbacf939916e086db34870/types_python_dateutil-2.9.0.20250708.tar.gz", hash = "sha256:ccdbd75dab2d6c9696c350579f34cffe2c281e4c5f27a585b2a2438dd1d5c8ab", size = 15834, upload-time = "2025-07-08T03:14:03.382Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/72/52/43e70a8e57fefb172c22a21000b03ebcc15e47e97f5cb8495b9c2832efb4/types_python_dateutil-2.9.0.20250708-py3-none-any.whl", hash = "sha256:4d6d0cc1cc4d24a2dc3816024e502564094497b713f7befda4d5bc7a8e3fd21f", size = 17724, upload-time = "2025-07-08T03:14:02.593Z" }, ] -[[package]] -name = "typing-extensions" -version = "4.13.2" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/f6/37/23083fcd6e35492953e8d2aaaa68b860eb422b34627b13f2ce3eb6106061/typing_extensions-4.13.2.tar.gz", hash = "sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef", size = 106967, upload-time = "2025-04-10T14:19:05.416Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/8b/54/b1ae86c0973cc6f0210b53d508ca3641fb6d0c56823f288d108bc7ab3cc8/typing_extensions-4.13.2-py3-none-any.whl", hash = "sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c", size = 45806, upload-time = "2025-04-10T14:19:03.967Z" }, -] - [[package]] name = "typing-extensions" version = "4.14.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/98/5a/da40306b885cc8c09109dc2e1abd358d5684b1425678151cdaed4731c822/typing_extensions-4.14.1.tar.gz", hash = "sha256:38b39f4aeeab64884ce9f74c94263ef78f3c22467c8724005483154c26648d36", size = 107673, upload-time = "2025-07-04T13:28:34.16Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/b5/00/d631e67a838026495268c2f6884f3711a15a9a2a96cd244fdaea53b823fb/typing_extensions-4.14.1-py3-none-any.whl", hash = "sha256:d1e1e3b58374dc93031d6eda2420a48ea44a36c2b4766a4fdeb3710755731d76", size = 43906, upload-time = "2025-07-04T13:28:32.743Z" }, @@ -6065,38 +3795,10 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e7/00/3fca040d7cf8a32776d3d81a00c8ee7457e00f80c649f1e4a863c8321ae9/uri_template-1.3.0-py3-none-any.whl", hash = "sha256:a44a133ea12d44a0c0f06d7d42a52d71282e77e2f937d8abd5655b8d56fc1363", size = 11140, upload-time = "2023-06-21T01:49:03.467Z" }, ] -[[package]] -name = "urllib3" -version = "2.2.3" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/ed/63/22ba4ebfe7430b76388e7cd448d5478814d3032121827c12a2cc287e2260/urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9", size = 300677, upload-time = "2024-09-12T10:52:18.401Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/ce/d9/5f4c13cecde62396b0d3fe530a50ccea91e7dfc1ccf0e09c228841bb5ba8/urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac", size = 126338, upload-time = "2024-09-12T10:52:16.589Z" }, -] - [[package]] name = "urllib3" version = "2.5.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/15/22/9ee70a2574a4f4599c47dd506532914ce044817c7752a79b6a51286319bc/urllib3-2.5.0.tar.gz", hash = "sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760", size = 393185, upload-time = "2025-06-18T14:07:41.644Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/a7/c2/fe1e52489ae3122415c51f387e221dd0773709bad6c6cdaa599e8a2c5185/urllib3-2.5.0-py3-none-any.whl", hash = "sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc", size = 129795, upload-time = "2025-06-18T14:07:40.39Z" }, @@ -6117,81 +3819,18 @@ version = "20.31.2" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "distlib" }, - { name = "filelock", version = "3.16.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "filelock", version = "3.18.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "platformdirs", version = "4.3.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, - { name = "platformdirs", version = "4.3.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, + { name = "filelock" }, + { name = "platformdirs" }, ] sdist = { url = "https://files.pythonhosted.org/packages/56/2c/444f465fb2c65f40c3a104fd0c495184c4f2336d65baf398e3c75d72ea94/virtualenv-20.31.2.tar.gz", hash = "sha256:e10c0a9d02835e592521be48b332b6caee6887f332c111aa79a09b9e79efc2af", size = 6076316, upload-time = "2025-05-08T17:58:23.811Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/f3/40/b1c265d4b2b62b58576588510fc4d1fe60a86319c8de99fd8e9fec617d2c/virtualenv-20.31.2-py3-none-any.whl", hash = "sha256:36efd0d9650ee985f0cad72065001e66d49a6f24eb44d98980f630686243cf11", size = 6057982, upload-time = "2025-05-08T17:58:21.15Z" }, ] -[[package]] -name = "watchdog" -version = "4.0.2" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/4f/38/764baaa25eb5e35c9a043d4c4588f9836edfe52a708950f4b6d5f714fd42/watchdog-4.0.2.tar.gz", hash = "sha256:b4dfbb6c49221be4535623ea4474a4d6ee0a9cef4a80b20c28db4d858b64e270", size = 126587, upload-time = "2024-08-11T07:38:01.623Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/46/b0/219893d41c16d74d0793363bf86df07d50357b81f64bba4cb94fe76e7af4/watchdog-4.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ede7f010f2239b97cc79e6cb3c249e72962404ae3865860855d5cbe708b0fd22", size = 100257, upload-time = "2024-08-11T07:37:04.209Z" }, - { url = "https://files.pythonhosted.org/packages/6d/c6/8e90c65693e87d98310b2e1e5fd7e313266990853b489e85ce8396cc26e3/watchdog-4.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a2cffa171445b0efa0726c561eca9a27d00a1f2b83846dbd5a4f639c4f8ca8e1", size = 92249, upload-time = "2024-08-11T07:37:06.364Z" }, - { url = "https://files.pythonhosted.org/packages/6f/cd/2e306756364a934532ff8388d90eb2dc8bb21fe575cd2b33d791ce05a02f/watchdog-4.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c50f148b31b03fbadd6d0b5980e38b558046b127dc483e5e4505fcef250f9503", size = 92888, upload-time = "2024-08-11T07:37:08.275Z" }, - { url = "https://files.pythonhosted.org/packages/de/78/027ad372d62f97642349a16015394a7680530460b1c70c368c506cb60c09/watchdog-4.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:7c7d4bf585ad501c5f6c980e7be9c4f15604c7cc150e942d82083b31a7548930", size = 100256, upload-time = "2024-08-11T07:37:11.017Z" }, - { url = "https://files.pythonhosted.org/packages/59/a9/412b808568c1814d693b4ff1cec0055dc791780b9dc947807978fab86bc1/watchdog-4.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:914285126ad0b6eb2258bbbcb7b288d9dfd655ae88fa28945be05a7b475a800b", size = 92252, upload-time = "2024-08-11T07:37:13.098Z" }, - { url = "https://files.pythonhosted.org/packages/04/57/179d76076cff264982bc335dd4c7da6d636bd3e9860bbc896a665c3447b6/watchdog-4.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:984306dc4720da5498b16fc037b36ac443816125a3705dfde4fd90652d8028ef", size = 92888, upload-time = "2024-08-11T07:37:15.077Z" }, - { url = "https://files.pythonhosted.org/packages/92/f5/ea22b095340545faea37ad9a42353b265ca751f543da3fb43f5d00cdcd21/watchdog-4.0.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:1cdcfd8142f604630deef34722d695fb455d04ab7cfe9963055df1fc69e6727a", size = 100342, upload-time = "2024-08-11T07:37:16.393Z" }, - { url = "https://files.pythonhosted.org/packages/cb/d2/8ce97dff5e465db1222951434e3115189ae54a9863aef99c6987890cc9ef/watchdog-4.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d7ab624ff2f663f98cd03c8b7eedc09375a911794dfea6bf2a359fcc266bff29", size = 92306, upload-time = "2024-08-11T07:37:17.997Z" }, - { url = "https://files.pythonhosted.org/packages/49/c4/1aeba2c31b25f79b03b15918155bc8c0b08101054fc727900f1a577d0d54/watchdog-4.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:132937547a716027bd5714383dfc40dc66c26769f1ce8a72a859d6a48f371f3a", size = 92915, upload-time = "2024-08-11T07:37:19.967Z" }, - { url = "https://files.pythonhosted.org/packages/79/63/eb8994a182672c042d85a33507475c50c2ee930577524dd97aea05251527/watchdog-4.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:cd67c7df93eb58f360c43802acc945fa8da70c675b6fa37a241e17ca698ca49b", size = 100343, upload-time = "2024-08-11T07:37:21.935Z" }, - { url = "https://files.pythonhosted.org/packages/ce/82/027c0c65c2245769580605bcd20a1dc7dfd6c6683c8c4e2ef43920e38d27/watchdog-4.0.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:bcfd02377be80ef3b6bc4ce481ef3959640458d6feaae0bd43dd90a43da90a7d", size = 92313, upload-time = "2024-08-11T07:37:23.314Z" }, - { url = "https://files.pythonhosted.org/packages/2a/89/ad4715cbbd3440cb0d336b78970aba243a33a24b1a79d66f8d16b4590d6a/watchdog-4.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:980b71510f59c884d684b3663d46e7a14b457c9611c481e5cef08f4dd022eed7", size = 92919, upload-time = "2024-08-11T07:37:24.715Z" }, - { url = "https://files.pythonhosted.org/packages/55/08/1a9086a3380e8828f65b0c835b86baf29ebb85e5e94a2811a2eb4f889cfd/watchdog-4.0.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:aa160781cafff2719b663c8a506156e9289d111d80f3387cf3af49cedee1f040", size = 100255, upload-time = "2024-08-11T07:37:26.862Z" }, - { url = "https://files.pythonhosted.org/packages/6c/3e/064974628cf305831f3f78264800bd03b3358ec181e3e9380a36ff156b93/watchdog-4.0.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f6ee8dedd255087bc7fe82adf046f0b75479b989185fb0bdf9a98b612170eac7", size = 92257, upload-time = "2024-08-11T07:37:28.253Z" }, - { url = "https://files.pythonhosted.org/packages/23/69/1d2ad9c12d93bc1e445baa40db46bc74757f3ffc3a3be592ba8dbc51b6e5/watchdog-4.0.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:0b4359067d30d5b864e09c8597b112fe0a0a59321a0f331498b013fb097406b4", size = 92886, upload-time = "2024-08-11T07:37:29.52Z" }, - { url = "https://files.pythonhosted.org/packages/68/eb/34d3173eceab490d4d1815ba9a821e10abe1da7a7264a224e30689b1450c/watchdog-4.0.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:770eef5372f146997638d737c9a3c597a3b41037cfbc5c41538fc27c09c3a3f9", size = 100254, upload-time = "2024-08-11T07:37:30.888Z" }, - { url = "https://files.pythonhosted.org/packages/18/a1/4bbafe7ace414904c2cc9bd93e472133e8ec11eab0b4625017f0e34caad8/watchdog-4.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:eeea812f38536a0aa859972d50c76e37f4456474b02bd93674d1947cf1e39578", size = 92249, upload-time = "2024-08-11T07:37:32.193Z" }, - { url = "https://files.pythonhosted.org/packages/f3/11/ec5684e0ca692950826af0de862e5db167523c30c9cbf9b3f4ce7ec9cc05/watchdog-4.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b2c45f6e1e57ebb4687690c05bc3a2c1fb6ab260550c4290b8abb1335e0fd08b", size = 92891, upload-time = "2024-08-11T07:37:34.212Z" }, - { url = "https://files.pythonhosted.org/packages/3b/9a/6f30f023324de7bad8a3eb02b0afb06bd0726003a3550e9964321315df5a/watchdog-4.0.2-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:10b6683df70d340ac3279eff0b2766813f00f35a1d37515d2c99959ada8f05fa", size = 91775, upload-time = "2024-08-11T07:37:35.567Z" }, - { url = "https://files.pythonhosted.org/packages/87/62/8be55e605d378a154037b9ba484e00a5478e627b69c53d0f63e3ef413ba6/watchdog-4.0.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:f7c739888c20f99824f7aa9d31ac8a97353e22d0c0e54703a547a218f6637eb3", size = 92255, upload-time = "2024-08-11T07:37:37.596Z" }, - { url = "https://files.pythonhosted.org/packages/6b/59/12e03e675d28f450bade6da6bc79ad6616080b317c472b9ae688d2495a03/watchdog-4.0.2-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:c100d09ac72a8a08ddbf0629ddfa0b8ee41740f9051429baa8e31bb903ad7508", size = 91682, upload-time = "2024-08-11T07:37:38.901Z" }, - { url = "https://files.pythonhosted.org/packages/ef/69/241998de9b8e024f5c2fbdf4324ea628b4231925305011ca8b7e1c3329f6/watchdog-4.0.2-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:f5315a8c8dd6dd9425b974515081fc0aadca1d1d61e078d2246509fd756141ee", size = 92249, upload-time = "2024-08-11T07:37:40.143Z" }, - { url = "https://files.pythonhosted.org/packages/70/3f/2173b4d9581bc9b5df4d7f2041b6c58b5e5448407856f68d4be9981000d0/watchdog-4.0.2-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:2d468028a77b42cc685ed694a7a550a8d1771bb05193ba7b24006b8241a571a1", size = 91773, upload-time = "2024-08-11T07:37:42.095Z" }, - { url = "https://files.pythonhosted.org/packages/f0/de/6fff29161d5789048f06ef24d94d3ddcc25795f347202b7ea503c3356acb/watchdog-4.0.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:f15edcae3830ff20e55d1f4e743e92970c847bcddc8b7509bcd172aa04de506e", size = 92250, upload-time = "2024-08-11T07:37:44.052Z" }, - { url = "https://files.pythonhosted.org/packages/8a/b1/25acf6767af6f7e44e0086309825bd8c098e301eed5868dc5350642124b9/watchdog-4.0.2-py3-none-manylinux2014_aarch64.whl", hash = "sha256:936acba76d636f70db8f3c66e76aa6cb5136a936fc2a5088b9ce1c7a3508fc83", size = 82947, upload-time = "2024-08-11T07:37:45.388Z" }, - { url = "https://files.pythonhosted.org/packages/e8/90/aebac95d6f954bd4901f5d46dcd83d68e682bfd21798fd125a95ae1c9dbf/watchdog-4.0.2-py3-none-manylinux2014_armv7l.whl", hash = "sha256:e252f8ca942a870f38cf785aef420285431311652d871409a64e2a0a52a2174c", size = 82942, upload-time = "2024-08-11T07:37:46.722Z" }, - { url = "https://files.pythonhosted.org/packages/15/3a/a4bd8f3b9381824995787488b9282aff1ed4667e1110f31a87b871ea851c/watchdog-4.0.2-py3-none-manylinux2014_i686.whl", hash = "sha256:0e83619a2d5d436a7e58a1aea957a3c1ccbf9782c43c0b4fed80580e5e4acd1a", size = 82947, upload-time = "2024-08-11T07:37:48.941Z" }, - { url = "https://files.pythonhosted.org/packages/09/cc/238998fc08e292a4a18a852ed8274159019ee7a66be14441325bcd811dfd/watchdog-4.0.2-py3-none-manylinux2014_ppc64.whl", hash = "sha256:88456d65f207b39f1981bf772e473799fcdc10801062c36fd5ad9f9d1d463a73", size = 82946, upload-time = "2024-08-11T07:37:50.279Z" }, - { url = "https://files.pythonhosted.org/packages/80/f1/d4b915160c9d677174aa5fae4537ae1f5acb23b3745ab0873071ef671f0a/watchdog-4.0.2-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:32be97f3b75693a93c683787a87a0dc8db98bb84701539954eef991fb35f5fbc", size = 82947, upload-time = "2024-08-11T07:37:51.55Z" }, - { url = "https://files.pythonhosted.org/packages/db/02/56ebe2cf33b352fe3309588eb03f020d4d1c061563d9858a9216ba004259/watchdog-4.0.2-py3-none-manylinux2014_s390x.whl", hash = "sha256:c82253cfc9be68e3e49282831afad2c1f6593af80c0daf1287f6a92657986757", size = 82944, upload-time = "2024-08-11T07:37:52.855Z" }, - { url = "https://files.pythonhosted.org/packages/01/d2/c8931ff840a7e5bd5dcb93f2bb2a1fd18faf8312e9f7f53ff1cf76ecc8ed/watchdog-4.0.2-py3-none-manylinux2014_x86_64.whl", hash = "sha256:c0b14488bd336c5b1845cee83d3e631a1f8b4e9c5091ec539406e4a324f882d8", size = 82947, upload-time = "2024-08-11T07:37:55.172Z" }, - { url = "https://files.pythonhosted.org/packages/d0/d8/cdb0c21a4a988669d7c210c75c6a2c9a0e16a3b08d9f7e633df0d9a16ad8/watchdog-4.0.2-py3-none-win32.whl", hash = "sha256:0d8a7e523ef03757a5aa29f591437d64d0d894635f8a50f370fe37f913ce4e19", size = 82935, upload-time = "2024-08-11T07:37:56.668Z" }, - { url = "https://files.pythonhosted.org/packages/99/2e/b69dfaae7a83ea64ce36538cc103a3065e12c447963797793d5c0a1d5130/watchdog-4.0.2-py3-none-win_amd64.whl", hash = "sha256:c344453ef3bf875a535b0488e3ad28e341adbd5a9ffb0f7d62cefacc8824ef2b", size = 82934, upload-time = "2024-08-11T07:37:57.991Z" }, - { url = "https://files.pythonhosted.org/packages/b0/0b/43b96a9ecdd65ff5545b1b13b687ca486da5c6249475b1a45f24d63a1858/watchdog-4.0.2-py3-none-win_ia64.whl", hash = "sha256:baececaa8edff42cd16558a639a9b0ddf425f93d892e8392a56bf904f5eff22c", size = 82933, upload-time = "2024-08-11T07:37:59.573Z" }, -] - [[package]] name = "watchdog" version = "6.0.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/db/7d/7f3d619e951c88ed75c6037b246ddcf2d322812ee8ea189be89511721d54/watchdog-6.0.0.tar.gz", hash = "sha256:9ddf7c82fda3ae8e24decda1338ede66e1c99883db93711d8fb941eaa2d8c282", size = 131220, upload-time = "2024-11-01T14:07:13.037Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/0c/56/90994d789c61df619bfc5ce2ecdabd5eeff564e1eb47512bd01b5e019569/watchdog-6.0.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d1cdb490583ebd691c012b3d6dae011000fe42edb7a82ece80965b42abd61f26", size = 96390, upload-time = "2024-11-01T14:06:24.793Z" }, @@ -6234,38 +3873,10 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/fd/84/fd2ba7aafacbad3c4201d395674fc6348826569da3c0937e75505ead3528/wcwidth-0.2.13-py2.py3-none-any.whl", hash = "sha256:3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859", size = 34166, upload-time = "2024-01-06T02:10:55.763Z" }, ] -[[package]] -name = "webcolors" -version = "24.8.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/fe/f8/53150a5bda7e042840b14f0236e1c0a4819d403658e3d453237983addfac/webcolors-24.8.0.tar.gz", hash = "sha256:08b07af286a01bcd30d583a7acadf629583d1f79bfef27dd2c2c5c263817277d", size = 42392, upload-time = "2024-08-10T08:52:31.226Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/f0/33/12020ba99beaff91682b28dc0bbf0345bbc3244a4afbae7644e4fa348f23/webcolors-24.8.0-py3-none-any.whl", hash = "sha256:fc4c3b59358ada164552084a8ebee637c221e4059267d0f8325b3b560f6c7f0a", size = 15027, upload-time = "2024-08-10T08:52:28.707Z" }, -] - [[package]] name = "webcolors" version = "24.11.1" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/7b/29/061ec845fb58521848f3739e466efd8250b4b7b98c1b6c5bf4d40b419b7e/webcolors-24.11.1.tar.gz", hash = "sha256:ecb3d768f32202af770477b8b65f318fa4f566c22948673a977b00d589dd80f6", size = 45064, upload-time = "2024-11-11T07:43:24.224Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/60/e8/c0e05e4684d13459f93d312077a9a2efbe04d59c393bc2b8802248c908d4/webcolors-24.11.1-py3-none-any.whl", hash = "sha256:515291393b4cdf0eb19c155749a096f779f7d909f7cceea072791cb9095b92e9", size = 14934, upload-time = "2024-11-11T07:43:22.529Z" }, @@ -6307,38 +3918,10 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ca/51/5447876806d1088a0f8f71e16542bf350918128d0a69437df26047c8e46f/widgetsnbextension-4.0.14-py3-none-any.whl", hash = "sha256:4875a9eaf72fbf5079dc372a51a9f268fc38d46f767cbf85c43a36da5cb9b575", size = 2196503, upload-time = "2025-04-10T13:01:23.086Z" }, ] -[[package]] -name = "zipp" -version = "3.20.2" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.9' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version < '3.9' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version < '3.9' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version < '3.9' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.9' and sys_platform != 'darwin' and sys_platform != 'linux')", -] -sdist = { url = "https://files.pythonhosted.org/packages/54/bf/5c0000c44ebc80123ecbdddba1f5dcd94a5ada602a9c225d84b5aaa55e86/zipp-3.20.2.tar.gz", hash = "sha256:bc9eb26f4506fda01b81bcde0ca78103b6e62f991b381fec825435c836edbc29", size = 24199, upload-time = "2024-09-13T13:44:16.101Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/62/8b/5ba542fa83c90e09eac972fc9baca7a88e7e7ca4b221a89251954019308b/zipp-3.20.2-py3-none-any.whl", hash = "sha256:a817ac80d6cf4b23bf7f2828b7cabf326f15a001bea8b1f9b49631780ba28350", size = 9200, upload-time = "2024-09-13T13:44:14.38Z" }, -] - [[package]] name = "zipp" version = "3.23.0" source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.12' and sys_platform == 'darwin'", - "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.11.*' and sys_platform == 'darwin'", - "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.10.*' and sys_platform == 'darwin'", - "python_full_version == '3.10.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.10.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.10.*' and sys_platform != 'darwin' and sys_platform != 'linux')", - "python_full_version == '3.9.*' and platform_machine == 'arm64' and sys_platform == 'darwin'", - "python_full_version == '3.9.*' and platform_machine == 'aarch64' and sys_platform == 'linux'", - "(python_full_version == '3.9.*' and platform_machine != 'arm64' and sys_platform == 'darwin') or (python_full_version == '3.9.*' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.9.*' and sys_platform != 'darwin' and sys_platform != 'linux')", -] sdist = { url = "https://files.pythonhosted.org/packages/e3/02/0f2892c661036d50ede074e376733dca2ae7c6eb617489437771209d4180/zipp-3.23.0.tar.gz", hash = "sha256:a07157588a12518c9d4034df3fbbee09c814741a33ff63c05fa29d26a2404166", size = 25547, upload-time = "2025-06-08T17:06:39.4Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/2e/54/647ade08bf0db230bfea292f893923872fd20be6ac6f53b2b936ba839d75/zipp-3.23.0-py3-none-any.whl", hash = "sha256:071652d6115ed432f5ce1d34c336c0adfd6a884660d1e9712a256d3d3bd4b14e", size = 10276, upload-time = "2025-06-08T17:06:38.034Z" }, From fb16bd9ee1a005a1dbdede7375a32058f16a891d Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 13:07:01 +0530 Subject: [PATCH 061/110] chore: change match_metric to overlap_metric --- supervision/detection/core.py | 17 ++++++------- supervision/detection/overlap_filter.py | 32 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index ed776496..6bbfbf4a 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -16,6 +16,7 @@ from supervision.detection.overlap_filter import ( box_non_max_suppression, mask_non_max_merge, mask_non_max_suppression, + OverlapMetric, ) from supervision.detection.tools.transformers import ( process_transformers_detection_result, @@ -1572,7 +1573,7 @@ class Detections: self, threshold: float = 0.5, class_agnostic: bool = False, - match_metric: str = "IOU", + overlap_metric: OverlapMetric = OverlapMetric.IOU, ) -> Detections: """ Performs non-max suppression on detection set. If the detections result @@ -1585,7 +1586,7 @@ class Detections: class_agnostic (bool): Whether to perform class-agnostic non-maximum suppression. If True, the class_id of each detection will be ignored. Defaults to False. - match_metric (str): Metric used for matching detections in slices. + overlap_metric (OverlapMetric): Metric used for matching detections in slices. "IOU" or "IOS". Defaults "IOU". Returns: @@ -1623,13 +1624,13 @@ class Detections: predictions=predictions, masks=self.mask, iou_threshold=threshold, - match_metric=match_metric, + match_metric=overlap_metric, ) else: indices = box_non_max_suppression( predictions=predictions, iou_threshold=threshold, - match_metric=match_metric, + match_metric=overlap_metric, ) return self[indices] @@ -1638,7 +1639,7 @@ class Detections: self, threshold: float = 0.5, class_agnostic: bool = False, - match_metric: str = "IOU", + overlap_metric: OverlapMetric = OverlapMetric.IOU, ) -> Detections: """ Perform non-maximum merging on the current set of object detections. @@ -1649,7 +1650,7 @@ class Detections: class_agnostic (bool): Whether to perform class-agnostic non-maximum merging. If True, the class_id of each detection will be ignored. Defaults to False. - match_metric (str): Metric used for matching detections in slices. + overlap_metric (OverlapMetric): Metric used for matching detections in slices. "IOU" or "IOS". Defaults "IOU". Returns: @@ -1689,13 +1690,13 @@ class Detections: predictions=predictions, masks=self.mask, iou_threshold=threshold, - match_metric=match_metric, + match_metric=overlap_metric, ) else: merge_groups = box_non_max_merge( predictions=predictions, iou_threshold=threshold, - match_metric=match_metric, + match_metric=overlap_metric, ) result = [] diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index 26edeaef..ab70c54e 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -406,3 +406,35 @@ class OverlapFilter(Enum): f"Invalid value type: {type(value)}. Must be an instance of " f"{cls.__name__} or str." ) + + +class OverlapMetric(Enum): + """ + Enum specifying the metric for measuring overlap between detections. + + Attributes: + IOU: Intersection over Union. + IOS: Intersection over Similarity. + """ + + IOU = "IOU" + IOS = "IOS" + + @classmethod + def list(cls): + return list(map(lambda c: c.value, cls)) + + @classmethod + def from_value(cls, value: Union[OverlapFilter, str]) -> OverlapFilter: + if isinstance(value, cls): + return value + if isinstance(value, str): + value = value.lower() + try: + return cls(value) + except ValueError: + raise ValueError(f"Invalid value: {value}. Must be one of {cls.list()}") + raise ValueError( + f"Invalid value type: {type(value)}. Must be an instance of " + f"{cls.__name__} or str." + ) From 42e9c5ffcba2945bc5edc24acd0222e249333cf1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 07:37:22 +0000 Subject: [PATCH 062/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 6bbfbf4a..a9857617 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -12,11 +12,11 @@ from supervision.config import ( ORIENTED_BOX_COORDINATES, ) from supervision.detection.overlap_filter import ( + OverlapMetric, box_non_max_merge, box_non_max_suppression, mask_non_max_merge, mask_non_max_suppression, - OverlapMetric, ) from supervision.detection.tools.transformers import ( process_transformers_detection_result, From 7849831e12d0af323edbd25bb75ced0fb616223b Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 13:08:40 +0530 Subject: [PATCH 063/110] chore: make pre-commit happy --- supervision/detection/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index a9857617..c428356a 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -1586,8 +1586,8 @@ class Detections: class_agnostic (bool): Whether to perform class-agnostic non-maximum suppression. If True, the class_id of each detection will be ignored. Defaults to False. - overlap_metric (OverlapMetric): Metric used for matching detections in slices. - "IOU" or "IOS". Defaults "IOU". + overlap_metric (OverlapMetric): Metric used for matching detections + in slices. Returns: Detections: A new Detections object containing the subset of detections From 3fed5f9a259e9c4c00c243216bb05232bb5b7d7d Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 14:17:41 +0530 Subject: [PATCH 064/110] update: docs --- docs/detection/double_detection_filter.md | 6 ++++++ supervision/detection/overlap_filter.py | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/detection/double_detection_filter.md b/docs/detection/double_detection_filter.md index b0266371..5c450ce4 100644 --- a/docs/detection/double_detection_filter.md +++ b/docs/detection/double_detection_filter.md @@ -10,6 +10,12 @@ comments: true :::supervision.detection.overlap_filter.OverlapFilter + + +:::supervision.detection.overlap_filter.OverlapMetric + diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index ab70c54e..9cff643f 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -413,8 +413,12 @@ class OverlapMetric(Enum): Enum specifying the metric for measuring overlap between detections. Attributes: - IOU: Intersection over Union. - IOS: Intersection over Similarity. + IOU: Intersection over Union. A region-overlap metric that compares + two shapes (usually bounding boxes or masks) by normalising the + shared area with the area of their union. + IOS: Intersection over Smaller, a region-overlap metric that compares + two shapes (usually bounding boxes or masks) by normalising the + shared area with the smaller of the two shapes. """ IOU = "IOU" From fd25f4bf81bf8701e7c20fa0393e0a4cf6e16b12 Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 15:01:25 +0530 Subject: [PATCH 065/110] add: docs for mask_non_max_merge --- docs/detection/double_detection_filter.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/detection/double_detection_filter.md b/docs/detection/double_detection_filter.md index 5c450ce4..fbe944cf 100644 --- a/docs/detection/double_detection_filter.md +++ b/docs/detection/double_detection_filter.md @@ -33,3 +33,9 @@ comments: true :::supervision.detection.overlap_filter.box_non_max_merge + + + +:::supervision.detection.overlap_filter.mask_non_max_merge From ebf4b930b79b4636a34af85696dfe80e7f9e47b8 Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 15:01:36 +0530 Subject: [PATCH 066/110] add: test for mask_non_max_merge --- test/detection/test_overlap_filter.py | 172 ++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) diff --git a/test/detection/test_overlap_filter.py b/test/detection/test_overlap_filter.py index f628c30f..e302afb1 100644 --- a/test/detection/test_overlap_filter.py +++ b/test/detection/test_overlap_filter.py @@ -8,6 +8,7 @@ from supervision.detection.overlap_filter import ( box_non_max_suppression, group_overlapping_boxes, mask_non_max_suppression, + mask_non_max_merge, ) @@ -447,3 +448,174 @@ def test_mask_non_max_suppression( predictions=predictions, masks=masks, iou_threshold=iou_threshold ) assert np.array_equal(result, expected_result) + + +@pytest.mark.parametrize( + "predictions, masks, iou_threshold, expected_result, exception", + [ + ( + np.empty((0, 6)), + np.empty((0, 5, 5)), + 0.5, + [], + DoesNotRaise(), + ), # empty predictions and masks + ( + np.array([[0, 0, 0, 0, 0.8]]), + np.array( + [ + [ + [False, False, False, False, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, False, False, False, False], + ] + ] + ), + 0.5, + [[0]], + DoesNotRaise(), + ), # single mask with no category + ( + np.array([[0, 0, 0, 0, 0.8, 0]]), + np.array( + [ + [ + [False, False, False, False, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, False, False, False, False], + ] + ] + ), + 0.5, + [[0]], + DoesNotRaise(), + ), # single mask with category + ( + np.array([[0, 0, 0, 0, 0.9], [0, 0, 0, 0, 0.8]]), + np.array( + [ + [ + [False, False, False, False, False], + [False, True, True, False, False], + [False, True, True, False, False], + [False, False, False, False, False], + [False, False, False, False, False], + ], + [ + [False, False, False, False, False], + [False, False, False, False, False], + [False, False, False, True, True], + [False, False, False, True, True], + [False, False, False, False, False], + ], + ] + ), + 0.5, + [[0], [1]], + DoesNotRaise(), + ), # two masks non-overlapping with no category + ( + np.array([[0, 0, 0, 0, 0.9], [0, 0, 0, 0, 0.8]]), + np.array( + [ + [ + [False, False, False, False, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, False, False, False, False], + ], + [ + [False, False, False, False, False], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, False, False, False], + ], + ] + ), + 0.2, + [[0, 1]], + DoesNotRaise(), + ), # two masks partially overlapping with no category + ( + np.array([[0, 0, 0, 0, 0.9, 0], [0, 0, 0, 0, 0.8, 1]]), + np.array( + [ + [ + [False, False, False, False, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, False, False, False, False], + ], + [ + [False, False, False, False, False], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, False, False, False], + ], + ] + ), + 0.2, + [[0], [1]], + DoesNotRaise(), + ), # two masks partially overlapping with different category + ( + np.array( + [ + [0, 0, 0, 0, 0.9, 0], + [0, 0, 0, 0, 0.8, 0], + [0, 0, 0, 0, 0.85, 1], + ] + ), + np.array( + [ + [ # mask 0, class 0 + [False, False, False, False, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, False, False, False, False], + ], + [ # mask 1, class 0 + [False, False, False, False, False], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, False, False, False], + ], + [ # mask 2, class 1 + [False, False, False, False, False], + [False, False, False, True, True], + [False, False, False, True, True], + [False, False, False, False, False], + [False, False, False, False, False], + ], + ] + ), + 0.2, + [[0, 1], [2]], + DoesNotRaise(), + ), # three masks, two overlapping with same class + ], +) +def test_mask_non_max_merge( + predictions: np.ndarray, + masks: np.ndarray, + iou_threshold: float, + expected_result: List[List[int]], + exception: Exception, +) -> None: + with exception: + result = mask_non_max_merge( + predictions=predictions, masks=masks, iou_threshold=iou_threshold + ) + result = sorted([sorted(group) for group in result]) + expected_result = sorted([sorted(group) for group in expected_result]) + assert result == expected_result From b3024e780d3baaf83571fa649776921c5be59bd9 Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 15:01:57 +0530 Subject: [PATCH 067/110] chore: make pre-commit happy --- test/detection/test_overlap_filter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/detection/test_overlap_filter.py b/test/detection/test_overlap_filter.py index e302afb1..08cd870f 100644 --- a/test/detection/test_overlap_filter.py +++ b/test/detection/test_overlap_filter.py @@ -7,8 +7,8 @@ import pytest from supervision.detection.overlap_filter import ( box_non_max_suppression, group_overlapping_boxes, - mask_non_max_suppression, mask_non_max_merge, + mask_non_max_suppression, ) From 007d8f5dadcbf4acc862775fcf51b2e5f72f464b Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 15:34:24 +0530 Subject: [PATCH 068/110] chore: make enum comparisons --- supervision/detection/core.py | 2 +- supervision/detection/overlap_filter.py | 83 +++--------- supervision/detection/utils.py | 70 +++++++--- test/detection/test_overlap_filter.py | 172 ------------------------ 4 files changed, 75 insertions(+), 252 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index c428356a..3b343b46 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -12,7 +12,6 @@ from supervision.config import ( ORIENTED_BOX_COORDINATES, ) from supervision.detection.overlap_filter import ( - OverlapMetric, box_non_max_merge, box_non_max_suppression, mask_non_max_merge, @@ -36,6 +35,7 @@ from supervision.detection.utils import ( merge_metadata, process_roboflow_result, xywh_to_xyxy, + OverlapMetric, ) from supervision.detection.vlm import ( LMM, diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index 9cff643f..34bfb024 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -7,6 +7,7 @@ import numpy as np import numpy.typing as npt from supervision.detection.utils import box_iou_batch, mask_iou_batch +from supervision.detection.utils import OverlapMetric def resize_masks(masks: np.ndarray, max_dimension: int = 640) -> np.ndarray: @@ -42,7 +43,7 @@ def mask_non_max_suppression( predictions: np.ndarray, masks: np.ndarray, iou_threshold: float = 0.5, - match_metric: str = "IOU", + overlap_metric: OverlapMetric = OverlapMetric.IOU, mask_dimension: int = 640, ) -> np.ndarray: """ @@ -58,8 +59,7 @@ def mask_non_max_suppression( dimensions of each mask. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. - match_metric (str): Metric used for matching detections in slices. - "IOU" or "IOS". Defaults "IOU". + overlap_metric (OverlapMetric): Metric used for matching detections in slices. mask_dimension (int): The dimension to which the masks should be resized before computing IOU values. Defaults to 640. @@ -84,7 +84,7 @@ def mask_non_max_suppression( predictions = predictions[sort_index] masks = masks[sort_index] masks_resized = resize_masks(masks, mask_dimension) - ious = mask_iou_batch(masks_resized, masks_resized, match_metric) + ious = mask_iou_batch(masks_resized, masks_resized, overlap_metric) categories = predictions[:, 5] keep = np.ones(rows, dtype=bool) @@ -97,7 +97,7 @@ def mask_non_max_suppression( def box_non_max_suppression( - predictions: np.ndarray, iou_threshold: float = 0.5, match_metric: str = "IOU" + predictions: np.ndarray, iou_threshold: float = 0.5, overlap_metric: OverlapMetric = OverlapMetric.IOU ) -> np.ndarray: """ Perform Non-Maximum Suppression (NMS) on object detection predictions. @@ -108,8 +108,7 @@ def box_non_max_suppression( or `(x_min, y_min, x_max, y_max, score, class)`. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. - match_metric (str): Metric used for matching detections in slices. - "IOU" or "IOS". Defaults "IOU". + overlap_metric (OverlapMetric): Metric used for matching detections in slices. Returns: np.ndarray: A boolean array indicating which predictions to keep after n @@ -135,7 +134,7 @@ def box_non_max_suppression( boxes = predictions[:, :4] categories = predictions[:, 5] - ious = box_iou_batch(boxes, boxes, match_metric) + ious = box_iou_batch(boxes, boxes, overlap_metric) ious = ious - np.eye(rows) keep = np.ones(rows, dtype=bool) @@ -155,7 +154,7 @@ def box_non_max_suppression( def group_overlapping_boxes( predictions: npt.NDArray[np.float64], iou_threshold: float = 0.5, - match_metric: str = "IOU", + overlap_metric: OverlapMetric = OverlapMetric.IOU, ) -> List[List[int]]: """ Apply greedy version of non-maximum merging to avoid detecting too many @@ -167,8 +166,7 @@ def group_overlapping_boxes( and the confidence scores. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. Defaults to 0.5. - match_metric (str): Metric used for matching detections in slices. - "IOU" or "IOS". Defaults "IOU". + overlap_metric (OverlapMetric): Metric used for matching detections in slices. Returns: List[List[int]]: Groups of prediction indices be merged. @@ -189,7 +187,7 @@ def group_overlapping_boxes( merge_candidate = np.expand_dims(predictions[idx], axis=0) ious = box_iou_batch( - predictions[order][:, :4], merge_candidate[:, :4], match_metric + predictions[order][:, :4], merge_candidate[:, :4], overlap_metric ) ious = ious.flatten() @@ -205,7 +203,7 @@ def mask_non_max_merge( masks: np.ndarray, iou_threshold: float = 0.5, mask_dimension: int = 640, - match_metric: str = "IOU", + overlap_metric: OverlapMetric = OverlapMetric.IOU, ) -> List[List[int]]: """ Perform Non-Maximum Merging (NMM) on segmentation predictions. @@ -222,8 +220,7 @@ def mask_non_max_merge( to use for non-maximum suppression. mask_dimension (int): The dimension to which the masks should be resized before computing IOU values. Defaults to 640. - match_metric (str): Metric used for matching detections in slices. - "IOU" or "IOS". Defaults "IOU". + overlap_metric (OverlapMetric): Metric used for matching detections in slices. Returns: np.ndarray: A boolean array indicating which predictions to keep after @@ -236,7 +233,7 @@ def mask_non_max_merge( masks_resized = resize_masks(masks, mask_dimension) if predictions.shape[1] == 5: return group_overlapping_masks( - predictions, masks_resized, iou_threshold, match_metric + predictions, masks_resized, iou_threshold, overlap_metric ) category_ids = predictions[:, 5] @@ -247,7 +244,7 @@ def mask_non_max_merge( predictions[curr_indices], masks_resized[curr_indices], iou_threshold, - match_metric, + overlap_metric, ) for merge_class_group in merge_class_groups: @@ -264,7 +261,7 @@ def mask_non_max_merge( def box_non_max_merge( predictions: npt.NDArray[np.float64], iou_threshold: float = 0.5, - match_metric: str = "IOU", + overlap_metric: OverlapMetric = OverlapMetric.IOU, ) -> List[List[int]]: """ Apply greedy version of non-maximum merging per category to avoid detecting @@ -277,22 +274,21 @@ def box_non_max_merge( detections of different classes to be merged. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. Defaults to 0.5. - match_metric (str): Metric used for matching detections in slices. - "IOU" or "IOS". Defaults "IOU". + overlap_metric (OverlapMetric): Metric used for matching detections in slices. Returns: List[List[int]]: Groups of prediction indices be merged. Each group may have 1 or more elements. """ if predictions.shape[1] == 5: - return group_overlapping_boxes(predictions, iou_threshold, match_metric) + return group_overlapping_boxes(predictions, iou_threshold, overlap_metric) category_ids = predictions[:, 5] merge_groups = [] for category_id in np.unique(category_ids): curr_indices = np.where(category_ids == category_id)[0] merge_class_groups = group_overlapping_boxes( - predictions[curr_indices], iou_threshold, match_metric + predictions[curr_indices], iou_threshold, overlap_metric ) for merge_class_group in merge_class_groups: @@ -310,7 +306,7 @@ def group_overlapping_masks( predictions: npt.NDArray[np.float64], masks: npt.NDArray[np.float64], iou_threshold: float = 0.5, - match_metric: str = "IOU", + overlap_metric: OverlapMetric = OverlapMetric.IOU, ) -> List[List[int]]: """ Apply greedy version of non-maximum merging to avoid detecting too many @@ -323,8 +319,7 @@ def group_overlapping_masks( the predictions. iou_threshold (float): The intersection-over-union threshold to use for non-maximum suppression. Defaults to 0.5. - match_metric (str): Metric used for matching detections in slices. - "IOU" or "IOS". Defaults "IOU". + overlap_metric (OverlapMetric): Metric used for matching detections in slices. Returns: List[List[int]]: Groups of prediction indices be merged. @@ -348,7 +343,7 @@ def group_overlapping_masks( candidate_groups = [idx] while len(order) > 0: # 'IOU or IOS' of the calculate mask and the remaining mask - ious = mask_iou_batch(masks[order], merge_candidate, match_metric) + ious = mask_iou_batch(masks[order], merge_candidate, overlap_metric) above_threshold: np.ndarray = ious.flatten() >= iou_threshold # if no mask is above threshold, break if not above_threshold.any(): @@ -406,39 +401,3 @@ class OverlapFilter(Enum): f"Invalid value type: {type(value)}. Must be an instance of " f"{cls.__name__} or str." ) - - -class OverlapMetric(Enum): - """ - Enum specifying the metric for measuring overlap between detections. - - Attributes: - IOU: Intersection over Union. A region-overlap metric that compares - two shapes (usually bounding boxes or masks) by normalising the - shared area with the area of their union. - IOS: Intersection over Smaller, a region-overlap metric that compares - two shapes (usually bounding boxes or masks) by normalising the - shared area with the smaller of the two shapes. - """ - - IOU = "IOU" - IOS = "IOS" - - @classmethod - def list(cls): - return list(map(lambda c: c.value, cls)) - - @classmethod - def from_value(cls, value: Union[OverlapFilter, str]) -> OverlapFilter: - if isinstance(value, cls): - return value - if isinstance(value, str): - value = value.lower() - try: - return cls(value) - except ValueError: - raise ValueError(f"Invalid value: {value}. Must be one of {cls.list()}") - raise ValueError( - f"Invalid value type: {type(value)}. Must be an instance of " - f"{cls.__name__} or str." - ) diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index b44cd2b6..63670144 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -1,4 +1,7 @@ +from __future__ import annotations + from itertools import chain +from enum import Enum from typing import Any, Dict, List, Optional, Tuple, Union import cv2 @@ -11,6 +14,42 @@ from supervision.geometry.core import Vector MIN_POLYGON_POINT_COUNT = 3 +class OverlapMetric(Enum): + """ + Enum specifying the metric for measuring overlap between detections. + + Attributes: + IOU: Intersection over Union. A region-overlap metric that compares + two shapes (usually bounding boxes or masks) by normalising the + shared area with the area of their union. + IOS: Intersection over Smaller, a region-overlap metric that compares + two shapes (usually bounding boxes or masks) by normalising the + shared area with the smaller of the two shapes. + """ + + IOU = "IOU" + IOS = "IOS" + + @classmethod + def list(cls): + return list(map(lambda c: c.value, cls)) + + @classmethod + def from_value(cls, value: Union[OverlapMetric, str]) -> OverlapMetric: + if isinstance(value, cls): + return value + if isinstance(value, str): + value = value.lower() + try: + return cls(value) + except ValueError: + raise ValueError(f"Invalid value: {value}. Must be one of {cls.list()}") + raise ValueError( + f"Invalid value type: {type(value)}. Must be an instance of " + f"{cls.__name__} or str." + ) + + def xyxy_to_polygons(box: np.ndarray) -> np.ndarray: """ Convert an array of boxes to an array of polygons. @@ -109,7 +148,7 @@ def box_iou( def box_iou_batch( - boxes_true: np.ndarray, boxes_detection: np.ndarray, match_metric: str = "IOU" + boxes_true: np.ndarray, boxes_detection: np.ndarray, overlap_metric: OverlapMetric = OverlapMetric.IOU ) -> np.ndarray: """ Compute Intersection over Union (IoU) of two sets of bounding boxes - @@ -126,8 +165,7 @@ def box_iou_batch( `shape = (N, 4)` where `N` is number of true objects. boxes_detection (np.ndarray): 2D `np.ndarray` representing detection boxes. `shape = (M, 4)` where `M` is number of detected objects. - match_metric (str): Metric used for matching detections in slices. - "IOU" or "IOS". Defaults "IOU". + overlap_metric (OverlapMetric): Metric used for matching detections in slices. Returns: np.ndarray: Pairwise IoU of boxes from `boxes_true` and `boxes_detection`. @@ -167,7 +205,7 @@ def box_iou_batch( area_inter = np.prod(np.clip(bottom_right - top_left, a_min=0, a_max=None), 2) - if match_metric.upper() == "IOU": + if overlap_metric == OverlapMetric.IOU: union_area = area_true[:, None] + area_detection - area_inter ious = np.divide( area_inter, @@ -175,7 +213,7 @@ def box_iou_batch( out=np.zeros_like(area_inter, dtype=float), where=union_area != 0, ) - elif match_metric.upper() == "IOS": + elif overlap_metric == OverlapMetric.IOS: small_area = np.minimum(area_true[:, None], area_detection) ious = np.divide( area_inter, @@ -185,7 +223,7 @@ def box_iou_batch( ) else: raise ValueError( - f"match_metric {match_metric} is not supported, " + f"overlap_metric {overlap_metric} is not supported, " "only 'IOU' and 'IOS' are supported" ) @@ -196,7 +234,7 @@ def box_iou_batch( def _mask_iou_batch_split( masks_true: np.ndarray, masks_detection: np.ndarray, - match_metric: str = "IOU", + overlap_metric: OverlapMetric = OverlapMetric.IOU, ) -> np.ndarray: """ Internal function. @@ -206,8 +244,7 @@ def _mask_iou_batch_split( Args: masks_true (np.ndarray): 3D `np.ndarray` representing ground-truth masks. masks_detection (np.ndarray): 3D `np.ndarray` representing detection masks. - match_metric (str): Metric used for matching detections in slices. - "IOU" or "IOS". Defaults "IOU". + overlap_metric (OverlapMetric): Metric used for matching detections in slices. Returns: np.ndarray: Pairwise IoU of masks from `masks_true` and `masks_detection`. @@ -219,7 +256,7 @@ def _mask_iou_batch_split( masks_true_area = masks_true.sum(axis=(1, 2)) # (area1, area2, ...) masks_detection_area = masks_detection.sum(axis=(1, 2)) # (area1) - if match_metric.upper() == "IOU": + if overlap_metric == OverlapMetric.IOU: union_area = masks_true_area[:, None] + masks_detection_area - intersection_area ious = np.divide( intersection_area, @@ -227,7 +264,7 @@ def _mask_iou_batch_split( out=np.zeros_like(intersection_area, dtype=float), where=union_area != 0, ) - elif match_metric.upper() == "IOS": + elif overlap_metric == OverlapMetric.IOS: # ios = intersection_area / min(area1, area2) small_area = np.minimum(masks_true_area[:, None], masks_detection_area) ious = np.divide( @@ -238,7 +275,7 @@ def _mask_iou_batch_split( ) else: raise ValueError( - f"match_metric {match_metric} is not supported, " + f"overlap_metric {overlap_metric} is not supported, " "only 'IOU' and 'IOS' are supported" ) @@ -249,7 +286,7 @@ def _mask_iou_batch_split( def mask_iou_batch( masks_true: np.ndarray, masks_detection: np.ndarray, - match_metric: str = "IOU", + overlap_metric: OverlapMetric = OverlapMetric.IOU, memory_limit: int = 1024 * 5, ) -> np.ndarray: """ @@ -259,8 +296,7 @@ def mask_iou_batch( Args: masks_true (np.ndarray): 3D `np.ndarray` representing ground-truth masks. masks_detection (np.ndarray): 3D `np.ndarray` representing detection masks. - match_metric (str): Metric used for matching detections in slices. - "IOU" or "IOS". Defaults "IOU". + overlap_metric (OverlapMetric): Metric used for matching detections in slices. memory_limit (int): memory limit in MB, default is 1024 * 5 MB (5GB). Returns: @@ -275,7 +311,7 @@ def mask_iou_batch( / 1024 ) if memory <= memory_limit: - return _mask_iou_batch_split(masks_true, masks_detection, match_metric) + return _mask_iou_batch_split(masks_true, masks_detection, overlap_metric) ious = [] step = max( @@ -292,7 +328,7 @@ def mask_iou_batch( for i in range(0, masks_true.shape[0], step): ious.append( _mask_iou_batch_split( - masks_true[i : i + step], masks_detection, match_metric + masks_true[i : i + step], masks_detection, overlap_metric ) ) diff --git a/test/detection/test_overlap_filter.py b/test/detection/test_overlap_filter.py index 08cd870f..f628c30f 100644 --- a/test/detection/test_overlap_filter.py +++ b/test/detection/test_overlap_filter.py @@ -7,7 +7,6 @@ import pytest from supervision.detection.overlap_filter import ( box_non_max_suppression, group_overlapping_boxes, - mask_non_max_merge, mask_non_max_suppression, ) @@ -448,174 +447,3 @@ def test_mask_non_max_suppression( predictions=predictions, masks=masks, iou_threshold=iou_threshold ) assert np.array_equal(result, expected_result) - - -@pytest.mark.parametrize( - "predictions, masks, iou_threshold, expected_result, exception", - [ - ( - np.empty((0, 6)), - np.empty((0, 5, 5)), - 0.5, - [], - DoesNotRaise(), - ), # empty predictions and masks - ( - np.array([[0, 0, 0, 0, 0.8]]), - np.array( - [ - [ - [False, False, False, False, False], - [False, True, True, True, False], - [False, True, True, True, False], - [False, True, True, True, False], - [False, False, False, False, False], - ] - ] - ), - 0.5, - [[0]], - DoesNotRaise(), - ), # single mask with no category - ( - np.array([[0, 0, 0, 0, 0.8, 0]]), - np.array( - [ - [ - [False, False, False, False, False], - [False, True, True, True, False], - [False, True, True, True, False], - [False, True, True, True, False], - [False, False, False, False, False], - ] - ] - ), - 0.5, - [[0]], - DoesNotRaise(), - ), # single mask with category - ( - np.array([[0, 0, 0, 0, 0.9], [0, 0, 0, 0, 0.8]]), - np.array( - [ - [ - [False, False, False, False, False], - [False, True, True, False, False], - [False, True, True, False, False], - [False, False, False, False, False], - [False, False, False, False, False], - ], - [ - [False, False, False, False, False], - [False, False, False, False, False], - [False, False, False, True, True], - [False, False, False, True, True], - [False, False, False, False, False], - ], - ] - ), - 0.5, - [[0], [1]], - DoesNotRaise(), - ), # two masks non-overlapping with no category - ( - np.array([[0, 0, 0, 0, 0.9], [0, 0, 0, 0, 0.8]]), - np.array( - [ - [ - [False, False, False, False, False], - [False, True, True, True, False], - [False, True, True, True, False], - [False, True, True, True, False], - [False, False, False, False, False], - ], - [ - [False, False, False, False, False], - [False, False, True, True, True], - [False, False, True, True, True], - [False, False, True, True, True], - [False, False, False, False, False], - ], - ] - ), - 0.2, - [[0, 1]], - DoesNotRaise(), - ), # two masks partially overlapping with no category - ( - np.array([[0, 0, 0, 0, 0.9, 0], [0, 0, 0, 0, 0.8, 1]]), - np.array( - [ - [ - [False, False, False, False, False], - [False, True, True, True, False], - [False, True, True, True, False], - [False, True, True, True, False], - [False, False, False, False, False], - ], - [ - [False, False, False, False, False], - [False, False, True, True, True], - [False, False, True, True, True], - [False, False, True, True, True], - [False, False, False, False, False], - ], - ] - ), - 0.2, - [[0], [1]], - DoesNotRaise(), - ), # two masks partially overlapping with different category - ( - np.array( - [ - [0, 0, 0, 0, 0.9, 0], - [0, 0, 0, 0, 0.8, 0], - [0, 0, 0, 0, 0.85, 1], - ] - ), - np.array( - [ - [ # mask 0, class 0 - [False, False, False, False, False], - [False, True, True, True, False], - [False, True, True, True, False], - [False, True, True, True, False], - [False, False, False, False, False], - ], - [ # mask 1, class 0 - [False, False, False, False, False], - [False, False, True, True, True], - [False, False, True, True, True], - [False, False, True, True, True], - [False, False, False, False, False], - ], - [ # mask 2, class 1 - [False, False, False, False, False], - [False, False, False, True, True], - [False, False, False, True, True], - [False, False, False, False, False], - [False, False, False, False, False], - ], - ] - ), - 0.2, - [[0, 1], [2]], - DoesNotRaise(), - ), # three masks, two overlapping with same class - ], -) -def test_mask_non_max_merge( - predictions: np.ndarray, - masks: np.ndarray, - iou_threshold: float, - expected_result: List[List[int]], - exception: Exception, -) -> None: - with exception: - result = mask_non_max_merge( - predictions=predictions, masks=masks, iou_threshold=iou_threshold - ) - result = sorted([sorted(group) for group in result]) - expected_result = sorted([sorted(group) for group in expected_result]) - assert result == expected_result From ae77077853c46f983b4e93cafc518ced9c27653a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 10:04:55 +0000 Subject: [PATCH 069/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 2 +- supervision/detection/overlap_filter.py | 7 ++++--- supervision/detection/utils.py | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 3b343b46..cdaf00d0 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -23,6 +23,7 @@ from supervision.detection.tools.transformers import ( process_transformers_v5_segmentation_result, ) from supervision.detection.utils import ( + OverlapMetric, box_iou_batch, calculate_masks_centroids, extract_ultralytics_masks, @@ -35,7 +36,6 @@ from supervision.detection.utils import ( merge_metadata, process_roboflow_result, xywh_to_xyxy, - OverlapMetric, ) from supervision.detection.vlm import ( LMM, diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index 34bfb024..47f5876b 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -6,8 +6,7 @@ from typing import List, Union import numpy as np import numpy.typing as npt -from supervision.detection.utils import box_iou_batch, mask_iou_batch -from supervision.detection.utils import OverlapMetric +from supervision.detection.utils import OverlapMetric, box_iou_batch, mask_iou_batch def resize_masks(masks: np.ndarray, max_dimension: int = 640) -> np.ndarray: @@ -97,7 +96,9 @@ def mask_non_max_suppression( def box_non_max_suppression( - predictions: np.ndarray, iou_threshold: float = 0.5, overlap_metric: OverlapMetric = OverlapMetric.IOU + predictions: np.ndarray, + iou_threshold: float = 0.5, + overlap_metric: OverlapMetric = OverlapMetric.IOU, ) -> np.ndarray: """ Perform Non-Maximum Suppression (NMS) on object detection predictions. diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 63670144..e06979ba 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -1,7 +1,7 @@ from __future__ import annotations -from itertools import chain from enum import Enum +from itertools import chain from typing import Any, Dict, List, Optional, Tuple, Union import cv2 @@ -148,7 +148,9 @@ def box_iou( def box_iou_batch( - boxes_true: np.ndarray, boxes_detection: np.ndarray, overlap_metric: OverlapMetric = OverlapMetric.IOU + boxes_true: np.ndarray, + boxes_detection: np.ndarray, + overlap_metric: OverlapMetric = OverlapMetric.IOU, ) -> np.ndarray: """ Compute Intersection over Union (IoU) of two sets of bounding boxes - From 4977fd64b145d2af540445c27902a1697a528262 Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 15:43:44 +0530 Subject: [PATCH 070/110] add: test_mask_non_max_merge --- test/detection/test_overlap_filter.py | 183 ++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) diff --git a/test/detection/test_overlap_filter.py b/test/detection/test_overlap_filter.py index f628c30f..8968780b 100644 --- a/test/detection/test_overlap_filter.py +++ b/test/detection/test_overlap_filter.py @@ -8,6 +8,7 @@ from supervision.detection.overlap_filter import ( box_non_max_suppression, group_overlapping_boxes, mask_non_max_suppression, + mask_non_max_merge, ) @@ -447,3 +448,185 @@ def test_mask_non_max_suppression( predictions=predictions, masks=masks, iou_threshold=iou_threshold ) assert np.array_equal(result, expected_result) + + +@pytest.mark.parametrize( + "predictions, masks, iou_threshold, expected_result, exception", + [ + ( + np.empty((0, 6)), + np.empty((0, 5, 5)), + 0.5, + [], + DoesNotRaise(), + ), # empty predictions and masks + ( + np.array([[0, 0, 0, 0, 0.8]]), + np.array( + [ + [ + [False, False, False, False, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, False, False, False, False], + ] + ] + ), + 0.5, + [[0]], + DoesNotRaise(), + ), # single mask with no category + ( + np.array([[0, 0, 0, 0, 0.8, 0]]), + np.array( + [ + [ + [False, False, False, False, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, False, False, False, False], + ] + ] + ), + 0.5, + [[0]], + DoesNotRaise(), + ), # single mask with category + ( + np.array([[0, 0, 0, 0, 0.8], [0, 0, 0, 0, 0.9]]), + np.array( + [ + [ + [False, False, False, False, False], + [False, True, True, False, False], + [False, True, True, False, False], + [False, False, False, False, False], + [False, False, False, False, False], + ], + [ + [False, False, False, False, False], + [False, False, False, False, False], + [False, False, False, True, True], + [False, False, False, True, True], + [False, False, False, False, False], + ], + ] + ), + 0.5, + [[0], [1]], + DoesNotRaise(), + ), # two masks non-overlapping with no category + ( + np.array([[0, 0, 0, 0, 0.8], [0, 0, 0, 0, 0.9]]), + np.array( + [ + [ + [False, False, False, False, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, False, False, False, False], + ], + [ + [False, False, False, False, False], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, False, False, False], + ], + ] + ), + 0.4, + [[0, 1]], + DoesNotRaise(), + ), # two masks partially overlapping with no category, merge + ( + np.array([[0, 0, 0, 0, 0.8], [0, 0, 0, 0, 0.9]]), + np.array( + [ + [ + [False, False, False, False, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, False, False, False, False], + ], + [ + [False, False, False, False, False], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, False, False, False], + ], + ] + ), + 0.6, + [[0, 1]], + DoesNotRaise(), + ), # two masks partially overlapping with no category, no merge + ( + np.array([[0, 0, 0, 0, 0.8, 0], [0, 0, 0, 0, 0.9, 1]]), + np.array( + [ + [ + [False, False, False, False, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, False, False, False, False], + ], + [ + [False, False, False, False, False], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, False, False, False], + ], + ] + ), + 0.4, + [[0], [1]], + DoesNotRaise(), + ), # two masks partially overlapping with different categories + ( + np.array([[0, 0, 0, 0, 0.8, 0], [0, 0, 0, 0, 0.9, 0]]), + np.array( + [ + [ + [False, False, False, False, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, True, True, True, False], + [False, False, False, False, False], + ], + [ + [False, False, False, False, False], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, True, True, True], + [False, False, False, False, False], + ], + ] + ), + 0.4, + [[0, 1]], + DoesNotRaise(), + ), # two masks partially overlapping with same category + ], +) +def test_mask_non_max_merge( + predictions: np.ndarray, + masks: np.ndarray, + iou_threshold: float, + expected_result: List[List[int]], + exception: Exception, +) -> None: + with exception: + result = mask_non_max_merge( + predictions=predictions, masks=masks, iou_threshold=iou_threshold + ) + sorted_result = sorted([sorted(group) for group in result]) + sorted_expected_result = sorted([sorted(group) for group in expected_result]) + assert sorted_result == sorted_expected_result From 9a38ebd15e591b1addcfa528492f5ff1320746b0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 10:14:03 +0000 Subject: [PATCH 071/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/detection/test_overlap_filter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/detection/test_overlap_filter.py b/test/detection/test_overlap_filter.py index 8968780b..b956b25b 100644 --- a/test/detection/test_overlap_filter.py +++ b/test/detection/test_overlap_filter.py @@ -7,8 +7,8 @@ import pytest from supervision.detection.overlap_filter import ( box_non_max_suppression, group_overlapping_boxes, - mask_non_max_suppression, mask_non_max_merge, + mask_non_max_suppression, ) From 2adb64b949df2abf14a574a49d460ca9c6fd223e Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 12:15:55 +0200 Subject: [PATCH 072/110] =?UTF-8?q?chore:=20=F0=9F=A7=B9=20update=20requir?= =?UTF-8?q?ements=20files=20to=20remove=20version=20constraints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/heatmap_and_track/requirements.txt | 4 ++-- examples/speed_estimation/ultralytics_example.py | 2 +- examples/time_in_zone/requirements.txt | 7 +++---- examples/tracking/requirements.txt | 6 +++--- examples/traffic_analysis/requirements.txt | 6 +++--- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/examples/heatmap_and_track/requirements.txt b/examples/heatmap_and_track/requirements.txt index dcf7f53f..d12cf36a 100644 --- a/examples/heatmap_and_track/requirements.txt +++ b/examples/heatmap_and_track/requirements.txt @@ -1,2 +1,2 @@ -supervision[assets]==0.19.0 -ultralytics<=8.3.40 +supervision +ultralytics \ No newline at end of file diff --git a/examples/speed_estimation/ultralytics_example.py b/examples/speed_estimation/ultralytics_example.py index 63a4c7ea..4a639314 100644 --- a/examples/speed_estimation/ultralytics_example.py +++ b/examples/speed_estimation/ultralytics_example.py @@ -70,7 +70,7 @@ if __name__ == "__main__": args = parse_arguments() video_info = sv.VideoInfo.from_video_path(video_path=args.source_video_path) - model = YOLO("yolov8x.pt") + model = YOLO("yolo11x.pt") byte_track = sv.ByteTrack( frame_rate=video_info.fps, track_activation_threshold=args.confidence_threshold diff --git a/examples/time_in_zone/requirements.txt b/examples/time_in_zone/requirements.txt index 58e3b78d..9f9446c8 100644 --- a/examples/time_in_zone/requirements.txt +++ b/examples/time_in_zone/requirements.txt @@ -1,5 +1,4 @@ -opencv-python -supervision>=0.20.0 -ultralytics<=8.3.40 -inference==0.9.17 +supervision +ultralytics +inference pytube diff --git a/examples/tracking/requirements.txt b/examples/tracking/requirements.txt index f31453c4..80c28300 100644 --- a/examples/tracking/requirements.txt +++ b/examples/tracking/requirements.txt @@ -1,4 +1,4 @@ -inference==0.9.17 -supervision==0.19.0 +inference +supervision tqdm -ultralytics<=8.3.40 +ultralytics diff --git a/examples/traffic_analysis/requirements.txt b/examples/traffic_analysis/requirements.txt index e07ecb06..a8f583e8 100644 --- a/examples/traffic_analysis/requirements.txt +++ b/examples/traffic_analysis/requirements.txt @@ -1,5 +1,5 @@ gdown -inference==0.9.17 -supervision>=0.20.0 +inference +supervision tqdm -ultralytics<=8.3.40 +ultralytics From 7ea8c2e43c466c49e905acb6f77aa10c73c56279 Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 15:46:10 +0530 Subject: [PATCH 073/110] chore: remove excessive comments in group_overlapping_masks --- supervision/detection/overlap_filter.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index 47f5876b..43333031 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -339,27 +339,20 @@ def group_overlapping_masks( merge_groups.append([idx]) break - # calculate mask merge_candidate = masks[idx][None, ...] candidate_groups = [idx] while len(order) > 0: - # 'IOU or IOS' of the calculate mask and the remaining mask ious = mask_iou_batch(masks[order], merge_candidate, overlap_metric) above_threshold: np.ndarray = ious.flatten() >= iou_threshold - # if no mask is above threshold, break if not above_threshold.any(): break - # get indexes that meet the threshold above_idx = order[above_threshold] - # update merge_candidate merge_candidate = np.logical_or.reduce( np.concatenate([masks[above_idx], merge_candidate]), axis=0, keepdims=True, ) - # add indexes that meet the criteria to the candidate_groups candidate_groups.extend(np.flip(above_idx).tolist()) - # update order, masks order = order[~above_threshold] merge_groups.append(candidate_groups) From f68a6bc362b0c12c1759ea0de7677f0b7f4dc314 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 10:16:23 +0000 Subject: [PATCH 074/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/heatmap_and_track/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/heatmap_and_track/requirements.txt b/examples/heatmap_and_track/requirements.txt index d12cf36a..a248de29 100644 --- a/examples/heatmap_and_track/requirements.txt +++ b/examples/heatmap_and_track/requirements.txt @@ -1,2 +1,2 @@ supervision -ultralytics \ No newline at end of file +ultralytics From c11a7de9499a4d5f7c3c40d9628413c3b83441b8 Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 15:58:26 +0530 Subject: [PATCH 075/110] chore: refactor docs for --- docs/detection/double_detection_filter.md | 6 ------ docs/detection/utils.md | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/detection/double_detection_filter.md b/docs/detection/double_detection_filter.md index fbe944cf..24384a13 100644 --- a/docs/detection/double_detection_filter.md +++ b/docs/detection/double_detection_filter.md @@ -10,12 +10,6 @@ comments: true :::supervision.detection.overlap_filter.OverlapFilter - - -:::supervision.detection.overlap_filter.OverlapMetric - diff --git a/docs/detection/utils.md b/docs/detection/utils.md index 5cef5d74..cd18be64 100644 --- a/docs/detection/utils.md +++ b/docs/detection/utils.md @@ -5,6 +5,12 @@ status: new # Detection Utils + + +:::supervision.detection.overlap_filter.OverlapMetric + From 84c9a34f924a825ebee9c16c88c867dcfb09dec4 Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 15:58:38 +0530 Subject: [PATCH 076/110] update: docstring --- supervision/detection/core.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index cdaf00d0..a74c2669 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -1586,8 +1586,8 @@ class Detections: class_agnostic (bool): Whether to perform class-agnostic non-maximum suppression. If True, the class_id of each detection will be ignored. Defaults to False. - overlap_metric (OverlapMetric): Metric used for matching detections - in slices. + overlap_metric (OverlapMetric): Metric used for measuring overlap between + detections in slices. Returns: Detections: A new Detections object containing the subset of detections @@ -1624,13 +1624,13 @@ class Detections: predictions=predictions, masks=self.mask, iou_threshold=threshold, - match_metric=overlap_metric, + overlap_metric=overlap_metric, ) else: indices = box_non_max_suppression( predictions=predictions, iou_threshold=threshold, - match_metric=overlap_metric, + overlap_metric=overlap_metric, ) return self[indices] @@ -1650,8 +1650,8 @@ class Detections: class_agnostic (bool): Whether to perform class-agnostic non-maximum merging. If True, the class_id of each detection will be ignored. Defaults to False. - overlap_metric (OverlapMetric): Metric used for matching detections in slices. - "IOU" or "IOS". Defaults "IOU". + overlap_metric (OverlapMetric): Metric used for measuring overlap between + detections in slices. Returns: Detections: A new Detections object containing the subset of detections @@ -1690,13 +1690,13 @@ class Detections: predictions=predictions, masks=self.mask, iou_threshold=threshold, - match_metric=overlap_metric, + overlap_metric=overlap_metric, ) else: merge_groups = box_non_max_merge( predictions=predictions, iou_threshold=threshold, - match_metric=overlap_metric, + overlap_metric=overlap_metric, ) result = [] @@ -1803,7 +1803,9 @@ def merge_inner_detection_object_pair( def merge_inner_detections_objects( - detections: List[Detections], threshold=0.5, match_metric: str = "IOU" + detections: List[Detections], + threshold=0.5, + overlap_metric: OverlapMetric = OverlapMetric.IOU, ) -> Detections: """ Given N detections each of length 1 (exactly one object inside), combine them into a @@ -1816,9 +1818,11 @@ def merge_inner_detections_objects( detections_1 = detections[0] for detections_2 in detections[1:]: if detections_1.mask is not None and detections_2.mask is not None: - iou = mask_iou_batch(detections_1.mask, detections_2.mask, match_metric)[0] + iou = mask_iou_batch(detections_1.mask, detections_2.mask, overlap_metric)[ + 0 + ] else: - iou = box_iou_batch(detections_1.xyxy, detections_2.xyxy, match_metric)[0] + iou = box_iou_batch(detections_1.xyxy, detections_2.xyxy, overlap_metric)[0] if iou < threshold: break detections_1 = merge_inner_detection_object_pair(detections_1, detections_2) From b792db72fd535194a2e6f17948c8b3c5feda6028 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 12:29:47 +0200 Subject: [PATCH 077/110] =?UTF-8?q?chore:=20=F0=9F=A7=B9=20update=20requir?= =?UTF-8?q?ements.txt=20to=20remove=20version=20constraints=20for=20depend?= =?UTF-8?q?encies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/speed_estimation/requirements.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/speed_estimation/requirements.txt b/examples/speed_estimation/requirements.txt index 343a687d..bb55ebd1 100644 --- a/examples/speed_estimation/requirements.txt +++ b/examples/speed_estimation/requirements.txt @@ -1,6 +1,6 @@ -supervision>=0.20.0 -tqdm==4.66.3 +supervision +tqdm requests -ultralytics==8.0.237 +ultralytics super-gradients==3.5.0 -inference==0.9.17 +inference From bcbbc578546c390fe763d82036a1b564af24716d Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 16:34:22 +0530 Subject: [PATCH 078/110] chore: configure mkdocs to add mathjax support --- docs/javascripts/mathjax.js | 19 +++++++++++++++++++ mkdocs.yml | 4 ++++ 2 files changed, 23 insertions(+) create mode 100644 docs/javascripts/mathjax.js diff --git a/docs/javascripts/mathjax.js b/docs/javascripts/mathjax.js new file mode 100644 index 00000000..160fedef --- /dev/null +++ b/docs/javascripts/mathjax.js @@ -0,0 +1,19 @@ +window.MathJax = { + tex: { + inlineMath: [["\\(", "\\)"]], + displayMath: [["\\[", "\\]"]], + processEscapes: true, + processEnvironments: true + }, + options: { + ignoreHtmlClass: ".*|", + processHtmlClass: "arithmatex" + } + }; + + document$.subscribe(() => { + MathJax.startup.output.clearCache() + MathJax.typesetClear() + MathJax.texReset() + MathJax.typesetPromise() + }) diff --git a/mkdocs.yml b/mkdocs.yml index dae49493..d3120939 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -168,12 +168,16 @@ markdown_extensions: anchor_linenums: true line_spans: __span pygments_lang_class: true + - pymdownx.arithmatex: + generic: true extra_javascript: - "javascripts/init_kapa_widget.js" - "javascripts/cookbooks-card.js" - "javascripts/segment.js" + - "javascripts/mathjax.js" - "https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.0.8/purify.min.js" + - "https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js" # Messages shown during document build # Reference: https://www.mkdocs.org/user-guide/configuration/#validation From 9400270e34d49a851bf67a571c52da7403444ae3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 11:05:26 +0000 Subject: [PATCH 079/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/javascripts/mathjax.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/javascripts/mathjax.js b/docs/javascripts/mathjax.js index 160fedef..0c7803cf 100644 --- a/docs/javascripts/mathjax.js +++ b/docs/javascripts/mathjax.js @@ -10,8 +10,8 @@ window.MathJax = { processHtmlClass: "arithmatex" } }; - - document$.subscribe(() => { + + document$.subscribe(() => { MathJax.startup.output.clearCache() MathJax.typesetClear() MathJax.texReset() From af31b96199df8b0cdd487a6531a6f95061519566 Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 16:41:54 +0530 Subject: [PATCH 080/110] update: docstring for box_iou to add formula --- supervision/detection/utils.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 13c3f1a6..733775e8 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -52,11 +52,14 @@ def box_iou( box_true: Union[List[float], np.ndarray], box_detection: Union[List[float], np.ndarray], ) -> float: - """ + r""" Compute the Intersection over Union (IoU) between two bounding boxes. - Both `box_true` and `box_detection` should be in (x_min, y_min, x_max, y_max) - format. + Mathematically, it is defined as: + + \[ + \text{IoU} = \frac{|\text{box}_{\text{true}} \cap \text{box}_{\text{detection}}|}{|\text{box}_{\text{true}} \cup \text{box}_{\text{detection}}|} + \] Note: Use `box_iou` when computing IoU between two individual boxes. @@ -1473,8 +1476,7 @@ def _jaccard(box_a: List[float], box_b: List[float], is_crowd: bool) -> float: """ Calculate the Jaccard index (intersection over union) between two bounding boxes. If a gt object is marked as "iscrowd", a dt is allowed to match any subregion - of the gt. Choosing gt' in the crowd gt that best matches the dt can be done using - gt'=intersect(dt,gt). Since by definition union(gt',dt)=dt, computing + of the gt. Choosing gt'=intersect(dt,gt). Since by definition union(gt',dt)=dt, computing iou(gt,dt,iscrowd) = iou(gt',dt) = area(intersect(gt,dt)) / area(dt) Args: From 7c1168fbc6d04b3cde4feb7b495905c4f92214ec Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 16:46:10 +0530 Subject: [PATCH 081/110] chore: make pre-commit happy --- supervision/detection/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 733775e8..0c017919 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -87,7 +87,7 @@ def box_iou( sv.box_iou(box_true=box_true, box_detection=box_detection) # 0.14285814285714285 ``` - """ + """ # noqa: E501 box_true = np.array(box_true) box_detection = np.array(box_detection) @@ -1486,7 +1486,7 @@ def _jaccard(box_a: List[float], box_b: List[float], is_crowd: bool) -> float: Returns: float: Jaccard index between the two bounding boxes. - """ + """ # noqa: E501 # Smallest number to avoid division by zero EPS = np.spacing(1) From 9f3ffdd26dafedbc3dcb8447d13dfc28fea6df2d Mon Sep 17 00:00:00 2001 From: Soumik Rakshit <19soumik.rakshit96@gmail.com> Date: Tue, 15 Jul 2025 17:17:39 +0530 Subject: [PATCH 082/110] fix: typo in utils.py --- supervision/detection/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 0c017919..e0844b75 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -52,7 +52,7 @@ def box_iou( box_true: Union[List[float], np.ndarray], box_detection: Union[List[float], np.ndarray], ) -> float: - r""" + """ Compute the Intersection over Union (IoU) between two bounding boxes. Mathematically, it is defined as: From cf179b9dfe202ebab0be85e951131505f8f4dc71 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 11:47:55 +0000 Subject: [PATCH 083/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index e0844b75..c485e891 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -57,9 +57,9 @@ def box_iou( Mathematically, it is defined as: - \[ - \text{IoU} = \frac{|\text{box}_{\text{true}} \cap \text{box}_{\text{detection}}|}{|\text{box}_{\text{true}} \cup \text{box}_{\text{detection}}|} - \] + \\[ + \text{IoU} = \frac{|\text{box}_{\text{true}} \\cap \text{box}_{\text{detection}}|}{|\text{box}_{\text{true}} \\cup \text{box}_{\text{detection}}|} + \\] Note: Use `box_iou` when computing IoU between two individual boxes. From a5155e23f295827013e8e245d8d2569f3092e8de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 12:27:31 +0000 Subject: [PATCH 084/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/overlap_filter.py | 1 - supervision/detection/utils.py | 30 ++++++++++++------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index 0a751b0b..fe0076ed 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -156,7 +156,6 @@ def group_overlapping_boxes( iou_threshold: float = 0.5, overlap_metric: OverlapMetric = OverlapMetric.IOU, ) -> list[list[int]]: - """ Apply greedy version of non-maximum merging to avoid detecting too many overlapping bounding boxes for a given object. diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 00c84dcf..1fff408a 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -35,7 +35,7 @@ class OverlapMetric(Enum): return list(map(lambda c: c.value, cls)) @classmethod - def from_value(cls, value: Union[OverlapMetric, str]) -> OverlapMetric: + def from_value(cls, value: OverlapMetric | str) -> OverlapMetric: if isinstance(value, cls): return value if isinstance(value, str): @@ -88,8 +88,8 @@ def polygon_to_mask(polygon: np.ndarray, resolution_wh: tuple[int, int]) -> np.n def box_iou( - box_true: Union[list[float], np.ndarray], - box_detection: Union[list[float], np.ndarray], + box_true: list[float] | np.ndarray, + box_detection: list[float] | np.ndarray, ) -> float: """ Compute the Intersection over Union (IoU) between two bounding boxes. @@ -418,7 +418,7 @@ def clip_boxes(xyxy: np.ndarray, resolution_wh: tuple[int, int]) -> np.ndarray: return result -def pad_boxes(xyxy: np.ndarray, px: int, py: Optional[int] = None) -> np.ndarray: +def pad_boxes(xyxy: np.ndarray, px: int, py: int | None = None) -> np.ndarray: """ Pads bounding boxes coordinates with a constant padding. @@ -736,8 +736,8 @@ def mask_to_polygons(mask: np.ndarray) -> list[np.ndarray]: def filter_polygons_by_area( polygons: list[np.ndarray], - min_area: Optional[float] = None, - max_area: Optional[float] = None, + min_area: float | None = None, + max_area: float | None = None, ) -> list[np.ndarray]: """ Filters a list of polygons based on their area. @@ -834,7 +834,7 @@ def approximate_polygon( return np.squeeze(approximated_points, axis=1) -def extract_ultralytics_masks(yolov8_results) -> Optional[np.ndarray]: +def extract_ultralytics_masks(yolov8_results) -> np.ndarray | None: if not yolov8_results.masks: return None @@ -876,9 +876,9 @@ def process_roboflow_result( np.ndarray, np.ndarray, np.ndarray, - Optional[np.ndarray], - Optional[np.ndarray], - dict[str, Union[list[np.ndarray], np.ndarray]], + np.ndarray | None, + np.ndarray | None, + dict[str, list[np.ndarray] | np.ndarray], ]: if not roboflow_result["predictions"]: return ( @@ -1216,8 +1216,8 @@ def is_metadata_equal(metadata_a: dict[str, Any], metadata_b: dict[str, Any]) -> def merge_data( - data_list: list[dict[str, Union[npt.NDArray[np.generic], list]]], -) -> dict[str, Union[npt.NDArray[np.generic], list]]: + data_list: list[dict[str, npt.NDArray[np.generic] | list]], +) -> dict[str, npt.NDArray[np.generic] | list]: """ Merges the data payloads of a list of Detections instances. @@ -1332,9 +1332,9 @@ def merge_metadata(metadata_list: list[dict[str, Any]]) -> dict[str, Any]: def get_data_item( - data: dict[str, Union[np.ndarray, list]], - index: Union[int, slice, list[int], np.ndarray], -) -> dict[str, Union[np.ndarray, list]]: + data: dict[str, np.ndarray | list], + index: int | slice | list[int] | np.ndarray, +) -> dict[str, np.ndarray | list]: """ Retrieve a subset of the data dictionary based on the given index. From b6cd9dd3f352d4c02325a05be0c97dc15fb64a77 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 15:30:08 +0300 Subject: [PATCH 085/110] =?UTF-8?q?chore:=20=F0=9F=A7=B9=20clean=20up=20un?= =?UTF-8?q?used=20imports=20and=20optimize=20code=20structure=20and=20conv?= =?UTF-8?q?ert=20more=20List=20to=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 2 +- supervision/detection/overlap_filter.py | 12 ++++++------ supervision/detection/utils.py | 2 +- test/detection/test_overlap_filter.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 03dbce24..03d82ae0 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -2052,7 +2052,7 @@ def merge_inner_detections_objects( def merge_inner_detections_objects_without_iou( - detections: List[Detections], + detections: list[Detections], ) -> Detections: """ Given N detections each of length 1 (exactly one object inside), combine them into a diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py index fe0076ed..3cace664 100644 --- a/supervision/detection/overlap_filter.py +++ b/supervision/detection/overlap_filter.py @@ -169,7 +169,7 @@ def group_overlapping_boxes( overlap_metric (OverlapMetric): Metric used for matching detections in slices. Returns: - List[List[int]]: Groups of prediction indices be merged. + list[list[int]]: Groups of prediction indices be merged. Each group may have 1 or more elements. """ merge_groups: list[list[int]] = [] @@ -204,7 +204,7 @@ def mask_non_max_merge( iou_threshold: float = 0.5, mask_dimension: int = 640, overlap_metric: OverlapMetric = OverlapMetric.IOU, -) -> List[List[int]]: +) -> list[list[int]]: """ Perform Non-Maximum Merging (NMM) on segmentation predictions. @@ -277,7 +277,7 @@ def box_non_max_merge( overlap_metric (OverlapMetric): Metric used for matching detections in slices. Returns: - List[List[int]]: Groups of prediction indices be merged. + list[list[int]]: Groups of prediction indices be merged. Each group may have 1 or more elements. """ if predictions.shape[1] == 5: @@ -307,7 +307,7 @@ def group_overlapping_masks( masks: npt.NDArray[np.float64], iou_threshold: float = 0.5, overlap_metric: OverlapMetric = OverlapMetric.IOU, -) -> List[List[int]]: +) -> list[list[int]]: """ Apply greedy version of non-maximum merging to avoid detecting too many @@ -322,10 +322,10 @@ def group_overlapping_masks( overlap_metric (OverlapMetric): Metric used for matching detections in slices. Returns: - List[List[int]]: Groups of prediction indices be merged. + list[list[int]]: Groups of prediction indices be merged. Each group may have 1 or more elements. """ - merge_groups: List[List[int]] = [] + merge_groups: list[list[int]] = [] scores = predictions[:, 4] order = scores.argsort() diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 1fff408a..eba62509 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -2,7 +2,7 @@ from __future__ import annotations from enum import Enum from itertools import chain -from typing import Any, Optional, Union +from typing import Any import cv2 import numpy as np diff --git a/test/detection/test_overlap_filter.py b/test/detection/test_overlap_filter.py index c1c6c5e2..f655f0e9 100644 --- a/test/detection/test_overlap_filter.py +++ b/test/detection/test_overlap_filter.py @@ -620,7 +620,7 @@ def test_mask_non_max_merge( predictions: np.ndarray, masks: np.ndarray, iou_threshold: float, - expected_result: List[List[int]], + expected_result: list[list[int]], exception: Exception, ) -> None: with exception: From 212e69b5a48637553a9512029cfd6734e720d43f Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 16:36:01 +0300 Subject: [PATCH 086/110] =?UTF-8?q?refactor:=20=F0=9F=A7=AA=20type=20hints?= =?UTF-8?q?=20to=20use=20the=20new=20union=20syntax=20for=20optional=20typ?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated type hints across multiple files to replace `Optional[X]` with `X | None` for better readability and consistency. - Added `from __future__ import annotations` to files to enable postponed evaluation of type annotations. - Adjusted function signatures and variable types in various modules including `polygon_zone.py`, `smoother.py`, `transformers.py`, `vlm.py`, and others. - Ensured compatibility with Python 3.10+ type hinting features. Signed-off-by: Onuralp SEZER --- .pre-commit-config.yaml | 2 +- .../scripts/download_from_youtube.py | 5 +- examples/time_in_zone/scripts/draw_zones.py | 8 +- .../traffic_analysis/inference_example.py | 5 +- .../traffic_analysis/ultralytics_example.py | 5 +- supervision/annotators/core.py | 151 +++++++++--------- supervision/annotators/utils.py | 17 +- supervision/assets/downloader.py | 5 +- supervision/dataset/formats/pascal_voc.py | 5 +- supervision/dataset/formats/yolo.py | 8 +- supervision/dataset/utils.py | 12 +- supervision/detection/line_zone.py | 12 +- .../detection/tools/inference_slicer.py | 20 +-- supervision/detection/tools/polygon_zone.py | 5 +- supervision/detection/tools/smoother.py | 5 +- supervision/detection/tools/transformers.py | 20 +-- supervision/detection/vlm.py | 36 ++--- supervision/draw/utils.py | 7 +- supervision/keypoint/annotators.py | 19 +-- supervision/metrics/detection.py | 2 +- supervision/utils/file.py | 17 +- supervision/utils/image.py | 47 +++--- supervision/utils/internal.py | 7 +- supervision/utils/notebook.py | 8 +- supervision/utils/video.py | 3 +- test/annotators/test_utils.py | 5 +- test/classification/test_core.py | 7 +- test/dataset/formats/test_coco.py | 5 +- test/dataset/formats/test_pascal_voc.py | 5 +- test/dataset/formats/test_yolo.py | 13 +- test/dataset/test_core.py | 5 +- test/dataset/test_utils.py | 10 +- test/detection/test_core.py | 11 +- test/detection/test_line_counter.py | 7 +- test/detection/test_overlap_filter.py | 7 +- test/detection/test_utils.py | 14 +- test/detection/test_vlm.py | 22 +-- test/detection/tools/test_inference_slicer.py | 11 +- test/draw/test_color.py | 7 +- test/metrics/test_detection.py | 15 +- test/test_utils.py | 20 +-- test/utils/test_file.py | 5 +- 42 files changed, 320 insertions(+), 280 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 85b49dfb..24e432cd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -58,6 +58,6 @@ repos: rev: v3.20.0 hooks: - id: pyupgrade - args: ["--py39-plus"] + args: ["--py310-plus"] additional_dependencies: - tomli diff --git a/examples/time_in_zone/scripts/download_from_youtube.py b/examples/time_in_zone/scripts/download_from_youtube.py index ff7d94c3..d8673631 100644 --- a/examples/time_in_zone/scripts/download_from_youtube.py +++ b/examples/time_in_zone/scripts/download_from_youtube.py @@ -1,11 +1,12 @@ +from __future__ import annotations + import argparse import os -from typing import Optional from pytube import YouTube -def main(url: str, output_path: Optional[str], file_name: Optional[str]) -> None: +def main(url: str, output_path: str | None, file_name: str | None) -> None: yt = YouTube(url) stream = yt.streams.get_highest_resolution() diff --git a/examples/time_in_zone/scripts/draw_zones.py b/examples/time_in_zone/scripts/draw_zones.py index 0e09a865..74508ccd 100644 --- a/examples/time_in_zone/scripts/draw_zones.py +++ b/examples/time_in_zone/scripts/draw_zones.py @@ -1,7 +1,9 @@ +from __future__ import annotations + import argparse import json import os -from typing import Any, Optional +from typing import Any import cv2 import numpy as np @@ -19,10 +21,10 @@ COLORS = sv.ColorPalette.DEFAULT WINDOW_NAME = "Draw Zones" POLYGONS = [[]] -current_mouse_position: Optional[tuple[int, int]] = None +current_mouse_position: tuple[int, int] | None = None -def resolve_source(source_path: str) -> Optional[np.ndarray]: +def resolve_source(source_path: str) -> np.ndarray | None: if not os.path.exists(source_path): return None diff --git a/examples/traffic_analysis/inference_example.py b/examples/traffic_analysis/inference_example.py index 6cd4e4bd..f7530ce7 100644 --- a/examples/traffic_analysis/inference_example.py +++ b/examples/traffic_analysis/inference_example.py @@ -1,7 +1,8 @@ +from __future__ import annotations + import argparse import os from collections.abc import Iterable -from typing import Optional import cv2 import numpy as np @@ -78,7 +79,7 @@ class VideoProcessor: roboflow_api_key: str, model_id: str, source_video_path: str, - target_video_path: Optional[str] = None, + target_video_path: str | None = None, confidence_threshold: float = 0.3, iou_threshold: float = 0.7, ) -> None: diff --git a/examples/traffic_analysis/ultralytics_example.py b/examples/traffic_analysis/ultralytics_example.py index 4beb1826..4df89405 100644 --- a/examples/traffic_analysis/ultralytics_example.py +++ b/examples/traffic_analysis/ultralytics_example.py @@ -1,6 +1,7 @@ +from __future__ import annotations + import argparse from collections.abc import Iterable -from typing import Optional import cv2 import numpy as np @@ -75,7 +76,7 @@ class VideoProcessor: self, source_weights_path: str, source_video_path: str, - target_video_path: Optional[str] = None, + target_video_path: str | None = None, confidence_threshold: float = 0.3, iou_threshold: float = 0.7, ) -> None: diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index e3607224..4462351a 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1,6 +1,7 @@ +from __future__ import annotations + from functools import lru_cache from math import sqrt -from typing import Optional, Union import cv2 import numpy as np @@ -65,14 +66,14 @@ class _BaseLabelAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, - text_color: Union[Color, ColorPalette] = Color.WHITE, + color: Color | ColorPalette = ColorPalette.DEFAULT, + text_color: Color | ColorPalette = Color.WHITE, text_padding: int = 10, text_position: Position = Position.TOP_LEFT, color_lookup: ColorLookup = ColorLookup.CLASS, border_radius: int = 0, smart_position: bool = False, - max_line_length: Optional[int] = None, + max_line_length: int | None = None, ): """ Initializes the _BaseLabelAnnotator. @@ -95,14 +96,14 @@ class _BaseLabelAnnotator(BaseAnnotator): line before wrapping the text. None means no wrapping. """ - self.color: Union[Color, ColorPalette] = color - self.text_color: Union[Color, ColorPalette] = text_color + self.color: Color | ColorPalette = color + self.text_color: Color | ColorPalette = text_color self.text_padding: int = text_padding self.text_anchor: Position = text_position self.color_lookup: ColorLookup = color_lookup self.border_radius: int = border_radius self.smart_position = smart_position - self.max_line_length: Optional[int] = max_line_length + self.max_line_length: int | None = max_line_length def _adjust_labels_in_frame( self, @@ -155,7 +156,7 @@ class BoxAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, thickness: int = 2, color_lookup: ColorLookup = ColorLookup.CLASS, ): @@ -167,7 +168,7 @@ class BoxAnnotator(BaseAnnotator): color_lookup (ColorLookup): Strategy for mapping colors to annotations. Options are `INDEX`, `CLASS`, `TRACK`. """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.thickness: int = thickness self.color_lookup: ColorLookup = color_lookup @@ -176,7 +177,7 @@ class BoxAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with bounding boxes based on the provided detections. @@ -238,7 +239,7 @@ class OrientedBoxAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, thickness: int = 2, color_lookup: ColorLookup = ColorLookup.CLASS, ): @@ -250,7 +251,7 @@ class OrientedBoxAnnotator(BaseAnnotator): color_lookup (ColorLookup): Strategy for mapping colors to annotations. Options are `INDEX`, `CLASS`, `TRACK`. """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.thickness: int = thickness self.color_lookup: ColorLookup = color_lookup @@ -259,7 +260,7 @@ class OrientedBoxAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with oriented bounding boxes based on the provided detections. @@ -327,7 +328,7 @@ class MaskAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, opacity: float = 0.5, color_lookup: ColorLookup = ColorLookup.CLASS, ): @@ -339,7 +340,7 @@ class MaskAnnotator(BaseAnnotator): color_lookup (ColorLookup): Strategy for mapping colors to annotations. Options are `INDEX`, `CLASS`, `TRACK`. """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.opacity = opacity self.color_lookup: ColorLookup = color_lookup @@ -348,7 +349,7 @@ class MaskAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with masks based on the provided detections. @@ -417,7 +418,7 @@ class PolygonAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, thickness: int = 2, color_lookup: ColorLookup = ColorLookup.CLASS, ): @@ -429,7 +430,7 @@ class PolygonAnnotator(BaseAnnotator): color_lookup (ColorLookup): Strategy for mapping colors to annotations. Options are `INDEX`, `CLASS`, `TRACK`. """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.thickness: int = thickness self.color_lookup: ColorLookup = color_lookup @@ -438,7 +439,7 @@ class PolygonAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with polygons based on the provided detections. @@ -504,7 +505,7 @@ class ColorAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, opacity: float = 0.5, color_lookup: ColorLookup = ColorLookup.CLASS, ): @@ -516,7 +517,7 @@ class ColorAnnotator(BaseAnnotator): color_lookup (ColorLookup): Strategy for mapping colors to annotations. Options are `INDEX`, `CLASS`, `TRACK`. """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.color_lookup: ColorLookup = color_lookup self.opacity = opacity @@ -525,7 +526,7 @@ class ColorAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with box masks based on the provided detections. @@ -596,7 +597,7 @@ class HaloAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, opacity: float = 0.8, kernel_size: int = 40, color_lookup: ColorLookup = ColorLookup.CLASS, @@ -611,7 +612,7 @@ class HaloAnnotator(BaseAnnotator): color_lookup (ColorLookup): Strategy for mapping colors to annotations. Options are `INDEX`, `CLASS`, `TRACK`. """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.opacity = opacity self.color_lookup: ColorLookup = color_lookup self.kernel_size: int = kernel_size @@ -621,7 +622,7 @@ class HaloAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with halos based on the provided detections. @@ -694,7 +695,7 @@ class EllipseAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, thickness: int = 2, start_angle: int = -45, end_angle: int = 235, @@ -710,7 +711,7 @@ class EllipseAnnotator(BaseAnnotator): color_lookup (ColorLookup): Strategy for mapping colors to annotations. Options are `INDEX`, `CLASS`, `TRACK`. """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.thickness: int = thickness self.start_angle: int = start_angle self.end_angle: int = end_angle @@ -721,7 +722,7 @@ class EllipseAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with ellipses based on the provided detections. @@ -789,7 +790,7 @@ class BoxCornerAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, thickness: int = 4, corner_length: int = 15, color_lookup: ColorLookup = ColorLookup.CLASS, @@ -803,7 +804,7 @@ class BoxCornerAnnotator(BaseAnnotator): color_lookup (ColorLookup): Strategy for mapping colors to annotations. Options are `INDEX`, `CLASS`, `TRACK`. """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.thickness: int = thickness self.corner_length: int = corner_length self.color_lookup: ColorLookup = color_lookup @@ -813,7 +814,7 @@ class BoxCornerAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with box corners based on the provided detections. @@ -880,7 +881,7 @@ class CircleAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, thickness: int = 2, color_lookup: ColorLookup = ColorLookup.CLASS, ): @@ -893,7 +894,7 @@ class CircleAnnotator(BaseAnnotator): Options are `INDEX`, `CLASS`, `TRACK`. """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.thickness: int = thickness self.color_lookup: ColorLookup = color_lookup @@ -902,7 +903,7 @@ class CircleAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with circles based on the provided detections. @@ -969,12 +970,12 @@ class DotAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, radius: int = 4, position: Position = Position.CENTER, color_lookup: ColorLookup = ColorLookup.CLASS, outline_thickness: int = 0, - outline_color: Union[Color, ColorPalette] = Color.BLACK, + outline_color: Color | ColorPalette = Color.BLACK, ): """ Args: @@ -989,19 +990,19 @@ class DotAnnotator(BaseAnnotator): use for outline. It is activated by setting outline_thickness to a value greater than 0. """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.radius: int = radius self.position: Position = position self.color_lookup: ColorLookup = color_lookup self.outline_thickness = outline_thickness - self.outline_color: Union[Color, ColorPalette] = outline_color + self.outline_color: Color | ColorPalette = outline_color @ensure_cv2_image_for_annotation def annotate( self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with dots based on the provided detections. @@ -1075,8 +1076,8 @@ class LabelAnnotator(_BaseLabelAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, - text_color: Union[Color, ColorPalette] = Color.WHITE, + color: Color | ColorPalette = ColorPalette.DEFAULT, + text_color: Color | ColorPalette = Color.WHITE, text_scale: float = 0.5, text_thickness: int = 1, text_padding: int = 10, @@ -1084,7 +1085,7 @@ class LabelAnnotator(_BaseLabelAnnotator): color_lookup: ColorLookup = ColorLookup.CLASS, border_radius: int = 0, smart_position: bool = False, - max_line_length: Optional[int] = None, + max_line_length: int | None = None, ): self.text_scale: float = text_scale self.text_thickness: int = text_thickness @@ -1104,8 +1105,8 @@ class LabelAnnotator(_BaseLabelAnnotator): self, scene: ImageType, # Ensure scene is initially a NumPy array here detections: Detections, - labels: Optional[list[str]] = None, - custom_color_lookup: Optional[np.ndarray] = None, + labels: list[str] | None = None, + custom_color_lookup: np.ndarray | None = None, ) -> np.ndarray: assert isinstance(scene, np.ndarray) validate_labels(labels, detections) @@ -1189,7 +1190,7 @@ class LabelAnnotator(_BaseLabelAnnotator): labels: list[str], label_properties: np.ndarray, detections: Detections, - custom_color_lookup: Optional[np.ndarray], + custom_color_lookup: np.ndarray | None, ) -> None: assert len(labels) == len(label_properties) == len(detections), ( f"Number of label properties ({len(label_properties)}), " @@ -1316,16 +1317,16 @@ class RichLabelAnnotator(_BaseLabelAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, - text_color: Union[Color, ColorPalette] = Color.WHITE, - font_path: Optional[str] = None, + color: Color | ColorPalette = ColorPalette.DEFAULT, + text_color: Color | ColorPalette = Color.WHITE, + font_path: str | None = None, font_size: int = 10, text_padding: int = 10, text_position: Position = Position.TOP_LEFT, color_lookup: ColorLookup = ColorLookup.CLASS, border_radius: int = 0, smart_position: bool = False, - max_line_length: Optional[int] = None, + max_line_length: int | None = None, ): self.font_path = font_path self.font_size = font_size @@ -1346,8 +1347,8 @@ class RichLabelAnnotator(_BaseLabelAnnotator): self, scene: ImageType, detections: Detections, - labels: Optional[list[str]] = None, - custom_color_lookup: Optional[np.ndarray] = None, + labels: list[str] | None = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: assert isinstance(scene, Image.Image) validate_labels(labels, detections) @@ -1427,7 +1428,7 @@ class RichLabelAnnotator(_BaseLabelAnnotator): labels: list[str], label_properties: np.ndarray, detections: Detections, - custom_color_lookup: Optional[np.ndarray], + custom_color_lookup: np.ndarray | None, ) -> None: assert len(labels) == len(label_properties) == len(detections), ( f"Number of label properties ({len(label_properties)}), " @@ -1485,7 +1486,7 @@ class RichLabelAnnotator(_BaseLabelAnnotator): y_position += line_height + self.text_padding @staticmethod - def _load_font(font_size: int, font_path: Optional[str]): + def _load_font(font_size: int, font_path: str | None): def load_default_font(size): try: return ImageFont.load_default(size) @@ -1527,7 +1528,7 @@ class IconAnnotator(BaseAnnotator): @ensure_cv2_image_for_annotation def annotate( - self, scene: ImageType, detections: Detections, icon_path: Union[str, list[str]] + self, scene: ImageType, detections: Detections, icon_path: str | list[str] ) -> ImageType: """ Annotates the given scene with given icons. @@ -1677,7 +1678,7 @@ class TraceAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, position: Position = Position.CENTER, trace_length: int = 30, thickness: int = 2, @@ -1695,7 +1696,7 @@ class TraceAnnotator(BaseAnnotator): color_lookup (ColorLookup): Strategy for mapping colors to annotations. Options are `INDEX`, `CLASS`, `TRACK`. """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.trace = Trace(max_size=trace_length, anchor=position) self.thickness = thickness self.color_lookup: ColorLookup = color_lookup @@ -1705,7 +1706,7 @@ class TraceAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Draws trace paths on the frame based on the detection coordinates provided. @@ -1812,7 +1813,7 @@ class HeatMapAnnotator(BaseAnnotator): self.kernel_size = kernel_size self.top_hue = top_hue self.low_hue = low_hue - self.heat_mask: Optional[npt.NDArray[np.float32]] = None + self.heat_mask: npt.NDArray[np.float32] | None = None @ensure_cv2_image_for_annotation def annotate(self, scene: ImageType, detections: Detections) -> ImageType: @@ -1963,13 +1964,13 @@ class TriangleAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, base: int = 10, height: int = 10, position: Position = Position.TOP_CENTER, color_lookup: ColorLookup = ColorLookup.CLASS, outline_thickness: int = 0, - outline_color: Union[Color, ColorPalette] = Color.BLACK, + outline_color: Color | ColorPalette = Color.BLACK, ): """ Args: @@ -1985,20 +1986,20 @@ class TriangleAnnotator(BaseAnnotator): use for outline. It is activated by setting outline_thickness to a value greater than 0. """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.base: int = base self.height: int = height self.position: Position = position self.color_lookup: ColorLookup = color_lookup self.outline_thickness: int = outline_thickness - self.outline_color: Union[Color, ColorPalette] = outline_color + self.outline_color: Color | ColorPalette = outline_color @ensure_cv2_image_for_annotation def annotate( self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with triangles based on the provided detections. @@ -2081,7 +2082,7 @@ class RoundBoxAnnotator(BaseAnnotator): def __init__( self, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, thickness: int = 2, color_lookup: ColorLookup = ColorLookup.CLASS, roundness: float = 0.6, @@ -2098,7 +2099,7 @@ class RoundBoxAnnotator(BaseAnnotator): By default roundness percent is calculated based on smaller side length (width or height). """ - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.thickness: int = thickness self.color_lookup: ColorLookup = color_lookup if not 0 < roundness <= 1.0: @@ -2110,7 +2111,7 @@ class RoundBoxAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with bounding boxes with rounded edges @@ -2214,11 +2215,11 @@ class PercentageBarAnnotator(BaseAnnotator): self, height: int = 16, width: int = 80, - color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + color: Color | ColorPalette = ColorPalette.DEFAULT, border_color: Color = Color.BLACK, position: Position = Position.TOP_CENTER, color_lookup: ColorLookup = ColorLookup.CLASS, - border_thickness: Optional[int] = None, + border_thickness: int | None = None, ): """ Args: @@ -2234,7 +2235,7 @@ class PercentageBarAnnotator(BaseAnnotator): """ self.height: int = height self.width: int = width - self.color: Union[Color, ColorPalette] = color + self.color: Color | ColorPalette = color self.border_color: Color = border_color self.position: Position = position self.color_lookup: ColorLookup = color_lookup @@ -2247,8 +2248,8 @@ class PercentageBarAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, - custom_values: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, + custom_values: np.ndarray | None = None, ) -> ImageType: """ Annotates the given scene with percentage bars based on the provided @@ -2366,7 +2367,7 @@ class PercentageBarAnnotator(BaseAnnotator): @staticmethod def validate_custom_values( - custom_values: Optional[Union[np.ndarray, list[float]]], detections: Detections + custom_values: np.ndarray | list[float] | None, detections: Detections ) -> None: if custom_values is None: if detections.confidence is None: @@ -2400,7 +2401,7 @@ class CropAnnotator(BaseAnnotator): self, position: Position = Position.TOP_CENTER, scale_factor: float = 2.0, - border_color: Union[Color, ColorPalette] = ColorPalette.DEFAULT, + border_color: Color | ColorPalette = ColorPalette.DEFAULT, border_thickness: int = 2, border_color_lookup: ColorLookup = ColorLookup.CLASS, ): @@ -2419,7 +2420,7 @@ class CropAnnotator(BaseAnnotator): """ self.position: Position = position self.scale_factor: float = scale_factor - self.border_color: Union[Color, ColorPalette] = border_color + self.border_color: Color | ColorPalette = border_color self.border_thickness: int = border_thickness self.border_color_lookup: ColorLookup = border_color_lookup @@ -2428,7 +2429,7 @@ class CropAnnotator(BaseAnnotator): self, scene: ImageType, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + custom_color_lookup: np.ndarray | None = None, ) -> ImageType: """ Annotates the provided scene with scaled and cropped parts of the image based diff --git a/supervision/annotators/utils.py b/supervision/annotators/utils.py index f51dfb19..a84e2049 100644 --- a/supervision/annotators/utils.py +++ b/supervision/annotators/utils.py @@ -1,6 +1,7 @@ +from __future__ import annotations + import textwrap from enum import Enum -from typing import Optional, Union import numpy as np @@ -35,7 +36,7 @@ class ColorLookup(Enum): def resolve_color_idx( detections: Detections, detection_idx: int, - color_lookup: Union[ColorLookup, np.ndarray] = ColorLookup.CLASS, + color_lookup: ColorLookup | np.ndarray = ColorLookup.CLASS, ) -> int: if detection_idx >= len(detections): raise ValueError( @@ -124,17 +125,17 @@ def resolve_text_background_xyxy( ) -def get_color_by_index(color: Union[Color, ColorPalette], idx: int) -> Color: +def get_color_by_index(color: Color | ColorPalette, idx: int) -> Color: if isinstance(color, ColorPalette): return color.by_idx(idx) return color def resolve_color( - color: Union[Color, ColorPalette], + color: Color | ColorPalette, detections: Detections, detection_idx: int, - color_lookup: Union[ColorLookup, np.ndarray] = ColorLookup.CLASS, + color_lookup: ColorLookup | np.ndarray = ColorLookup.CLASS, ) -> Color: idx = resolve_color_idx( detections=detections, @@ -189,7 +190,7 @@ def wrap_text(text: str, max_line_length=None) -> list[str]: return all_lines if all_lines else [""] -def validate_labels(labels: Optional[list[str]], detections: Detections): +def validate_labels(labels: list[str] | None, detections: Detections): """ Validates that the number of provided labels matches the number of detections. @@ -211,7 +212,7 @@ def validate_labels(labels: Optional[list[str]], detections: Detections): def get_labels_text( - detections: Detections, custom_labels: Optional[list[str]] + detections: Detections, custom_labels: list[str] | None ) -> list[str]: """ Retrieves the text labels for the detections. @@ -309,7 +310,7 @@ def snap_boxes(xyxy: np.ndarray, resolution_wh: tuple[int, int]) -> np.ndarray: class Trace: def __init__( self, - max_size: Optional[int] = None, + max_size: int | None = None, start_frame_id: int = 0, anchor: Position = Position.CENTER, ) -> None: diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index c8e3e56d..dbdd84ce 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -1,8 +1,9 @@ +from __future__ import annotations + import os from hashlib import new as hash_new from pathlib import Path from shutil import copyfileobj -from typing import Union from requests import get from tqdm.auto import tqdm @@ -32,7 +33,7 @@ def is_md5_hash_matching(filename: str, original_md5_hash: str) -> bool: return computed_md5_hash.hexdigest() == original_md5_hash -def download_assets(asset_name: Union[VideoAssets, str]) -> str: +def download_assets(asset_name: VideoAssets | str) -> str: """ Download a specified asset if it doesn't already exist or is corrupted. diff --git a/supervision/dataset/formats/pascal_voc.py b/supervision/dataset/formats/pascal_voc.py index 8eddfb96..fb068ccc 100644 --- a/supervision/dataset/formats/pascal_voc.py +++ b/supervision/dataset/formats/pascal_voc.py @@ -1,6 +1,7 @@ +from __future__ import annotations + import os from pathlib import Path -from typing import Optional from xml.etree.ElementTree import Element, SubElement import cv2 @@ -15,7 +16,7 @@ from supervision.utils.file import list_files_with_extensions def object_to_pascal_voc( - xyxy: np.ndarray, name: str, polygon: Optional[np.ndarray] = None + xyxy: np.ndarray, name: str, polygon: np.ndarray | None = None ) -> Element: root = Element("object") diff --git a/supervision/dataset/formats/yolo.py b/supervision/dataset/formats/yolo.py index 7903e598..f065aefd 100644 --- a/supervision/dataset/formats/yolo.py +++ b/supervision/dataset/formats/yolo.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import os from pathlib import Path -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING import numpy as np from PIL import Image @@ -205,7 +207,7 @@ def object_to_yolo( xyxy: np.ndarray, class_id: int, image_shape: tuple[int, int, int], - polygon: Optional[np.ndarray] = None, + polygon: np.ndarray | None = None, ) -> str: h, w, _ = image_shape if polygon is None: @@ -260,7 +262,7 @@ def detections_to_yolo_annotations( def save_yolo_annotations( - dataset: "DetectionDataset", + dataset: DetectionDataset, annotations_directory_path: str, min_image_area_percentage: float = 0.0, max_image_area_percentage: float = 1.0, diff --git a/supervision/dataset/utils.py b/supervision/dataset/utils.py index 487ff1d9..9c02c415 100644 --- a/supervision/dataset/utils.py +++ b/supervision/dataset/utils.py @@ -1,9 +1,11 @@ +from __future__ import annotations + import copy import os import random import shutil from pathlib import Path -from typing import TYPE_CHECKING, Optional, TypeVar, Union +from typing import TYPE_CHECKING, TypeVar import cv2 import numpy as np @@ -98,9 +100,7 @@ def map_detections_class_id( return detections_copy -def save_dataset_images( - dataset: "DetectionDataset", images_directory_path: str -) -> None: +def save_dataset_images(dataset: DetectionDataset, images_directory_path: str) -> None: Path(images_directory_path).mkdir(parents=True, exist_ok=True) for image_path in dataset.image_paths: final_path = os.path.join(images_directory_path, Path(image_path).name) @@ -114,7 +114,7 @@ def save_dataset_images( def train_test_split( data: list[T], train_ratio: float = 0.8, - random_state: Optional[int] = None, + random_state: int | None = None, shuffle: bool = True, ) -> tuple[list[T], list[T]]: """ @@ -140,7 +140,7 @@ def train_test_split( def rle_to_mask( - rle: Union[npt.NDArray[np.int_], list[int]], resolution_wh: tuple[int, int] + rle: npt.NDArray[np.int_] | list[int], resolution_wh: tuple[int, int] ) -> npt.NDArray[np.bool_]: """ Converts run-length encoding (RLE) to a binary mask. diff --git a/supervision/detection/line_zone.py b/supervision/detection/line_zone.py index b94fc531..bf7e42da 100644 --- a/supervision/detection/line_zone.py +++ b/supervision/detection/line_zone.py @@ -1,9 +1,11 @@ +from __future__ import annotations + import math import warnings from collections import Counter, defaultdict, deque from collections.abc import Iterable from functools import lru_cache -from typing import Any, Literal, Optional +from typing import Any, Literal import cv2 import numpy as np @@ -161,7 +163,7 @@ class LineZone: self._compute_anchor_sides(detections) ) - class_ids: list[Optional[int]] = ( + class_ids: list[int | None] = ( list(detections.class_id) if detections.class_id is not None else [None] * len(detections) @@ -325,8 +327,8 @@ class LineZoneAnnotator: text_scale: float = 0.5, text_offset: float = 1.5, text_padding: int = 10, - custom_in_text: Optional[str] = None, - custom_out_text: Optional[str] = None, + custom_in_text: str | None = None, + custom_out_text: str | None = None, display_in_count: bool = True, display_out_count: bool = True, display_text_box: bool = True, @@ -758,7 +760,7 @@ class LineZoneAnnotatorMulticlass: self, frame: np.ndarray, line_zones: list[LineZone], - line_zone_labels: Optional[list[str]] = None, + line_zone_labels: list[str] | None = None, ) -> np.ndarray: """ Draws a table with the number of objects of each class that crossed each line. diff --git a/supervision/detection/tools/inference_slicer.py b/supervision/detection/tools/inference_slicer.py index dd01f6d1..e0ffb3bf 100644 --- a/supervision/detection/tools/inference_slicer.py +++ b/supervision/detection/tools/inference_slicer.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import warnings +from collections.abc import Callable from concurrent.futures import ThreadPoolExecutor, as_completed -from typing import Callable, Optional, Union import numpy as np @@ -18,7 +20,7 @@ from supervision.utils.internal import ( def move_detections( detections: Detections, offset: np.ndarray, - resolution_wh: Optional[tuple[int, int]] = None, + resolution_wh: tuple[int, int] | None = None, ) -> Detections: """ Args: @@ -89,9 +91,9 @@ class InferenceSlicer: self, callback: Callable[[np.ndarray], Detections], slice_wh: tuple[int, int] = (320, 320), - overlap_ratio_wh: Optional[tuple[float, float]] = (0.2, 0.2), - overlap_wh: Optional[tuple[int, int]] = None, - overlap_filter: Union[OverlapFilter, str] = OverlapFilter.NON_MAX_SUPPRESSION, + overlap_ratio_wh: tuple[float, float] | None = (0.2, 0.2), + overlap_wh: tuple[int, int] | None = None, + overlap_filter: OverlapFilter | str = OverlapFilter.NON_MAX_SUPPRESSION, iou_threshold: float = 0.5, match_metric: str = "IOU", thread_workers: int = 1, @@ -208,8 +210,8 @@ class InferenceSlicer: def _generate_offset( resolution_wh: tuple[int, int], slice_wh: tuple[int, int], - overlap_ratio_wh: Optional[tuple[float, float]], - overlap_wh: Optional[tuple[int, int]], + overlap_ratio_wh: tuple[float, float] | None, + overlap_wh: tuple[int, int] | None, ) -> np.ndarray: """ Generate offset coordinates for slicing an image based on the given resolution, @@ -268,8 +270,8 @@ class InferenceSlicer: @staticmethod def _validate_overlap( - overlap_ratio_wh: Optional[tuple[float, float]], - overlap_wh: Optional[tuple[int, int]], + overlap_ratio_wh: tuple[float, float] | None, + overlap_wh: tuple[int, int] | None, ) -> None: if overlap_ratio_wh is not None and overlap_wh is not None: raise ValueError( diff --git a/supervision/detection/tools/polygon_zone.py b/supervision/detection/tools/polygon_zone.py index 0b1141ce..40c75337 100644 --- a/supervision/detection/tools/polygon_zone.py +++ b/supervision/detection/tools/polygon_zone.py @@ -1,6 +1,7 @@ +from __future__ import annotations + from collections.abc import Iterable from dataclasses import replace -from typing import Optional import cv2 import numpy as np @@ -154,7 +155,7 @@ class PolygonZoneAnnotator: self.display_in_zone_count = display_in_zone_count self.opacity = opacity - def annotate(self, scene: np.ndarray, label: Optional[str] = None) -> np.ndarray: + def annotate(self, scene: np.ndarray, label: str | None = None) -> np.ndarray: """ Annotates the polygon zone within a frame with a count of detected objects. diff --git a/supervision/detection/tools/smoother.py b/supervision/detection/tools/smoother.py index 933d4fa4..2c1137c0 100644 --- a/supervision/detection/tools/smoother.py +++ b/supervision/detection/tools/smoother.py @@ -1,7 +1,8 @@ +from __future__ import annotations + import warnings from collections import defaultdict, deque from copy import deepcopy -from typing import Optional import numpy as np @@ -95,7 +96,7 @@ class DetectionsSmoother: return self.get_smoothed_detections() - def get_track(self, track_id: int) -> Optional[Detections]: + def get_track(self, track_id: int) -> Detections | None: track = self.tracks.get(track_id, None) if track is None: return None diff --git a/supervision/detection/tools/transformers.py b/supervision/detection/tools/transformers.py index 433aa48f..97eb03ce 100644 --- a/supervision/detection/tools/transformers.py +++ b/supervision/detection/tools/transformers.py @@ -1,5 +1,7 @@ +from __future__ import annotations + import io -from typing import Any, Optional +from typing import Any import numpy as np from PIL import Image @@ -9,7 +11,7 @@ from supervision.detection.utils import mask_to_xyxy def process_transformers_detection_result( - detection_result: dict, id2label: Optional[dict[int, str]] + detection_result: dict, id2label: dict[int, str] | None ) -> dict: """ Process the result of Transformers object detection functions such as @@ -38,7 +40,7 @@ def process_transformers_detection_result( def process_transformers_v4_segmentation_result( - segmentation_result: dict, id2label: Optional[dict[int, str]] + segmentation_result: dict, id2label: dict[int, str] | None ) -> dict: """ Process the result of Transformers segmentation functions such as @@ -77,7 +79,7 @@ def process_transformers_v4_segmentation_result( def process_transformers_v5_segmentation_result( - segmentation_result: dict, id2label: Optional[dict[int, str]] + segmentation_result: dict, id2label: dict[int, str] | None ) -> dict: """ Process the result of Transformers segmentation functions such as @@ -107,7 +109,7 @@ def process_transformers_v5_segmentation_result( def process_transformers_v5_semantic_or_instance_segmentation_result( - segmentation_result: dict, id2label: Optional[dict[int, str]] + segmentation_result: dict, id2label: dict[int, str] | None ) -> dict: """ Process the result of Transformers segmentation functions such as @@ -143,7 +145,7 @@ def process_transformers_v5_semantic_or_instance_segmentation_result( def process_transformers_v4_panoptic_segmentation_result( - segmentation_result: dict, id2label: Optional[dict[int, str]] + segmentation_result: dict, id2label: dict[int, str] | None ) -> dict: """ Process the result of the Transformers function `post_process_panoptic` (v4). @@ -177,7 +179,7 @@ def process_transformers_v4_panoptic_segmentation_result( def process_transformers_v5_panoptic_segmentation_result( - segmentation_array: np.ndarray, id2label: Optional[dict[int, str]] + segmentation_array: np.ndarray, id2label: dict[int, str] | None ) -> dict: """ Process the result of the Transformers function @@ -220,8 +222,8 @@ def png_string_to_segmentation_array(png_string: bytes) -> np.ndarray: def append_class_names_to_data( class_ids: np.ndarray, - id2label: Optional[dict[int, str]], - data: Optional[dict[str, Any]] = None, + id2label: dict[int, str] | None, + data: dict[str, Any] | None = None, ) -> dict[str, Any]: """ Helper function to create or append to a data dictionary with class names if diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index d98405e3..3adec2bc 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -1,9 +1,11 @@ +from __future__ import annotations + import base64 import io import json import re from enum import Enum -from typing import Any, Optional, Union +from typing import Any import numpy as np from PIL import Image @@ -80,9 +82,7 @@ SUPPORTED_TASKS_FLORENCE_2 = [ ] -def validate_vlm_parameters( - vlm: Union[VLM, str], result: Any, kwargs: dict[str, Any] -) -> VLM: +def validate_vlm_parameters(vlm: VLM | str, result: Any, kwargs: dict[str, Any]) -> VLM: if isinstance(vlm, str): try: vlm = VLM(vlm.lower()) @@ -110,8 +110,8 @@ def validate_vlm_parameters( def from_paligemma( - result: str, resolution_wh: tuple[int, int], classes: Optional[list[str]] = None -) -> tuple[np.ndarray, Optional[np.ndarray], np.ndarray]: + result: str, resolution_wh: tuple[int, int], classes: list[str] | None = None +) -> tuple[np.ndarray, np.ndarray | None, np.ndarray]: """ Parse bounding boxes from paligemma-formatted text, scale them to the specified resolution, and optionally filter by classes. @@ -161,8 +161,8 @@ def from_qwen_2_5_vl( result: str, input_wh: tuple[int, int], resolution_wh: tuple[int, int], - classes: Optional[list[str]] = None, -) -> tuple[np.ndarray, Optional[np.ndarray], np.ndarray]: + classes: list[str] | None = None, +) -> tuple[np.ndarray, np.ndarray | None, np.ndarray]: """ Parse and scale bounding boxes from Qwen-2.5-VL style JSON output. @@ -239,9 +239,7 @@ def from_qwen_2_5_vl( def from_florence_2( result: dict, resolution_wh: tuple[int, int] -) -> tuple[ - np.ndarray, Optional[np.ndarray], Optional[np.ndarray], Optional[np.ndarray] -]: +) -> tuple[np.ndarray, np.ndarray | None, np.ndarray | None, np.ndarray | None]: """ Parse results from the Florence 2 multi-model model. https://huggingface.co/microsoft/Florence-2-large @@ -335,8 +333,8 @@ def from_florence_2( def from_google_gemini_2_0( result: str, resolution_wh: tuple[int, int], - classes: Optional[list[str]] = None, -) -> tuple[np.ndarray, Optional[np.ndarray], np.ndarray]: + classes: list[str] | None = None, +) -> tuple[np.ndarray, np.ndarray | None, np.ndarray]: """ Parse and scale bounding boxes from Google Gemini style [JSON output](https://ai.google.dev/gemini-api/docs/vision?lang=python). @@ -424,13 +422,13 @@ def from_google_gemini_2_0( def from_google_gemini_2_5( result: str, resolution_wh: tuple[int, int], - classes: Optional[list[str]] = None, + classes: list[str] | None = None, ) -> tuple[ np.ndarray, - Optional[np.ndarray], + np.ndarray | None, np.ndarray, - Optional[np.ndarray], - Optional[np.ndarray], + np.ndarray | None, + np.ndarray | None, ]: """ Parse and scale bounding boxes and masks from Google Gemini 2.5 style @@ -490,8 +488,8 @@ def from_google_gemini_2_5( boxes_list: list = [] labels_list: list = [] - confidence_list: Optional[list] = [] - masks_list: Optional[list] = [] + confidence_list: list | None = [] + masks_list: list | None = [] for item in data: if "box_2d" not in item or "label" not in item: diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 87a96a2a..ed4a9037 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -1,5 +1,6 @@ +from __future__ import annotations + import os -from typing import Optional, Union import cv2 import numpy as np @@ -215,7 +216,7 @@ def draw_text( text_thickness: int = 1, text_padding: int = 10, text_font: int = cv2.FONT_HERSHEY_SIMPLEX, - background_color: Optional[Color] = None, + background_color: Color | None = None, ) -> np.ndarray: """ Draw text with background on a scene. @@ -282,7 +283,7 @@ def draw_text( def draw_image( - scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect + scene: np.ndarray, image: str | np.ndarray, opacity: float, rect: Rect ) -> np.ndarray: """ Draws an image onto a given scene with specified opacity and dimensions. diff --git a/supervision/keypoint/annotators.py b/supervision/keypoint/annotators.py index 9a44c5eb..5d74ea11 100644 --- a/supervision/keypoint/annotators.py +++ b/supervision/keypoint/annotators.py @@ -1,6 +1,7 @@ +from __future__ import annotations + from abc import ABC, abstractmethod from logging import warn -from typing import Optional, Union import cv2 import numpy as np @@ -106,7 +107,7 @@ class EdgeAnnotator(BaseKeyPointAnnotator): self, color: Color = Color.ROBOFLOW, thickness: int = 2, - edges: Optional[list[tuple[int, int]]] = None, + edges: list[tuple[int, int]] | None = None, ) -> None: """ Args: @@ -196,8 +197,8 @@ class VertexLabelAnnotator: def __init__( self, - color: Union[Color, list[Color]] = Color.ROBOFLOW, - text_color: Union[Color, list[Color]] = Color.WHITE, + color: Color | list[Color] = Color.ROBOFLOW, + text_color: Color | list[Color] = Color.WHITE, text_scale: float = 0.5, text_thickness: int = 1, text_padding: int = 10, @@ -220,8 +221,8 @@ class VertexLabelAnnotator: smart_position (bool): Spread out the labels to avoid overlap. """ self.border_radius: int = border_radius - self.color: Union[Color, list[Color]] = color - self.text_color: Union[Color, list[Color]] = text_color + self.color: Color | list[Color] = color + self.text_color: Color | list[Color] = text_color self.text_scale: float = text_scale self.text_thickness: int = text_thickness self.text_padding: int = text_padding @@ -231,7 +232,7 @@ class VertexLabelAnnotator: self, scene: ImageType, key_points: KeyPoints, - labels: Optional[list[str]] = None, + labels: list[str] | None = None, ) -> ImageType: """ A class that draws labels of skeleton vertices on images. It uses specified key @@ -412,7 +413,7 @@ class VertexLabelAnnotator: @staticmethod def preprocess_and_validate_labels( - labels: Optional[list[str]], points_count: int, skeletons_count: int + labels: list[str] | None, points_count: int, skeletons_count: int ) -> np.ndarray: if labels and len(labels) != points_count: raise ValueError( @@ -426,7 +427,7 @@ class VertexLabelAnnotator: @staticmethod def preprocess_and_validate_colors( - colors: Optional[Union[Color, list[Color]]], + colors: Color | list[Color] | None, points_count: int, skeletons_count: int, ) -> np.ndarray: diff --git a/supervision/metrics/detection.py b/supervision/metrics/detection.py index 3f1f96d5..1a55de55 100644 --- a/supervision/metrics/detection.py +++ b/supervision/metrics/detection.py @@ -1,7 +1,7 @@ from __future__ import annotations +from collections.abc import Callable from dataclasses import dataclass -from typing import Callable import matplotlib import matplotlib.pyplot as plt diff --git a/supervision/utils/file.py b/supervision/utils/file.py index 82c32ef3..c3a04ff2 100644 --- a/supervision/utils/file.py +++ b/supervision/utils/file.py @@ -1,6 +1,7 @@ +from __future__ import annotations + import json from pathlib import Path -from typing import Optional, Union import numpy as np import yaml @@ -18,7 +19,7 @@ class NumpyJsonEncoder(json.JSONEncoder): def list_files_with_extensions( - directory: Union[str, Path], extensions: Optional[list[str]] = None + directory: str | Path, extensions: list[str] | None = None ) -> list[Path]: """ List files in a directory with specified extensions or @@ -57,7 +58,7 @@ def list_files_with_extensions( return files_with_extensions -def read_txt_file(file_path: Union[str, Path], skip_empty: bool = False) -> list[str]: +def read_txt_file(file_path: str | Path, skip_empty: bool = False) -> list[str]: """ Read a text file and return a list of strings without newline characters. Optionally skip empty lines. @@ -79,7 +80,7 @@ def read_txt_file(file_path: Union[str, Path], skip_empty: bool = False) -> list return lines -def save_text_file(lines: list[str], file_path: Union[str, Path]) -> None: +def save_text_file(lines: list[str], file_path: str | Path) -> None: """ Write a list of strings to a text file, each string on a new line. @@ -92,7 +93,7 @@ def save_text_file(lines: list[str], file_path: Union[str, Path]) -> None: file.write(line + "\n") -def read_json_file(file_path: Union[str, Path]) -> dict: +def read_json_file(file_path: str | Path) -> dict: """ Read a json file and return a dict. @@ -107,7 +108,7 @@ def read_json_file(file_path: Union[str, Path]) -> dict: return data -def save_json_file(data: dict, file_path: Union[str, Path], indent: int = 3) -> None: +def save_json_file(data: dict, file_path: str | Path, indent: int = 3) -> None: """ Write a dict to a json file. @@ -120,7 +121,7 @@ def save_json_file(data: dict, file_path: Union[str, Path], indent: int = 3) -> json.dump(data, fp, cls=NumpyJsonEncoder, indent=indent) -def read_yaml_file(file_path: Union[str, Path]) -> dict: +def read_yaml_file(file_path: str | Path) -> dict: """ Read a yaml file and return a dict. @@ -135,7 +136,7 @@ def read_yaml_file(file_path: Union[str, Path]) -> dict: return data -def save_yaml_file(data: dict, file_path: Union[str, Path]) -> None: +def save_yaml_file(data: dict, file_path: str | Path) -> None: """ Save a dict to a json file. diff --git a/supervision/utils/image.py b/supervision/utils/image.py index b34872fc..69609867 100644 --- a/supervision/utils/image.py +++ b/supervision/utils/image.py @@ -1,9 +1,12 @@ +from __future__ import annotations + import itertools import math import os import shutil +from collections.abc import Callable from functools import partial -from typing import Callable, Literal, Optional, Union +from typing import Literal import cv2 import numpy as np @@ -28,7 +31,7 @@ MAX_COLUMNS_FOR_SINGLE_ROW_GRID = 3 @ensure_cv2_image_for_processing def crop_image( image: ImageType, - xyxy: Union[npt.NDArray[int], list[int], tuple[int, int, int, int]], + xyxy: npt.NDArray[int] | list[int] | tuple[int, int, int, int], ) -> ImageType: """ Crops the given image based on the given bounding box. @@ -220,7 +223,7 @@ def resize_image( def letterbox_image( image: ImageType, resolution_wh: tuple[int, int], - color: Union[tuple[int, int, int], Color] = Color.BLACK, + color: tuple[int, int, int] | Color = Color.BLACK, ) -> ImageType: """ Resizes and pads an image to a specified resolution with a given color, maintaining @@ -412,7 +415,7 @@ class ImageSink: return self - def save_image(self, image: np.ndarray, image_name: Optional[str] = None): + def save_image(self, image: np.ndarray, image_name: str | None = None): """ Save a given image in the target directory. @@ -436,23 +439,21 @@ class ImageSink: def create_tiles( images: list[ImageType], - grid_size: Optional[tuple[Optional[int], Optional[int]]] = None, - single_tile_size: Optional[tuple[int, int]] = None, + grid_size: tuple[int | None, int | None] | None = None, + single_tile_size: tuple[int, int] | None = None, tile_scaling: Literal["min", "max", "avg"] = "avg", - tile_padding_color: Union[tuple[int, int, int], Color] = Color.from_hex("#D9D9D9"), + tile_padding_color: tuple[int, int, int] | Color = Color.from_hex("#D9D9D9"), tile_margin: int = 10, - tile_margin_color: Union[tuple[int, int, int], Color] = Color.from_hex("#BFBEBD"), + tile_margin_color: tuple[int, int, int] | Color = Color.from_hex("#BFBEBD"), return_type: Literal["auto", "cv2", "pillow"] = "auto", - titles: Optional[list[Optional[str]]] = None, - titles_anchors: Optional[Union[Point, list[Optional[Point]]]] = None, - titles_color: Union[tuple[int, int, int], Color] = Color.from_hex("#262523"), - titles_scale: Optional[float] = None, + titles: list[str | None] | None = None, + titles_anchors: Point | list[Point | None] | None = None, + titles_color: tuple[int, int, int] | Color = Color.from_hex("#262523"), + titles_scale: float | None = None, titles_thickness: int = 1, titles_padding: int = 10, titles_text_font: int = cv2.FONT_HERSHEY_SIMPLEX, - titles_background_color: Union[tuple[int, int, int], Color] = Color.from_hex( - "#D9D9D9" - ), + titles_background_color: tuple[int, int, int] | Color = Color.from_hex("#D9D9D9"), default_title_placement: RelativePosition = "top", ) -> ImageType: """ @@ -613,7 +614,7 @@ def _aggregate_images_shape( def _establish_grid_size( - images: list[np.ndarray], grid_size: Optional[tuple[Optional[int], Optional[int]]] + images: list[np.ndarray], grid_size: tuple[int | None, int | None] | None ) -> tuple[int, int]: if grid_size is None or all(e is None for e in grid_size): return _negotiate_grid_size(images=images) @@ -642,10 +643,10 @@ def _generate_tiles( tile_padding_color: tuple[int, int, int], tile_margin: int, tile_margin_color: tuple[int, int, int], - titles: Optional[list[Optional[str]]], - titles_anchors: list[Optional[Point]], + titles: list[str | None] | None, + titles_anchors: list[Point | None], titles_color: tuple[int, int, int], - titles_scale: Optional[float], + titles_scale: float | None, titles_thickness: int, titles_padding: int, titles_text_font: int, @@ -686,10 +687,10 @@ def _generate_tiles( def _draw_texts( images: list[np.ndarray], - titles: Optional[list[Optional[str]]], - titles_anchors: list[Optional[Point]], + titles: list[str | None] | None, + titles_anchors: list[Point | None], titles_color: tuple[int, int, int], - titles_scale: Optional[float], + titles_scale: float | None, titles_thickness: int, titles_padding: int, titles_text_font: int, @@ -730,7 +731,7 @@ def _draw_texts( def _prepare_default_titles_anchors( images: list[np.ndarray], - titles_anchors: list[Optional[Point]], + titles_anchors: list[Point | None], default_title_placement: RelativePosition, ) -> list[Point]: result = [] diff --git a/supervision/utils/internal.py b/supervision/utils/internal.py index 94b5465c..242a4172 100644 --- a/supervision/utils/internal.py +++ b/supervision/utils/internal.py @@ -1,8 +1,11 @@ +from __future__ import annotations + import functools import inspect import os import warnings -from typing import Any, Callable, Generic, Optional, TypeVar +from collections.abc import Callable +from typing import Any, Generic, TypeVar class SupervisionWarnings(Warning): @@ -144,7 +147,7 @@ class classproperty(Generic[T]): """ self.fget = fget - def __get__(self, owner_self: Any, owner_cls: Optional[type] = None) -> T: + def __get__(self, owner_self: Any, owner_cls: type | None = None) -> T: """ Override the __get__ method to return the result of the function call. diff --git a/supervision/utils/notebook.py b/supervision/utils/notebook.py index 5e7091f8..9262f12b 100644 --- a/supervision/utils/notebook.py +++ b/supervision/utils/notebook.py @@ -1,4 +1,4 @@ -from typing import Optional +from __future__ import annotations import cv2 import matplotlib.pyplot as plt @@ -9,7 +9,7 @@ from supervision.utils.conversion import pillow_to_cv2 def plot_image( - image: ImageType, size: tuple[int, int] = (12, 12), cmap: Optional[str] = "gray" + image: ImageType, size: tuple[int, int] = (12, 12), cmap: str | None = "gray" ) -> None: """ Plots image using matplotlib. @@ -48,9 +48,9 @@ def plot_image( def plot_images_grid( images: list[ImageType], grid_size: tuple[int, int], - titles: Optional[list[str]] = None, + titles: list[str] | None = None, size: tuple[int, int] = (12, 12), - cmap: Optional[str] = "gray", + cmap: str | None = "gray", ) -> None: """ Plots images in a grid using matplotlib. diff --git a/supervision/utils/video.py b/supervision/utils/video.py index 32d1879b..3b281b4e 100644 --- a/supervision/utils/video.py +++ b/supervision/utils/video.py @@ -2,9 +2,8 @@ from __future__ import annotations import time from collections import deque -from collections.abc import Generator +from collections.abc import Callable, Generator from dataclasses import dataclass -from typing import Callable import cv2 import numpy as np diff --git a/test/annotators/test_utils.py b/test/annotators/test_utils.py index 588f0242..2fdccec1 100644 --- a/test/annotators/test_utils.py +++ b/test/annotators/test_utils.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional import numpy as np import pytest @@ -97,7 +98,7 @@ def test_resolve_color_idx( detections: Detections, detection_idx: int, color_lookup: ColorLookup, - expected_result: Optional[int], + expected_result: int | None, exception: Exception, ) -> None: with exception: diff --git a/test/classification/test_core.py b/test/classification/test_core.py index 9ab04e63..958ed901 100644 --- a/test/classification/test_core.py +++ b/test/classification/test_core.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional import numpy as np import pytest @@ -49,9 +50,9 @@ from supervision.classification.core import Classifications ) def test_top_k( class_id: np.ndarray, - confidence: Optional[np.ndarray], + confidence: np.ndarray | None, k: int, - expected_result: Optional[tuple[np.ndarray, np.ndarray]], + expected_result: tuple[np.ndarray, np.ndarray] | None, exception: Exception, ) -> None: with exception: diff --git a/test/dataset/formats/test_coco.py b/test/dataset/formats/test_coco.py index d9748cf3..bde8566c 100644 --- a/test/dataset/formats/test_coco.py +++ b/test/dataset/formats/test_coco.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional, Union import numpy as np import pytest @@ -21,7 +22,7 @@ def mock_coco_annotation( category_id: int = 0, bbox: tuple[float, float, float, float] = (0.0, 0.0, 0.0, 0.0), area: float = 0.0, - segmentation: Optional[Union[list[list], dict]] = None, + segmentation: list[list] | dict | None = None, iscrowd: bool = False, ) -> dict: if not segmentation: diff --git a/test/dataset/formats/test_pascal_voc.py b/test/dataset/formats/test_pascal_voc.py index 3006e227..27600c50 100644 --- a/test/dataset/formats/test_pascal_voc.py +++ b/test/dataset/formats/test_pascal_voc.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional import numpy as np import pytest @@ -60,7 +61,7 @@ def are_xml_elements_equal(elem1, elem2): def test_object_to_pascal_voc( xyxy: np.ndarray, name: str, - polygon: Optional[np.ndarray], + polygon: np.ndarray | None, expected_result, exception: Exception, ): diff --git a/test/dataset/formats/test_yolo.py b/test/dataset/formats/test_yolo.py index 62774a5d..4b032603 100644 --- a/test/dataset/formats/test_yolo.py +++ b/test/dataset/formats/test_yolo.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional import numpy as np import pytest @@ -57,7 +58,7 @@ def _arrays_almost_equal( ], ) def test_with_mask( - lines: list[str], expected_result: Optional[bool], exception: Exception + lines: list[str], expected_result: bool | None, exception: Exception ) -> None: with exception: result = _with_mask(lines=lines) @@ -174,7 +175,7 @@ def test_yolo_annotations_to_detections( lines: list[str], resolution_wh: tuple[int, int], with_masks: bool, - expected_result: Optional[Detections], + expected_result: Detections | None, exception: Exception, ) -> None: with exception: @@ -202,7 +203,7 @@ def test_yolo_annotations_to_detections( ], ) def test_image_name_to_annotation_name( - image_name: str, expected_result: Optional[str], exception: Exception + image_name: str, expected_result: str | None, exception: Exception ) -> None: with exception: result = _image_name_to_annotation_name(image_name=image_name) @@ -268,8 +269,8 @@ def test_object_to_yolo( xyxy: np.ndarray, class_id: int, image_shape: tuple[int, int, int], - polygon: Optional[np.ndarray], - expected_result: Optional[str], + polygon: np.ndarray | None, + expected_result: str | None, exception: Exception, ) -> None: with exception: diff --git a/test/dataset/test_core.py b/test/dataset/test_core.py index 3cc19a80..5ad3a3ef 100644 --- a/test/dataset/test_core.py +++ b/test/dataset/test_core.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional import pytest @@ -159,7 +160,7 @@ from test.test_utils import mock_detections ) def test_dataset_merge( dataset_list: list[DetectionDataset], - expected_result: Optional[DetectionDataset], + expected_result: DetectionDataset | None, exception: Exception, ) -> None: with exception: diff --git a/test/dataset/test_utils.py b/test/dataset/test_utils.py index 758e6d4c..0b5a79f2 100644 --- a/test/dataset/test_utils.py +++ b/test/dataset/test_utils.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional, TypeVar +from typing import TypeVar import numpy as np import numpy.typing as npt @@ -78,7 +80,7 @@ def test_train_test_split( train_ratio: float, random_state: int, shuffle: bool, - expected_result: Optional[tuple[list[T], list[T]]], + expected_result: tuple[list[T], list[T]] | None, exception: Exception, ) -> None: with exception: @@ -165,7 +167,7 @@ def test_merge_class_maps( def test_build_class_index_mapping( source_classes: list[str], target_classes: list[str], - expected_result: Optional[dict[int, int]], + expected_result: dict[int, int] | None, exception: Exception, ) -> None: with exception: @@ -225,7 +227,7 @@ def test_build_class_index_mapping( def test_map_detections_class_id( source_to_target_mapping: dict[int, int], detections: Detections, - expected_result: Optional[Detections], + expected_result: Detections | None, exception: Exception, ) -> None: with exception: diff --git a/test/detection/test_core.py b/test/detection/test_core.py index c0270f70..c57bea40 100644 --- a/test/detection/test_core.py +++ b/test/detection/test_core.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional, Union import numpy as np import pytest @@ -233,8 +234,8 @@ TEST_DET_DIFFERENT_METADATA = Detections( ) def test_getitem( detections: Detections, - index: Union[int, slice, list[int], np.ndarray], - expected_result: Optional[Detections], + index: int | slice | list[int] | np.ndarray, + expected_result: Detections | None, exception: Exception, ) -> None: with exception: @@ -506,7 +507,7 @@ def test_getitem( ) def test_merge( detections_list: list[Detections], - expected_result: Optional[Detections], + expected_result: Detections | None, exception: Exception, ) -> None: with exception: @@ -808,7 +809,7 @@ def test_equal( def test_merge_inner_detection_object_pair( detection_1: Detections, detection_2: Detections, - expected_result: Optional[Detections], + expected_result: Detections | None, exception: Exception, ): with exception: diff --git a/test/detection/test_line_counter.py b/test/detection/test_line_counter.py index 7291a1c5..f7227fa6 100644 --- a/test/detection/test_line_counter.py +++ b/test/detection/test_line_counter.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional import pytest @@ -65,7 +66,7 @@ from test.test_utils import mock_detections ) def test_calculate_region_of_interest_limits( vector: Vector, - expected_result: Optional[tuple[Vector, Vector]], + expected_result: tuple[Vector, Vector] | None, exception: Exception, ) -> None: with exception: @@ -741,7 +742,7 @@ def test_line_zone_one_detection_long_horizon( ) def test_line_zone_long_horizon_disappearing_detections( vector: Vector, - xyxy_sequence: list[list[Optional[list[float]]]], + xyxy_sequence: list[list[list[float] | None]], anchors: list[Position], minimum_crossing_threshold: int, expected_crossed_in: list[list[bool]], diff --git a/test/detection/test_overlap_filter.py b/test/detection/test_overlap_filter.py index f655f0e9..d870f897 100644 --- a/test/detection/test_overlap_filter.py +++ b/test/detection/test_overlap_filter.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional import numpy as np import pytest @@ -234,7 +235,7 @@ def test_group_overlapping_boxes( def test_box_non_max_suppression( predictions: np.ndarray, iou_threshold: float, - expected_result: Optional[np.ndarray], + expected_result: np.ndarray | None, exception: Exception, ) -> None: with exception: @@ -440,7 +441,7 @@ def test_mask_non_max_suppression( predictions: np.ndarray, masks: np.ndarray, iou_threshold: float, - expected_result: Optional[np.ndarray], + expected_result: np.ndarray | None, exception: Exception, ) -> None: with exception: diff --git a/test/detection/test_utils.py b/test/detection/test_utils.py index 99762c91..eb76b996 100644 --- a/test/detection/test_utils.py +++ b/test/detection/test_utils.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Any, Optional +from typing import Any import numpy as np import numpy.typing as npt @@ -153,8 +155,8 @@ def test_clip_boxes( ) def test_filter_polygons_by_area( polygons: list[np.ndarray], - min_area: Optional[float], - max_area: Optional[float], + min_area: float | None, + max_area: float | None, expected_result: list[np.ndarray], exception: Exception, ) -> None: @@ -373,7 +375,7 @@ def test_filter_polygons_by_area( def test_process_roboflow_result( roboflow_result: dict, expected_result: tuple[ - np.ndarray, np.ndarray, np.ndarray, Optional[np.ndarray], np.ndarray + np.ndarray, np.ndarray, np.ndarray, np.ndarray | None, np.ndarray ], exception: Exception, ) -> None: @@ -1033,7 +1035,7 @@ def test_calculate_masks_centroids( ) def test_merge_data( data_list: list[dict[str, Any]], - expected_result: Optional[dict[str, Any]], + expected_result: dict[str, Any] | None, exception: Exception, ): with exception: @@ -1209,7 +1211,7 @@ def test_merge_data( def test_get_data_item( data: dict[str, Any], index: Any, - expected_result: Optional[dict[str, Any]], + expected_result: dict[str, Any] | None, exception: Exception, ): with exception: diff --git a/test/detection/test_vlm.py b/test/detection/test_vlm.py index 93e030a6..1b4c2f18 100644 --- a/test/detection/test_vlm.py +++ b/test/detection/test_vlm.py @@ -1,6 +1,7 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise from contextlib import nullcontext as does_not_raise -from typing import Optional import numpy as np import pytest @@ -185,8 +186,8 @@ def test_from_paligemma( exception, result: str, resolution_wh: tuple[int, int], - classes: Optional[list[str]], - expected_results: tuple[np.ndarray, Optional[np.ndarray], np.ndarray], + classes: list[str] | None, + expected_results: tuple[np.ndarray, np.ndarray | None, np.ndarray], ) -> None: with exception: result = from_paligemma( @@ -347,7 +348,7 @@ def test_from_qwen_2_5_vl( result: str, input_wh: tuple[int, int], resolution_wh: tuple[int, int], - classes: Optional[list[str]], + classes: list[str] | None, expected_results, ) -> None: with exception: @@ -489,8 +490,8 @@ def test_from_google_gemini( exception, result: str, resolution_wh: tuple[int, int], - classes: Optional[list[str]], - expected_results: tuple[np.ndarray, Optional[np.ndarray], np.ndarray], + classes: list[str] | None, + expected_results: tuple[np.ndarray, np.ndarray | None, np.ndarray], ) -> None: with exception: xyxy, class_id, class_name = from_google_gemini_2_0( @@ -865,7 +866,7 @@ def test_florence_2( florence_result: dict, resolution_wh: tuple[int, int], expected_results: tuple[ - np.ndarray, Optional[np.ndarray], Optional[np.ndarray], Optional[np.ndarray] + np.ndarray, np.ndarray | None, np.ndarray | None, np.ndarray | None ], exception: Exception, ) -> None: @@ -1081,10 +1082,9 @@ def test_from_google_gemini_2_5( exception, result: str, resolution_wh: tuple[int, int], - classes: Optional[list[str]], - expected_results: Optional[ - tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray] - ], + classes: list[str] | None, + expected_results: None + | (tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]), ): with exception: ( diff --git a/test/detection/tools/test_inference_slicer.py b/test/detection/tools/test_inference_slicer.py index 84f3b803..af29723a 100644 --- a/test/detection/tools/test_inference_slicer.py +++ b/test/detection/tools/test_inference_slicer.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional import numpy as np import pytest @@ -47,9 +48,9 @@ def mock_callback(): def test_inference_slicer_overlap( mock_callback, slice_wh: tuple[int, int], - overlap_ratio_wh: Optional[tuple[float, float]], - overlap_wh: Optional[tuple[int, int]], - expected_overlap: Optional[tuple[int, int]], + overlap_ratio_wh: tuple[float, float] | None, + overlap_wh: tuple[int, int] | None, + expected_overlap: tuple[int, int] | None, exception: Exception, ) -> None: with exception: @@ -169,7 +170,7 @@ def test_inference_slicer_overlap( def test_generate_offset( resolution_wh: tuple[int, int], slice_wh: tuple[int, int], - overlap_wh: Optional[tuple[int, int]], + overlap_wh: tuple[int, int] | None, expected_offsets: np.ndarray, ) -> None: offsets = InferenceSlicer._generate_offset( diff --git a/test/draw/test_color.py b/test/draw/test_color.py index b9dbc440..05ad6862 100644 --- a/test/draw/test_color.py +++ b/test/draw/test_color.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional import pytest @@ -25,7 +26,7 @@ from supervision.draw.color import Color ], ) def test_color_from_hex( - color_hex, expected_result: Optional[Color], exception: Exception + color_hex, expected_result: Color | None, exception: Exception ) -> None: with exception: result = Color.from_hex(color_hex=color_hex) @@ -44,7 +45,7 @@ def test_color_from_hex( ], ) def test_color_as_hex( - color: Color, expected_result: Optional[str], exception: Exception + color: Color, expected_result: str | None, exception: Exception ) -> None: with exception: result = color.as_hex() diff --git a/test/metrics/test_detection.py b/test/metrics/test_detection.py index b2313bdd..f5be7ac6 100644 --- a/test/metrics/test_detection.py +++ b/test/metrics/test_detection.py @@ -1,5 +1,6 @@ +from __future__ import annotations + from contextlib import ExitStack as DoesNotRaise -from typing import Optional, Union import numpy as np import pytest @@ -103,9 +104,7 @@ def update_ideal_conf_matrix(conf_matrix: np.ndarray, class_ids: np.ndarray): return conf_matrix -def worsen_ideal_conf_matrix( - conf_matrix: np.ndarray, class_ids: Union[np.ndarray, list] -): +def worsen_ideal_conf_matrix(conf_matrix: np.ndarray, class_ids: np.ndarray | list): for class_id in class_ids: class_id = int(class_id) conf_matrix[class_id, class_id] -= 1 @@ -177,7 +176,7 @@ BAD_CONF_MATRIX = worsen_ideal_conf_matrix( def test_detections_to_tensor( detections: Detections, with_confidence: bool, - expected_result: Optional[np.ndarray], + expected_result: np.ndarray | None, exception: Exception, ): with exception: @@ -343,7 +342,7 @@ def test_from_tensors( classes, conf_threshold, iou_threshold, - expected_result: Optional[np.ndarray], + expected_result: np.ndarray | None, exception: Exception, ): with exception: @@ -380,7 +379,7 @@ def test_evaluate_detection_batch( num_classes, conf_threshold, iou_threshold, - expected_result: Optional[np.ndarray], + expected_result: np.ndarray | None, exception: Exception, ): with exception: @@ -408,7 +407,7 @@ def test_evaluate_detection_batch( ) def test_drop_extra_matches( matches, - expected_result: Optional[np.ndarray], + expected_result: np.ndarray | None, exception: Exception, ): with exception: diff --git a/test/test_utils.py b/test/test_utils.py index 8e5ca016..19fffad5 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -1,4 +1,6 @@ -from typing import Any, Optional +from __future__ import annotations + +from typing import Any import numpy as np import numpy.typing as npt @@ -9,11 +11,11 @@ from supervision.keypoint.core import KeyPoints def mock_detections( xyxy: npt.NDArray[np.float32], - mask: Optional[list[np.ndarray]] = None, - confidence: Optional[list[float]] = None, - class_id: Optional[list[int]] = None, - tracker_id: Optional[list[int]] = None, - data: Optional[dict[str, list[Any]]] = None, + mask: list[np.ndarray] | None = None, + confidence: list[float] | None = None, + class_id: list[int] | None = None, + tracker_id: list[int] | None = None, + data: dict[str, list[Any]] | None = None, ) -> Detections: def convert_data(data: dict[str, list[Any]]): return {k: np.array(v) for k, v in data.items()} @@ -34,9 +36,9 @@ def mock_detections( def mock_keypoints( xy: npt.NDArray[np.float32], - confidence: Optional[list[float]] = None, - class_id: Optional[list[int]] = None, - data: Optional[dict[str, list[Any]]] = None, + confidence: list[float] | None = None, + class_id: list[int] | None = None, + data: dict[str, list[Any]] | None = None, ) -> KeyPoints: def convert_data(data: dict[str, list[Any]]): return {k: np.array(v) for k, v in data.items()} diff --git a/test/utils/test_file.py b/test/utils/test_file.py index 9a4a4d33..71f5bdeb 100644 --- a/test/utils/test_file.py +++ b/test/utils/test_file.py @@ -1,6 +1,7 @@ +from __future__ import annotations + import os from contextlib import ExitStack as DoesNotRaise -from typing import Optional import pytest @@ -56,7 +57,7 @@ def setup_and_teardown_files(): def test_read_txt_file( file_name: str, skip_empty: bool, - expected_result: Optional[list[str]], + expected_result: list[str] | None, exception: Exception, ): with exception: From fa5fcbb26484aec9b3824ed660ed478ec66f8e60 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 15 Jul 2025 19:23:55 +0200 Subject: [PATCH 087/110] utils split across multiple files; internal and external imports working; utils tests split across multiple files; tests working locally --- supervision/__init__.py | 64 +- supervision/annotators/core.py | 11 +- supervision/dataset/formats/coco.py | 8 +- supervision/dataset/formats/pascal_voc.py | 2 +- supervision/dataset/formats/yolo.py | 2 +- supervision/dataset/utils.py | 8 +- supervision/detection/core.py | 29 +- supervision/detection/line_zone.py | 2 +- supervision/detection/overlap_filter.py | 396 ---- .../detection/tools/inference_slicer.py | 5 +- supervision/detection/tools/polygon_zone.py | 3 +- supervision/detection/tools/transformers.py | 2 +- supervision/detection/utils.py | 1667 ----------------- supervision/detection/utils/__init__.py | 0 supervision/detection/utils/boxes.py | 333 ++++ supervision/detection/utils/converters.py | 272 +++ supervision/detection/utils/internal.py | 331 ++++ supervision/detection/utils/iou_and_nms.py | 795 ++++++++ supervision/detection/utils/masks.py | 260 +++ supervision/detection/utils/polygons.py | 85 + supervision/detection/vlm.py | 7 +- supervision/keypoint/annotators.py | 2 +- supervision/keypoint/core.py | 2 +- supervision/metrics/detection.py | 2 +- supervision/metrics/f1_score.py | 8 +- supervision/metrics/mean_average_recall.py | 8 +- supervision/metrics/precision.py | 7 +- supervision/metrics/recall.py | 8 +- supervision/tracker/byte_tracker/core.py | 2 +- supervision/tracker/byte_tracker/matching.py | 2 +- test/detection/test_utils.py | 1642 ---------------- test/detection/tools/test_inference_slicer.py | 2 +- test/detection/utils/__init__.py | 0 test/detection/utils/test_boxes.py | 144 ++ test/detection/utils/test_converters.py | 127 ++ test/detection/utils/test_internal.py | 786 ++++++++ .../test_iou_and_nms.py} | 10 +- test/detection/utils/test_masks.py | 498 +++++ test/detection/utils/test_polygons.py | 102 + 39 files changed, 3821 insertions(+), 3813 deletions(-) delete mode 100644 supervision/detection/overlap_filter.py delete mode 100644 supervision/detection/utils.py create mode 100644 supervision/detection/utils/__init__.py create mode 100644 supervision/detection/utils/boxes.py create mode 100644 supervision/detection/utils/converters.py create mode 100644 supervision/detection/utils/internal.py create mode 100644 supervision/detection/utils/iou_and_nms.py create mode 100644 supervision/detection/utils/masks.py create mode 100644 supervision/detection/utils/polygons.py delete mode 100644 test/detection/test_utils.py create mode 100644 test/detection/utils/__init__.py create mode 100644 test/detection/utils/test_boxes.py create mode 100644 test/detection/utils/test_converters.py create mode 100644 test/detection/utils/test_internal.py rename test/detection/{test_overlap_filter.py => utils/test_iou_and_nms.py} (99%) create mode 100644 test/detection/utils/test_masks.py create mode 100644 test/detection/utils/test_polygons.py diff --git a/supervision/__init__.py b/supervision/__init__.py index 76019aef..62da6460 100644 --- a/supervision/__init__.py +++ b/supervision/__init__.py @@ -46,43 +46,51 @@ from supervision.detection.line_zone import ( LineZoneAnnotator, LineZoneAnnotatorMulticlass, ) -from supervision.detection.overlap_filter import ( +from supervision.detection.utils.iou_and_nms import ( + box_iou, + box_iou_batch, + box_iou_batch_with_jaccard, + oriented_box_iou_batch, + mask_iou_batch, OverlapFilter, + OverlapMetric, box_non_max_merge, box_non_max_suppression, mask_non_max_suppression, ) +from supervision.detection.utils.masks import ( + move_masks, + calculate_masks_centroids, + contains_holes, + contains_multiple_segments +) +from supervision.detection.utils.converters import ( + xcycwh_to_xyxy, + xywh_to_xyxy, + xyxy_to_polygons, + xyxy_to_xcycarh, + xyxy_to_xywh, + mask_to_polygons, + mask_to_xyxy, + polygon_to_mask, + polygon_to_xyxy, +) +from supervision.detection.utils.boxes import ( + clip_boxes, + denormalize_boxes, + move_boxes, + pad_boxes, + scale_boxes, +) +from supervision.detection.utils.polygons import ( + filter_polygons_by_area, + approximate_polygon +) from supervision.detection.tools.csv_sink import CSVSink from supervision.detection.tools.inference_slicer import InferenceSlicer from supervision.detection.tools.json_sink import JSONSink from supervision.detection.tools.polygon_zone import PolygonZone, PolygonZoneAnnotator from supervision.detection.tools.smoother import DetectionsSmoother -from supervision.detection.utils import ( - box_iou, - box_iou_batch, - box_iou_batch_with_jaccard, - calculate_masks_centroids, - clip_boxes, - contains_holes, - contains_multiple_segments, - denormalize_boxes, - filter_polygons_by_area, - mask_iou_batch, - mask_to_polygons, - mask_to_xyxy, - move_boxes, - move_masks, - oriented_box_iou_batch, - pad_boxes, - polygon_to_mask, - polygon_to_xyxy, - scale_boxes, - xcycwh_to_xyxy, - xywh_to_xyxy, - xyxy_to_polygons, - xyxy_to_xcycarh, - xyxy_to_xywh, -) from supervision.detection.vlm import LMM, VLM from supervision.draw.color import Color, ColorPalette from supervision.draw.utils import ( @@ -167,6 +175,7 @@ __all__ = [ "MeanAveragePrecision", "OrientedBoxAnnotator", "OverlapFilter", + "OverlapMetric", "PercentageBarAnnotator", "PixelateAnnotator", "Point", @@ -235,4 +244,5 @@ __all__ = [ "xyxy_to_polygons", "xyxy_to_xcycarh", "xyxy_to_xywh", + "approximate_polygon" ] diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 4462351a..096198c5 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -22,13 +22,10 @@ from supervision.annotators.utils import ( ) from supervision.config import ORIENTED_BOX_COORDINATES from supervision.detection.core import Detections -from supervision.detection.utils import ( - clip_boxes, - mask_to_polygons, - polygon_to_mask, - spread_out_boxes, - xyxy_to_polygons, -) +from supervision.detection.utils.boxes import spread_out_boxes, clip_boxes +from supervision.detection.utils.converters import mask_to_polygons, xyxy_to_polygons, \ + polygon_to_mask + from supervision.draw.color import Color, ColorPalette from supervision.draw.utils import draw_polygon, draw_rounded_rectangle, draw_text from supervision.geometry.core import Point, Position, Rect diff --git a/supervision/dataset/formats/coco.py b/supervision/dataset/formats/coco.py index ab032d47..34fb3fe1 100644 --- a/supervision/dataset/formats/coco.py +++ b/supervision/dataset/formats/coco.py @@ -13,11 +13,9 @@ from supervision.dataset.utils import ( rle_to_mask, ) from supervision.detection.core import Detections -from supervision.detection.utils import ( - contains_holes, - contains_multiple_segments, - polygon_to_mask, -) +from supervision.detection.utils.converters import polygon_to_mask +from supervision.detection.utils.masks import contains_holes, contains_multiple_segments + from supervision.utils.file import read_json_file, save_json_file if TYPE_CHECKING: diff --git a/supervision/dataset/formats/pascal_voc.py b/supervision/dataset/formats/pascal_voc.py index fb068ccc..c5172c33 100644 --- a/supervision/dataset/formats/pascal_voc.py +++ b/supervision/dataset/formats/pascal_voc.py @@ -11,7 +11,7 @@ from defusedxml.minidom import parseString from supervision.dataset.utils import approximate_mask_with_polygons from supervision.detection.core import Detections -from supervision.detection.utils import polygon_to_mask, polygon_to_xyxy +from supervision.detection.utils.converters import polygon_to_mask, polygon_to_xyxy from supervision.utils.file import list_files_with_extensions diff --git a/supervision/dataset/formats/yolo.py b/supervision/dataset/formats/yolo.py index f065aefd..8af010fa 100644 --- a/supervision/dataset/formats/yolo.py +++ b/supervision/dataset/formats/yolo.py @@ -10,7 +10,7 @@ from PIL import Image from supervision.config import ORIENTED_BOX_COORDINATES from supervision.dataset.utils import approximate_mask_with_polygons from supervision.detection.core import Detections -from supervision.detection.utils import polygon_to_mask, polygon_to_xyxy +from supervision.detection.utils.converters import polygon_to_mask, polygon_to_xyxy from supervision.utils.file import ( list_files_with_extensions, read_txt_file, diff --git a/supervision/dataset/utils.py b/supervision/dataset/utils.py index 9c02c415..eb9af0b2 100644 --- a/supervision/dataset/utils.py +++ b/supervision/dataset/utils.py @@ -12,11 +12,9 @@ import numpy as np import numpy.typing as npt from supervision.detection.core import Detections -from supervision.detection.utils import ( - approximate_polygon, - filter_polygons_by_area, - mask_to_polygons, -) +from supervision.detection.utils.converters import mask_to_polygons +from supervision.detection.utils.polygons import filter_polygons_by_area, \ + approximate_polygon if TYPE_CHECKING: from supervision.dataset.core import DetectionDataset diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 03d82ae0..d492c52e 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -12,32 +12,23 @@ from supervision.config import ( CLASS_NAME_DATA_FIELD, ORIENTED_BOX_COORDINATES, ) -from supervision.detection.overlap_filter import ( - box_non_max_merge, - box_non_max_suppression, - mask_non_max_merge, - mask_non_max_suppression, -) from supervision.detection.tools.transformers import ( process_transformers_detection_result, process_transformers_v4_segmentation_result, process_transformers_v5_segmentation_result, ) -from supervision.detection.utils import ( +from supervision.detection.utils.converters import mask_to_xyxy, xywh_to_xyxy +from supervision.detection.utils.internal import get_data_item, is_data_equal, \ + is_metadata_equal, extract_ultralytics_masks, process_roboflow_result, merge_data, \ + merge_metadata +from supervision.detection.utils.iou_and_nms import ( OverlapMetric, - box_iou_batch, - calculate_masks_centroids, - extract_ultralytics_masks, - get_data_item, - is_data_equal, - is_metadata_equal, - mask_iou_batch, - mask_to_xyxy, - merge_data, - merge_metadata, - process_roboflow_result, - xywh_to_xyxy, + box_non_max_merge, + box_non_max_suppression, + mask_non_max_merge, + mask_non_max_suppression, mask_iou_batch, box_iou_batch, ) +from supervision.detection.utils.masks import calculate_masks_centroids from supervision.detection.vlm import ( LMM, VLM, diff --git a/supervision/detection/line_zone.py b/supervision/detection/line_zone.py index bf7e42da..9baa2edb 100644 --- a/supervision/detection/line_zone.py +++ b/supervision/detection/line_zone.py @@ -13,7 +13,7 @@ import numpy.typing as npt from supervision.config import CLASS_NAME_DATA_FIELD from supervision.detection.core import Detections -from supervision.detection.utils import cross_product +from supervision.detection.utils.internal import cross_product from supervision.draw.color import Color from supervision.draw.utils import draw_rectangle, draw_text from supervision.geometry.core import Point, Position, Rect, Vector diff --git a/supervision/detection/overlap_filter.py b/supervision/detection/overlap_filter.py deleted file mode 100644 index 3cace664..00000000 --- a/supervision/detection/overlap_filter.py +++ /dev/null @@ -1,396 +0,0 @@ -from __future__ import annotations - -from enum import Enum - -import numpy as np -import numpy.typing as npt - -from supervision.detection.utils import OverlapMetric, box_iou_batch, mask_iou_batch - - -def resize_masks(masks: np.ndarray, max_dimension: int = 640) -> np.ndarray: - """ - Resize all masks in the array to have a maximum dimension of max_dimension, - maintaining aspect ratio. - - Args: - masks (np.ndarray): 3D array of binary masks with shape (N, H, W). - max_dimension (int): The maximum dimension for the resized masks. - - Returns: - np.ndarray: Array of resized masks. - """ - max_height = np.max(masks.shape[1]) - max_width = np.max(masks.shape[2]) - scale = min(max_dimension / max_height, max_dimension / max_width) - - new_height = int(scale * max_height) - new_width = int(scale * max_width) - - x = np.linspace(0, max_width - 1, new_width).astype(int) - y = np.linspace(0, max_height - 1, new_height).astype(int) - xv, yv = np.meshgrid(x, y) - - resized_masks = masks[:, yv, xv] - - resized_masks = resized_masks.reshape(masks.shape[0], new_height, new_width) - return resized_masks - - -def mask_non_max_suppression( - predictions: np.ndarray, - masks: np.ndarray, - iou_threshold: float = 0.5, - overlap_metric: OverlapMetric = OverlapMetric.IOU, - mask_dimension: int = 640, -) -> np.ndarray: - """ - Perform Non-Maximum Suppression (NMS) on segmentation predictions. - - Args: - predictions (np.ndarray): A 2D array of object detection predictions in - the format of `(x_min, y_min, x_max, y_max, score)` - or `(x_min, y_min, x_max, y_max, score, class)`. Shape: `(N, 5)` or - `(N, 6)`, where N is the number of predictions. - masks (np.ndarray): A 3D array of binary masks corresponding to the predictions. - Shape: `(N, H, W)`, where N is the number of predictions, and H, W are the - dimensions of each mask. - iou_threshold (float): The intersection-over-union threshold - to use for non-maximum suppression. - overlap_metric (OverlapMetric): Metric used for matching detections in slices. - mask_dimension (int): The dimension to which the masks should be - resized before computing IOU values. Defaults to 640. - - Returns: - np.ndarray: A boolean array indicating which predictions to keep after - non-maximum suppression. - - Raises: - AssertionError: If `iou_threshold` is not within the closed - range from `0` to `1`. - """ - assert 0 <= iou_threshold <= 1, ( - "Value of `iou_threshold` must be in the closed range from 0 to 1, " - f"{iou_threshold} given." - ) - rows, columns = predictions.shape - - if columns == 5: - predictions = np.c_[predictions, np.zeros(rows)] - - sort_index = predictions[:, 4].argsort()[::-1] - predictions = predictions[sort_index] - masks = masks[sort_index] - masks_resized = resize_masks(masks, mask_dimension) - ious = mask_iou_batch(masks_resized, masks_resized, overlap_metric) - categories = predictions[:, 5] - - keep = np.ones(rows, dtype=bool) - for i in range(rows): - if keep[i]: - condition = (ious[i] > iou_threshold) & (categories[i] == categories) - keep[i + 1 :] = np.where(condition[i + 1 :], False, keep[i + 1 :]) - - return keep[sort_index.argsort()] - - -def box_non_max_suppression( - predictions: np.ndarray, - iou_threshold: float = 0.5, - overlap_metric: OverlapMetric = OverlapMetric.IOU, -) -> np.ndarray: - """ - Perform Non-Maximum Suppression (NMS) on object detection predictions. - - Args: - predictions (np.ndarray): An array of object detection predictions in - the format of `(x_min, y_min, x_max, y_max, score)` - or `(x_min, y_min, x_max, y_max, score, class)`. - iou_threshold (float): The intersection-over-union threshold - to use for non-maximum suppression. - overlap_metric (OverlapMetric): Metric used for matching detections in slices. - - Returns: - np.ndarray: A boolean array indicating which predictions to keep after n - on-maximum suppression. - - Raises: - AssertionError: If `iou_threshold` is not within the - closed range from `0` to `1`. - """ - assert 0 <= iou_threshold <= 1, ( - "Value of `iou_threshold` must be in the closed range from 0 to 1, " - f"{iou_threshold} given." - ) - rows, columns = predictions.shape - - # add column #5 - category filled with zeros for agnostic nms - if columns == 5: - predictions = np.c_[predictions, np.zeros(rows)] - - # sort predictions column #4 - score - sort_index = np.flip(predictions[:, 4].argsort()) - predictions = predictions[sort_index] - - boxes = predictions[:, :4] - categories = predictions[:, 5] - ious = box_iou_batch(boxes, boxes, overlap_metric) - ious = ious - np.eye(rows) - - keep = np.ones(rows, dtype=bool) - - for index, (iou, category) in enumerate(zip(ious, categories)): - if not keep[index]: - continue - - # drop detections with iou > iou_threshold and - # same category as current detections - condition = (iou > iou_threshold) & (categories == category) - keep = keep & ~condition - - return keep[sort_index.argsort()] - - -def group_overlapping_boxes( - predictions: npt.NDArray[np.float64], - iou_threshold: float = 0.5, - overlap_metric: OverlapMetric = OverlapMetric.IOU, -) -> list[list[int]]: - """ - Apply greedy version of non-maximum merging to avoid detecting too many - overlapping bounding boxes for a given object. - - Args: - predictions (npt.NDArray[np.float64]): An array of shape `(n, 5)` containing - the bounding boxes coordinates in format `[x1, y1, x2, y2]` - and the confidence scores. - iou_threshold (float): The intersection-over-union threshold - to use for non-maximum suppression. Defaults to 0.5. - overlap_metric (OverlapMetric): Metric used for matching detections in slices. - - Returns: - list[list[int]]: Groups of prediction indices be merged. - Each group may have 1 or more elements. - """ - merge_groups: list[list[int]] = [] - - scores = predictions[:, 4] - order = scores.argsort() - - while len(order) > 0: - idx = int(order[-1]) - - order = order[:-1] - if len(order) == 0: - merge_groups.append([idx]) - break - - merge_candidate = np.expand_dims(predictions[idx], axis=0) - ious = box_iou_batch( - predictions[order][:, :4], merge_candidate[:, :4], overlap_metric - ) - ious = ious.flatten() - - above_threshold = ious >= iou_threshold - merge_group = [idx, *np.flip(order[above_threshold]).tolist()] - merge_groups.append(merge_group) - order = order[~above_threshold] - return merge_groups - - -def mask_non_max_merge( - predictions: np.ndarray, - masks: np.ndarray, - iou_threshold: float = 0.5, - mask_dimension: int = 640, - overlap_metric: OverlapMetric = OverlapMetric.IOU, -) -> list[list[int]]: - """ - Perform Non-Maximum Merging (NMM) on segmentation predictions. - - Args: - predictions (np.ndarray): A 2D array of object detection predictions in - the format of `(x_min, y_min, x_max, y_max, score)` - or `(x_min, y_min, x_max, y_max, score, class)`. Shape: `(N, 5)` or - `(N, 6)`, where N is the number of predictions. - masks (np.ndarray): A 3D array of binary masks corresponding to the predictions. - Shape: `(N, H, W)`, where N is the number of predictions, and H, W are the - dimensions of each mask. - iou_threshold (float): The intersection-over-union threshold - to use for non-maximum suppression. - mask_dimension (int): The dimension to which the masks should be - resized before computing IOU values. Defaults to 640. - overlap_metric (OverlapMetric): Metric used for matching detections in slices. - - Returns: - np.ndarray: A boolean array indicating which predictions to keep after - non-maximum suppression. - - Raises: - AssertionError: If `iou_threshold` is not within the closed - range from `0` to `1`. - """ - masks_resized = resize_masks(masks, mask_dimension) - if predictions.shape[1] == 5: - return group_overlapping_masks( - predictions, masks_resized, iou_threshold, overlap_metric - ) - - category_ids = predictions[:, 5] - merge_groups = [] - for category_id in np.unique(category_ids): - curr_indices = np.where(category_ids == category_id)[0] - merge_class_groups = group_overlapping_masks( - predictions[curr_indices], - masks_resized[curr_indices], - iou_threshold, - overlap_metric, - ) - - for merge_class_group in merge_class_groups: - merge_groups.append(curr_indices[merge_class_group].tolist()) - - for merge_group in merge_groups: - if len(merge_group) == 0: - raise ValueError( - f"Empty group detected when non-max-merging detections: {merge_groups}" - ) - return merge_groups - - -def box_non_max_merge( - predictions: npt.NDArray[np.float64], - iou_threshold: float = 0.5, - overlap_metric: OverlapMetric = OverlapMetric.IOU, -) -> list[list[int]]: - """ - Apply greedy version of non-maximum merging per category to avoid detecting - too many overlapping bounding boxes for a given object. - - Args: - predictions (npt.NDArray[np.float64]): An array of shape `(n, 5)` or `(n, 6)` - containing the bounding boxes coordinates in format `[x1, y1, x2, y2]`, - the confidence scores and class_ids. Omit class_id column to allow - detections of different classes to be merged. - iou_threshold (float): The intersection-over-union threshold - to use for non-maximum suppression. Defaults to 0.5. - overlap_metric (OverlapMetric): Metric used for matching detections in slices. - - Returns: - list[list[int]]: Groups of prediction indices be merged. - Each group may have 1 or more elements. - """ - if predictions.shape[1] == 5: - return group_overlapping_boxes(predictions, iou_threshold, overlap_metric) - - category_ids = predictions[:, 5] - merge_groups = [] - for category_id in np.unique(category_ids): - curr_indices = np.where(category_ids == category_id)[0] - merge_class_groups = group_overlapping_boxes( - predictions[curr_indices], iou_threshold, overlap_metric - ) - - for merge_class_group in merge_class_groups: - merge_groups.append(curr_indices[merge_class_group].tolist()) - - for merge_group in merge_groups: - if len(merge_group) == 0: - raise ValueError( - f"Empty group detected when non-max-merging detections: {merge_groups}" - ) - return merge_groups - - -def group_overlapping_masks( - predictions: npt.NDArray[np.float64], - masks: npt.NDArray[np.float64], - iou_threshold: float = 0.5, - overlap_metric: OverlapMetric = OverlapMetric.IOU, -) -> list[list[int]]: - """ - Apply greedy version of non-maximum merging to avoid detecting too many - - Args: - predictions (npt.NDArray[np.float64]): An array of shape `(n, 5)` containing - the bounding boxes coordinates in format `[x1, y1, x2, y2]` - and the confidence scores. - masks (npt.NDArray[np.float64]): A 3D array of binary masks corresponding to - the predictions. - iou_threshold (float): The intersection-over-union threshold - to use for non-maximum suppression. Defaults to 0.5. - overlap_metric (OverlapMetric): Metric used for matching detections in slices. - - Returns: - list[list[int]]: Groups of prediction indices be merged. - Each group may have 1 or more elements. - """ - merge_groups: list[list[int]] = [] - - scores = predictions[:, 4] - order = scores.argsort() - - while len(order) > 0: - idx = int(order[-1]) - - order = order[:-1] - if len(order) == 0: - merge_groups.append([idx]) - break - - merge_candidate = masks[idx][None, ...] - candidate_groups = [idx] - while len(order) > 0: - ious = mask_iou_batch(masks[order], merge_candidate, overlap_metric) - above_threshold: np.ndarray = ious.flatten() >= iou_threshold - if not above_threshold.any(): - break - above_idx = order[above_threshold] - merge_candidate = np.logical_or.reduce( - np.concatenate([masks[above_idx], merge_candidate]), - axis=0, - keepdims=True, - ) - candidate_groups.extend(np.flip(above_idx).tolist()) - order = order[~above_threshold] - - merge_groups.append(candidate_groups) - return merge_groups - - -class OverlapFilter(Enum): - """ - Enum specifying the strategy for filtering overlapping detections. - - Attributes: - NONE: Do not filter detections based on overlap. - NON_MAX_SUPPRESSION: Filter detections using non-max suppression. This means, - detections that overlap by more than a set threshold will be discarded, - except for the one with the highest confidence. - NON_MAX_MERGE: Merge detections with non-max merging. This means, - detections that overlap by more than a set threshold will be merged - into a single detection. - """ - - NONE = "none" - NON_MAX_SUPPRESSION = "non_max_suppression" - NON_MAX_MERGE = "non_max_merge" - - @classmethod - def list(cls): - return list(map(lambda c: c.value, cls)) - - @classmethod - def from_value(cls, value: OverlapFilter | str) -> OverlapFilter: - if isinstance(value, cls): - return value - if isinstance(value, str): - value = value.lower() - try: - return cls(value) - except ValueError: - raise ValueError(f"Invalid value: {value}. Must be one of {cls.list()}") - raise ValueError( - f"Invalid value type: {type(value)}. Must be an instance of " - f"{cls.__name__} or str." - ) diff --git a/supervision/detection/tools/inference_slicer.py b/supervision/detection/tools/inference_slicer.py index e0ffb3bf..ff4a44b2 100644 --- a/supervision/detection/tools/inference_slicer.py +++ b/supervision/detection/tools/inference_slicer.py @@ -8,8 +8,9 @@ import numpy as np from supervision.config import ORIENTED_BOX_COORDINATES from supervision.detection.core import Detections -from supervision.detection.overlap_filter import OverlapFilter -from supervision.detection.utils import move_boxes, move_masks, move_oriented_boxes +from supervision.detection.utils.boxes import move_boxes, move_oriented_boxes +from supervision.detection.utils.iou_and_nms import OverlapFilter +from supervision.detection.utils.masks import move_masks from supervision.utils.image import crop_image from supervision.utils.internal import ( SupervisionWarnings, diff --git a/supervision/detection/tools/polygon_zone.py b/supervision/detection/tools/polygon_zone.py index 40c75337..952da514 100644 --- a/supervision/detection/tools/polygon_zone.py +++ b/supervision/detection/tools/polygon_zone.py @@ -8,7 +8,8 @@ import numpy as np import numpy.typing as npt from supervision import Detections -from supervision.detection.utils import clip_boxes, polygon_to_mask +from supervision.detection.utils.boxes import clip_boxes +from supervision.detection.utils.converters import polygon_to_mask from supervision.draw.color import Color from supervision.draw.utils import draw_filled_polygon, draw_polygon, draw_text from supervision.geometry.core import Position diff --git a/supervision/detection/tools/transformers.py b/supervision/detection/tools/transformers.py index 97eb03ce..0358464e 100644 --- a/supervision/detection/tools/transformers.py +++ b/supervision/detection/tools/transformers.py @@ -7,7 +7,7 @@ import numpy as np from PIL import Image from supervision.config import CLASS_NAME_DATA_FIELD -from supervision.detection.utils import mask_to_xyxy +from supervision.detection.utils.converters import mask_to_xyxy def process_transformers_detection_result( diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py deleted file mode 100644 index cd33f183..00000000 --- a/supervision/detection/utils.py +++ /dev/null @@ -1,1667 +0,0 @@ -from __future__ import annotations - -from enum import Enum -from itertools import chain -from typing import Any - -import cv2 -import numpy as np -import numpy.typing as npt - -from supervision.config import CLASS_NAME_DATA_FIELD -from supervision.geometry.core import Vector - -MIN_POLYGON_POINT_COUNT = 3 - - -class OverlapMetric(Enum): - """ - Enum specifying the metric for measuring overlap between detections. - - Attributes: - IOU: Intersection over Union. A region-overlap metric that compares - two shapes (usually bounding boxes or masks) by normalising the - shared area with the area of their union. - IOS: Intersection over Smaller, a region-overlap metric that compares - two shapes (usually bounding boxes or masks) by normalising the - shared area with the smaller of the two shapes. - """ - - IOU = "IOU" - IOS = "IOS" - - @classmethod - def list(cls): - return list(map(lambda c: c.value, cls)) - - @classmethod - def from_value(cls, value: OverlapMetric | str) -> OverlapMetric: - if isinstance(value, cls): - return value - if isinstance(value, str): - value = value.lower() - try: - return cls(value) - except ValueError: - raise ValueError(f"Invalid value: {value}. Must be one of {cls.list()}") - raise ValueError( - f"Invalid value type: {type(value)}. Must be an instance of " - f"{cls.__name__} or str." - ) - - -def xyxy_to_polygons(box: np.ndarray) -> np.ndarray: - """ - Convert an array of boxes to an array of polygons. - Retains the input datatype. - - Args: - box (np.ndarray): An array of boxes (N, 4), where each box is represented as a - list of four coordinates in the format `(x_min, y_min, x_max, y_max)`. - - Returns: - np.ndarray: An array of polygons (N, 4, 2), where each polygon is - represented as a list of four coordinates in the format `(x, y)`. - """ - polygon = np.zeros((box.shape[0], 4, 2), dtype=box.dtype) - polygon[:, :, 0] = box[:, [0, 2, 2, 0]] - polygon[:, :, 1] = box[:, [1, 1, 3, 3]] - return polygon - - -def polygon_to_mask(polygon: np.ndarray, resolution_wh: tuple[int, int]) -> np.ndarray: - """Generate a mask from a polygon. - - Args: - polygon (np.ndarray): The polygon for which the mask should be generated, - given as a list of vertices. - resolution_wh (Tuple[int, int]): The width and height of the desired resolution. - - Returns: - np.ndarray: The generated 2D mask, where the polygon is marked with - `1`'s and the rest is filled with `0`'s. - """ - width, height = map(int, resolution_wh) - mask = np.zeros((height, width), dtype=np.uint8) - cv2.fillPoly(mask, [polygon.astype(np.int32)], color=1) - return mask - - -def box_iou( - box_true: list[float] | np.ndarray, - box_detection: list[float] | np.ndarray, -) -> float: - """ - Compute the Intersection over Union (IoU) between two bounding boxes. - - Mathematically, it is defined as: - - \\[ - \text{IoU} = \frac{|\text{box}_{\text{true}} \\cap \text{box}_{\text{detection}}|}{|\text{box}_{\text{true}} \\cup \text{box}_{\text{detection}}|} - \\] - - Note: - Use `box_iou` when computing IoU between two individual boxes. - For comparing multiple boxes (arrays of boxes), use `box_iou_batch` for better - performance. - - Args: - box_true (Union[List[float], np.ndarray]): A single bounding box represented as - [x_min, y_min, x_max, y_max]. - box_detection (Union[List[float], np.ndarray]): - A single bounding box represented as [x_min, y_min, x_max, y_max]. - - Returns: - IoU (float): IoU score between the two boxes. Ranges from 0.0 (no overlap) - to 1.0 (perfect overlap). - - Examples: - ```python - import numpy as np - import supervision as sv - - box_true = np.array([100, 100, 200, 200]) - box_detection = np.array([150, 150, 250, 250]) - - sv.box_iou(box_true=box_true, box_detection=box_detection) - # 0.14285814285714285 - ``` - """ # noqa: E501 - box_true = np.array(box_true) - box_detection = np.array(box_detection) - - inter_x1 = max(box_true[0], box_detection[0]) - inter_y1 = max(box_true[1], box_detection[1]) - inter_x2 = min(box_true[2], box_detection[2]) - inter_y2 = min(box_true[3], box_detection[3]) - - inter_w = max(0, inter_x2 - inter_x1) - inter_h = max(0, inter_y2 - inter_y1) - - inter_area = inter_w * inter_h - - area_true = (box_true[2] - box_true[0]) * (box_true[3] - box_true[1]) - area_detection = (box_detection[2] - box_detection[0]) * ( - box_detection[3] - box_detection[1] - ) - - union_area = area_true + area_detection - inter_area - - return inter_area / union_area + 1e-6 - - -def box_iou_batch( - boxes_true: np.ndarray, - boxes_detection: np.ndarray, - overlap_metric: OverlapMetric = OverlapMetric.IOU, -) -> np.ndarray: - """ - Compute Intersection over Union (IoU) of two sets of bounding boxes - - `boxes_true` and `boxes_detection`. Both sets - of boxes are expected to be in `(x_min, y_min, x_max, y_max)` format. - - Note: - Use `box_iou` when computing IoU between two individual boxes. - For comparing multiple boxes (arrays of boxes), use `box_iou_batch` for better - performance. - - Args: - boxes_true (np.ndarray): 2D `np.ndarray` representing ground-truth boxes. - `shape = (N, 4)` where `N` is number of true objects. - boxes_detection (np.ndarray): 2D `np.ndarray` representing detection boxes. - `shape = (M, 4)` where `M` is number of detected objects. - overlap_metric (OverlapMetric): Metric used for matching detections in slices. - - Returns: - np.ndarray: Pairwise IoU of boxes from `boxes_true` and `boxes_detection`. - `shape = (N, M)` where `N` is number of true objects and - `M` is number of detected objects. - - Examples: - ```python - import numpy as np - import supervision as sv - - boxes_true = np.array([ - [100, 100, 200, 200], - [300, 300, 400, 400] - ]) - boxes_detection = np.array([ - [150, 150, 250, 250], - [320, 320, 420, 420] - ]) - - sv.box_iou_batch(boxes_true=boxes_true, boxes_detection=boxes_detection) - # array([ - # [0.14285714, 0. ], - # [0. , 0.47058824] - # ]) - ``` - """ - - def box_area(box): - return (box[2] - box[0]) * (box[3] - box[1]) - - area_true = box_area(boxes_true.T) - area_detection = box_area(boxes_detection.T) - - top_left = np.maximum(boxes_true[:, None, :2], boxes_detection[:, :2]) - bottom_right = np.minimum(boxes_true[:, None, 2:], boxes_detection[:, 2:]) - - area_inter = np.prod(np.clip(bottom_right - top_left, a_min=0, a_max=None), 2) - - if overlap_metric == OverlapMetric.IOU: - union_area = area_true[:, None] + area_detection - area_inter - ious = np.divide( - area_inter, - union_area, - out=np.zeros_like(area_inter, dtype=float), - where=union_area != 0, - ) - elif overlap_metric == OverlapMetric.IOS: - small_area = np.minimum(area_true[:, None], area_detection) - ious = np.divide( - area_inter, - small_area, - out=np.zeros_like(area_inter, dtype=float), - where=small_area != 0, - ) - else: - raise ValueError( - f"overlap_metric {overlap_metric} is not supported, " - "only 'IOU' and 'IOS' are supported" - ) - - ious = np.nan_to_num(ious) - return ious - - -def _mask_iou_batch_split( - masks_true: np.ndarray, - masks_detection: np.ndarray, - overlap_metric: OverlapMetric = OverlapMetric.IOU, -) -> np.ndarray: - """ - Internal function. - Compute Intersection over Union (IoU) of two sets of masks - - `masks_true` and `masks_detection`. - - Args: - masks_true (np.ndarray): 3D `np.ndarray` representing ground-truth masks. - masks_detection (np.ndarray): 3D `np.ndarray` representing detection masks. - overlap_metric (OverlapMetric): Metric used for matching detections in slices. - - Returns: - np.ndarray: Pairwise IoU of masks from `masks_true` and `masks_detection`. - """ - intersection_area = np.logical_and(masks_true[:, None], masks_detection).sum( - axis=(2, 3) - ) - - masks_true_area = masks_true.sum(axis=(1, 2)) # (area1, area2, ...) - masks_detection_area = masks_detection.sum(axis=(1, 2)) # (area1) - - if overlap_metric == OverlapMetric.IOU: - union_area = masks_true_area[:, None] + masks_detection_area - intersection_area - ious = np.divide( - intersection_area, - union_area, - out=np.zeros_like(intersection_area, dtype=float), - where=union_area != 0, - ) - elif overlap_metric == OverlapMetric.IOS: - # ios = intersection_area / min(area1, area2) - small_area = np.minimum(masks_true_area[:, None], masks_detection_area) - ious = np.divide( - intersection_area, - small_area, - out=np.zeros_like(intersection_area, dtype=float), - where=small_area != 0, - ) - else: - raise ValueError( - f"overlap_metric {overlap_metric} is not supported, " - "only 'IOU' and 'IOS' are supported" - ) - - ious = np.nan_to_num(ious) - return ious - - -def mask_iou_batch( - masks_true: np.ndarray, - masks_detection: np.ndarray, - overlap_metric: OverlapMetric = OverlapMetric.IOU, - memory_limit: int = 1024 * 5, -) -> np.ndarray: - """ - Compute Intersection over Union (IoU) of two sets of masks - - `masks_true` and `masks_detection`. - - Args: - masks_true (np.ndarray): 3D `np.ndarray` representing ground-truth masks. - masks_detection (np.ndarray): 3D `np.ndarray` representing detection masks. - overlap_metric (OverlapMetric): Metric used for matching detections in slices. - memory_limit (int): memory limit in MB, default is 1024 * 5 MB (5GB). - - Returns: - np.ndarray: Pairwise IoU of masks from `masks_true` and `masks_detection`. - """ - memory = ( - masks_true.shape[0] - * masks_true.shape[1] - * masks_true.shape[2] - * masks_detection.shape[0] - / 1024 - / 1024 - ) - if memory <= memory_limit: - return _mask_iou_batch_split(masks_true, masks_detection, overlap_metric) - - ious = [] - step = max( - memory_limit - * 1024 - * 1024 - // ( - masks_detection.shape[0] - * masks_detection.shape[1] - * masks_detection.shape[2] - ), - 1, - ) - for i in range(0, masks_true.shape[0], step): - ious.append( - _mask_iou_batch_split( - masks_true[i : i + step], masks_detection, overlap_metric - ) - ) - - return np.vstack(ious) - - -def oriented_box_iou_batch( - boxes_true: np.ndarray, boxes_detection: np.ndarray -) -> np.ndarray: - """ - Compute Intersection over Union (IoU) of two sets of oriented bounding boxes - - `boxes_true` and `boxes_detection`. Both sets of boxes are expected to be in - `((x1, y1), (x2, y2), (x3, y3), (x4, y4))` format. - - Args: - boxes_true (np.ndarray): a `np.ndarray` representing ground-truth boxes. - `shape = (N, 4, 2)` where `N` is number of true objects. - boxes_detection (np.ndarray): a `np.ndarray` representing detection boxes. - `shape = (M, 4, 2)` where `M` is number of detected objects. - - Returns: - np.ndarray: Pairwise IoU of boxes from `boxes_true` and `boxes_detection`. - `shape = (N, M)` where `N` is number of true objects and - `M` is number of detected objects. - """ - - boxes_true = boxes_true.reshape(-1, 4, 2) - boxes_detection = boxes_detection.reshape(-1, 4, 2) - - max_height = int(max(boxes_true[:, :, 0].max(), boxes_detection[:, :, 0].max()) + 1) - # adding 1 because we are 0-indexed - max_width = int(max(boxes_true[:, :, 1].max(), boxes_detection[:, :, 1].max()) + 1) - - mask_true = np.zeros((boxes_true.shape[0], max_height, max_width)) - for i, box_true in enumerate(boxes_true): - mask_true[i] = polygon_to_mask(box_true, (max_width, max_height)) - - mask_detection = np.zeros((boxes_detection.shape[0], max_height, max_width)) - for i, box_detection in enumerate(boxes_detection): - mask_detection[i] = polygon_to_mask(box_detection, (max_width, max_height)) - - ious = mask_iou_batch(mask_true, mask_detection) - return ious - - -def clip_boxes(xyxy: np.ndarray, resolution_wh: tuple[int, int]) -> np.ndarray: - """ - Clips bounding boxes coordinates to fit within the frame resolution. - - Args: - xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each - row corresponds to a bounding box in - the format `(x_min, y_min, x_max, y_max)`. - resolution_wh (Tuple[int, int]): A tuple of the form `(width, height)` - representing the resolution of the frame. - - Returns: - np.ndarray: A numpy array of shape `(N, 4)` where each row - corresponds to a bounding box with coordinates clipped to fit - within the frame resolution. - - Examples: - ```python - import numpy as np - import supervision as sv - - xyxy = np.array([ - [10, 20, 300, 200], - [15, 25, 350, 450], - [-10, -20, 30, 40] - ]) - - sv.clip_boxes(xyxy=xyxy, resolution_wh=(320, 240)) - # array([ - # [ 10, 20, 300, 200], - # [ 15, 25, 320, 240], - # [ 0, 0, 30, 40] - # ]) - ``` - """ - result = np.copy(xyxy) - width, height = resolution_wh - result[:, [0, 2]] = result[:, [0, 2]].clip(0, width) - result[:, [1, 3]] = result[:, [1, 3]].clip(0, height) - return result - - -def pad_boxes(xyxy: np.ndarray, px: int, py: int | None = None) -> np.ndarray: - """ - Pads bounding boxes coordinates with a constant padding. - - Args: - xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each - row corresponds to a bounding box in the format - `(x_min, y_min, x_max, y_max)`. - px (int): The padding value to be added to both the left and right sides of - each bounding box. - py (Optional[int]): The padding value to be added to both the top and bottom - sides of each bounding box. If not provided, `px` will be used for both - dimensions. - - Returns: - np.ndarray: A numpy array of shape `(N, 4)` where each row corresponds to a - bounding box with coordinates padded according to the provided padding - values. - - Examples: - ```python - import numpy as np - import supervision as sv - - xyxy = np.array([ - [10, 20, 30, 40], - [15, 25, 35, 45] - ]) - - sv.pad_boxes(xyxy=xyxy, px=5, py=10) - # array([ - # [ 5, 10, 35, 50], - # [10, 15, 40, 55] - # ]) - ``` - """ - if py is None: - py = px - - result = xyxy.copy() - result[:, [0, 1]] -= [px, py] - result[:, [2, 3]] += [px, py] - - return result - - -def xywh_to_xyxy(xywh: np.ndarray) -> np.ndarray: - """ - Converts bounding box coordinates from `(x, y, width, height)` - format to `(x_min, y_min, x_max, y_max)` format. - - Args: - xywh (np.ndarray): A numpy array of shape `(N, 4)` where each row - corresponds to a bounding box in the format `(x, y, width, height)`. - - Returns: - np.ndarray: A numpy array of shape `(N, 4)` where each row corresponds - to a bounding box in the format `(x_min, y_min, x_max, y_max)`. - - Examples: - ```python - import numpy as np - import supervision as sv - - xywh = np.array([ - [10, 20, 30, 40], - [15, 25, 35, 45] - ]) - - sv.xywh_to_xyxy(xywh=xywh) - # array([ - # [10, 20, 40, 60], - # [15, 25, 50, 70] - # ]) - ``` - """ - xyxy = xywh.copy() - xyxy[:, 2] = xywh[:, 0] + xywh[:, 2] - xyxy[:, 3] = xywh[:, 1] + xywh[:, 3] - return xyxy - - -def xyxy_to_xywh(xyxy: np.ndarray) -> np.ndarray: - """ - Converts bounding box coordinates from `(x_min, y_min, x_max, y_max)` - format to `(x, y, width, height)` format. - - Args: - xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each row - corresponds to a bounding box in the format `(x_min, y_min, x_max, - y_max)`. - - Returns: - np.ndarray: A numpy array of shape `(N, 4)` where each row corresponds - to a bounding box in the format `(x, y, width, height)`. - - Examples: - ```python - import numpy as np - import supervision as sv - - xyxy = np.array([ - [10, 20, 40, 60], - [15, 25, 50, 70] - ]) - - sv.xyxy_to_xywh(xyxy=xyxy) - # array([ - # [10, 20, 30, 40], - # [15, 25, 35, 45] - # ]) - ``` - """ - xywh = xyxy.copy() - xywh[:, 2] = xyxy[:, 2] - xyxy[:, 0] - xywh[:, 3] = xyxy[:, 3] - xyxy[:, 1] - return xywh - - -def xcycwh_to_xyxy(xcycwh: np.ndarray) -> np.ndarray: - """ - Converts bounding box coordinates from `(center_x, center_y, width, height)` - format to `(x_min, y_min, x_max, y_max)` format. - - Args: - xcycwh (np.ndarray): A numpy array of shape `(N, 4)` where each row - corresponds to a bounding box in the format `(center_x, center_y, width, - height)`. - - Returns: - np.ndarray: A numpy array of shape `(N, 4)` where each row corresponds - to a bounding box in the format `(x_min, y_min, x_max, y_max)`. - - Examples: - ```python - import numpy as np - import supervision as sv - - xcycwh = np.array([ - [50, 50, 20, 30], - [30, 40, 10, 15] - ]) - - sv.xcycwh_to_xyxy(xcycwh=xcycwh) - # array([ - # [40, 35, 60, 65], - # [25, 32.5, 35, 47.5] - # ]) - ``` - """ - xyxy = xcycwh.copy() - xyxy[:, 0] = xcycwh[:, 0] - xcycwh[:, 2] / 2 - xyxy[:, 1] = xcycwh[:, 1] - xcycwh[:, 3] / 2 - xyxy[:, 2] = xcycwh[:, 0] + xcycwh[:, 2] / 2 - xyxy[:, 3] = xcycwh[:, 1] + xcycwh[:, 3] / 2 - return xyxy - - -def xyxy_to_xcycarh(xyxy: np.ndarray) -> np.ndarray: - """ - Converts bounding box coordinates from `(x_min, y_min, x_max, y_max)` - into measurement space to format `(center x, center y, aspect ratio, height)`, - where the aspect ratio is `width / height`. - - Args: - xyxy (np.ndarray): Bounding box in format `(x1, y1, x2, y2)`. - Expected shape is `(N, 4)`. - Returns: - np.ndarray: Bounding box in format - `(center x, center y, aspect ratio, height)`. Shape `(N, 4)`. - - Examples: - ```python - import numpy as np - import supervision as sv - - xyxy = np.array([ - [10, 20, 40, 60], - [15, 25, 50, 70] - ]) - - sv.xyxy_to_xcycarh(xyxy=xyxy) - # array([ - # [25. , 40. , 0.75, 40. ], - # [32.5 , 47.5 , 0.77777778, 45. ] - # ]) - ``` - - """ - if xyxy.size == 0: - return np.empty((0, 4), dtype=float) - - x1, y1, x2, y2 = xyxy.T - width = x2 - x1 - height = y2 - y1 - center_x = x1 + width / 2 - center_y = y1 + height / 2 - - aspect_ratio = np.divide( - width, - height, - out=np.zeros_like(width, dtype=float), - where=height != 0, - ) - result = np.column_stack((center_x, center_y, aspect_ratio, height)) - return result.astype(float) - - -def denormalize_boxes( - normalized_xyxy: np.ndarray, - resolution_wh: tuple[int, int], - normalization_factor: float = 1.0, -) -> np.ndarray: - """ - Convert normalized xyxy coordinates to absolute XYXY coordinates. By default, assumes - normalized values are between 0 and 1, but supports custom ranges via normalization_factor parameter. - Args: - normalized_xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each row contains - normalized coordinates in format `(x1, y1, x2, y2)` with values between 0 and normalization_factor. - resolution_wh (Tuple[int, int]): A tuple of the form `(width, height)` representing - the target resolution. - normalization_factor (float): The maximum value of the normalization range. For example: - - normalization_factor=1.0 means input coordinates are normalized between 0 and 1 - - normalization_factor=100.0 means input coordinates are normalized between 0 and 100 - - normalization_factor=1000.0 means input coordinates are normalized between 0 and 1000 - Returns: - np.ndarray: A numpy array of shape `(N, 4)` containing the absolute coordinates - in format `(x1, y1, x2, y2)`. - Examples: - ```python - import numpy as np - import supervision as sv - # Example with default normalization (0-1) - normalized_xyxy = np.array([ - [0.1, 0.2, 0.5, 0.6], - [0.3, 0.4, 0.7, 0.8] - ]) - resolution_wh = (100, 200) - sv.denormalize_boxes(normalized_xyxy, resolution_wh) - # array([ - # [ 10., 40., 50., 120.], - # [ 30., 80., 70., 160.] - # ]) - # Example with custom normalization (0-100) - normalized_xyxy = np.array([ - [10., 20., 50., 60.], - [30., 40., 70., 80.] - ]) - sv.denormalize_boxes(normalized_xyxy, resolution_wh, max_value=100.0) - # array([ - # [ 10., 40., 50., 120.], - # [ 30., 80., 70., 160.] - # ]) - ``` - """ # noqa E501 // docs - width, height = resolution_wh - result = normalized_xyxy.copy() - - result[[0, 2]] = (result[[0, 2]] * width) / normalization_factor - result[[1, 3]] = (result[[1, 3]] * height) / normalization_factor - - return result - - -def mask_to_xyxy(masks: np.ndarray) -> np.ndarray: - """ - Converts a 3D `np.array` of 2D bool masks into a 2D `np.array` of bounding boxes. - - Parameters: - masks (np.ndarray): A 3D `np.array` of shape `(N, W, H)` - containing 2D bool masks - - Returns: - np.ndarray: A 2D `np.array` of shape `(N, 4)` containing the bounding boxes - `(x_min, y_min, x_max, y_max)` for each mask - """ - n = masks.shape[0] - xyxy = np.zeros((n, 4), dtype=int) - - for i, mask in enumerate(masks): - rows, cols = np.where(mask) - - if len(rows) > 0 and len(cols) > 0: - x_min, x_max = np.min(cols), np.max(cols) - y_min, y_max = np.min(rows), np.max(rows) - xyxy[i, :] = [x_min, y_min, x_max, y_max] - - return xyxy - - -def mask_to_polygons(mask: np.ndarray) -> list[np.ndarray]: - """ - Converts a binary mask to a list of polygons. - - Parameters: - mask (np.ndarray): A binary mask represented as a 2D NumPy array of - shape `(H, W)`, where H and W are the height and width of - the mask, respectively. - - Returns: - List[np.ndarray]: A list of polygons, where each polygon is represented by a - NumPy array of shape `(N, 2)`, containing the `x`, `y` coordinates - of the points. Polygons with fewer points than `MIN_POLYGON_POINT_COUNT = 3` - are excluded from the output. - """ - - contours, _ = cv2.findContours( - mask.astype(np.uint8), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE - ) - return [ - np.squeeze(contour, axis=1) - for contour in contours - if contour.shape[0] >= MIN_POLYGON_POINT_COUNT - ] - - -def filter_polygons_by_area( - polygons: list[np.ndarray], - min_area: float | None = None, - max_area: float | None = None, -) -> list[np.ndarray]: - """ - Filters a list of polygons based on their area. - - Parameters: - polygons (List[np.ndarray]): A list of polygons, where each polygon is - represented by a NumPy array of shape `(N, 2)`, - containing the `x`, `y` coordinates of the points. - min_area (Optional[float]): The minimum area threshold. - Only polygons with an area greater than or equal to this value - will be included in the output. If set to None, - no minimum area constraint will be applied. - max_area (Optional[float]): The maximum area threshold. - Only polygons with an area less than or equal to this value - will be included in the output. If set to None, - no maximum area constraint will be applied. - - Returns: - List[np.ndarray]: A new list of polygons containing only those with - areas within the specified thresholds. - """ - if min_area is None and max_area is None: - return polygons - ares = [cv2.contourArea(polygon) for polygon in polygons] - return [ - polygon - for polygon, area in zip(polygons, ares) - if (min_area is None or area >= min_area) - and (max_area is None or area <= max_area) - ] - - -def polygon_to_xyxy(polygon: np.ndarray) -> np.ndarray: - """ - Converts a polygon represented by a NumPy array into a bounding box. - - Parameters: - polygon (np.ndarray): A polygon represented by a NumPy array of shape `(N, 2)`, - containing the `x`, `y` coordinates of the points. - - Returns: - np.ndarray: A 1D NumPy array containing the bounding box - `(x_min, y_min, x_max, y_max)` of the input polygon. - """ - x_min, y_min = np.min(polygon, axis=0) - x_max, y_max = np.max(polygon, axis=0) - return np.array([x_min, y_min, x_max, y_max]) - - -def approximate_polygon( - polygon: np.ndarray, percentage: float, epsilon_step: float = 0.05 -) -> np.ndarray: - """ - Approximates a given polygon by reducing a certain percentage of points. - - This function uses the Ramer-Douglas-Peucker algorithm to simplify the input - polygon by reducing the number of points - while preserving the general shape. - - Parameters: - polygon (np.ndarray): A 2D NumPy array of shape `(N, 2)` containing - the `x`, `y` coordinates of the input polygon's points. - percentage (float): The percentage of points to be removed from the - input polygon, in the range `[0, 1)`. - epsilon_step (float): Approximation accuracy step. - Epsilon is the maximum distance between the original curve - and its approximation. - - Returns: - np.ndarray: A new 2D NumPy array of shape `(M, 2)`, - where `M <= N * (1 - percentage)`, containing - the `x`, `y` coordinates of the - approximated polygon's points. - """ - - if percentage < 0 or percentage >= 1: - raise ValueError("Percentage must be in the range [0, 1).") - - target_points = max(int(len(polygon) * (1 - percentage)), 3) - - if len(polygon) <= target_points: - return polygon - - epsilon = 0 - approximated_points = polygon - while True: - epsilon += epsilon_step - new_approximated_points = cv2.approxPolyDP(polygon, epsilon, closed=True) - if len(new_approximated_points) > target_points: - approximated_points = new_approximated_points - else: - break - - return np.squeeze(approximated_points, axis=1) - - -def extract_ultralytics_masks(yolov8_results) -> np.ndarray | None: - if not yolov8_results.masks: - return None - - orig_shape = yolov8_results.orig_shape - inference_shape = tuple(yolov8_results.masks.data.shape[1:]) - - pad = (0, 0) - - if inference_shape != orig_shape: - gain = min( - inference_shape[0] / orig_shape[0], - inference_shape[1] / orig_shape[1], - ) - pad = ( - (inference_shape[1] - orig_shape[1] * gain) / 2, - (inference_shape[0] - orig_shape[0] * gain) / 2, - ) - - top, left = int(pad[1]), int(pad[0]) - bottom, right = int(inference_shape[0] - pad[1]), int(inference_shape[1] - pad[0]) - - mask_maps = [] - masks = yolov8_results.masks.data.cpu().numpy() - for i in range(masks.shape[0]): - mask = masks[i] - mask = mask[top:bottom, left:right] - - if mask.shape != orig_shape: - mask = cv2.resize(mask, (orig_shape[1], orig_shape[0])) - - mask_maps.append(mask) - - return np.asarray(mask_maps, dtype=bool) - - -def process_roboflow_result( - roboflow_result: dict, -) -> tuple[ - np.ndarray, - np.ndarray, - np.ndarray, - np.ndarray | None, - np.ndarray | None, - dict[str, list[np.ndarray] | np.ndarray], -]: - if not roboflow_result["predictions"]: - return ( - np.empty((0, 4)), - np.empty(0), - np.empty(0), - None, - None, - {CLASS_NAME_DATA_FIELD: np.empty(0)}, - ) - - xyxy = [] - confidence = [] - class_id = [] - class_name = [] - masks = [] - tracker_ids = [] - - image_width = int(roboflow_result["image"]["width"]) - image_height = int(roboflow_result["image"]["height"]) - - for prediction in roboflow_result["predictions"]: - x = prediction["x"] - y = prediction["y"] - width = prediction["width"] - height = prediction["height"] - x_min = x - width / 2 - y_min = y - height / 2 - x_max = x_min + width - y_max = y_min + height - - if "points" not in prediction: - xyxy.append([x_min, y_min, x_max, y_max]) - class_id.append(prediction["class_id"]) - class_name.append(prediction["class"]) - confidence.append(prediction["confidence"]) - if "tracker_id" in prediction: - tracker_ids.append(prediction["tracker_id"]) - elif len(prediction["points"]) >= 3: - polygon = np.array( - [[point["x"], point["y"]] for point in prediction["points"]], dtype=int - ) - mask = polygon_to_mask(polygon, resolution_wh=(image_width, image_height)) - xyxy.append([x_min, y_min, x_max, y_max]) - class_id.append(prediction["class_id"]) - class_name.append(prediction["class"]) - confidence.append(prediction["confidence"]) - masks.append(mask) - if "tracker_id" in prediction: - tracker_ids.append(prediction["tracker_id"]) - - xyxy = np.array(xyxy) if len(xyxy) > 0 else np.empty((0, 4)) - confidence = np.array(confidence) if len(confidence) > 0 else np.empty(0) - class_id = np.array(class_id).astype(int) if len(class_id) > 0 else np.empty(0) - class_name = np.array(class_name) if len(class_name) > 0 else np.empty(0) - masks = np.array(masks, dtype=bool) if len(masks) > 0 else None - tracker_id = np.array(tracker_ids).astype(int) if len(tracker_ids) > 0 else None - data = {CLASS_NAME_DATA_FIELD: class_name} - - return xyxy, confidence, class_id, masks, tracker_id, data - - -def move_boxes( - xyxy: npt.NDArray[np.float64], offset: npt.NDArray[np.int32] -) -> npt.NDArray[np.float64]: - """ - Parameters: - xyxy (npt.NDArray[np.float64]): An array of shape `(n, 4)` containing the - bounding boxes coordinates in format `[x1, y1, x2, y2]` - offset (np.array): An array of shape `(2,)` containing offset values in format - is `[dx, dy]`. - - Returns: - npt.NDArray[np.float64]: Repositioned bounding boxes. - - Examples: - ```python - import numpy as np - import supervision as sv - - xyxy = np.array([ - [10, 10, 20, 20], - [30, 30, 40, 40] - ]) - offset = np.array([5, 5]) - - sv.move_boxes(xyxy=xyxy, offset=offset) - # array([ - # [15, 15, 25, 25], - # [35, 35, 45, 45] - # ]) - ``` - """ - return xyxy + np.hstack([offset, offset]) - - -def move_oriented_boxes( - xyxyxyxy: npt.NDArray[np.float64], offset: npt.NDArray[np.int32] -) -> npt.NDArray[np.float64]: - """ - Parameters: - xyxyxyxy (npt.NDArray[np.float64]): An array of shape `(n, 4, 2)` containing the - oriented bounding boxes coordinates in format - `[[x1, y1], [x2, y2], [x3, y3], [x3, y3]]` - offset (np.array): An array of shape `(2,)` containing offset values in format - is `[dx, dy]`. - - Returns: - npt.NDArray[np.float64]: Repositioned bounding boxes. - - Examples: - ```python - import numpy as np - import supervision as sv - - xyxyxyxy = np.array([ - [ - [20, 10], - [10, 20], - [20, 30], - [30, 20] - ], - [ - [30 ,30], - [20, 40], - [30, 50], - [40, 40] - ] - ]) - offset = np.array([5, 5]) - - sv.move_oriented_boxes(xyxy=xyxy, offset=offset) - # array([ - # [ - # [25, 15], - # [15, 25], - # [25, 35], - # [35, 25] - # ], - # [ - # [35, 35], - # [25, 45], - # [35, 55], - # [45, 45] - # ] - # ]) - ``` - """ - return xyxyxyxy + offset - - -def move_masks( - masks: npt.NDArray[np.bool_], - offset: npt.NDArray[np.int32], - resolution_wh: tuple[int, int], -) -> npt.NDArray[np.bool_]: - """ - Offset the masks in an array by the specified (x, y) amount. - - Args: - masks (npt.NDArray[np.bool_]): A 3D array of binary masks corresponding to the - predictions. Shape: `(N, H, W)`, where N is the number of predictions, and - H, W are the dimensions of each mask. - offset (npt.NDArray[np.int32]): An array of shape `(2,)` containing int values - `[dx, dy]`. Supports both positive and negative values for bidirectional - movement. - resolution_wh (Tuple[int, int]): The width and height of the desired mask - resolution. - - Returns: - (npt.NDArray[np.bool_]) repositioned masks, optionally padded to the specified - shape. - - Examples: - ```python - import numpy as np - import supervision as sv - - mask = np.array([[[False, False, False, False], - [False, True, True, False], - [False, True, True, False], - [False, False, False, False]]], dtype=bool) - - offset = np.array([1, 1]) - sv.move_masks(mask, offset, resolution_wh=(4, 4)) - # array([[[False, False, False, False], - # [False, False, False, False], - # [False, False, True, True], - # [False, False, True, True]]], dtype=bool) - - offset = np.array([-2, 2]) - sv.move_masks(mask, offset, resolution_wh=(4, 4)) - # array([[[False, False, False, False], - # [False, False, False, False], - # [False, False, False, False], - # [True, False, False, False]]], dtype=bool) - ``` - """ - mask_array = np.full((masks.shape[0], resolution_wh[1], resolution_wh[0]), False) - - if offset[0] < 0: - source_x_start = -offset[0] - source_x_end = min(masks.shape[2], resolution_wh[0] - offset[0]) - destination_x_start = 0 - destination_x_end = min(resolution_wh[0], masks.shape[2] + offset[0]) - else: - source_x_start = 0 - source_x_end = min(masks.shape[2], resolution_wh[0] - offset[0]) - destination_x_start = offset[0] - destination_x_end = offset[0] + source_x_end - source_x_start - - if offset[1] < 0: - source_y_start = -offset[1] - source_y_end = min(masks.shape[1], resolution_wh[1] - offset[1]) - destination_y_start = 0 - destination_y_end = min(resolution_wh[1], masks.shape[1] + offset[1]) - else: - source_y_start = 0 - source_y_end = min(masks.shape[1], resolution_wh[1] - offset[1]) - destination_y_start = offset[1] - destination_y_end = offset[1] + source_y_end - source_y_start - - if source_x_end > source_x_start and source_y_end > source_y_start: - mask_array[ - :, - destination_y_start:destination_y_end, - destination_x_start:destination_x_end, - ] = masks[:, source_y_start:source_y_end, source_x_start:source_x_end] - - return mask_array - - -def scale_boxes( - xyxy: npt.NDArray[np.float64], factor: float -) -> npt.NDArray[np.float64]: - """ - Scale the dimensions of bounding boxes. - - Parameters: - xyxy (npt.NDArray[np.float64]): An array of shape `(n, 4)` containing the - bounding boxes coordinates in format `[x1, y1, x2, y2]` - factor (float): A float value representing the factor by which the box - dimensions are scaled. A factor greater than 1 enlarges the boxes, while a - factor less than 1 shrinks them. - - Returns: - npt.NDArray[np.float64]: Scaled bounding boxes. - - Examples: - ```python - import numpy as np - import supervision as sv - - xyxy = np.array([ - [10, 10, 20, 20], - [30, 30, 40, 40] - ]) - - sv.scale_boxes(xyxy=xyxy, factor=1.5) - # array([ - # [ 7.5, 7.5, 22.5, 22.5], - # [27.5, 27.5, 42.5, 42.5] - # ]) - ``` - """ - centers = (xyxy[:, :2] + xyxy[:, 2:]) / 2 - new_sizes = (xyxy[:, 2:] - xyxy[:, :2]) * factor - return np.concatenate((centers - new_sizes / 2, centers + new_sizes / 2), axis=1) - - -def calculate_masks_centroids(masks: np.ndarray) -> np.ndarray: - """ - Calculate the centroids of binary masks in a tensor. - - Parameters: - masks (np.ndarray): A 3D NumPy array of shape (num_masks, height, width). - Each 2D array in the tensor represents a binary mask. - - Returns: - A 2D NumPy array of shape (num_masks, 2), where each row contains the x and y - coordinates (in that order) of the centroid of the corresponding mask. - """ - num_masks, height, width = masks.shape - total_pixels = masks.sum(axis=(1, 2)) - - # offset for 1-based indexing - vertical_indices, horizontal_indices = np.indices((height, width)) + 0.5 - # avoid division by zero for empty masks - total_pixels[total_pixels == 0] = 1 - - def sum_over_mask(indices: np.ndarray, axis: tuple) -> np.ndarray: - return np.tensordot(masks, indices, axes=axis) - - aggregation_axis = ([1, 2], [0, 1]) - centroid_x = sum_over_mask(horizontal_indices, aggregation_axis) / total_pixels - centroid_y = sum_over_mask(vertical_indices, aggregation_axis) / total_pixels - - return np.column_stack((centroid_x, centroid_y)).astype(int) - - -def is_data_equal(data_a: dict[str, np.ndarray], data_b: dict[str, np.ndarray]) -> bool: - """ - Compares the data payloads of two Detections instances. - - Args: - data_a, data_b: The data payloads of the instances. - - Returns: - True if the data payloads are equal, False otherwise. - """ - return set(data_a.keys()) == set(data_b.keys()) and all( - np.array_equal(data_a[key], data_b[key]) for key in data_a - ) - - -def is_metadata_equal(metadata_a: dict[str, Any], metadata_b: dict[str, Any]) -> bool: - """ - Compares the metadata payloads of two Detections instances. - - Args: - metadata_a, metadata_b: The metadata payloads of the instances. - - Returns: - True if the metadata payloads are equal, False otherwise. - """ - return set(metadata_a.keys()) == set(metadata_b.keys()) and all( - np.array_equal(metadata_a[key], metadata_b[key]) - if ( - isinstance(metadata_a[key], np.ndarray) - and isinstance(metadata_b[key], np.ndarray) - ) - else metadata_a[key] == metadata_b[key] - for key in metadata_a - ) - - -def merge_data( - data_list: list[dict[str, npt.NDArray[np.generic] | list]], -) -> dict[str, npt.NDArray[np.generic] | list]: - """ - Merges the data payloads of a list of Detections instances. - - Warning: Assumes that empty detections were filtered-out before passing data to - this function. - - Args: - data_list: The data payloads of the Detections instances. Each data payload - is a dictionary with the same keys, and the values are either lists or - npt.NDArray[np.generic]. - - Returns: - A single data payload containing the merged data, preserving the original data - types (list or npt.NDArray[np.generic]). - - Raises: - ValueError: If data values within a single object have different lengths or if - dictionaries have different keys. - """ - if not data_list: - return {} - - all_keys_sets = [set(data.keys()) for data in data_list] - if not all(keys_set == all_keys_sets[0] for keys_set in all_keys_sets): - raise ValueError("All data dictionaries must have the same keys to merge.") - - for data in data_list: - lengths = [len(value) for value in data.values()] - if len(set(lengths)) > 1: - raise ValueError( - "All data values within a single object must have equal length." - ) - - merged_data = {key: [] for key in all_keys_sets[0]} - for data in data_list: - for key in data: - merged_data[key].append(data[key]) - - for key in merged_data: - if all(isinstance(item, list) for item in merged_data[key]): - merged_data[key] = list(chain.from_iterable(merged_data[key])) - elif all(isinstance(item, np.ndarray) for item in merged_data[key]): - ndim = merged_data[key][0].ndim - if ndim == 1: - merged_data[key] = np.hstack(merged_data[key]) - elif ndim > 1: - merged_data[key] = np.vstack(merged_data[key]) - else: - raise ValueError(f"Unexpected array dimension for key '{key}'.") - else: - raise ValueError( - f"Inconsistent data types for key '{key}'. Only np.ndarray and list " - f"types are allowed." - ) - - return merged_data - - -def merge_metadata(metadata_list: list[dict[str, Any]]) -> dict[str, Any]: - """ - Merge metadata from a list of metadata dictionaries. - - This function combines the metadata dictionaries. If a key appears in more than one - dictionary, the values must be identical for the merge to succeed. - - Warning: Assumes that empty detections were filtered-out before passing metadata to - this function. - - Args: - metadata_list (List[Dict[str, Any]]): A list of metadata dictionaries to merge. - - Returns: - Dict[str, Any]: A single merged metadata dictionary. - - Raises: - ValueError: If there are conflicting values for the same key or if - dictionaries have different keys. - """ - if not metadata_list: - return {} - - all_keys_sets = [set(metadata.keys()) for metadata in metadata_list] - if not all(keys_set == all_keys_sets[0] for keys_set in all_keys_sets): - raise ValueError("All metadata dictionaries must have the same keys to merge.") - - merged_metadata: dict[str, Any] = {} - for metadata in metadata_list: - for key, value in metadata.items(): - if key not in merged_metadata: - merged_metadata[key] = value - continue - - other_value = merged_metadata[key] - if isinstance(value, np.ndarray) and isinstance(other_value, np.ndarray): - if not np.array_equal(merged_metadata[key], value): - raise ValueError( - f"Conflicting metadata for key: '{key}': " - "{type(value)}, {type(other_value)}." - ) - elif isinstance(value, np.ndarray) or isinstance(other_value, np.ndarray): - # Since [] == np.array([]). - raise ValueError( - f"Conflicting metadata for key: '{key}': " - "{type(value)}, {type(other_value)}." - ) - else: - print("hm") - if merged_metadata[key] != value: - raise ValueError(f"Conflicting metadata for key: '{key}'.") - - return merged_metadata - - -def get_data_item( - data: dict[str, np.ndarray | list], - index: int | slice | list[int] | np.ndarray, -) -> dict[str, np.ndarray | list]: - """ - Retrieve a subset of the data dictionary based on the given index. - - Args: - data: The data dictionary of the Detections object. - index: The index or indices specifying the subset to retrieve. - - Returns: - A subset of the data dictionary corresponding to the specified index. - """ - subset_data = {} - for key, value in data.items(): - if isinstance(value, np.ndarray): - subset_data[key] = value[index] - elif isinstance(value, list): - if isinstance(index, slice): - subset_data[key] = value[index] - elif isinstance(index, list): - subset_data[key] = [value[i] for i in index] - elif isinstance(index, np.ndarray): - if index.dtype == bool: - subset_data[key] = [ - value[i] for i, index_value in enumerate(index) if index_value - ] - else: - subset_data[key] = [value[i] for i in index] - elif isinstance(index, int): - subset_data[key] = [value[index]] - else: - raise TypeError(f"Unsupported index type: {type(index)}") - else: - raise TypeError(f"Unsupported data type for key '{key}': {type(value)}") - - return subset_data - - -def contains_holes(mask: npt.NDArray[np.bool_]) -> bool: - """ - Checks if the binary mask contains holes (background pixels fully enclosed by - foreground pixels). - - Args: - mask (npt.NDArray[np.bool_]): 2D binary mask where `True` indicates foreground - object and `False` indicates background. - - Returns: - True if holes are detected, False otherwise. - - Examples: - ```python - import numpy as np - import supervision as sv - - mask = np.array([ - [0, 0, 0, 0, 0], - [0, 1, 1, 1, 0], - [0, 1, 0, 1, 0], - [0, 1, 1, 1, 0], - [0, 0, 0, 0, 0] - ]).astype(bool) - - sv.contains_holes(mask=mask) - # True - - mask = np.array([ - [0, 0, 0, 0, 0], - [0, 1, 1, 1, 0], - [0, 1, 1, 1, 0], - [0, 1, 1, 1, 0], - [0, 0, 0, 0, 0] - ]).astype(bool) - - sv.contains_holes(mask=mask) - # False - ``` - - ![contains_holes](https://media.roboflow.com/supervision-docs/contains-holes.png){ align=center width="800" } - """ # noqa E501 // docs - mask_uint8 = mask.astype(np.uint8) - _, hierarchy = cv2.findContours(mask_uint8, cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE) - - if hierarchy is not None: - parent_contour_index = 3 - for h in hierarchy[0]: - if h[parent_contour_index] != -1: - return True - return False - - -def contains_multiple_segments( - mask: npt.NDArray[np.bool_], connectivity: int = 4 -) -> bool: - """ - Checks if the binary mask contains multiple unconnected foreground segments. - - Args: - mask (npt.NDArray[np.bool_]): 2D binary mask where `True` indicates foreground - object and `False` indicates background. - connectivity (int) : Default: 4 is 4-way connectivity, which means that - foreground pixels are the part of the same segment/component - if their edges touch. - Alternatively: 8 for 8-way connectivity, when foreground pixels are - connected by their edges or corners touch. - - Returns: - True when the mask contains multiple not connected components, False otherwise. - - Raises: - ValueError: If connectivity(int) parameter value is not 4 or 8. - - Examples: - ```python - import numpy as np - import supervision as sv - - mask = np.array([ - [0, 0, 0, 0, 0, 0], - [0, 1, 1, 0, 1, 1], - [0, 1, 1, 0, 1, 1], - [0, 0, 0, 0, 0, 0], - [0, 1, 1, 1, 0, 0], - [0, 1, 1, 1, 0, 0] - ]).astype(bool) - - sv.contains_multiple_segments(mask=mask, connectivity=4) - # True - - mask = np.array([ - [0, 0, 0, 0, 0, 0], - [0, 1, 1, 1, 1, 1], - [0, 1, 1, 1, 1, 1], - [0, 1, 1, 1, 1, 1], - [0, 1, 1, 1, 1, 1], - [0, 0, 0, 0, 0, 0] - ]).astype(bool) - - sv.contains_multiple_segments(mask=mask, connectivity=4) - # False - ``` - - ![contains_multiple_segments](https://media.roboflow.com/supervision-docs/contains-multiple-segments.png){ align=center width="800" } - """ # noqa E501 // docs - if connectivity != 4 and connectivity != 8: - raise ValueError( - "Incorrect connectivity value. Possible connectivity values: 4 or 8." - ) - mask_uint8 = mask.astype(np.uint8) - labels = np.zeros_like(mask_uint8, dtype=np.int32) - number_of_labels, _ = cv2.connectedComponents( - mask_uint8, labels, connectivity=connectivity - ) - return number_of_labels > 2 - - -def cross_product(anchors: np.ndarray, vector: Vector) -> np.ndarray: - """ - Get array of cross products of each anchor with a vector. - Args: - anchors: Array of anchors of shape (number of anchors, detections, 2) - vector: Vector to calculate cross product with - - Returns: - Array of cross products of shape (number of anchors, detections) - """ - vector_at_zero = np.array( - [ - vector.end.x - vector.start.x, - vector.end.y - vector.start.y, - ] - ) - vector_start = np.array([vector.start.x, vector.start.y]) - return np.cross(vector_at_zero, anchors - vector_start) - - -def spread_out_boxes( - xyxy: np.ndarray, - max_iterations: int = 100, -) -> np.ndarray: - """ - Spread out boxes that overlap with each other. - - Args: - xyxy: Numpy array of shape (N, 4) where N is the number of boxes. - max_iterations: Maximum number of iterations to run the algorithm for. - """ - if len(xyxy) == 0: - return xyxy - - xyxy_padded = pad_boxes(xyxy, px=1) - for _ in range(max_iterations): - # NxN - iou = box_iou_batch(xyxy_padded, xyxy_padded) - np.fill_diagonal(iou, 0) - if np.all(iou == 0): - break - - overlap_mask = iou > 0 - - # Nx2 - centers = (xyxy_padded[:, :2] + xyxy_padded[:, 2:]) / 2 - - # NxNx2 - delta_centers = centers[:, np.newaxis, :] - centers[np.newaxis, :, :] - delta_centers *= overlap_mask[:, :, np.newaxis] - - # Nx2 - delta_sum = np.sum(delta_centers, axis=1) - delta_magnitude = np.linalg.norm(delta_sum, axis=1, keepdims=True) - direction_vectors = np.divide( - delta_sum, - delta_magnitude, - out=np.zeros_like(delta_sum), - where=delta_magnitude != 0, - ) - - force_vectors = np.sum(iou, axis=1) - force_vectors = force_vectors[:, np.newaxis] * direction_vectors - - force_vectors *= 10 - force_vectors[(force_vectors > 0) & (force_vectors < 2)] = 2 - force_vectors[(force_vectors < 0) & (force_vectors > -2)] = -2 - - force_vectors = force_vectors.astype(int) - - xyxy_padded[:, [0, 1]] += force_vectors - xyxy_padded[:, [2, 3]] += force_vectors - - return pad_boxes(xyxy_padded, px=-1) - - -def _jaccard(box_a: list[float], box_b: list[float], is_crowd: bool) -> float: - """ - Calculate the Jaccard index (intersection over union) between two bounding boxes. - If a gt object is marked as "iscrowd", a dt is allowed to match any subregion - of the gt. Choosing gt'=intersect(dt,gt). Since by definition union(gt',dt)=dt, computing - iou(gt,dt,iscrowd) = iou(gt',dt) = area(intersect(gt,dt)) / area(dt) - - Args: - box_a (List[float]): Box coordinates in the format [x, y, width, height]. - box_b (List[float]): Box coordinates in the format [x, y, width, height]. - iscrowd (bool): Flag indicating if the second box is a crowd region or not. - - Returns: - float: Jaccard index between the two bounding boxes. - """ # noqa: E501 - # Smallest number to avoid division by zero - EPS = np.spacing(1) - - xa, ya, x2a, y2a = box_a[0], box_a[1], box_a[0] + box_a[2], box_a[1] + box_a[3] - xb, yb, x2b, y2b = box_b[0], box_b[1], box_b[0] + box_b[2], box_b[1] + box_b[3] - - # Innermost left x - xi = max(xa, xb) - # Innermost right x - x2i = min(x2a, x2b) - # Same for y - yi = max(ya, yb) - y2i = min(y2a, y2b) - - # Calculate areas - Aa = max(x2a - xa, 0.0) * max(y2a - ya, 0.0) - Ab = max(x2b - xb, 0.0) * max(y2b - yb, 0.0) - Ai = max(x2i - xi, 0.0) * max(y2i - yi, 0.0) - - if is_crowd: - return Ai / (Aa + EPS) - - return Ai / (Aa + Ab - Ai + EPS) - - -def box_iou_batch_with_jaccard( - boxes_true: list[list[float]], - boxes_detection: list[list[float]], - is_crowd: list[bool], -) -> np.ndarray: - """ - Calculate the intersection over union (IoU) between detection bounding boxes (dt) - and ground-truth bounding boxes (gt). - Reference: https://github.com/rafaelpadilla/review_object_detection_metrics - - Args: - boxes_true (List[List[float]]): List of ground-truth bounding boxes in the \ - format [x, y, width, height]. - boxes_detection (List[List[float]]): List of detection bounding boxes in the \ - format [x, y, width, height]. - is_crowd (List[bool]): List indicating if each ground-truth bounding box \ - is a crowd region or not. - - Returns: - np.ndarray: Array of IoU values of shape (len(dt), len(gt)). - - Examples: - ```python - import numpy as np - import supervision as sv - - boxes_true = [ - [10, 20, 30, 40], # x, y, w, h - [15, 25, 35, 45] - ] - boxes_detection = [ - [12, 22, 28, 38], - [16, 26, 36, 46] - ] - is_crowd = [False, False] - - ious = sv.box_iou_batch_with_jaccard( - boxes_true=boxes_true, - boxes_detection=boxes_detection, - is_crowd=is_crowd - ) - # array([ - # [0.8866..., 0.4960...], - # [0.4000..., 0.8622...] - # ]) - ``` - """ - assert len(is_crowd) == len(boxes_true), ( - "`is_crowd` must have the same length as `boxes_true`" - ) - if len(boxes_detection) == 0 or len(boxes_true) == 0: - return np.array([]) - ious = np.zeros((len(boxes_detection), len(boxes_true)), dtype=np.float64) - for g_idx, g in enumerate(boxes_true): - for d_idx, d in enumerate(boxes_detection): - ious[d_idx, g_idx] = _jaccard(d, g, is_crowd[g_idx]) - return ious diff --git a/supervision/detection/utils/__init__.py b/supervision/detection/utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/supervision/detection/utils/boxes.py b/supervision/detection/utils/boxes.py new file mode 100644 index 00000000..0beb3903 --- /dev/null +++ b/supervision/detection/utils/boxes.py @@ -0,0 +1,333 @@ +from __future__ import annotations + +import numpy as np +import numpy.typing as npt + +from supervision.detection.utils.iou_and_nms import box_iou_batch + + +def clip_boxes(xyxy: np.ndarray, resolution_wh: tuple[int, int]) -> np.ndarray: + """ + Clips bounding boxes coordinates to fit within the frame resolution. + + Args: + xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each + row corresponds to a bounding box in + the format `(x_min, y_min, x_max, y_max)`. + resolution_wh (Tuple[int, int]): A tuple of the form `(width, height)` + representing the resolution of the frame. + + Returns: + np.ndarray: A numpy array of shape `(N, 4)` where each row + corresponds to a bounding box with coordinates clipped to fit + within the frame resolution. + + Examples: + ```python + import numpy as np + import supervision as sv + + xyxy = np.array([ + [10, 20, 300, 200], + [15, 25, 350, 450], + [-10, -20, 30, 40] + ]) + + sv.clip_boxes(xyxy=xyxy, resolution_wh=(320, 240)) + # array([ + # [ 10, 20, 300, 200], + # [ 15, 25, 320, 240], + # [ 0, 0, 30, 40] + # ]) + ``` + """ + result = np.copy(xyxy) + width, height = resolution_wh + result[:, [0, 2]] = result[:, [0, 2]].clip(0, width) + result[:, [1, 3]] = result[:, [1, 3]].clip(0, height) + return result + + +def pad_boxes(xyxy: np.ndarray, px: int, py: int | None = None) -> np.ndarray: + """ + Pads bounding boxes coordinates with a constant padding. + + Args: + xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each + row corresponds to a bounding box in the format + `(x_min, y_min, x_max, y_max)`. + px (int): The padding value to be added to both the left and right sides of + each bounding box. + py (Optional[int]): The padding value to be added to both the top and bottom + sides of each bounding box. If not provided, `px` will be used for both + dimensions. + + Returns: + np.ndarray: A numpy array of shape `(N, 4)` where each row corresponds to a + bounding box with coordinates padded according to the provided padding + values. + + Examples: + ```python + import numpy as np + import supervision as sv + + xyxy = np.array([ + [10, 20, 30, 40], + [15, 25, 35, 45] + ]) + + sv.pad_boxes(xyxy=xyxy, px=5, py=10) + # array([ + # [ 5, 10, 35, 50], + # [10, 15, 40, 55] + # ]) + ``` + """ + if py is None: + py = px + + result = xyxy.copy() + result[:, [0, 1]] -= [px, py] + result[:, [2, 3]] += [px, py] + + return result + + +def denormalize_boxes( + normalized_xyxy: np.ndarray, + resolution_wh: tuple[int, int], + normalization_factor: float = 1.0, +) -> np.ndarray: + """ + Convert normalized xyxy coordinates to absolute XYXY coordinates. By default, assumes + normalized values are between 0 and 1, but supports custom ranges via normalization_factor parameter. + Args: + normalized_xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each row contains + normalized coordinates in format `(x1, y1, x2, y2)` with values between 0 and normalization_factor. + resolution_wh (Tuple[int, int]): A tuple of the form `(width, height)` representing + the target resolution. + normalization_factor (float): The maximum value of the normalization range. For example: + - normalization_factor=1.0 means input coordinates are normalized between 0 and 1 + - normalization_factor=100.0 means input coordinates are normalized between 0 and 100 + - normalization_factor=1000.0 means input coordinates are normalized between 0 and 1000 + Returns: + np.ndarray: A numpy array of shape `(N, 4)` containing the absolute coordinates + in format `(x1, y1, x2, y2)`. + Examples: + ```python + import numpy as np + import supervision as sv + # Example with default normalization (0-1) + normalized_xyxy = np.array([ + [0.1, 0.2, 0.5, 0.6], + [0.3, 0.4, 0.7, 0.8] + ]) + resolution_wh = (100, 200) + sv.denormalize_boxes(normalized_xyxy, resolution_wh) + # array([ + # [ 10., 40., 50., 120.], + # [ 30., 80., 70., 160.] + # ]) + # Example with custom normalization (0-100) + normalized_xyxy = np.array([ + [10., 20., 50., 60.], + [30., 40., 70., 80.] + ]) + sv.denormalize_boxes(normalized_xyxy, resolution_wh, max_value=100.0) + # array([ + # [ 10., 40., 50., 120.], + # [ 30., 80., 70., 160.] + # ]) + ``` + """ # noqa E501 // docs + width, height = resolution_wh + result = normalized_xyxy.copy() + + result[[0, 2]] = (result[[0, 2]] * width) / normalization_factor + result[[1, 3]] = (result[[1, 3]] * height) / normalization_factor + + return result + + +def move_boxes( + xyxy: npt.NDArray[np.float64], offset: npt.NDArray[np.int32] +) -> npt.NDArray[np.float64]: + """ + Parameters: + xyxy (npt.NDArray[np.float64]): An array of shape `(n, 4)` containing the + bounding boxes coordinates in format `[x1, y1, x2, y2]` + offset (np.array): An array of shape `(2,)` containing offset values in format + is `[dx, dy]`. + + Returns: + npt.NDArray[np.float64]: Repositioned bounding boxes. + + Examples: + ```python + import numpy as np + import supervision as sv + + xyxy = np.array([ + [10, 10, 20, 20], + [30, 30, 40, 40] + ]) + offset = np.array([5, 5]) + + sv.move_boxes(xyxy=xyxy, offset=offset) + # array([ + # [15, 15, 25, 25], + # [35, 35, 45, 45] + # ]) + ``` + """ + return xyxy + np.hstack([offset, offset]) + + +def move_oriented_boxes( + xyxyxyxy: npt.NDArray[np.float64], offset: npt.NDArray[np.int32] +) -> npt.NDArray[np.float64]: + """ + Parameters: + xyxyxyxy (npt.NDArray[np.float64]): An array of shape `(n, 4, 2)` containing the + oriented bounding boxes coordinates in format + `[[x1, y1], [x2, y2], [x3, y3], [x3, y3]]` + offset (np.array): An array of shape `(2,)` containing offset values in format + is `[dx, dy]`. + + Returns: + npt.NDArray[np.float64]: Repositioned bounding boxes. + + Examples: + ```python + import numpy as np + import supervision as sv + + xyxyxyxy = np.array([ + [ + [20, 10], + [10, 20], + [20, 30], + [30, 20] + ], + [ + [30 ,30], + [20, 40], + [30, 50], + [40, 40] + ] + ]) + offset = np.array([5, 5]) + + sv.move_oriented_boxes(xyxy=xyxy, offset=offset) + # array([ + # [ + # [25, 15], + # [15, 25], + # [25, 35], + # [35, 25] + # ], + # [ + # [35, 35], + # [25, 45], + # [35, 55], + # [45, 45] + # ] + # ]) + ``` + """ + return xyxyxyxy + offset + + +def scale_boxes( + xyxy: npt.NDArray[np.float64], factor: float +) -> npt.NDArray[np.float64]: + """ + Scale the dimensions of bounding boxes. + + Parameters: + xyxy (npt.NDArray[np.float64]): An array of shape `(n, 4)` containing the + bounding boxes coordinates in format `[x1, y1, x2, y2]` + factor (float): A float value representing the factor by which the box + dimensions are scaled. A factor greater than 1 enlarges the boxes, while a + factor less than 1 shrinks them. + + Returns: + npt.NDArray[np.float64]: Scaled bounding boxes. + + Examples: + ```python + import numpy as np + import supervision as sv + + xyxy = np.array([ + [10, 10, 20, 20], + [30, 30, 40, 40] + ]) + + sv.scale_boxes(xyxy=xyxy, factor=1.5) + # array([ + # [ 7.5, 7.5, 22.5, 22.5], + # [27.5, 27.5, 42.5, 42.5] + # ]) + ``` + """ + centers = (xyxy[:, :2] + xyxy[:, 2:]) / 2 + new_sizes = (xyxy[:, 2:] - xyxy[:, :2]) * factor + return np.concatenate((centers - new_sizes / 2, centers + new_sizes / 2), axis=1) + + +def spread_out_boxes( + xyxy: np.ndarray, + max_iterations: int = 100, +) -> np.ndarray: + """ + Spread out boxes that overlap with each other. + + Args: + xyxy: Numpy array of shape (N, 4) where N is the number of boxes. + max_iterations: Maximum number of iterations to run the algorithm for. + """ + if len(xyxy) == 0: + return xyxy + + xyxy_padded = pad_boxes(xyxy, px=1) + for _ in range(max_iterations): + # NxN + iou = box_iou_batch(xyxy_padded, xyxy_padded) + np.fill_diagonal(iou, 0) + if np.all(iou == 0): + break + + overlap_mask = iou > 0 + + # Nx2 + centers = (xyxy_padded[:, :2] + xyxy_padded[:, 2:]) / 2 + + # NxNx2 + delta_centers = centers[:, np.newaxis, :] - centers[np.newaxis, :, :] + delta_centers *= overlap_mask[:, :, np.newaxis] + + # Nx2 + delta_sum = np.sum(delta_centers, axis=1) + delta_magnitude = np.linalg.norm(delta_sum, axis=1, keepdims=True) + direction_vectors = np.divide( + delta_sum, + delta_magnitude, + out=np.zeros_like(delta_sum), + where=delta_magnitude != 0, + ) + + force_vectors = np.sum(iou, axis=1) + force_vectors = force_vectors[:, np.newaxis] * direction_vectors + + force_vectors *= 10 + force_vectors[(force_vectors > 0) & (force_vectors < 2)] = 2 + force_vectors[(force_vectors < 0) & (force_vectors > -2)] = -2 + + force_vectors = force_vectors.astype(int) + + xyxy_padded[:, [0, 1]] += force_vectors + xyxy_padded[:, [2, 3]] += force_vectors + + return pad_boxes(xyxy_padded, px=-1) diff --git a/supervision/detection/utils/converters.py b/supervision/detection/utils/converters.py new file mode 100644 index 00000000..9e02783a --- /dev/null +++ b/supervision/detection/utils/converters.py @@ -0,0 +1,272 @@ +import cv2 +import numpy as np + +MIN_POLYGON_POINT_COUNT = 3 + + +def xyxy_to_polygons(box: np.ndarray) -> np.ndarray: + """ + Convert an array of boxes to an array of polygons. + Retains the input datatype. + + Args: + box (np.ndarray): An array of boxes (N, 4), where each box is represented as a + list of four coordinates in the format `(x_min, y_min, x_max, y_max)`. + + Returns: + np.ndarray: An array of polygons (N, 4, 2), where each polygon is + represented as a list of four coordinates in the format `(x, y)`. + """ + polygon = np.zeros((box.shape[0], 4, 2), dtype=box.dtype) + polygon[:, :, 0] = box[:, [0, 2, 2, 0]] + polygon[:, :, 1] = box[:, [1, 1, 3, 3]] + return polygon + + +def polygon_to_mask(polygon: np.ndarray, resolution_wh: tuple[int, int]) -> np.ndarray: + """Generate a mask from a polygon. + + Args: + polygon (np.ndarray): The polygon for which the mask should be generated, + given as a list of vertices. + resolution_wh (Tuple[int, int]): The width and height of the desired resolution. + + Returns: + np.ndarray: The generated 2D mask, where the polygon is marked with + `1`'s and the rest is filled with `0`'s. + """ + width, height = map(int, resolution_wh) + mask = np.zeros((height, width), dtype=np.uint8) + cv2.fillPoly(mask, [polygon.astype(np.int32)], color=1) + return mask + + +def xywh_to_xyxy(xywh: np.ndarray) -> np.ndarray: + """ + Converts bounding box coordinates from `(x, y, width, height)` + format to `(x_min, y_min, x_max, y_max)` format. + + Args: + xywh (np.ndarray): A numpy array of shape `(N, 4)` where each row + corresponds to a bounding box in the format `(x, y, width, height)`. + + Returns: + np.ndarray: A numpy array of shape `(N, 4)` where each row corresponds + to a bounding box in the format `(x_min, y_min, x_max, y_max)`. + + Examples: + ```python + import numpy as np + import supervision as sv + + xywh = np.array([ + [10, 20, 30, 40], + [15, 25, 35, 45] + ]) + + sv.xywh_to_xyxy(xywh=xywh) + # array([ + # [10, 20, 40, 60], + # [15, 25, 50, 70] + # ]) + ``` + """ + xyxy = xywh.copy() + xyxy[:, 2] = xywh[:, 0] + xywh[:, 2] + xyxy[:, 3] = xywh[:, 1] + xywh[:, 3] + return xyxy + + +def xyxy_to_xywh(xyxy: np.ndarray) -> np.ndarray: + """ + Converts bounding box coordinates from `(x_min, y_min, x_max, y_max)` + format to `(x, y, width, height)` format. + + Args: + xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each row + corresponds to a bounding box in the format `(x_min, y_min, x_max, + y_max)`. + + Returns: + np.ndarray: A numpy array of shape `(N, 4)` where each row corresponds + to a bounding box in the format `(x, y, width, height)`. + + Examples: + ```python + import numpy as np + import supervision as sv + + xyxy = np.array([ + [10, 20, 40, 60], + [15, 25, 50, 70] + ]) + + sv.xyxy_to_xywh(xyxy=xyxy) + # array([ + # [10, 20, 30, 40], + # [15, 25, 35, 45] + # ]) + ``` + """ + xywh = xyxy.copy() + xywh[:, 2] = xyxy[:, 2] - xyxy[:, 0] + xywh[:, 3] = xyxy[:, 3] - xyxy[:, 1] + return xywh + + +def xcycwh_to_xyxy(xcycwh: np.ndarray) -> np.ndarray: + """ + Converts bounding box coordinates from `(center_x, center_y, width, height)` + format to `(x_min, y_min, x_max, y_max)` format. + + Args: + xcycwh (np.ndarray): A numpy array of shape `(N, 4)` where each row + corresponds to a bounding box in the format `(center_x, center_y, width, + height)`. + + Returns: + np.ndarray: A numpy array of shape `(N, 4)` where each row corresponds + to a bounding box in the format `(x_min, y_min, x_max, y_max)`. + + Examples: + ```python + import numpy as np + import supervision as sv + + xcycwh = np.array([ + [50, 50, 20, 30], + [30, 40, 10, 15] + ]) + + sv.xcycwh_to_xyxy(xcycwh=xcycwh) + # array([ + # [40, 35, 60, 65], + # [25, 32.5, 35, 47.5] + # ]) + ``` + """ + xyxy = xcycwh.copy() + xyxy[:, 0] = xcycwh[:, 0] - xcycwh[:, 2] / 2 + xyxy[:, 1] = xcycwh[:, 1] - xcycwh[:, 3] / 2 + xyxy[:, 2] = xcycwh[:, 0] + xcycwh[:, 2] / 2 + xyxy[:, 3] = xcycwh[:, 1] + xcycwh[:, 3] / 2 + return xyxy + + +def xyxy_to_xcycarh(xyxy: np.ndarray) -> np.ndarray: + """ + Converts bounding box coordinates from `(x_min, y_min, x_max, y_max)` + into measurement space to format `(center x, center y, aspect ratio, height)`, + where the aspect ratio is `width / height`. + + Args: + xyxy (np.ndarray): Bounding box in format `(x1, y1, x2, y2)`. + Expected shape is `(N, 4)`. + Returns: + np.ndarray: Bounding box in format + `(center x, center y, aspect ratio, height)`. Shape `(N, 4)`. + + Examples: + ```python + import numpy as np + import supervision as sv + + xyxy = np.array([ + [10, 20, 40, 60], + [15, 25, 50, 70] + ]) + + sv.xyxy_to_xcycarh(xyxy=xyxy) + # array([ + # [25. , 40. , 0.75, 40. ], + # [32.5 , 47.5 , 0.77777778, 45. ] + # ]) + ``` + + """ + if xyxy.size == 0: + return np.empty((0, 4), dtype=float) + + x1, y1, x2, y2 = xyxy.T + width = x2 - x1 + height = y2 - y1 + center_x = x1 + width / 2 + center_y = y1 + height / 2 + + aspect_ratio = np.divide( + width, + height, + out=np.zeros_like(width, dtype=float), + where=height != 0, + ) + result = np.column_stack((center_x, center_y, aspect_ratio, height)) + return result.astype(float) + + +def mask_to_xyxy(masks: np.ndarray) -> np.ndarray: + """ + Converts a 3D `np.array` of 2D bool masks into a 2D `np.array` of bounding boxes. + + Parameters: + masks (np.ndarray): A 3D `np.array` of shape `(N, W, H)` + containing 2D bool masks + + Returns: + np.ndarray: A 2D `np.array` of shape `(N, 4)` containing the bounding boxes + `(x_min, y_min, x_max, y_max)` for each mask + """ + n = masks.shape[0] + xyxy = np.zeros((n, 4), dtype=int) + + for i, mask in enumerate(masks): + rows, cols = np.where(mask) + + if len(rows) > 0 and len(cols) > 0: + x_min, x_max = np.min(cols), np.max(cols) + y_min, y_max = np.min(rows), np.max(rows) + xyxy[i, :] = [x_min, y_min, x_max, y_max] + + return xyxy + + +def mask_to_polygons(mask: np.ndarray) -> list[np.ndarray]: + """ + Converts a binary mask to a list of polygons. + + Parameters: + mask (np.ndarray): A binary mask represented as a 2D NumPy array of + shape `(H, W)`, where H and W are the height and width of + the mask, respectively. + + Returns: + List[np.ndarray]: A list of polygons, where each polygon is represented by a + NumPy array of shape `(N, 2)`, containing the `x`, `y` coordinates + of the points. Polygons with fewer points than `MIN_POLYGON_POINT_COUNT = 3` + are excluded from the output. + """ + + contours, _ = cv2.findContours( + mask.astype(np.uint8), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE + ) + return [ + np.squeeze(contour, axis=1) + for contour in contours + if contour.shape[0] >= MIN_POLYGON_POINT_COUNT + ] + + +def polygon_to_xyxy(polygon: np.ndarray) -> np.ndarray: + """ + Converts a polygon represented by a NumPy array into a bounding box. + + Parameters: + polygon (np.ndarray): A polygon represented by a NumPy array of shape `(N, 2)`, + containing the `x`, `y` coordinates of the points. + + Returns: + np.ndarray: A 1D NumPy array containing the bounding box + `(x_min, y_min, x_max, y_max)` of the input polygon. + """ + x_min, y_min = np.min(polygon, axis=0) + x_max, y_max = np.max(polygon, axis=0) + return np.array([x_min, y_min, x_max, y_max]) diff --git a/supervision/detection/utils/internal.py b/supervision/detection/utils/internal.py new file mode 100644 index 00000000..2bcaf955 --- /dev/null +++ b/supervision/detection/utils/internal.py @@ -0,0 +1,331 @@ +from __future__ import annotations + +from itertools import chain +from typing import Any + +import cv2 +import numpy as np +import numpy.typing as npt + +from supervision.config import CLASS_NAME_DATA_FIELD +from supervision.detection.utils.converters import polygon_to_mask +from supervision.geometry.core import Vector + + +def extract_ultralytics_masks(yolov8_results) -> np.ndarray | None: + if not yolov8_results.masks: + return None + + orig_shape = yolov8_results.orig_shape + inference_shape = tuple(yolov8_results.masks.data.shape[1:]) + + pad = (0, 0) + + if inference_shape != orig_shape: + gain = min( + inference_shape[0] / orig_shape[0], + inference_shape[1] / orig_shape[1], + ) + pad = ( + (inference_shape[1] - orig_shape[1] * gain) / 2, + (inference_shape[0] - orig_shape[0] * gain) / 2, + ) + + top, left = int(pad[1]), int(pad[0]) + bottom, right = int(inference_shape[0] - pad[1]), int(inference_shape[1] - pad[0]) + + mask_maps = [] + masks = yolov8_results.masks.data.cpu().numpy() + for i in range(masks.shape[0]): + mask = masks[i] + mask = mask[top:bottom, left:right] + + if mask.shape != orig_shape: + mask = cv2.resize(mask, (orig_shape[1], orig_shape[0])) + + mask_maps.append(mask) + + return np.asarray(mask_maps, dtype=bool) + + +def process_roboflow_result( + roboflow_result: dict, +) -> tuple[ + np.ndarray, + np.ndarray, + np.ndarray, + np.ndarray | None, + np.ndarray | None, + dict[str, list[np.ndarray] | np.ndarray], +]: + if not roboflow_result["predictions"]: + return ( + np.empty((0, 4)), + np.empty(0), + np.empty(0), + None, + None, + {CLASS_NAME_DATA_FIELD: np.empty(0)}, + ) + + xyxy = [] + confidence = [] + class_id = [] + class_name = [] + masks = [] + tracker_ids = [] + + image_width = int(roboflow_result["image"]["width"]) + image_height = int(roboflow_result["image"]["height"]) + + for prediction in roboflow_result["predictions"]: + x = prediction["x"] + y = prediction["y"] + width = prediction["width"] + height = prediction["height"] + x_min = x - width / 2 + y_min = y - height / 2 + x_max = x_min + width + y_max = y_min + height + + if "points" not in prediction: + xyxy.append([x_min, y_min, x_max, y_max]) + class_id.append(prediction["class_id"]) + class_name.append(prediction["class"]) + confidence.append(prediction["confidence"]) + if "tracker_id" in prediction: + tracker_ids.append(prediction["tracker_id"]) + elif len(prediction["points"]) >= 3: + polygon = np.array( + [[point["x"], point["y"]] for point in prediction["points"]], dtype=int + ) + mask = polygon_to_mask(polygon, resolution_wh=(image_width, image_height)) + xyxy.append([x_min, y_min, x_max, y_max]) + class_id.append(prediction["class_id"]) + class_name.append(prediction["class"]) + confidence.append(prediction["confidence"]) + masks.append(mask) + if "tracker_id" in prediction: + tracker_ids.append(prediction["tracker_id"]) + + xyxy = np.array(xyxy) if len(xyxy) > 0 else np.empty((0, 4)) + confidence = np.array(confidence) if len(confidence) > 0 else np.empty(0) + class_id = np.array(class_id).astype(int) if len(class_id) > 0 else np.empty(0) + class_name = np.array(class_name) if len(class_name) > 0 else np.empty(0) + masks = np.array(masks, dtype=bool) if len(masks) > 0 else None + tracker_id = np.array(tracker_ids).astype(int) if len(tracker_ids) > 0 else None + data = {CLASS_NAME_DATA_FIELD: class_name} + + return xyxy, confidence, class_id, masks, tracker_id, data + + +def is_data_equal(data_a: dict[str, np.ndarray], data_b: dict[str, np.ndarray]) -> bool: + """ + Compares the data payloads of two Detections instances. + + Args: + data_a, data_b: The data payloads of the instances. + + Returns: + True if the data payloads are equal, False otherwise. + """ + return set(data_a.keys()) == set(data_b.keys()) and all( + np.array_equal(data_a[key], data_b[key]) for key in data_a + ) + + +def is_metadata_equal(metadata_a: dict[str, Any], metadata_b: dict[str, Any]) -> bool: + """ + Compares the metadata payloads of two Detections instances. + + Args: + metadata_a, metadata_b: The metadata payloads of the instances. + + Returns: + True if the metadata payloads are equal, False otherwise. + """ + return set(metadata_a.keys()) == set(metadata_b.keys()) and all( + np.array_equal(metadata_a[key], metadata_b[key]) + if ( + isinstance(metadata_a[key], np.ndarray) + and isinstance(metadata_b[key], np.ndarray) + ) + else metadata_a[key] == metadata_b[key] + for key in metadata_a + ) + + +def merge_data( + data_list: list[dict[str, npt.NDArray[np.generic] | list]], +) -> dict[str, npt.NDArray[np.generic] | list]: + """ + Merges the data payloads of a list of Detections instances. + + Warning: Assumes that empty detections were filtered-out before passing data to + this function. + + Args: + data_list: The data payloads of the Detections instances. Each data payload + is a dictionary with the same keys, and the values are either lists or + npt.NDArray[np.generic]. + + Returns: + A single data payload containing the merged data, preserving the original data + types (list or npt.NDArray[np.generic]). + + Raises: + ValueError: If data values within a single object have different lengths or if + dictionaries have different keys. + """ + if not data_list: + return {} + + all_keys_sets = [set(data.keys()) for data in data_list] + if not all(keys_set == all_keys_sets[0] for keys_set in all_keys_sets): + raise ValueError("All data dictionaries must have the same keys to merge.") + + for data in data_list: + lengths = [len(value) for value in data.values()] + if len(set(lengths)) > 1: + raise ValueError( + "All data values within a single object must have equal length." + ) + + merged_data = {key: [] for key in all_keys_sets[0]} + for data in data_list: + for key in data: + merged_data[key].append(data[key]) + + for key in merged_data: + if all(isinstance(item, list) for item in merged_data[key]): + merged_data[key] = list(chain.from_iterable(merged_data[key])) + elif all(isinstance(item, np.ndarray) for item in merged_data[key]): + ndim = merged_data[key][0].ndim + if ndim == 1: + merged_data[key] = np.hstack(merged_data[key]) + elif ndim > 1: + merged_data[key] = np.vstack(merged_data[key]) + else: + raise ValueError(f"Unexpected array dimension for key '{key}'.") + else: + raise ValueError( + f"Inconsistent data types for key '{key}'. Only np.ndarray and list " + f"types are allowed." + ) + + return merged_data + + +def merge_metadata(metadata_list: list[dict[str, Any]]) -> dict[str, Any]: + """ + Merge metadata from a list of metadata dictionaries. + + This function combines the metadata dictionaries. If a key appears in more than one + dictionary, the values must be identical for the merge to succeed. + + Warning: Assumes that empty detections were filtered-out before passing metadata to + this function. + + Args: + metadata_list (List[Dict[str, Any]]): A list of metadata dictionaries to merge. + + Returns: + Dict[str, Any]: A single merged metadata dictionary. + + Raises: + ValueError: If there are conflicting values for the same key or if + dictionaries have different keys. + """ + if not metadata_list: + return {} + + all_keys_sets = [set(metadata.keys()) for metadata in metadata_list] + if not all(keys_set == all_keys_sets[0] for keys_set in all_keys_sets): + raise ValueError("All metadata dictionaries must have the same keys to merge.") + + merged_metadata: dict[str, Any] = {} + for metadata in metadata_list: + for key, value in metadata.items(): + if key not in merged_metadata: + merged_metadata[key] = value + continue + + other_value = merged_metadata[key] + if isinstance(value, np.ndarray) and isinstance(other_value, np.ndarray): + if not np.array_equal(merged_metadata[key], value): + raise ValueError( + f"Conflicting metadata for key: '{key}': " + "{type(value)}, {type(other_value)}." + ) + elif isinstance(value, np.ndarray) or isinstance(other_value, np.ndarray): + # Since [] == np.array([]). + raise ValueError( + f"Conflicting metadata for key: '{key}': " + "{type(value)}, {type(other_value)}." + ) + else: + print("hm") + if merged_metadata[key] != value: + raise ValueError(f"Conflicting metadata for key: '{key}'.") + + return merged_metadata + + +def get_data_item( + data: dict[str, np.ndarray | list], + index: int | slice | list[int] | np.ndarray, +) -> dict[str, np.ndarray | list]: + """ + Retrieve a subset of the data dictionary based on the given index. + + Args: + data: The data dictionary of the Detections object. + index: The index or indices specifying the subset to retrieve. + + Returns: + A subset of the data dictionary corresponding to the specified index. + """ + subset_data = {} + for key, value in data.items(): + if isinstance(value, np.ndarray): + subset_data[key] = value[index] + elif isinstance(value, list): + if isinstance(index, slice): + subset_data[key] = value[index] + elif isinstance(index, list): + subset_data[key] = [value[i] for i in index] + elif isinstance(index, np.ndarray): + if index.dtype == bool: + subset_data[key] = [ + value[i] for i, index_value in enumerate(index) if index_value + ] + else: + subset_data[key] = [value[i] for i in index] + elif isinstance(index, int): + subset_data[key] = [value[index]] + else: + raise TypeError(f"Unsupported index type: {type(index)}") + else: + raise TypeError(f"Unsupported data type for key '{key}': {type(value)}") + + return subset_data + + +def cross_product(anchors: np.ndarray, vector: Vector) -> np.ndarray: + """ + Get array of cross products of each anchor with a vector. + Args: + anchors: Array of anchors of shape (number of anchors, detections, 2) + vector: Vector to calculate cross product with + + Returns: + Array of cross products of shape (number of anchors, detections) + """ + vector_at_zero = np.array( + [ + vector.end.x - vector.start.x, + vector.end.y - vector.start.y, + ] + ) + vector_start = np.array([vector.start.x, vector.start.y]) + return np.cross(vector_at_zero, anchors - vector_start) diff --git a/supervision/detection/utils/iou_and_nms.py b/supervision/detection/utils/iou_and_nms.py new file mode 100644 index 00000000..07602a2d --- /dev/null +++ b/supervision/detection/utils/iou_and_nms.py @@ -0,0 +1,795 @@ +from __future__ import annotations + +from enum import Enum + +import numpy as np +import numpy.typing as npt + +from supervision.detection.utils.converters import polygon_to_mask +from supervision.detection.utils.masks import resize_masks + + +class OverlapFilter(Enum): + """ + Enum specifying the strategy for filtering overlapping detections. + + Attributes: + NONE: Do not filter detections based on overlap. + NON_MAX_SUPPRESSION: Filter detections using non-max suppression. This means, + detections that overlap by more than a set threshold will be discarded, + except for the one with the highest confidence. + NON_MAX_MERGE: Merge detections with non-max merging. This means, + detections that overlap by more than a set threshold will be merged + into a single detection. + """ + + NONE = "none" + NON_MAX_SUPPRESSION = "non_max_suppression" + NON_MAX_MERGE = "non_max_merge" + + @classmethod + def list(cls): + return list(map(lambda c: c.value, cls)) + + @classmethod + def from_value(cls, value: OverlapFilter | str) -> OverlapFilter: + if isinstance(value, cls): + return value + if isinstance(value, str): + value = value.lower() + try: + return cls(value) + except ValueError: + raise ValueError(f"Invalid value: {value}. Must be one of {cls.list()}") + raise ValueError( + f"Invalid value type: {type(value)}. Must be an instance of " + f"{cls.__name__} or str." + ) + + +class OverlapMetric(Enum): + """ + Enum specifying the metric for measuring overlap between detections. + + Attributes: + IOU: Intersection over Union. A region-overlap metric that compares + two shapes (usually bounding boxes or masks) by normalising the + shared area with the area of their union. + IOS: Intersection over Smaller, a region-overlap metric that compares + two shapes (usually bounding boxes or masks) by normalising the + shared area with the smaller of the two shapes. + """ + + IOU = "IOU" + IOS = "IOS" + + @classmethod + def list(cls): + return list(map(lambda c: c.value, cls)) + + @classmethod + def from_value(cls, value: OverlapMetric | str) -> OverlapMetric: + if isinstance(value, cls): + return value + if isinstance(value, str): + value = value.lower() + try: + return cls(value) + except ValueError: + raise ValueError(f"Invalid value: {value}. Must be one of {cls.list()}") + raise ValueError( + f"Invalid value type: {type(value)}. Must be an instance of " + f"{cls.__name__} or str." + ) + + +def box_iou( + box_true: list[float] | np.ndarray, + box_detection: list[float] | np.ndarray, +) -> float: + """ + Compute the Intersection over Union (IoU) between two bounding boxes. + + Mathematically, it is defined as: + + \\[ + \text{IoU} = \frac{|\text{box}_{\text{true}} \\cap \text{box}_{\text{detection}}|}{|\text{box}_{\text{true}} \\cup \text{box}_{\text{detection}}|} + \\] + + Note: + Use `box_iou` when computing IoU between two individual boxes. + For comparing multiple boxes (arrays of boxes), use `box_iou_batch` for better + performance. + + Args: + box_true (Union[List[float], np.ndarray]): A single bounding box represented as + [x_min, y_min, x_max, y_max]. + box_detection (Union[List[float], np.ndarray]): + A single bounding box represented as [x_min, y_min, x_max, y_max]. + + Returns: + IoU (float): IoU score between the two boxes. Ranges from 0.0 (no overlap) + to 1.0 (perfect overlap). + + Examples: + ```python + import numpy as np + import supervision as sv + + box_true = np.array([100, 100, 200, 200]) + box_detection = np.array([150, 150, 250, 250]) + + sv.box_iou(box_true=box_true, box_detection=box_detection) + # 0.14285814285714285 + ``` + """ # noqa: E501 + box_true = np.array(box_true) + box_detection = np.array(box_detection) + + inter_x1 = max(box_true[0], box_detection[0]) + inter_y1 = max(box_true[1], box_detection[1]) + inter_x2 = min(box_true[2], box_detection[2]) + inter_y2 = min(box_true[3], box_detection[3]) + + inter_w = max(0, inter_x2 - inter_x1) + inter_h = max(0, inter_y2 - inter_y1) + + inter_area = inter_w * inter_h + + area_true = (box_true[2] - box_true[0]) * (box_true[3] - box_true[1]) + area_detection = (box_detection[2] - box_detection[0]) * ( + box_detection[3] - box_detection[1] + ) + + union_area = area_true + area_detection - inter_area + + return inter_area / union_area + 1e-6 + + +def box_iou_batch( + boxes_true: np.ndarray, + boxes_detection: np.ndarray, + overlap_metric: OverlapMetric = OverlapMetric.IOU, +) -> np.ndarray: + """ + Compute Intersection over Union (IoU) of two sets of bounding boxes - + `boxes_true` and `boxes_detection`. Both sets + of boxes are expected to be in `(x_min, y_min, x_max, y_max)` format. + + Note: + Use `box_iou` when computing IoU between two individual boxes. + For comparing multiple boxes (arrays of boxes), use `box_iou_batch` for better + performance. + + Args: + boxes_true (np.ndarray): 2D `np.ndarray` representing ground-truth boxes. + `shape = (N, 4)` where `N` is number of true objects. + boxes_detection (np.ndarray): 2D `np.ndarray` representing detection boxes. + `shape = (M, 4)` where `M` is number of detected objects. + overlap_metric (OverlapMetric): Metric used for matching detections in slices. + + Returns: + np.ndarray: Pairwise IoU of boxes from `boxes_true` and `boxes_detection`. + `shape = (N, M)` where `N` is number of true objects and + `M` is number of detected objects. + + Examples: + ```python + import numpy as np + import supervision as sv + + boxes_true = np.array([ + [100, 100, 200, 200], + [300, 300, 400, 400] + ]) + boxes_detection = np.array([ + [150, 150, 250, 250], + [320, 320, 420, 420] + ]) + + sv.box_iou_batch(boxes_true=boxes_true, boxes_detection=boxes_detection) + # array([ + # [0.14285714, 0. ], + # [0. , 0.47058824] + # ]) + ``` + """ + + def box_area(box): + return (box[2] - box[0]) * (box[3] - box[1]) + + area_true = box_area(boxes_true.T) + area_detection = box_area(boxes_detection.T) + + top_left = np.maximum(boxes_true[:, None, :2], boxes_detection[:, :2]) + bottom_right = np.minimum(boxes_true[:, None, 2:], boxes_detection[:, 2:]) + + area_inter = np.prod(np.clip(bottom_right - top_left, a_min=0, a_max=None), 2) + + if overlap_metric == OverlapMetric.IOU: + union_area = area_true[:, None] + area_detection - area_inter + ious = np.divide( + area_inter, + union_area, + out=np.zeros_like(area_inter, dtype=float), + where=union_area != 0, + ) + elif overlap_metric == OverlapMetric.IOS: + small_area = np.minimum(area_true[:, None], area_detection) + ious = np.divide( + area_inter, + small_area, + out=np.zeros_like(area_inter, dtype=float), + where=small_area != 0, + ) + else: + raise ValueError( + f"overlap_metric {overlap_metric} is not supported, " + "only 'IOU' and 'IOS' are supported" + ) + + ious = np.nan_to_num(ious) + return ious + + +def _jaccard(box_a: list[float], box_b: list[float], is_crowd: bool) -> float: + """ + Calculate the Jaccard index (intersection over union) between two bounding boxes. + If a gt object is marked as "iscrowd", a dt is allowed to match any subregion + of the gt. Choosing gt'=intersect(dt,gt). Since by definition union(gt',dt)=dt, computing + iou(gt,dt,iscrowd) = iou(gt',dt) = area(intersect(gt,dt)) / area(dt) + + Args: + box_a (List[float]): Box coordinates in the format [x, y, width, height]. + box_b (List[float]): Box coordinates in the format [x, y, width, height]. + iscrowd (bool): Flag indicating if the second box is a crowd region or not. + + Returns: + float: Jaccard index between the two bounding boxes. + """ # noqa: E501 + # Smallest number to avoid division by zero + EPS = np.spacing(1) + + xa, ya, x2a, y2a = box_a[0], box_a[1], box_a[0] + box_a[2], box_a[1] + box_a[3] + xb, yb, x2b, y2b = box_b[0], box_b[1], box_b[0] + box_b[2], box_b[1] + box_b[3] + + # Innermost left x + xi = max(xa, xb) + # Innermost right x + x2i = min(x2a, x2b) + # Same for y + yi = max(ya, yb) + y2i = min(y2a, y2b) + + # Calculate areas + Aa = max(x2a - xa, 0.0) * max(y2a - ya, 0.0) + Ab = max(x2b - xb, 0.0) * max(y2b - yb, 0.0) + Ai = max(x2i - xi, 0.0) * max(y2i - yi, 0.0) + + if is_crowd: + return Ai / (Aa + EPS) + + return Ai / (Aa + Ab - Ai + EPS) + + +def box_iou_batch_with_jaccard( + boxes_true: list[list[float]], + boxes_detection: list[list[float]], + is_crowd: list[bool], +) -> np.ndarray: + """ + Calculate the intersection over union (IoU) between detection bounding boxes (dt) + and ground-truth bounding boxes (gt). + Reference: https://github.com/rafaelpadilla/review_object_detection_metrics + + Args: + boxes_true (List[List[float]]): List of ground-truth bounding boxes in the \ + format [x, y, width, height]. + boxes_detection (List[List[float]]): List of detection bounding boxes in the \ + format [x, y, width, height]. + is_crowd (List[bool]): List indicating if each ground-truth bounding box \ + is a crowd region or not. + + Returns: + np.ndarray: Array of IoU values of shape (len(dt), len(gt)). + + Examples: + ```python + import numpy as np + import supervision as sv + + boxes_true = [ + [10, 20, 30, 40], # x, y, w, h + [15, 25, 35, 45] + ] + boxes_detection = [ + [12, 22, 28, 38], + [16, 26, 36, 46] + ] + is_crowd = [False, False] + + ious = sv.box_iou_batch_with_jaccard( + boxes_true=boxes_true, + boxes_detection=boxes_detection, + is_crowd=is_crowd + ) + # array([ + # [0.8866..., 0.4960...], + # [0.4000..., 0.8622...] + # ]) + ``` + """ + assert len(is_crowd) == len(boxes_true), ( + "`is_crowd` must have the same length as `boxes_true`" + ) + if len(boxes_detection) == 0 or len(boxes_true) == 0: + return np.array([]) + ious = np.zeros((len(boxes_detection), len(boxes_true)), dtype=np.float64) + for g_idx, g in enumerate(boxes_true): + for d_idx, d in enumerate(boxes_detection): + ious[d_idx, g_idx] = _jaccard(d, g, is_crowd[g_idx]) + return ious + + +def oriented_box_iou_batch( + boxes_true: np.ndarray, boxes_detection: np.ndarray +) -> np.ndarray: + """ + Compute Intersection over Union (IoU) of two sets of oriented bounding boxes - + `boxes_true` and `boxes_detection`. Both sets of boxes are expected to be in + `((x1, y1), (x2, y2), (x3, y3), (x4, y4))` format. + + Args: + boxes_true (np.ndarray): a `np.ndarray` representing ground-truth boxes. + `shape = (N, 4, 2)` where `N` is number of true objects. + boxes_detection (np.ndarray): a `np.ndarray` representing detection boxes. + `shape = (M, 4, 2)` where `M` is number of detected objects. + + Returns: + np.ndarray: Pairwise IoU of boxes from `boxes_true` and `boxes_detection`. + `shape = (N, M)` where `N` is number of true objects and + `M` is number of detected objects. + """ + + boxes_true = boxes_true.reshape(-1, 4, 2) + boxes_detection = boxes_detection.reshape(-1, 4, 2) + + max_height = int(max(boxes_true[:, :, 0].max(), boxes_detection[:, :, 0].max()) + 1) + # adding 1 because we are 0-indexed + max_width = int(max(boxes_true[:, :, 1].max(), boxes_detection[:, :, 1].max()) + 1) + + mask_true = np.zeros((boxes_true.shape[0], max_height, max_width)) + for i, box_true in enumerate(boxes_true): + mask_true[i] = polygon_to_mask(box_true, (max_width, max_height)) + + mask_detection = np.zeros((boxes_detection.shape[0], max_height, max_width)) + for i, box_detection in enumerate(boxes_detection): + mask_detection[i] = polygon_to_mask(box_detection, (max_width, max_height)) + + ious = mask_iou_batch(mask_true, mask_detection) + return ious + + +def _mask_iou_batch_split( + masks_true: np.ndarray, + masks_detection: np.ndarray, + overlap_metric: OverlapMetric = OverlapMetric.IOU, +) -> np.ndarray: + """ + Internal function. + Compute Intersection over Union (IoU) of two sets of masks - + `masks_true` and `masks_detection`. + + Args: + masks_true (np.ndarray): 3D `np.ndarray` representing ground-truth masks. + masks_detection (np.ndarray): 3D `np.ndarray` representing detection masks. + overlap_metric (OverlapMetric): Metric used for matching detections in slices. + + Returns: + np.ndarray: Pairwise IoU of masks from `masks_true` and `masks_detection`. + """ + intersection_area = np.logical_and(masks_true[:, None], masks_detection).sum( + axis=(2, 3) + ) + + masks_true_area = masks_true.sum(axis=(1, 2)) # (area1, area2, ...) + masks_detection_area = masks_detection.sum(axis=(1, 2)) # (area1) + + if overlap_metric == OverlapMetric.IOU: + union_area = masks_true_area[:, None] + masks_detection_area - intersection_area + ious = np.divide( + intersection_area, + union_area, + out=np.zeros_like(intersection_area, dtype=float), + where=union_area != 0, + ) + elif overlap_metric == OverlapMetric.IOS: + # ios = intersection_area / min(area1, area2) + small_area = np.minimum(masks_true_area[:, None], masks_detection_area) + ious = np.divide( + intersection_area, + small_area, + out=np.zeros_like(intersection_area, dtype=float), + where=small_area != 0, + ) + else: + raise ValueError( + f"overlap_metric {overlap_metric} is not supported, " + "only 'IOU' and 'IOS' are supported" + ) + + ious = np.nan_to_num(ious) + return ious + + +def mask_iou_batch( + masks_true: np.ndarray, + masks_detection: np.ndarray, + overlap_metric: OverlapMetric = OverlapMetric.IOU, + memory_limit: int = 1024 * 5, +) -> np.ndarray: + """ + Compute Intersection over Union (IoU) of two sets of masks - + `masks_true` and `masks_detection`. + + Args: + masks_true (np.ndarray): 3D `np.ndarray` representing ground-truth masks. + masks_detection (np.ndarray): 3D `np.ndarray` representing detection masks. + overlap_metric (OverlapMetric): Metric used for matching detections in slices. + memory_limit (int): memory limit in MB, default is 1024 * 5 MB (5GB). + + Returns: + np.ndarray: Pairwise IoU of masks from `masks_true` and `masks_detection`. + """ + memory = ( + masks_true.shape[0] + * masks_true.shape[1] + * masks_true.shape[2] + * masks_detection.shape[0] + / 1024 + / 1024 + ) + if memory <= memory_limit: + return _mask_iou_batch_split(masks_true, masks_detection, overlap_metric) + + ious = [] + step = max( + memory_limit + * 1024 + * 1024 + // ( + masks_detection.shape[0] + * masks_detection.shape[1] + * masks_detection.shape[2] + ), + 1, + ) + for i in range(0, masks_true.shape[0], step): + ious.append( + _mask_iou_batch_split( + masks_true[i : i + step], masks_detection, overlap_metric + ) + ) + + return np.vstack(ious) + + +def mask_non_max_suppression( + predictions: np.ndarray, + masks: np.ndarray, + iou_threshold: float = 0.5, + overlap_metric: OverlapMetric = OverlapMetric.IOU, + mask_dimension: int = 640, +) -> np.ndarray: + """ + Perform Non-Maximum Suppression (NMS) on segmentation predictions. + + Args: + predictions (np.ndarray): A 2D array of object detection predictions in + the format of `(x_min, y_min, x_max, y_max, score)` + or `(x_min, y_min, x_max, y_max, score, class)`. Shape: `(N, 5)` or + `(N, 6)`, where N is the number of predictions. + masks (np.ndarray): A 3D array of binary masks corresponding to the predictions. + Shape: `(N, H, W)`, where N is the number of predictions, and H, W are the + dimensions of each mask. + iou_threshold (float): The intersection-over-union threshold + to use for non-maximum suppression. + overlap_metric (OverlapMetric): Metric used for matching detections in slices. + mask_dimension (int): The dimension to which the masks should be + resized before computing IOU values. Defaults to 640. + + Returns: + np.ndarray: A boolean array indicating which predictions to keep after + non-maximum suppression. + + Raises: + AssertionError: If `iou_threshold` is not within the closed + range from `0` to `1`. + """ + assert 0 <= iou_threshold <= 1, ( + "Value of `iou_threshold` must be in the closed range from 0 to 1, " + f"{iou_threshold} given." + ) + rows, columns = predictions.shape + + if columns == 5: + predictions = np.c_[predictions, np.zeros(rows)] + + sort_index = predictions[:, 4].argsort()[::-1] + predictions = predictions[sort_index] + masks = masks[sort_index] + masks_resized = resize_masks(masks, mask_dimension) + ious = mask_iou_batch(masks_resized, masks_resized, overlap_metric) + categories = predictions[:, 5] + + keep = np.ones(rows, dtype=bool) + for i in range(rows): + if keep[i]: + condition = (ious[i] > iou_threshold) & (categories[i] == categories) + keep[i + 1 :] = np.where(condition[i + 1 :], False, keep[i + 1 :]) + + return keep[sort_index.argsort()] + + +def box_non_max_suppression( + predictions: np.ndarray, + iou_threshold: float = 0.5, + overlap_metric: OverlapMetric = OverlapMetric.IOU, +) -> np.ndarray: + """ + Perform Non-Maximum Suppression (NMS) on object detection predictions. + + Args: + predictions (np.ndarray): An array of object detection predictions in + the format of `(x_min, y_min, x_max, y_max, score)` + or `(x_min, y_min, x_max, y_max, score, class)`. + iou_threshold (float): The intersection-over-union threshold + to use for non-maximum suppression. + overlap_metric (OverlapMetric): Metric used for matching detections in slices. + + Returns: + np.ndarray: A boolean array indicating which predictions to keep after n + on-maximum suppression. + + Raises: + AssertionError: If `iou_threshold` is not within the + closed range from `0` to `1`. + """ + assert 0 <= iou_threshold <= 1, ( + "Value of `iou_threshold` must be in the closed range from 0 to 1, " + f"{iou_threshold} given." + ) + rows, columns = predictions.shape + + # add column #5 - category filled with zeros for agnostic nms + if columns == 5: + predictions = np.c_[predictions, np.zeros(rows)] + + # sort predictions column #4 - score + sort_index = np.flip(predictions[:, 4].argsort()) + predictions = predictions[sort_index] + + boxes = predictions[:, :4] + categories = predictions[:, 5] + ious = box_iou_batch(boxes, boxes, overlap_metric) + ious = ious - np.eye(rows) + + keep = np.ones(rows, dtype=bool) + + for index, (iou, category) in enumerate(zip(ious, categories)): + if not keep[index]: + continue + + # drop detections with iou > iou_threshold and + # same category as current detections + condition = (iou > iou_threshold) & (categories == category) + keep = keep & ~condition + + return keep[sort_index.argsort()] + + +def _group_overlapping_masks( + predictions: npt.NDArray[np.float64], + masks: npt.NDArray[np.float64], + iou_threshold: float = 0.5, + overlap_metric: OverlapMetric = OverlapMetric.IOU, +) -> list[list[int]]: + """ + Apply greedy version of non-maximum merging to avoid detecting too many + + Args: + predictions (npt.NDArray[np.float64]): An array of shape `(n, 5)` containing + the bounding boxes coordinates in format `[x1, y1, x2, y2]` + and the confidence scores. + masks (npt.NDArray[np.float64]): A 3D array of binary masks corresponding to + the predictions. + iou_threshold (float): The intersection-over-union threshold + to use for non-maximum suppression. Defaults to 0.5. + overlap_metric (OverlapMetric): Metric used for matching detections in slices. + + Returns: + list[list[int]]: Groups of prediction indices be merged. + Each group may have 1 or more elements. + """ + merge_groups: list[list[int]] = [] + + scores = predictions[:, 4] + order = scores.argsort() + + while len(order) > 0: + idx = int(order[-1]) + + order = order[:-1] + if len(order) == 0: + merge_groups.append([idx]) + break + + merge_candidate = masks[idx][None, ...] + candidate_groups = [idx] + while len(order) > 0: + ious = mask_iou_batch(masks[order], merge_candidate, overlap_metric) + above_threshold: np.ndarray = ious.flatten() >= iou_threshold + if not above_threshold.any(): + break + above_idx = order[above_threshold] + merge_candidate = np.logical_or.reduce( + np.concatenate([masks[above_idx], merge_candidate]), + axis=0, + keepdims=True, + ) + candidate_groups.extend(np.flip(above_idx).tolist()) + order = order[~above_threshold] + + merge_groups.append(candidate_groups) + return merge_groups + + +def mask_non_max_merge( + predictions: np.ndarray, + masks: np.ndarray, + iou_threshold: float = 0.5, + mask_dimension: int = 640, + overlap_metric: OverlapMetric = OverlapMetric.IOU, +) -> list[list[int]]: + """ + Perform Non-Maximum Merging (NMM) on segmentation predictions. + + Args: + predictions (np.ndarray): A 2D array of object detection predictions in + the format of `(x_min, y_min, x_max, y_max, score)` + or `(x_min, y_min, x_max, y_max, score, class)`. Shape: `(N, 5)` or + `(N, 6)`, where N is the number of predictions. + masks (np.ndarray): A 3D array of binary masks corresponding to the predictions. + Shape: `(N, H, W)`, where N is the number of predictions, and H, W are the + dimensions of each mask. + iou_threshold (float): The intersection-over-union threshold + to use for non-maximum suppression. + mask_dimension (int): The dimension to which the masks should be + resized before computing IOU values. Defaults to 640. + overlap_metric (OverlapMetric): Metric used for matching detections in slices. + + Returns: + np.ndarray: A boolean array indicating which predictions to keep after + non-maximum suppression. + + Raises: + AssertionError: If `iou_threshold` is not within the closed + range from `0` to `1`. + """ + masks_resized = resize_masks(masks, mask_dimension) + if predictions.shape[1] == 5: + return _group_overlapping_masks( + predictions, masks_resized, iou_threshold, overlap_metric + ) + + category_ids = predictions[:, 5] + merge_groups = [] + for category_id in np.unique(category_ids): + curr_indices = np.where(category_ids == category_id)[0] + merge_class_groups = _group_overlapping_masks( + predictions[curr_indices], + masks_resized[curr_indices], + iou_threshold, + overlap_metric, + ) + + for merge_class_group in merge_class_groups: + merge_groups.append(curr_indices[merge_class_group].tolist()) + + for merge_group in merge_groups: + if len(merge_group) == 0: + raise ValueError( + f"Empty group detected when non-max-merging detections: {merge_groups}" + ) + return merge_groups + + +def _group_overlapping_boxes( + predictions: npt.NDArray[np.float64], + iou_threshold: float = 0.5, + overlap_metric: OverlapMetric = OverlapMetric.IOU, +) -> list[list[int]]: + """ + Apply greedy version of non-maximum merging to avoid detecting too many + overlapping bounding boxes for a given object. + + Args: + predictions (npt.NDArray[np.float64]): An array of shape `(n, 5)` containing + the bounding boxes coordinates in format `[x1, y1, x2, y2]` + and the confidence scores. + iou_threshold (float): The intersection-over-union threshold + to use for non-maximum suppression. Defaults to 0.5. + overlap_metric (OverlapMetric): Metric used for matching detections in slices. + + Returns: + list[list[int]]: Groups of prediction indices be merged. + Each group may have 1 or more elements. + """ + merge_groups: list[list[int]] = [] + + scores = predictions[:, 4] + order = scores.argsort() + + while len(order) > 0: + idx = int(order[-1]) + + order = order[:-1] + if len(order) == 0: + merge_groups.append([idx]) + break + + merge_candidate = np.expand_dims(predictions[idx], axis=0) + ious = box_iou_batch( + predictions[order][:, :4], merge_candidate[:, :4], overlap_metric + ) + ious = ious.flatten() + + above_threshold = ious >= iou_threshold + merge_group = [idx, *np.flip(order[above_threshold]).tolist()] + merge_groups.append(merge_group) + order = order[~above_threshold] + return merge_groups + + +def box_non_max_merge( + predictions: npt.NDArray[np.float64], + iou_threshold: float = 0.5, + overlap_metric: OverlapMetric = OverlapMetric.IOU, +) -> list[list[int]]: + """ + Apply greedy version of non-maximum merging per category to avoid detecting + too many overlapping bounding boxes for a given object. + + Args: + predictions (npt.NDArray[np.float64]): An array of shape `(n, 5)` or `(n, 6)` + containing the bounding boxes coordinates in format `[x1, y1, x2, y2]`, + the confidence scores and class_ids. Omit class_id column to allow + detections of different classes to be merged. + iou_threshold (float): The intersection-over-union threshold + to use for non-maximum suppression. Defaults to 0.5. + overlap_metric (OverlapMetric): Metric used for matching detections in slices. + + Returns: + list[list[int]]: Groups of prediction indices be merged. + Each group may have 1 or more elements. + """ + if predictions.shape[1] == 5: + return _group_overlapping_boxes(predictions, iou_threshold, overlap_metric) + + category_ids = predictions[:, 5] + merge_groups = [] + for category_id in np.unique(category_ids): + curr_indices = np.where(category_ids == category_id)[0] + merge_class_groups = _group_overlapping_boxes( + predictions[curr_indices], iou_threshold, overlap_metric + ) + + for merge_class_group in merge_class_groups: + merge_groups.append(curr_indices[merge_class_group].tolist()) + + for merge_group in merge_groups: + if len(merge_group) == 0: + raise ValueError( + f"Empty group detected when non-max-merging detections: {merge_groups}" + ) + return merge_groups diff --git a/supervision/detection/utils/masks.py b/supervision/detection/utils/masks.py new file mode 100644 index 00000000..f2063a88 --- /dev/null +++ b/supervision/detection/utils/masks.py @@ -0,0 +1,260 @@ +import cv2 +import numpy as np +import numpy.typing as npt + + +def move_masks( + masks: npt.NDArray[np.bool_], + offset: npt.NDArray[np.int32], + resolution_wh: tuple[int, int], +) -> npt.NDArray[np.bool_]: + """ + Offset the masks in an array by the specified (x, y) amount. + + Args: + masks (npt.NDArray[np.bool_]): A 3D array of binary masks corresponding to the + predictions. Shape: `(N, H, W)`, where N is the number of predictions, and + H, W are the dimensions of each mask. + offset (npt.NDArray[np.int32]): An array of shape `(2,)` containing int values + `[dx, dy]`. Supports both positive and negative values for bidirectional + movement. + resolution_wh (Tuple[int, int]): The width and height of the desired mask + resolution. + + Returns: + (npt.NDArray[np.bool_]) repositioned masks, optionally padded to the specified + shape. + + Examples: + ```python + import numpy as np + import supervision as sv + + mask = np.array([[[False, False, False, False], + [False, True, True, False], + [False, True, True, False], + [False, False, False, False]]], dtype=bool) + + offset = np.array([1, 1]) + sv.move_masks(mask, offset, resolution_wh=(4, 4)) + # array([[[False, False, False, False], + # [False, False, False, False], + # [False, False, True, True], + # [False, False, True, True]]], dtype=bool) + + offset = np.array([-2, 2]) + sv.move_masks(mask, offset, resolution_wh=(4, 4)) + # array([[[False, False, False, False], + # [False, False, False, False], + # [False, False, False, False], + # [True, False, False, False]]], dtype=bool) + ``` + """ + mask_array = np.full((masks.shape[0], resolution_wh[1], resolution_wh[0]), False) + + if offset[0] < 0: + source_x_start = -offset[0] + source_x_end = min(masks.shape[2], resolution_wh[0] - offset[0]) + destination_x_start = 0 + destination_x_end = min(resolution_wh[0], masks.shape[2] + offset[0]) + else: + source_x_start = 0 + source_x_end = min(masks.shape[2], resolution_wh[0] - offset[0]) + destination_x_start = offset[0] + destination_x_end = offset[0] + source_x_end - source_x_start + + if offset[1] < 0: + source_y_start = -offset[1] + source_y_end = min(masks.shape[1], resolution_wh[1] - offset[1]) + destination_y_start = 0 + destination_y_end = min(resolution_wh[1], masks.shape[1] + offset[1]) + else: + source_y_start = 0 + source_y_end = min(masks.shape[1], resolution_wh[1] - offset[1]) + destination_y_start = offset[1] + destination_y_end = offset[1] + source_y_end - source_y_start + + if source_x_end > source_x_start and source_y_end > source_y_start: + mask_array[ + :, + destination_y_start:destination_y_end, + destination_x_start:destination_x_end, + ] = masks[:, source_y_start:source_y_end, source_x_start:source_x_end] + + return mask_array + + +def calculate_masks_centroids(masks: np.ndarray) -> np.ndarray: + """ + Calculate the centroids of binary masks in a tensor. + + Parameters: + masks (np.ndarray): A 3D NumPy array of shape (num_masks, height, width). + Each 2D array in the tensor represents a binary mask. + + Returns: + A 2D NumPy array of shape (num_masks, 2), where each row contains the x and y + coordinates (in that order) of the centroid of the corresponding mask. + """ + num_masks, height, width = masks.shape + total_pixels = masks.sum(axis=(1, 2)) + + # offset for 1-based indexing + vertical_indices, horizontal_indices = np.indices((height, width)) + 0.5 + # avoid division by zero for empty masks + total_pixels[total_pixels == 0] = 1 + + def sum_over_mask(indices: np.ndarray, axis: tuple) -> np.ndarray: + return np.tensordot(masks, indices, axes=axis) + + aggregation_axis = ([1, 2], [0, 1]) + centroid_x = sum_over_mask(horizontal_indices, aggregation_axis) / total_pixels + centroid_y = sum_over_mask(vertical_indices, aggregation_axis) / total_pixels + + return np.column_stack((centroid_x, centroid_y)).astype(int) + + +def contains_holes(mask: npt.NDArray[np.bool_]) -> bool: + """ + Checks if the binary mask contains holes (background pixels fully enclosed by + foreground pixels). + + Args: + mask (npt.NDArray[np.bool_]): 2D binary mask where `True` indicates foreground + object and `False` indicates background. + + Returns: + True if holes are detected, False otherwise. + + Examples: + ```python + import numpy as np + import supervision as sv + + mask = np.array([ + [0, 0, 0, 0, 0], + [0, 1, 1, 1, 0], + [0, 1, 0, 1, 0], + [0, 1, 1, 1, 0], + [0, 0, 0, 0, 0] + ]).astype(bool) + + sv.contains_holes(mask=mask) + # True + + mask = np.array([ + [0, 0, 0, 0, 0], + [0, 1, 1, 1, 0], + [0, 1, 1, 1, 0], + [0, 1, 1, 1, 0], + [0, 0, 0, 0, 0] + ]).astype(bool) + + sv.contains_holes(mask=mask) + # False + ``` + + ![contains_holes](https://media.roboflow.com/supervision-docs/contains-holes.png){ align=center width="800" } + """ # noqa E501 // docs + mask_uint8 = mask.astype(np.uint8) + _, hierarchy = cv2.findContours(mask_uint8, cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE) + + if hierarchy is not None: + parent_contour_index = 3 + for h in hierarchy[0]: + if h[parent_contour_index] != -1: + return True + return False + + +def contains_multiple_segments( + mask: npt.NDArray[np.bool_], connectivity: int = 4 +) -> bool: + """ + Checks if the binary mask contains multiple unconnected foreground segments. + + Args: + mask (npt.NDArray[np.bool_]): 2D binary mask where `True` indicates foreground + object and `False` indicates background. + connectivity (int) : Default: 4 is 4-way connectivity, which means that + foreground pixels are the part of the same segment/component + if their edges touch. + Alternatively: 8 for 8-way connectivity, when foreground pixels are + connected by their edges or corners touch. + + Returns: + True when the mask contains multiple not connected components, False otherwise. + + Raises: + ValueError: If connectivity(int) parameter value is not 4 or 8. + + Examples: + ```python + import numpy as np + import supervision as sv + + mask = np.array([ + [0, 0, 0, 0, 0, 0], + [0, 1, 1, 0, 1, 1], + [0, 1, 1, 0, 1, 1], + [0, 0, 0, 0, 0, 0], + [0, 1, 1, 1, 0, 0], + [0, 1, 1, 1, 0, 0] + ]).astype(bool) + + sv.contains_multiple_segments(mask=mask, connectivity=4) + # True + + mask = np.array([ + [0, 0, 0, 0, 0, 0], + [0, 1, 1, 1, 1, 1], + [0, 1, 1, 1, 1, 1], + [0, 1, 1, 1, 1, 1], + [0, 1, 1, 1, 1, 1], + [0, 0, 0, 0, 0, 0] + ]).astype(bool) + + sv.contains_multiple_segments(mask=mask, connectivity=4) + # False + ``` + + ![contains_multiple_segments](https://media.roboflow.com/supervision-docs/contains-multiple-segments.png){ align=center width="800" } + """ # noqa E501 // docs + if connectivity != 4 and connectivity != 8: + raise ValueError( + "Incorrect connectivity value. Possible connectivity values: 4 or 8." + ) + mask_uint8 = mask.astype(np.uint8) + labels = np.zeros_like(mask_uint8, dtype=np.int32) + number_of_labels, _ = cv2.connectedComponents( + mask_uint8, labels, connectivity=connectivity + ) + return number_of_labels > 2 + + +def resize_masks(masks: np.ndarray, max_dimension: int = 640) -> np.ndarray: + """ + Resize all masks in the array to have a maximum dimension of max_dimension, + maintaining aspect ratio. + + Args: + masks (np.ndarray): 3D array of binary masks with shape (N, H, W). + max_dimension (int): The maximum dimension for the resized masks. + + Returns: + np.ndarray: Array of resized masks. + """ + max_height = np.max(masks.shape[1]) + max_width = np.max(masks.shape[2]) + scale = min(max_dimension / max_height, max_dimension / max_width) + + new_height = int(scale * max_height) + new_width = int(scale * max_width) + + x = np.linspace(0, max_width - 1, new_width).astype(int) + y = np.linspace(0, max_height - 1, new_height).astype(int) + xv, yv = np.meshgrid(x, y) + + resized_masks = masks[:, yv, xv] + + return resized_masks.reshape(masks.shape[0], new_height, new_width) diff --git a/supervision/detection/utils/polygons.py b/supervision/detection/utils/polygons.py new file mode 100644 index 00000000..3998e700 --- /dev/null +++ b/supervision/detection/utils/polygons.py @@ -0,0 +1,85 @@ +import cv2 +import numpy as np + + +def filter_polygons_by_area( + polygons: list[np.ndarray], + min_area: float | None = None, + max_area: float | None = None, +) -> list[np.ndarray]: + """ + Filters a list of polygons based on their area. + + Parameters: + polygons (List[np.ndarray]): A list of polygons, where each polygon is + represented by a NumPy array of shape `(N, 2)`, + containing the `x`, `y` coordinates of the points. + min_area (Optional[float]): The minimum area threshold. + Only polygons with an area greater than or equal to this value + will be included in the output. If set to None, + no minimum area constraint will be applied. + max_area (Optional[float]): The maximum area threshold. + Only polygons with an area less than or equal to this value + will be included in the output. If set to None, + no maximum area constraint will be applied. + + Returns: + List[np.ndarray]: A new list of polygons containing only those with + areas within the specified thresholds. + """ + if min_area is None and max_area is None: + return polygons + ares = [cv2.contourArea(polygon) for polygon in polygons] + return [ + polygon + for polygon, area in zip(polygons, ares) + if (min_area is None or area >= min_area) + and (max_area is None or area <= max_area) + ] + + +def approximate_polygon( + polygon: np.ndarray, percentage: float, epsilon_step: float = 0.05 +) -> np.ndarray: + """ + Approximates a given polygon by reducing a certain percentage of points. + + This function uses the Ramer-Douglas-Peucker algorithm to simplify the input + polygon by reducing the number of points + while preserving the general shape. + + Parameters: + polygon (np.ndarray): A 2D NumPy array of shape `(N, 2)` containing + the `x`, `y` coordinates of the input polygon's points. + percentage (float): The percentage of points to be removed from the + input polygon, in the range `[0, 1)`. + epsilon_step (float): Approximation accuracy step. + Epsilon is the maximum distance between the original curve + and its approximation. + + Returns: + np.ndarray: A new 2D NumPy array of shape `(M, 2)`, + where `M <= N * (1 - percentage)`, containing + the `x`, `y` coordinates of the + approximated polygon's points. + """ + + if percentage < 0 or percentage >= 1: + raise ValueError("Percentage must be in the range [0, 1).") + + target_points = max(int(len(polygon) * (1 - percentage)), 3) + + if len(polygon) <= target_points: + return polygon + + epsilon = 0 + approximated_points = polygon + while True: + epsilon += epsilon_step + new_approximated_points = cv2.approxPolyDP(polygon, epsilon, closed=True) + if len(new_approximated_points) > target_points: + approximated_points = new_approximated_points + else: + break + + return np.squeeze(approximated_points, axis=1) \ No newline at end of file diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 3adec2bc..d6f293af 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -10,11 +10,8 @@ from typing import Any import numpy as np from PIL import Image -from supervision.detection.utils import ( - denormalize_boxes, - polygon_to_mask, - polygon_to_xyxy, -) +from supervision.detection.utils.boxes import denormalize_boxes +from supervision.detection.utils.converters import polygon_to_mask, polygon_to_xyxy from supervision.utils.internal import deprecated from supervision.validators import validate_resolution diff --git a/supervision/keypoint/annotators.py b/supervision/keypoint/annotators.py index 5d74ea11..d83d7d5e 100644 --- a/supervision/keypoint/annotators.py +++ b/supervision/keypoint/annotators.py @@ -7,7 +7,7 @@ import cv2 import numpy as np from supervision.annotators.base import ImageType -from supervision.detection.utils import pad_boxes, spread_out_boxes +from supervision.detection.utils.boxes import pad_boxes, spread_out_boxes from supervision.draw.color import Color from supervision.draw.utils import draw_rounded_rectangle from supervision.geometry.core import Rect diff --git a/supervision/keypoint/core.py b/supervision/keypoint/core.py index 89bfe0b8..0d57c561 100644 --- a/supervision/keypoint/core.py +++ b/supervision/keypoint/core.py @@ -9,7 +9,7 @@ import numpy.typing as npt from supervision.config import CLASS_NAME_DATA_FIELD from supervision.detection.core import Detections -from supervision.detection.utils import get_data_item, is_data_equal +from supervision.detection.utils.internal import get_data_item, is_data_equal from supervision.validators import validate_keypoints_fields diff --git a/supervision/metrics/detection.py b/supervision/metrics/detection.py index 1a55de55..438b6a80 100644 --- a/supervision/metrics/detection.py +++ b/supervision/metrics/detection.py @@ -9,7 +9,7 @@ import numpy as np from supervision.dataset.core import DetectionDataset from supervision.detection.core import Detections -from supervision.detection.utils import box_iou_batch +from supervision.detection.utils.iou_and_nms import box_iou_batch def detections_to_tensor( diff --git a/supervision/metrics/f1_score.py b/supervision/metrics/f1_score.py index 193eb915..c68ebbad 100644 --- a/supervision/metrics/f1_score.py +++ b/supervision/metrics/f1_score.py @@ -9,11 +9,9 @@ from matplotlib import pyplot as plt from supervision.config import ORIENTED_BOX_COORDINATES from supervision.detection.core import Detections -from supervision.detection.utils import ( - box_iou_batch, - mask_iou_batch, - oriented_box_iou_batch, -) +from supervision.detection.utils.iou_and_nms import box_iou_batch, mask_iou_batch, \ + oriented_box_iou_batch + from supervision.draw.color import LEGACY_COLOR_PALETTE from supervision.metrics.core import AveragingMethod, Metric, MetricTarget from supervision.metrics.utils.object_size import ( diff --git a/supervision/metrics/mean_average_recall.py b/supervision/metrics/mean_average_recall.py index 37aa2d4e..b96582d9 100644 --- a/supervision/metrics/mean_average_recall.py +++ b/supervision/metrics/mean_average_recall.py @@ -9,11 +9,9 @@ from matplotlib import pyplot as plt from supervision.config import ORIENTED_BOX_COORDINATES from supervision.detection.core import Detections -from supervision.detection.utils import ( - box_iou_batch, - mask_iou_batch, - oriented_box_iou_batch, -) +from supervision.detection.utils.iou_and_nms import box_iou_batch, mask_iou_batch, \ + oriented_box_iou_batch + from supervision.draw.color import LEGACY_COLOR_PALETTE from supervision.metrics.core import Metric, MetricTarget from supervision.metrics.utils.object_size import ( diff --git a/supervision/metrics/precision.py b/supervision/metrics/precision.py index e77b78eb..4916094a 100644 --- a/supervision/metrics/precision.py +++ b/supervision/metrics/precision.py @@ -9,11 +9,8 @@ from matplotlib import pyplot as plt from supervision.config import ORIENTED_BOX_COORDINATES from supervision.detection.core import Detections -from supervision.detection.utils import ( - box_iou_batch, - mask_iou_batch, - oriented_box_iou_batch, -) +from supervision.detection.utils.iou_and_nms import box_iou_batch, mask_iou_batch, \ + oriented_box_iou_batch from supervision.draw.color import LEGACY_COLOR_PALETTE from supervision.metrics.core import AveragingMethod, Metric, MetricTarget from supervision.metrics.utils.object_size import ( diff --git a/supervision/metrics/recall.py b/supervision/metrics/recall.py index 1e1ae3e0..582eb8ba 100644 --- a/supervision/metrics/recall.py +++ b/supervision/metrics/recall.py @@ -9,11 +9,9 @@ from matplotlib import pyplot as plt from supervision.config import ORIENTED_BOX_COORDINATES from supervision.detection.core import Detections -from supervision.detection.utils import ( - box_iou_batch, - mask_iou_batch, - oriented_box_iou_batch, -) +from supervision.detection.utils.iou_and_nms import box_iou_batch, mask_iou_batch, \ + oriented_box_iou_batch + from supervision.draw.color import LEGACY_COLOR_PALETTE from supervision.metrics.core import AveragingMethod, Metric, MetricTarget from supervision.metrics.utils.object_size import ( diff --git a/supervision/tracker/byte_tracker/core.py b/supervision/tracker/byte_tracker/core.py index 7b506763..9c75299e 100644 --- a/supervision/tracker/byte_tracker/core.py +++ b/supervision/tracker/byte_tracker/core.py @@ -1,7 +1,7 @@ import numpy as np from supervision.detection.core import Detections -from supervision.detection.utils import box_iou_batch +from supervision.detection.utils.iou_and_nms import box_iou_batch from supervision.tracker.byte_tracker import matching from supervision.tracker.byte_tracker.kalman_filter import KalmanFilter from supervision.tracker.byte_tracker.single_object_track import STrack, TrackState diff --git a/supervision/tracker/byte_tracker/matching.py b/supervision/tracker/byte_tracker/matching.py index 5850dc9e..bdd8196e 100644 --- a/supervision/tracker/byte_tracker/matching.py +++ b/supervision/tracker/byte_tracker/matching.py @@ -5,7 +5,7 @@ from typing import TYPE_CHECKING import numpy as np from scipy.optimize import linear_sum_assignment -from supervision.detection.utils import box_iou_batch +from supervision.detection.utils.iou_and_nms import box_iou_batch if TYPE_CHECKING: from supervision.tracker.byte_tracker.core import STrack diff --git a/test/detection/test_utils.py b/test/detection/test_utils.py deleted file mode 100644 index eb76b996..00000000 --- a/test/detection/test_utils.py +++ /dev/null @@ -1,1642 +0,0 @@ -from __future__ import annotations - -from contextlib import ExitStack as DoesNotRaise -from typing import Any - -import numpy as np -import numpy.typing as npt -import pytest - -from supervision.config import CLASS_NAME_DATA_FIELD -from supervision.detection.utils import ( - calculate_masks_centroids, - clip_boxes, - contains_holes, - contains_multiple_segments, - filter_polygons_by_area, - get_data_item, - merge_data, - merge_metadata, - move_boxes, - move_masks, - process_roboflow_result, - scale_boxes, - xcycwh_to_xyxy, - xywh_to_xyxy, - xyxy_to_xcycarh, - xyxy_to_xywh, -) - -TEST_MASK = np.zeros((1, 1000, 1000), dtype=bool) -TEST_MASK[:, 300:351, 200:251] = True - - -@pytest.mark.parametrize( - "xyxy, resolution_wh, expected_result", - [ - ( - np.empty(shape=(0, 4)), - (1280, 720), - np.empty(shape=(0, 4)), - ), - ( - np.array([[1.0, 1.0, 1279.0, 719.0]]), - (1280, 720), - np.array([[1.0, 1.0, 1279.0, 719.0]]), - ), - ( - np.array([[-1.0, 1.0, 1279.0, 719.0]]), - (1280, 720), - np.array([[0.0, 1.0, 1279.0, 719.0]]), - ), - ( - np.array([[1.0, -1.0, 1279.0, 719.0]]), - (1280, 720), - np.array([[1.0, 0.0, 1279.0, 719.0]]), - ), - ( - np.array([[1.0, 1.0, 1281.0, 719.0]]), - (1280, 720), - np.array([[1.0, 1.0, 1280.0, 719.0]]), - ), - ( - np.array([[1.0, 1.0, 1279.0, 721.0]]), - (1280, 720), - np.array([[1.0, 1.0, 1279.0, 720.0]]), - ), - ], -) -def test_clip_boxes( - xyxy: np.ndarray, - resolution_wh: tuple[int, int], - expected_result: np.ndarray, -) -> None: - result = clip_boxes(xyxy=xyxy, resolution_wh=resolution_wh) - assert np.array_equal(result, expected_result) - - -@pytest.mark.parametrize( - "polygons, min_area, max_area, expected_result, exception", - [ - ( - [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], - None, - None, - [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], - DoesNotRaise(), - ), # single polygon without area constraints - ( - [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], - 50, - None, - [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], - DoesNotRaise(), - ), # single polygon with min_area constraint - ( - [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], - None, - 50, - [], - DoesNotRaise(), - ), # single polygon with max_area constraint - ( - [ - np.array([[0, 0], [0, 10], [10, 10], [10, 0]]), - np.array([[0, 0], [0, 20], [20, 20], [20, 0]]), - ], - 200, - None, - [np.array([[0, 0], [0, 20], [20, 20], [20, 0]])], - DoesNotRaise(), - ), # two polygons with min_area constraint - ( - [ - np.array([[0, 0], [0, 10], [10, 10], [10, 0]]), - np.array([[0, 0], [0, 20], [20, 20], [20, 0]]), - ], - None, - 200, - [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], - DoesNotRaise(), - ), # two polygons with max_area constraint - ( - [ - np.array([[0, 0], [0, 10], [10, 10], [10, 0]]), - np.array([[0, 0], [0, 20], [20, 20], [20, 0]]), - ], - 200, - 200, - [], - DoesNotRaise(), - ), # two polygons with both area constraints - ( - [ - np.array([[0, 0], [0, 10], [10, 10], [10, 0]]), - np.array([[0, 0], [0, 20], [20, 20], [20, 0]]), - ], - 100, - 100, - [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], - DoesNotRaise(), - ), # two polygons with min_area and - # max_area equal to the area of the first polygon - ( - [ - np.array([[0, 0], [0, 10], [10, 10], [10, 0]]), - np.array([[0, 0], [0, 20], [20, 20], [20, 0]]), - ], - 400, - 400, - [np.array([[0, 0], [0, 20], [20, 20], [20, 0]])], - DoesNotRaise(), - ), # two polygons with min_area and - # max_area equal to the area of the second polygon - ], -) -def test_filter_polygons_by_area( - polygons: list[np.ndarray], - min_area: float | None, - max_area: float | None, - expected_result: list[np.ndarray], - exception: Exception, -) -> None: - with exception: - result = filter_polygons_by_area( - polygons=polygons, min_area=min_area, max_area=max_area - ) - assert len(result) == len(expected_result) - for result_polygon, expected_result_polygon in zip(result, expected_result): - assert np.array_equal(result_polygon, expected_result_polygon) - - -@pytest.mark.parametrize( - "roboflow_result, expected_result, exception", - [ - ( - {"predictions": [], "image": {"width": 1000, "height": 1000}}, - ( - np.empty((0, 4)), - np.empty(0), - np.empty(0), - None, - None, - {CLASS_NAME_DATA_FIELD: np.empty(0)}, - ), - DoesNotRaise(), - ), # empty result - ( - { - "predictions": [ - { - "x": 200.0, - "y": 300.0, - "width": 50.0, - "height": 50.0, - "confidence": 0.9, - "class_id": 0, - "class": "person", - } - ], - "image": {"width": 1000, "height": 1000}, - }, - ( - np.array([[175.0, 275.0, 225.0, 325.0]]), - np.array([0.9]), - np.array([0]), - None, - None, - {CLASS_NAME_DATA_FIELD: np.array(["person"])}, - ), - DoesNotRaise(), - ), # single correct object detection result - ( - { - "predictions": [ - { - "x": 200.0, - "y": 300.0, - "width": 50.0, - "height": 50.0, - "confidence": 0.9, - "class_id": 0, - "class": "person", - "tracker_id": 1, - }, - { - "x": 500.0, - "y": 500.0, - "width": 100.0, - "height": 100.0, - "confidence": 0.8, - "class_id": 7, - "class": "truck", - "tracker_id": 2, - }, - ], - "image": {"width": 1000, "height": 1000}, - }, - ( - np.array([[175.0, 275.0, 225.0, 325.0], [450.0, 450.0, 550.0, 550.0]]), - np.array([0.9, 0.8]), - np.array([0, 7]), - None, - np.array([1, 2]), - {CLASS_NAME_DATA_FIELD: np.array(["person", "truck"])}, - ), - DoesNotRaise(), - ), # two correct object detection result - ( - { - "predictions": [ - { - "x": 200.0, - "y": 300.0, - "width": 50.0, - "height": 50.0, - "confidence": 0.9, - "class_id": 0, - "class": "person", - "points": [], - "tracker_id": None, - } - ], - "image": {"width": 1000, "height": 1000}, - }, - ( - np.empty((0, 4)), - np.empty(0), - np.empty(0), - None, - None, - {CLASS_NAME_DATA_FIELD: np.empty(0)}, - ), - DoesNotRaise(), - ), # single incorrect instance segmentation result with no points - ( - { - "predictions": [ - { - "x": 200.0, - "y": 300.0, - "width": 50.0, - "height": 50.0, - "confidence": 0.9, - "class_id": 0, - "class": "person", - "points": [{"x": 200.0, "y": 300.0}, {"x": 250.0, "y": 300.0}], - } - ], - "image": {"width": 1000, "height": 1000}, - }, - ( - np.empty((0, 4)), - np.empty(0), - np.empty(0), - None, - None, - {CLASS_NAME_DATA_FIELD: np.empty(0)}, - ), - DoesNotRaise(), - ), # single incorrect instance segmentation result with no enough points - ( - { - "predictions": [ - { - "x": 200.0, - "y": 300.0, - "width": 50.0, - "height": 50.0, - "confidence": 0.9, - "class_id": 0, - "class": "person", - "points": [ - {"x": 200.0, "y": 300.0}, - {"x": 250.0, "y": 300.0}, - {"x": 250.0, "y": 350.0}, - {"x": 200.0, "y": 350.0}, - ], - } - ], - "image": {"width": 1000, "height": 1000}, - }, - ( - np.array([[175.0, 275.0, 225.0, 325.0]]), - np.array([0.9]), - np.array([0]), - TEST_MASK, - None, - {CLASS_NAME_DATA_FIELD: np.array(["person"])}, - ), - DoesNotRaise(), - ), # single incorrect instance segmentation result with no enough points - ( - { - "predictions": [ - { - "x": 200.0, - "y": 300.0, - "width": 50.0, - "height": 50.0, - "confidence": 0.9, - "class_id": 0, - "class": "person", - "points": [ - {"x": 200.0, "y": 300.0}, - {"x": 250.0, "y": 300.0}, - {"x": 250.0, "y": 350.0}, - {"x": 200.0, "y": 350.0}, - ], - }, - { - "x": 500.0, - "y": 500.0, - "width": 100.0, - "height": 100.0, - "confidence": 0.8, - "class_id": 7, - "class": "truck", - "points": [], - }, - ], - "image": {"width": 1000, "height": 1000}, - }, - ( - np.array([[175.0, 275.0, 225.0, 325.0]]), - np.array([0.9]), - np.array([0]), - TEST_MASK, - None, - {CLASS_NAME_DATA_FIELD: np.array(["person"])}, - ), - DoesNotRaise(), - ), # two instance segmentation results - one correct, one incorrect - ], -) -def test_process_roboflow_result( - roboflow_result: dict, - expected_result: tuple[ - np.ndarray, np.ndarray, np.ndarray, np.ndarray | None, np.ndarray - ], - exception: Exception, -) -> None: - with exception: - result = process_roboflow_result(roboflow_result=roboflow_result) - assert np.array_equal(result[0], expected_result[0]) - assert np.array_equal(result[1], expected_result[1]) - assert np.array_equal(result[2], expected_result[2]) - assert (result[3] is None and expected_result[3] is None) or ( - np.array_equal(result[3], expected_result[3]) - ) - assert (result[4] is None and expected_result[4] is None) or ( - np.array_equal(result[4], expected_result[4]) - ) - for key in result[5]: - if isinstance(result[5][key], np.ndarray): - assert np.array_equal(result[5][key], expected_result[5][key]), ( - f"Mismatch in arrays for key {key}" - ) - else: - assert result[5][key] == expected_result[5][key], ( - f"Mismatch in non-array data for key {key}" - ) - - -@pytest.mark.parametrize( - "xyxy, offset, expected_result, exception", - [ - ( - np.empty(shape=(0, 4)), - np.array([0, 0]), - np.empty(shape=(0, 4)), - DoesNotRaise(), - ), # empty xyxy array - ( - np.array([[0, 0, 10, 10]]), - np.array([0, 0]), - np.array([[0, 0, 10, 10]]), - DoesNotRaise(), - ), # single box with zero offset - ( - np.array([[0, 0, 10, 10]]), - np.array([10, 10]), - np.array([[10, 10, 20, 20]]), - DoesNotRaise(), - ), # single box with non-zero offset - ( - np.array([[0, 0, 10, 10], [0, 0, 10, 10]]), - np.array([10, 10]), - np.array([[10, 10, 20, 20], [10, 10, 20, 20]]), - DoesNotRaise(), - ), # two boxes with non-zero offset - ( - np.array([[0, 0, 10, 10], [0, 0, 10, 10]]), - np.array([-10, -10]), - np.array([[-10, -10, 0, 0], [-10, -10, 0, 0]]), - DoesNotRaise(), - ), # two boxes with negative offset - ], -) -def test_move_boxes( - xyxy: np.ndarray, - offset: np.ndarray, - expected_result: np.ndarray, - exception: Exception, -) -> None: - with exception: - result = move_boxes(xyxy=xyxy, offset=offset) - assert np.array_equal(result, expected_result) - - -@pytest.mark.parametrize( - "masks, offset, resolution_wh, expected_result, exception", - [ - ( - np.array( - [ - [ - [False, False, False, False], - [False, True, True, False], - [False, True, True, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - np.array([0, 0]), - (4, 4), - np.array( - [ - [ - [False, False, False, False], - [False, True, True, False], - [False, True, True, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - DoesNotRaise(), - ), - ( - np.array( - [ - [ - [False, False, False, False], - [False, True, True, False], - [False, True, True, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - np.array([-1, -1]), - (4, 4), - np.array( - [ - [ - [True, True, False, False], - [True, True, False, False], - [False, False, False, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - DoesNotRaise(), - ), - ( - np.array( - [ - [ - [False, False, False, False], - [False, True, True, False], - [False, True, True, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - np.array([-2, -2]), - (4, 4), - np.array( - [ - [ - [True, False, False, False], - [False, False, False, False], - [False, False, False, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - DoesNotRaise(), - ), - ( - np.array( - [ - [ - [False, False, False, False], - [False, True, True, False], - [False, True, True, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - np.array([-3, -3]), - (4, 4), - np.array( - [ - [ - [False, False, False, False], - [False, False, False, False], - [False, False, False, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - DoesNotRaise(), - ), - ( - np.array( - [ - [ - [False, False, False, False], - [False, True, True, False], - [False, True, True, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - np.array([-2, -1]), - (4, 4), - np.array( - [ - [ - [True, False, False, False], - [True, False, False, False], - [False, False, False, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - DoesNotRaise(), - ), - ( - np.array( - [ - [ - [False, False, False, False], - [False, True, True, False], - [False, True, True, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - np.array([-1, -2]), - (4, 4), - np.array( - [ - [ - [True, True, False, False], - [False, False, False, False], - [False, False, False, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - DoesNotRaise(), - ), - ( - np.array( - [ - [ - [False, False, False, False], - [False, True, True, False], - [False, True, True, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - np.array([-2, 2]), - (4, 4), - np.array( - [ - [ - [False, False, False, False], - [False, False, False, False], - [False, False, False, False], - [True, False, False, False], - ] - ], - dtype=bool, - ), - DoesNotRaise(), - ), - ( - np.array( - [ - [ - [False, False, False, False], - [False, True, True, False], - [False, True, True, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - np.array([3, 3]), - (4, 4), - np.array( - [ - [ - [False, False, False, False], - [False, False, False, False], - [False, False, False, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - DoesNotRaise(), - ), - ( - np.array( - [ - [ - [False, False, False, False], - [False, True, True, False], - [False, True, True, False], - [False, False, False, False], - ] - ], - dtype=bool, - ), - np.array([3, 3]), - (6, 6), - np.array( - [ - [ - [False, False, False, False, False, False], - [False, False, False, False, False, False], - [False, False, False, False, False, False], - [False, False, False, False, False, False], - [False, False, False, False, True, True], - [False, False, False, False, True, True], - ] - ], - dtype=bool, - ), - DoesNotRaise(), - ), - ], -) -def test_move_masks( - masks: np.ndarray, - offset: np.ndarray, - resolution_wh: tuple[int, int], - expected_result: np.ndarray, - exception: Exception, -) -> None: - with exception: - result = move_masks(masks=masks, offset=offset, resolution_wh=resolution_wh) - np.testing.assert_array_equal(result, expected_result) - - -@pytest.mark.parametrize( - "xyxy, factor, expected_result, exception", - [ - ( - np.empty(shape=(0, 4)), - 2.0, - np.empty(shape=(0, 4)), - DoesNotRaise(), - ), # empty xyxy array - ( - np.array([[0, 0, 10, 10]]), - 1.0, - np.array([[0, 0, 10, 10]]), - DoesNotRaise(), - ), # single box with factor equal to 1.0 - ( - np.array([[0, 0, 10, 10]]), - 2.0, - np.array([[-5, -5, 15, 15]]), - DoesNotRaise(), - ), # single box with factor equal to 2.0 - ( - np.array([[0, 0, 10, 10]]), - 0.5, - np.array([[2.5, 2.5, 7.5, 7.5]]), - DoesNotRaise(), - ), # single box with factor equal to 0.5 - ( - np.array([[0, 0, 10, 10], [10, 10, 30, 30]]), - 2.0, - np.array([[-5, -5, 15, 15], [0, 0, 40, 40]]), - DoesNotRaise(), - ), # two boxes with factor equal to 2.0 - ], -) -def test_scale_boxes( - xyxy: np.ndarray, - factor: float, - expected_result: np.ndarray, - exception: Exception, -) -> None: - with exception: - result = scale_boxes(xyxy=xyxy, factor=factor) - assert np.array_equal(result, expected_result) - - -@pytest.mark.parametrize( - "masks, expected_result, exception", - [ - ( - np.array( - [ - [ - [0, 0, 0, 0], - [0, 0, 0, 0], - [0, 0, 0, 0], - [0, 0, 0, 0], - ] - ] - ), - np.array([[0, 0]]), - DoesNotRaise(), - ), # single mask with all zeros - ( - np.array( - [ - [ - [1, 1, 1, 1], - [1, 1, 1, 1], - [1, 1, 1, 1], - [1, 1, 1, 1], - ] - ] - ), - np.array([[2, 2]]), - DoesNotRaise(), - ), # single mask with all ones - ( - np.array( - [ - [ - [0, 1, 1, 0], - [1, 1, 1, 1], - [1, 1, 1, 1], - [0, 1, 1, 0], - ] - ] - ), - np.array([[2, 2]]), - DoesNotRaise(), - ), # single mask with symmetric ones - ( - np.array( - [ - [ - [0, 0, 0, 0], - [0, 0, 1, 1], - [0, 0, 1, 1], - [0, 0, 0, 0], - ] - ] - ), - np.array([[3, 2]]), - DoesNotRaise(), - ), # single mask with asymmetric ones - ( - np.array( - [ - [ - [0, 1, 1, 0], - [1, 1, 1, 1], - [1, 1, 1, 1], - [0, 1, 1, 0], - ], - [ - [0, 0, 0, 0], - [0, 0, 1, 1], - [0, 0, 1, 1], - [0, 0, 0, 0], - ], - ] - ), - np.array([[2, 2], [3, 2]]), - DoesNotRaise(), - ), # two masks - ], -) -def test_calculate_masks_centroids( - masks: np.ndarray, - expected_result: np.ndarray, - exception: Exception, -) -> None: - with exception: - result = calculate_masks_centroids(masks=masks) - assert np.array_equal(result, expected_result) - - -@pytest.mark.parametrize( - "data_list, expected_result, exception", - [ - ( - [], - {}, - DoesNotRaise(), - ), # empty data list - ( - [{}], - {}, - DoesNotRaise(), - ), # single empty data dict - ( - [{}, {}], - {}, - DoesNotRaise(), - ), # two empty data dicts - ( - [ - {"test_1": []}, - ], - {"test_1": []}, - DoesNotRaise(), - ), # single data dict with a single field name and empty list values - ( - [ - {"test_1": []}, - {"test_1": []}, - ], - {"test_1": []}, - DoesNotRaise(), - ), # two data dicts with the same field name and empty list values - ( - [ - {"test_1": np.array([])}, - ], - {"test_1": np.array([])}, - DoesNotRaise(), - ), # single data dict with a single field name and empty np.array values - ( - [ - {"test_1": np.array([])}, - {"test_1": np.array([])}, - ], - {"test_1": np.array([])}, - DoesNotRaise(), - ), # two data dicts with the same field name and empty np.array values - ( - [ - {"test_1": [1, 2, 3]}, - ], - {"test_1": [1, 2, 3]}, - DoesNotRaise(), - ), # single data dict with a single field name and list values - ( - [ - {"test_1": []}, - {"test_1": [3, 2, 1]}, - ], - {"test_1": [3, 2, 1]}, - DoesNotRaise(), - ), # two data dicts with the same field name; one of with empty list as value - ( - [ - {"test_1": [1, 2, 3]}, - {"test_1": [3, 2, 1]}, - ], - {"test_1": [1, 2, 3, 3, 2, 1]}, - DoesNotRaise(), - ), # two data dicts with the same field name and list values - ( - [ - {"test_1": [1, 2, 3]}, - {"test_1": [3, 2, 1]}, - {"test_1": [1, 2, 3]}, - ], - {"test_1": [1, 2, 3, 3, 2, 1, 1, 2, 3]}, - DoesNotRaise(), - ), # three data dicts with the same field name and list values - ( - [ - {"test_1": [1, 2, 3]}, - {"test_2": [3, 2, 1]}, - ], - None, - pytest.raises(ValueError), - ), # two data dicts with different field names - ( - [ - {"test_1": np.array([1, 2, 3])}, - {"test_1": np.array([3, 2, 1])}, - ], - {"test_1": np.array([1, 2, 3, 3, 2, 1])}, - DoesNotRaise(), - ), # two data dicts with the same field name and np.array values as 1D arrays - ( - [ - {"test_1": np.array([[1, 2, 3]])}, - {"test_1": np.array([[3, 2, 1]])}, - ], - {"test_1": np.array([[1, 2, 3], [3, 2, 1]])}, - DoesNotRaise(), - ), # two data dicts with the same field name and np.array values as 2D arrays - ( - [ - {"test_1": np.array([1, 2, 3]), "test_2": np.array(["a", "b", "c"])}, - {"test_1": np.array([3, 2, 1]), "test_2": np.array(["c", "b", "a"])}, - ], - { - "test_1": np.array([1, 2, 3, 3, 2, 1]), - "test_2": np.array(["a", "b", "c", "c", "b", "a"]), - }, - DoesNotRaise(), - ), # two data dicts with the same field names and np.array values - ( - [ - {"test_1": [1, 2, 3], "test_2": np.array(["a", "b", "c"])}, - {"test_1": [3, 2, 1], "test_2": np.array(["c", "b", "a"])}, - ], - { - "test_1": [1, 2, 3, 3, 2, 1], - "test_2": np.array(["a", "b", "c", "c", "b", "a"]), - }, - DoesNotRaise(), - ), # two data dicts with the same field names and mixed values - ( - [ - {"test_1": np.array([1, 2, 3])}, - {"test_1": np.array([[3, 2, 1]])}, - ], - None, - pytest.raises(ValueError), - ), # two data dicts with the same field name and 1D and 2D arrays values - ( - [ - {"test_1": np.array([1, 2, 3]), "test_2": np.array(["a", "b"])}, - {"test_1": np.array([3, 2, 1]), "test_2": np.array(["c", "b", "a"])}, - ], - None, - pytest.raises(ValueError), - ), # two data dicts with the same field name and different length arrays values - ( - [{}, {"test_1": [1, 2, 3]}], - None, - pytest.raises(ValueError), - ), # two data dicts; one empty and one non-empty dict - ( - [{"test_1": [], "test_2": []}, {"test_1": [1, 2, 3], "test_2": [1, 2, 3]}], - {"test_1": [1, 2, 3], "test_2": [1, 2, 3]}, - DoesNotRaise(), - ), # two data dicts; one empty and one non-empty dict; same keys - ( - [{"test_1": []}, {"test_1": [1, 2, 3], "test_2": [4, 5, 6]}], - None, - pytest.raises(ValueError), - ), # two data dicts; one empty and one non-empty dict; different keys - ( - [ - { - "test_1": [1, 2, 3], - "test_2": [4, 5, 6], - "test_3": [7, 8, 9], - }, - {"test_1": [1, 2, 3], "test_2": [4, 5, 6]}, - ], - None, - pytest.raises(ValueError), - ), # two data dicts; one with three keys, one with two keys - ( - [ - {"test_1": [1, 2, 3]}, - {"test_1": [1, 2, 3], "test_2": [1, 2, 3]}, - ], - None, - pytest.raises(ValueError), - ), # some keys missing in one dict - ( - [ - {"test_1": [1, 2, 3], "test_2": ["a", "b"]}, - {"test_1": [4, 5], "test_2": ["c", "d", "e"]}, - ], - None, - pytest.raises(ValueError), - ), # different value lengths for the same key - ], -) -def test_merge_data( - data_list: list[dict[str, Any]], - expected_result: dict[str, Any] | None, - exception: Exception, -): - with exception: - result = merge_data(data_list=data_list) - if expected_result is None: - assert False, f"Expected an error, but got result {result}" - - for key in result: - if isinstance(result[key], np.ndarray): - assert np.array_equal(result[key], expected_result[key]), ( - f"Mismatch in arrays for key {key}" - ) - else: - assert result[key] == expected_result[key], ( - f"Mismatch in non-array data for key {key}" - ) - - -@pytest.mark.parametrize( - "data, index, expected_result, exception", - [ - ({}, 0, {}, DoesNotRaise()), # empty data dict - ( - { - "test_1": [1, 2, 3], - }, - 0, - { - "test_1": [1], - }, - DoesNotRaise(), - ), # data dict with a single list field and integer index - ( - { - "test_1": np.array([1, 2, 3]), - }, - 0, - { - "test_1": np.array([1]), - }, - DoesNotRaise(), - ), # data dict with a single np.array field and integer index - ( - { - "test_1": [1, 2, 3], - }, - slice(0, 2), - { - "test_1": [1, 2], - }, - DoesNotRaise(), - ), # data dict with a single list field and slice index - ( - { - "test_1": np.array([1, 2, 3]), - }, - slice(0, 2), - { - "test_1": np.array([1, 2]), - }, - DoesNotRaise(), - ), # data dict with a single np.array field and slice index - ( - { - "test_1": [1, 2, 3], - }, - -1, - { - "test_1": [3], - }, - DoesNotRaise(), - ), # data dict with a single list field and negative integer index - ( - { - "test_1": np.array([1, 2, 3]), - }, - -1, - { - "test_1": np.array([3]), - }, - DoesNotRaise(), - ), # data dict with a single np.array field and negative integer index - ( - { - "test_1": [1, 2, 3], - }, - [0, 2], - { - "test_1": [1, 3], - }, - DoesNotRaise(), - ), # data dict with a single list field and integer list index - ( - { - "test_1": np.array([1, 2, 3]), - }, - [0, 2], - { - "test_1": np.array([1, 3]), - }, - DoesNotRaise(), - ), # data dict with a single np.array field and integer list index - ( - { - "test_1": [1, 2, 3], - }, - np.array([0, 2]), - { - "test_1": [1, 3], - }, - DoesNotRaise(), - ), # data dict with a single list field and integer np.array index - ( - { - "test_1": np.array([1, 2, 3]), - }, - np.array([0, 2]), - { - "test_1": np.array([1, 3]), - }, - DoesNotRaise(), - ), # data dict with a single np.array field and integer np.array index - ( - { - "test_1": np.array([1, 2, 3]), - }, - np.array([True, True, True]), - { - "test_1": np.array([1, 2, 3]), - }, - DoesNotRaise(), - ), # data dict with a single np.array field and all-true bool np.array index - ( - { - "test_1": np.array([1, 2, 3]), - }, - np.array([False, False, False]), - { - "test_1": np.array([]), - }, - DoesNotRaise(), - ), # data dict with a single np.array field and all-false bool np.array index - ( - { - "test_1": np.array([1, 2, 3]), - }, - np.array([False, True, False]), - { - "test_1": np.array([2]), - }, - DoesNotRaise(), - ), # data dict with a single np.array field and mixed bool np.array index - ( - {"test_1": np.array([1, 2, 3]), "test_2": ["a", "b", "c"]}, - 0, - {"test_1": np.array([1]), "test_2": ["a"]}, - DoesNotRaise(), - ), # data dict with two fields and integer index - ( - {"test_1": np.array([1, 2, 3]), "test_2": ["a", "b", "c"]}, - -1, - {"test_1": np.array([3]), "test_2": ["c"]}, - DoesNotRaise(), - ), # data dict with two fields and negative integer index - ( - {"test_1": np.array([1, 2, 3]), "test_2": ["a", "b", "c"]}, - np.array([False, True, False]), - {"test_1": np.array([2]), "test_2": ["b"]}, - DoesNotRaise(), - ), # data dict with two fields and mixed bool np.array index - ], -) -def test_get_data_item( - data: dict[str, Any], - index: Any, - expected_result: dict[str, Any] | None, - exception: Exception, -): - with exception: - result = get_data_item(data=data, index=index) - for key in result: - if isinstance(result[key], np.ndarray): - assert np.array_equal(result[key], expected_result[key]), ( - f"Mismatch in arrays for key {key}" - ) - else: - assert result[key] == expected_result[key], ( - f"Mismatch in non-array data for key {key}" - ) - - -@pytest.mark.parametrize( - "mask, expected_result, exception", - [ - ( - np.array([[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 0, 0], [0, 1, 1, 0]]).astype( - bool - ), - False, - DoesNotRaise(), - ), # foreground object in one continuous piece - ( - np.array([[1, 0, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0], [0, 1, 1, 0]]).astype( - bool - ), - False, - DoesNotRaise(), - ), # foreground object in 2 separate elements - ( - np.array([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]).astype( - bool - ), - False, - DoesNotRaise(), - ), # no foreground pixels in mask - ( - np.array([[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]).astype( - bool - ), - False, - DoesNotRaise(), - ), # only foreground pixels in mask - ( - np.array([[1, 1, 1, 0], [1, 0, 1, 0], [1, 1, 1, 0], [0, 0, 0, 0]]).astype( - bool - ), - True, - DoesNotRaise(), - ), # foreground object has 1 hole - ( - np.array([[1, 1, 1, 0], [1, 0, 1, 1], [1, 1, 0, 1], [0, 1, 1, 1]]).astype( - bool - ), - True, - DoesNotRaise(), - ), # foreground object has 2 holes - ], -) -def test_contains_holes( - mask: npt.NDArray[np.bool_], expected_result: bool, exception: Exception -) -> None: - with exception: - result = contains_holes(mask) - assert result == expected_result - - -@pytest.mark.parametrize( - "mask, connectivity, expected_result, exception", - [ - ( - np.array([[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 0, 0], [0, 1, 1, 0]]).astype( - bool - ), - 4, - False, - DoesNotRaise(), - ), # foreground object in one continuous piece - ( - np.array([[1, 0, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0], [0, 1, 1, 0]]).astype( - bool - ), - 4, - True, - DoesNotRaise(), - ), # foreground object in 2 separate elements - ( - np.array([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]).astype( - bool - ), - 4, - False, - DoesNotRaise(), - ), # no foreground pixels in mask - ( - np.array([[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]).astype( - bool - ), - 4, - False, - DoesNotRaise(), - ), # only foreground pixels in mask - ( - np.array([[1, 1, 1, 0], [1, 0, 1, 1], [1, 1, 0, 1], [0, 1, 1, 1]]).astype( - bool - ), - 4, - False, - DoesNotRaise(), - ), # foreground object has 2 holes, but is in single piece - ( - np.array([[1, 1, 0, 0], [1, 1, 0, 1], [1, 0, 1, 1], [0, 0, 1, 1]]).astype( - bool - ), - 4, - True, - DoesNotRaise(), - ), # foreground object in 2 elements with respect to 4-way connectivity - ( - np.array([[1, 1, 0, 0], [1, 1, 0, 1], [1, 0, 1, 1], [0, 0, 1, 1]]).astype( - bool - ), - 8, - False, - DoesNotRaise(), - ), # foreground object in single piece with respect to 8-way connectivity - ( - np.array([[1, 1, 0, 0], [1, 1, 0, 1], [1, 0, 1, 1], [0, 0, 1, 1]]).astype( - bool - ), - 5, - None, - pytest.raises(ValueError), - ), # Incorrect connectivity parameter value, raises ValueError - ], -) -def test_contains_multiple_segments( - mask: npt.NDArray[np.bool_], - connectivity: int, - expected_result: bool, - exception: Exception, -) -> None: - with exception: - result = contains_multiple_segments(mask=mask, connectivity=connectivity) - assert result == expected_result - - -@pytest.mark.parametrize( - "xywh, expected_result", - [ - (np.array([[10, 20, 30, 40]]), np.array([[10, 20, 40, 60]])), # standard case - (np.array([[0, 0, 0, 0]]), np.array([[0, 0, 0, 0]])), # zero size bounding box - ( - np.array([[50, 50, 100, 100]]), - np.array([[50, 50, 150, 150]]), - ), # large bounding box - ( - np.array([[-10, -20, 30, 40]]), - np.array([[-10, -20, 20, 20]]), - ), # negative coordinates - (np.array([[50, 50, 0, 30]]), np.array([[50, 50, 50, 80]])), # zero width - (np.array([[50, 50, 20, 0]]), np.array([[50, 50, 70, 50]])), # zero height - (np.array([]).reshape(0, 4), np.array([]).reshape(0, 4)), # empty array - ], -) -def test_xywh_to_xyxy(xywh: np.ndarray, expected_result: np.ndarray) -> None: - result = xywh_to_xyxy(xywh) - np.testing.assert_array_equal(result, expected_result) - - -@pytest.mark.parametrize( - "xyxy, expected_result", - [ - (np.array([[10, 20, 40, 60]]), np.array([[10, 20, 30, 40]])), # standard case - (np.array([[0, 0, 0, 0]]), np.array([[0, 0, 0, 0]])), # zero size bounding box - ( - np.array([[50, 50, 150, 150]]), - np.array([[50, 50, 100, 100]]), - ), # large bounding box - ( - np.array([[-10, -20, 20, 20]]), - np.array([[-10, -20, 30, 40]]), - ), # negative coordinates - (np.array([[50, 50, 50, 80]]), np.array([[50, 50, 0, 30]])), # zero width - (np.array([[50, 50, 70, 50]]), np.array([[50, 50, 20, 0]])), # zero height - (np.array([]).reshape(0, 4), np.array([]).reshape(0, 4)), # empty array - ], -) -def test_xyxy_to_xywh(xyxy: np.ndarray, expected_result: np.ndarray) -> None: - result = xyxy_to_xywh(xyxy) - np.testing.assert_array_equal(result, expected_result) - - -@pytest.mark.parametrize( - "xyxy, expected_result", - [ - # Empty and zero cases - (np.array([]).reshape(0, 4), np.array([]).reshape(0, 4)), # empty array - ( - np.array([[0, 0, 0, 0]]), - np.array([[0, 0, 0.0, 0]]), - ), # zero size bounding box - ( - np.array([[10, 10, 10, 10]]), - np.array([[10, 10, 0.0, 0]]), - ), # point (x1=x2, y1=y2) - # Zero width/height cases - (np.array([[50, 50, 80, 50]]), np.array([[65, 50, 0.0, 0]])), # zero height - (np.array([[50, 50, 50, 80]]), np.array([[50, 65, 0.0, 30]])), # zero width - # Standard cases - (np.array([[10, 20, 40, 60]]), np.array([[25, 40, 0.75, 40]])), # standard case - ( - np.array([[-30, -40, -10, -20]]), - np.array([[-20, -30, 1.0, 20]]), - ), # all negative values - ( - np.array([[0.1, 0.2, 0.4, 0.6]]), - np.array([[0.25, 0.4, 0.75, 0.4]]), - ), # values between 0-1 - # Different aspect ratios - ( - np.array([[10, 20, 50, 100]]), - np.array([[30, 60, 0.5, 80]]), - ), # tall rectangle (height > width) - ( - np.array([[20, 10, 100, 50]]), - np.array([[60, 30, 2.0, 40]]), - ), # wide rectangle (width > height) - ( - np.array([[50, 50, 150, 150]]), - np.array([[100, 100, 1.0, 100]]), - ), # height == width - # Multiple boxes in one array - ( - np.array([[0, 0, 0, 0], [10, 20, 40, 60]]), - np.array([[0, 0, 0.0, 0], [25, 40, 0.75, 40]]), - ), # one zero-sized box and one normal box - ], -) -def test_xyxy_to_xcycarh(xyxy: np.ndarray, expected_result: np.ndarray) -> None: - result = xyxy_to_xcycarh(xyxy) - np.testing.assert_allclose(result, expected_result) - - -@pytest.mark.parametrize( - "xcycwh, expected_result", - [ - (np.array([[50, 50, 20, 30]]), np.array([[40, 35, 60, 65]])), # standard case - (np.array([[0, 0, 0, 0]]), np.array([[0, 0, 0, 0]])), # zero size bounding box - ( - np.array([[50, 50, 100, 100]]), - np.array([[0, 0, 100, 100]]), - ), # large bounding box centered at (50, 50) - ( - np.array([[-10, -10, 20, 30]]), - np.array([[-20, -25, 0, 5]]), - ), # negative coordinates - (np.array([[50, 50, 0, 30]]), np.array([[50, 35, 50, 65]])), # zero width - (np.array([[50, 50, 20, 0]]), np.array([[40, 50, 60, 50]])), # zero height - (np.array([]).reshape(0, 4), np.array([]).reshape(0, 4)), # empty array - ], -) -def test_xcycwh_to_xyxy(xcycwh: np.ndarray, expected_result: np.ndarray) -> None: - result = xcycwh_to_xyxy(xcycwh) - np.testing.assert_array_equal(result, expected_result) - - -@pytest.mark.parametrize( - "metadata_list, expected_result, exception", - [ - # Identical metadata with a single key - ([{"key1": "value1"}, {"key1": "value1"}], {"key1": "value1"}, DoesNotRaise()), - # Identical metadata with multiple keys - ( - [ - {"key1": "value1", "key2": "value2"}, - {"key1": "value1", "key2": "value2"}, - ], - {"key1": "value1", "key2": "value2"}, - DoesNotRaise(), - ), - # Conflicting values for the same key - ([{"key1": "value1"}, {"key1": "value2"}], None, pytest.raises(ValueError)), - # Different sets of keys across dictionaries - ([{"key1": "value1"}, {"key2": "value2"}], None, pytest.raises(ValueError)), - # Empty metadata list - ([], {}, DoesNotRaise()), - # Empty metadata dictionaries - ([{}, {}], {}, DoesNotRaise()), - # Different declaration order for keys - ( - [ - {"key1": "value1", "key2": "value2"}, - {"key2": "value2", "key1": "value1"}, - ], - {"key1": "value1", "key2": "value2"}, - DoesNotRaise(), - ), - # Nested metadata dictionaries - ( - [{"key1": {"sub_key": "sub_value"}}, {"key1": {"sub_key": "sub_value"}}], - {"key1": {"sub_key": "sub_value"}}, - DoesNotRaise(), - ), - # Large metadata dictionaries with many keys - ( - [ - {f"key{i}": f"value{i}" for i in range(100)}, - {f"key{i}": f"value{i}" for i in range(100)}, - ], - {f"key{i}": f"value{i}" for i in range(100)}, - DoesNotRaise(), - ), - # Mixed types in list metadata values - ( - [{"key1": ["value1", 2, True]}, {"key1": ["value1", 2, True]}], - {"key1": ["value1", 2, True]}, - DoesNotRaise(), - ), - # Identical lists across metadata dictionaries - ( - [{"key1": [1, 2, 3]}, {"key1": [1, 2, 3]}], - {"key1": [1, 2, 3]}, - DoesNotRaise(), - ), - # Identical numpy arrays across metadata dictionaries - ( - [{"key1": np.array([1, 2, 3])}, {"key1": np.array([1, 2, 3])}], - {"key1": np.array([1, 2, 3])}, - DoesNotRaise(), - ), - # Identical numpy arrays across metadata dictionaries, different datatype - ( - [ - {"key1": np.array([1, 2, 3], dtype=np.int32)}, - {"key1": np.array([1, 2, 3], dtype=np.int64)}, - ], - {"key1": np.array([1, 2, 3])}, - DoesNotRaise(), - ), - # Conflicting lists for the same key - ([{"key1": [1, 2, 3]}, {"key1": [4, 5, 6]}], None, pytest.raises(ValueError)), - # Conflicting numpy arrays for the same key - ( - [{"key1": np.array([1, 2, 3])}, {"key1": np.array([4, 5, 6])}], - None, - pytest.raises(ValueError), - ), - # Mixed data types: list and numpy array for the same key - ( - [{"key1": [1, 2, 3]}, {"key1": np.array([1, 2, 3])}], - None, - pytest.raises(ValueError), - ), - # Empty lists and numpy arrays for the same key - ([{"key1": []}, {"key1": np.array([])}], None, pytest.raises(ValueError)), - # Identical multi-dimensional lists across metadata dictionaries - ( - [{"key1": [[1, 2], [3, 4]]}, {"key1": [[1, 2], [3, 4]]}], - {"key1": [[1, 2], [3, 4]]}, - DoesNotRaise(), - ), - # Identical multi-dimensional numpy arrays across metadata dictionaries - ( - [ - {"key1": np.arange(4).reshape(2, 2)}, - {"key1": np.arange(4).reshape(2, 2)}, - ], - {"key1": np.arange(4).reshape(2, 2)}, - DoesNotRaise(), - ), - # Conflicting multi-dimensional lists for the same key - ( - [{"key1": [[1, 2], [3, 4]]}, {"key1": [[5, 6], [7, 8]]}], - None, - pytest.raises(ValueError), - ), - # Conflicting multi-dimensional numpy arrays for the same key - ( - [ - {"key1": np.arange(4).reshape(2, 2)}, - {"key1": np.arange(4, 8).reshape(2, 2)}, - ], - None, - pytest.raises(ValueError), - ), - # Mixed types with multi-dimensional list and array for the same key - ( - [{"key1": [[1, 2], [3, 4]]}, {"key1": np.arange(4).reshape(2, 2)}], - None, - pytest.raises(ValueError), - ), - # Identical higher-dimensional (3D) numpy arrays across - # metadata dictionaries - ( - [ - {"key1": np.arange(8).reshape(2, 2, 2)}, - {"key1": np.arange(8).reshape(2, 2, 2)}, - ], - {"key1": np.arange(8).reshape(2, 2, 2)}, - DoesNotRaise(), - ), - # Differently-shaped higher-dimensional (3D) numpy arrays - # across metadata dictionaries - ( - [ - {"key1": np.arange(8).reshape(2, 2, 2)}, - {"key1": np.arange(8).reshape(4, 1, 2)}, - ], - None, - pytest.raises(ValueError), - ), - ], -) -def test_merge_metadata(metadata_list, expected_result, exception): - with exception: - result = merge_metadata(metadata_list) - if expected_result is None: - assert result is None, f"Expected an error, but got a result {result}" - for key, value in result.items(): - assert key in expected_result - if isinstance(value, np.ndarray): - np.testing.assert_array_equal(value, expected_result[key]) - else: - assert value == expected_result[key] diff --git a/test/detection/tools/test_inference_slicer.py b/test/detection/tools/test_inference_slicer.py index af29723a..ba66cbe1 100644 --- a/test/detection/tools/test_inference_slicer.py +++ b/test/detection/tools/test_inference_slicer.py @@ -6,7 +6,7 @@ import numpy as np import pytest from supervision.detection.core import Detections -from supervision.detection.overlap_filter import OverlapFilter +from supervision.detection.utils.iou_and_nms import OverlapFilter from supervision.detection.tools.inference_slicer import InferenceSlicer diff --git a/test/detection/utils/__init__.py b/test/detection/utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/detection/utils/test_boxes.py b/test/detection/utils/test_boxes.py new file mode 100644 index 00000000..d6bf1acc --- /dev/null +++ b/test/detection/utils/test_boxes.py @@ -0,0 +1,144 @@ +from __future__ import annotations + +from contextlib import ExitStack as DoesNotRaise + +import numpy as np +import pytest + +from supervision.detection.utils.boxes import clip_boxes, move_boxes, scale_boxes + + +@pytest.mark.parametrize( + "xyxy, resolution_wh, expected_result", + [ + ( + np.empty(shape=(0, 4)), + (1280, 720), + np.empty(shape=(0, 4)), + ), + ( + np.array([[1.0, 1.0, 1279.0, 719.0]]), + (1280, 720), + np.array([[1.0, 1.0, 1279.0, 719.0]]), + ), + ( + np.array([[-1.0, 1.0, 1279.0, 719.0]]), + (1280, 720), + np.array([[0.0, 1.0, 1279.0, 719.0]]), + ), + ( + np.array([[1.0, -1.0, 1279.0, 719.0]]), + (1280, 720), + np.array([[1.0, 0.0, 1279.0, 719.0]]), + ), + ( + np.array([[1.0, 1.0, 1281.0, 719.0]]), + (1280, 720), + np.array([[1.0, 1.0, 1280.0, 719.0]]), + ), + ( + np.array([[1.0, 1.0, 1279.0, 721.0]]), + (1280, 720), + np.array([[1.0, 1.0, 1279.0, 720.0]]), + ), + ], +) +def test_clip_boxes( + xyxy: np.ndarray, + resolution_wh: tuple[int, int], + expected_result: np.ndarray, +) -> None: + result = clip_boxes(xyxy=xyxy, resolution_wh=resolution_wh) + assert np.array_equal(result, expected_result) + + +@pytest.mark.parametrize( + "xyxy, offset, expected_result, exception", + [ + ( + np.empty(shape=(0, 4)), + np.array([0, 0]), + np.empty(shape=(0, 4)), + DoesNotRaise(), + ), # empty xyxy array + ( + np.array([[0, 0, 10, 10]]), + np.array([0, 0]), + np.array([[0, 0, 10, 10]]), + DoesNotRaise(), + ), # single box with zero offset + ( + np.array([[0, 0, 10, 10]]), + np.array([10, 10]), + np.array([[10, 10, 20, 20]]), + DoesNotRaise(), + ), # single box with non-zero offset + ( + np.array([[0, 0, 10, 10], [0, 0, 10, 10]]), + np.array([10, 10]), + np.array([[10, 10, 20, 20], [10, 10, 20, 20]]), + DoesNotRaise(), + ), # two boxes with non-zero offset + ( + np.array([[0, 0, 10, 10], [0, 0, 10, 10]]), + np.array([-10, -10]), + np.array([[-10, -10, 0, 0], [-10, -10, 0, 0]]), + DoesNotRaise(), + ), # two boxes with negative offset + ], +) +def test_move_boxes( + xyxy: np.ndarray, + offset: np.ndarray, + expected_result: np.ndarray, + exception: Exception, +) -> None: + with exception: + result = move_boxes(xyxy=xyxy, offset=offset) + assert np.array_equal(result, expected_result) + + +@pytest.mark.parametrize( + "xyxy, factor, expected_result, exception", + [ + ( + np.empty(shape=(0, 4)), + 2.0, + np.empty(shape=(0, 4)), + DoesNotRaise(), + ), # empty xyxy array + ( + np.array([[0, 0, 10, 10]]), + 1.0, + np.array([[0, 0, 10, 10]]), + DoesNotRaise(), + ), # single box with factor equal to 1.0 + ( + np.array([[0, 0, 10, 10]]), + 2.0, + np.array([[-5, -5, 15, 15]]), + DoesNotRaise(), + ), # single box with factor equal to 2.0 + ( + np.array([[0, 0, 10, 10]]), + 0.5, + np.array([[2.5, 2.5, 7.5, 7.5]]), + DoesNotRaise(), + ), # single box with factor equal to 0.5 + ( + np.array([[0, 0, 10, 10], [10, 10, 30, 30]]), + 2.0, + np.array([[-5, -5, 15, 15], [0, 0, 40, 40]]), + DoesNotRaise(), + ), # two boxes with factor equal to 2.0 + ], +) +def test_scale_boxes( + xyxy: np.ndarray, + factor: float, + expected_result: np.ndarray, + exception: Exception, +) -> None: + with exception: + result = scale_boxes(xyxy=xyxy, factor=factor) + assert np.array_equal(result, expected_result) \ No newline at end of file diff --git a/test/detection/utils/test_converters.py b/test/detection/utils/test_converters.py new file mode 100644 index 00000000..55146a99 --- /dev/null +++ b/test/detection/utils/test_converters.py @@ -0,0 +1,127 @@ +from __future__ import annotations + +import numpy as np +import pytest + +from supervision.detection.utils.converters import xywh_to_xyxy, xyxy_to_xywh, \ + xyxy_to_xcycarh, xcycwh_to_xyxy + + +@pytest.mark.parametrize( + "xywh, expected_result", + [ + (np.array([[10, 20, 30, 40]]), np.array([[10, 20, 40, 60]])), # standard case + (np.array([[0, 0, 0, 0]]), np.array([[0, 0, 0, 0]])), # zero size bounding box + ( + np.array([[50, 50, 100, 100]]), + np.array([[50, 50, 150, 150]]), + ), # large bounding box + ( + np.array([[-10, -20, 30, 40]]), + np.array([[-10, -20, 20, 20]]), + ), # negative coordinates + (np.array([[50, 50, 0, 30]]), np.array([[50, 50, 50, 80]])), # zero width + (np.array([[50, 50, 20, 0]]), np.array([[50, 50, 70, 50]])), # zero height + (np.array([]).reshape(0, 4), np.array([]).reshape(0, 4)), # empty array + ], +) +def test_xywh_to_xyxy(xywh: np.ndarray, expected_result: np.ndarray) -> None: + result = xywh_to_xyxy(xywh) + np.testing.assert_array_equal(result, expected_result) + + +@pytest.mark.parametrize( + "xyxy, expected_result", + [ + (np.array([[10, 20, 40, 60]]), np.array([[10, 20, 30, 40]])), # standard case + (np.array([[0, 0, 0, 0]]), np.array([[0, 0, 0, 0]])), # zero size bounding box + ( + np.array([[50, 50, 150, 150]]), + np.array([[50, 50, 100, 100]]), + ), # large bounding box + ( + np.array([[-10, -20, 20, 20]]), + np.array([[-10, -20, 30, 40]]), + ), # negative coordinates + (np.array([[50, 50, 50, 80]]), np.array([[50, 50, 0, 30]])), # zero width + (np.array([[50, 50, 70, 50]]), np.array([[50, 50, 20, 0]])), # zero height + (np.array([]).reshape(0, 4), np.array([]).reshape(0, 4)), # empty array + ], +) +def test_xyxy_to_xywh(xyxy: np.ndarray, expected_result: np.ndarray) -> None: + result = xyxy_to_xywh(xyxy) + np.testing.assert_array_equal(result, expected_result) + + +@pytest.mark.parametrize( + "xyxy, expected_result", + [ + # Empty and zero cases + (np.array([]).reshape(0, 4), np.array([]).reshape(0, 4)), # empty array + ( + np.array([[0, 0, 0, 0]]), + np.array([[0, 0, 0.0, 0]]), + ), # zero size bounding box + ( + np.array([[10, 10, 10, 10]]), + np.array([[10, 10, 0.0, 0]]), + ), # point (x1=x2, y1=y2) + # Zero width/height cases + (np.array([[50, 50, 80, 50]]), np.array([[65, 50, 0.0, 0]])), # zero height + (np.array([[50, 50, 50, 80]]), np.array([[50, 65, 0.0, 30]])), # zero width + # Standard cases + (np.array([[10, 20, 40, 60]]), np.array([[25, 40, 0.75, 40]])), # standard case + ( + np.array([[-30, -40, -10, -20]]), + np.array([[-20, -30, 1.0, 20]]), + ), # all negative values + ( + np.array([[0.1, 0.2, 0.4, 0.6]]), + np.array([[0.25, 0.4, 0.75, 0.4]]), + ), # values between 0-1 + # Different aspect ratios + ( + np.array([[10, 20, 50, 100]]), + np.array([[30, 60, 0.5, 80]]), + ), # tall rectangle (height > width) + ( + np.array([[20, 10, 100, 50]]), + np.array([[60, 30, 2.0, 40]]), + ), # wide rectangle (width > height) + ( + np.array([[50, 50, 150, 150]]), + np.array([[100, 100, 1.0, 100]]), + ), # height == width + # Multiple boxes in one array + ( + np.array([[0, 0, 0, 0], [10, 20, 40, 60]]), + np.array([[0, 0, 0.0, 0], [25, 40, 0.75, 40]]), + ), # one zero-sized box and one normal box + ], +) +def test_xyxy_to_xcycarh(xyxy: np.ndarray, expected_result: np.ndarray) -> None: + result = xyxy_to_xcycarh(xyxy) + np.testing.assert_allclose(result, expected_result) + + +@pytest.mark.parametrize( + "xcycwh, expected_result", + [ + (np.array([[50, 50, 20, 30]]), np.array([[40, 35, 60, 65]])), # standard case + (np.array([[0, 0, 0, 0]]), np.array([[0, 0, 0, 0]])), # zero size bounding box + ( + np.array([[50, 50, 100, 100]]), + np.array([[0, 0, 100, 100]]), + ), # large bounding box centered at (50, 50) + ( + np.array([[-10, -10, 20, 30]]), + np.array([[-20, -25, 0, 5]]), + ), # negative coordinates + (np.array([[50, 50, 0, 30]]), np.array([[50, 35, 50, 65]])), # zero width + (np.array([[50, 50, 20, 0]]), np.array([[40, 50, 60, 50]])), # zero height + (np.array([]).reshape(0, 4), np.array([]).reshape(0, 4)), # empty array + ], +) +def test_xcycwh_to_xyxy(xcycwh: np.ndarray, expected_result: np.ndarray) -> None: + result = xcycwh_to_xyxy(xcycwh) + np.testing.assert_array_equal(result, expected_result) \ No newline at end of file diff --git a/test/detection/utils/test_internal.py b/test/detection/utils/test_internal.py new file mode 100644 index 00000000..525cf3b3 --- /dev/null +++ b/test/detection/utils/test_internal.py @@ -0,0 +1,786 @@ +from __future__ import annotations + +from contextlib import ExitStack as DoesNotRaise +from typing import Any + +import numpy as np +import pytest + +from supervision.config import CLASS_NAME_DATA_FIELD +from supervision.detection.utils.internal import process_roboflow_result, merge_data, \ + get_data_item, merge_metadata + +TEST_MASK = np.zeros((1, 1000, 1000), dtype=bool) +TEST_MASK[:, 300:351, 200:251] = True + + +@pytest.mark.parametrize( + "roboflow_result, expected_result, exception", + [ + ( + {"predictions": [], "image": {"width": 1000, "height": 1000}}, + ( + np.empty((0, 4)), + np.empty(0), + np.empty(0), + None, + None, + {CLASS_NAME_DATA_FIELD: np.empty(0)}, + ), + DoesNotRaise(), + ), # empty result + ( + { + "predictions": [ + { + "x": 200.0, + "y": 300.0, + "width": 50.0, + "height": 50.0, + "confidence": 0.9, + "class_id": 0, + "class": "person", + } + ], + "image": {"width": 1000, "height": 1000}, + }, + ( + np.array([[175.0, 275.0, 225.0, 325.0]]), + np.array([0.9]), + np.array([0]), + None, + None, + {CLASS_NAME_DATA_FIELD: np.array(["person"])}, + ), + DoesNotRaise(), + ), # single correct object detection result + ( + { + "predictions": [ + { + "x": 200.0, + "y": 300.0, + "width": 50.0, + "height": 50.0, + "confidence": 0.9, + "class_id": 0, + "class": "person", + "tracker_id": 1, + }, + { + "x": 500.0, + "y": 500.0, + "width": 100.0, + "height": 100.0, + "confidence": 0.8, + "class_id": 7, + "class": "truck", + "tracker_id": 2, + }, + ], + "image": {"width": 1000, "height": 1000}, + }, + ( + np.array([[175.0, 275.0, 225.0, 325.0], [450.0, 450.0, 550.0, 550.0]]), + np.array([0.9, 0.8]), + np.array([0, 7]), + None, + np.array([1, 2]), + {CLASS_NAME_DATA_FIELD: np.array(["person", "truck"])}, + ), + DoesNotRaise(), + ), # two correct object detection result + ( + { + "predictions": [ + { + "x": 200.0, + "y": 300.0, + "width": 50.0, + "height": 50.0, + "confidence": 0.9, + "class_id": 0, + "class": "person", + "points": [], + "tracker_id": None, + } + ], + "image": {"width": 1000, "height": 1000}, + }, + ( + np.empty((0, 4)), + np.empty(0), + np.empty(0), + None, + None, + {CLASS_NAME_DATA_FIELD: np.empty(0)}, + ), + DoesNotRaise(), + ), # single incorrect instance segmentation result with no points + ( + { + "predictions": [ + { + "x": 200.0, + "y": 300.0, + "width": 50.0, + "height": 50.0, + "confidence": 0.9, + "class_id": 0, + "class": "person", + "points": [{"x": 200.0, "y": 300.0}, {"x": 250.0, "y": 300.0}], + } + ], + "image": {"width": 1000, "height": 1000}, + }, + ( + np.empty((0, 4)), + np.empty(0), + np.empty(0), + None, + None, + {CLASS_NAME_DATA_FIELD: np.empty(0)}, + ), + DoesNotRaise(), + ), # single incorrect instance segmentation result with no enough points + ( + { + "predictions": [ + { + "x": 200.0, + "y": 300.0, + "width": 50.0, + "height": 50.0, + "confidence": 0.9, + "class_id": 0, + "class": "person", + "points": [ + {"x": 200.0, "y": 300.0}, + {"x": 250.0, "y": 300.0}, + {"x": 250.0, "y": 350.0}, + {"x": 200.0, "y": 350.0}, + ], + } + ], + "image": {"width": 1000, "height": 1000}, + }, + ( + np.array([[175.0, 275.0, 225.0, 325.0]]), + np.array([0.9]), + np.array([0]), + TEST_MASK, + None, + {CLASS_NAME_DATA_FIELD: np.array(["person"])}, + ), + DoesNotRaise(), + ), # single incorrect instance segmentation result with no enough points + ( + { + "predictions": [ + { + "x": 200.0, + "y": 300.0, + "width": 50.0, + "height": 50.0, + "confidence": 0.9, + "class_id": 0, + "class": "person", + "points": [ + {"x": 200.0, "y": 300.0}, + {"x": 250.0, "y": 300.0}, + {"x": 250.0, "y": 350.0}, + {"x": 200.0, "y": 350.0}, + ], + }, + { + "x": 500.0, + "y": 500.0, + "width": 100.0, + "height": 100.0, + "confidence": 0.8, + "class_id": 7, + "class": "truck", + "points": [], + }, + ], + "image": {"width": 1000, "height": 1000}, + }, + ( + np.array([[175.0, 275.0, 225.0, 325.0]]), + np.array([0.9]), + np.array([0]), + TEST_MASK, + None, + {CLASS_NAME_DATA_FIELD: np.array(["person"])}, + ), + DoesNotRaise(), + ), # two instance segmentation results - one correct, one incorrect + ], +) +def test_process_roboflow_result( + roboflow_result: dict, + expected_result: tuple[ + np.ndarray, np.ndarray, np.ndarray, np.ndarray | None, np.ndarray + ], + exception: Exception, +) -> None: + with exception: + result = process_roboflow_result(roboflow_result=roboflow_result) + assert np.array_equal(result[0], expected_result[0]) + assert np.array_equal(result[1], expected_result[1]) + assert np.array_equal(result[2], expected_result[2]) + assert (result[3] is None and expected_result[3] is None) or ( + np.array_equal(result[3], expected_result[3]) + ) + assert (result[4] is None and expected_result[4] is None) or ( + np.array_equal(result[4], expected_result[4]) + ) + for key in result[5]: + if isinstance(result[5][key], np.ndarray): + assert np.array_equal(result[5][key], expected_result[5][key]), ( + f"Mismatch in arrays for key {key}" + ) + else: + assert result[5][key] == expected_result[5][key], ( + f"Mismatch in non-array data for key {key}" + ) + +@pytest.mark.parametrize( + "data_list, expected_result, exception", + [ + ( + [], + {}, + DoesNotRaise(), + ), # empty data list + ( + [{}], + {}, + DoesNotRaise(), + ), # single empty data dict + ( + [{}, {}], + {}, + DoesNotRaise(), + ), # two empty data dicts + ( + [ + {"test_1": []}, + ], + {"test_1": []}, + DoesNotRaise(), + ), # single data dict with a single field name and empty list values + ( + [ + {"test_1": []}, + {"test_1": []}, + ], + {"test_1": []}, + DoesNotRaise(), + ), # two data dicts with the same field name and empty list values + ( + [ + {"test_1": np.array([])}, + ], + {"test_1": np.array([])}, + DoesNotRaise(), + ), # single data dict with a single field name and empty np.array values + ( + [ + {"test_1": np.array([])}, + {"test_1": np.array([])}, + ], + {"test_1": np.array([])}, + DoesNotRaise(), + ), # two data dicts with the same field name and empty np.array values + ( + [ + {"test_1": [1, 2, 3]}, + ], + {"test_1": [1, 2, 3]}, + DoesNotRaise(), + ), # single data dict with a single field name and list values + ( + [ + {"test_1": []}, + {"test_1": [3, 2, 1]}, + ], + {"test_1": [3, 2, 1]}, + DoesNotRaise(), + ), # two data dicts with the same field name; one of with empty list as value + ( + [ + {"test_1": [1, 2, 3]}, + {"test_1": [3, 2, 1]}, + ], + {"test_1": [1, 2, 3, 3, 2, 1]}, + DoesNotRaise(), + ), # two data dicts with the same field name and list values + ( + [ + {"test_1": [1, 2, 3]}, + {"test_1": [3, 2, 1]}, + {"test_1": [1, 2, 3]}, + ], + {"test_1": [1, 2, 3, 3, 2, 1, 1, 2, 3]}, + DoesNotRaise(), + ), # three data dicts with the same field name and list values + ( + [ + {"test_1": [1, 2, 3]}, + {"test_2": [3, 2, 1]}, + ], + None, + pytest.raises(ValueError), + ), # two data dicts with different field names + ( + [ + {"test_1": np.array([1, 2, 3])}, + {"test_1": np.array([3, 2, 1])}, + ], + {"test_1": np.array([1, 2, 3, 3, 2, 1])}, + DoesNotRaise(), + ), # two data dicts with the same field name and np.array values as 1D arrays + ( + [ + {"test_1": np.array([[1, 2, 3]])}, + {"test_1": np.array([[3, 2, 1]])}, + ], + {"test_1": np.array([[1, 2, 3], [3, 2, 1]])}, + DoesNotRaise(), + ), # two data dicts with the same field name and np.array values as 2D arrays + ( + [ + {"test_1": np.array([1, 2, 3]), "test_2": np.array(["a", "b", "c"])}, + {"test_1": np.array([3, 2, 1]), "test_2": np.array(["c", "b", "a"])}, + ], + { + "test_1": np.array([1, 2, 3, 3, 2, 1]), + "test_2": np.array(["a", "b", "c", "c", "b", "a"]), + }, + DoesNotRaise(), + ), # two data dicts with the same field names and np.array values + ( + [ + {"test_1": [1, 2, 3], "test_2": np.array(["a", "b", "c"])}, + {"test_1": [3, 2, 1], "test_2": np.array(["c", "b", "a"])}, + ], + { + "test_1": [1, 2, 3, 3, 2, 1], + "test_2": np.array(["a", "b", "c", "c", "b", "a"]), + }, + DoesNotRaise(), + ), # two data dicts with the same field names and mixed values + ( + [ + {"test_1": np.array([1, 2, 3])}, + {"test_1": np.array([[3, 2, 1]])}, + ], + None, + pytest.raises(ValueError), + ), # two data dicts with the same field name and 1D and 2D arrays values + ( + [ + {"test_1": np.array([1, 2, 3]), "test_2": np.array(["a", "b"])}, + {"test_1": np.array([3, 2, 1]), "test_2": np.array(["c", "b", "a"])}, + ], + None, + pytest.raises(ValueError), + ), # two data dicts with the same field name and different length arrays values + ( + [{}, {"test_1": [1, 2, 3]}], + None, + pytest.raises(ValueError), + ), # two data dicts; one empty and one non-empty dict + ( + [{"test_1": [], "test_2": []}, {"test_1": [1, 2, 3], "test_2": [1, 2, 3]}], + {"test_1": [1, 2, 3], "test_2": [1, 2, 3]}, + DoesNotRaise(), + ), # two data dicts; one empty and one non-empty dict; same keys + ( + [{"test_1": []}, {"test_1": [1, 2, 3], "test_2": [4, 5, 6]}], + None, + pytest.raises(ValueError), + ), # two data dicts; one empty and one non-empty dict; different keys + ( + [ + { + "test_1": [1, 2, 3], + "test_2": [4, 5, 6], + "test_3": [7, 8, 9], + }, + {"test_1": [1, 2, 3], "test_2": [4, 5, 6]}, + ], + None, + pytest.raises(ValueError), + ), # two data dicts; one with three keys, one with two keys + ( + [ + {"test_1": [1, 2, 3]}, + {"test_1": [1, 2, 3], "test_2": [1, 2, 3]}, + ], + None, + pytest.raises(ValueError), + ), # some keys missing in one dict + ( + [ + {"test_1": [1, 2, 3], "test_2": ["a", "b"]}, + {"test_1": [4, 5], "test_2": ["c", "d", "e"]}, + ], + None, + pytest.raises(ValueError), + ), # different value lengths for the same key + ], +) +def test_merge_data( + data_list: list[dict[str, Any]], + expected_result: dict[str, Any] | None, + exception: Exception, +): + with exception: + result = merge_data(data_list=data_list) + if expected_result is None: + assert False, f"Expected an error, but got result {result}" + + for key in result: + if isinstance(result[key], np.ndarray): + assert np.array_equal(result[key], expected_result[key]), ( + f"Mismatch in arrays for key {key}" + ) + else: + assert result[key] == expected_result[key], ( + f"Mismatch in non-array data for key {key}" + ) + + +@pytest.mark.parametrize( + "data, index, expected_result, exception", + [ + ({}, 0, {}, DoesNotRaise()), # empty data dict + ( + { + "test_1": [1, 2, 3], + }, + 0, + { + "test_1": [1], + }, + DoesNotRaise(), + ), # data dict with a single list field and integer index + ( + { + "test_1": np.array([1, 2, 3]), + }, + 0, + { + "test_1": np.array([1]), + }, + DoesNotRaise(), + ), # data dict with a single np.array field and integer index + ( + { + "test_1": [1, 2, 3], + }, + slice(0, 2), + { + "test_1": [1, 2], + }, + DoesNotRaise(), + ), # data dict with a single list field and slice index + ( + { + "test_1": np.array([1, 2, 3]), + }, + slice(0, 2), + { + "test_1": np.array([1, 2]), + }, + DoesNotRaise(), + ), # data dict with a single np.array field and slice index + ( + { + "test_1": [1, 2, 3], + }, + -1, + { + "test_1": [3], + }, + DoesNotRaise(), + ), # data dict with a single list field and negative integer index + ( + { + "test_1": np.array([1, 2, 3]), + }, + -1, + { + "test_1": np.array([3]), + }, + DoesNotRaise(), + ), # data dict with a single np.array field and negative integer index + ( + { + "test_1": [1, 2, 3], + }, + [0, 2], + { + "test_1": [1, 3], + }, + DoesNotRaise(), + ), # data dict with a single list field and integer list index + ( + { + "test_1": np.array([1, 2, 3]), + }, + [0, 2], + { + "test_1": np.array([1, 3]), + }, + DoesNotRaise(), + ), # data dict with a single np.array field and integer list index + ( + { + "test_1": [1, 2, 3], + }, + np.array([0, 2]), + { + "test_1": [1, 3], + }, + DoesNotRaise(), + ), # data dict with a single list field and integer np.array index + ( + { + "test_1": np.array([1, 2, 3]), + }, + np.array([0, 2]), + { + "test_1": np.array([1, 3]), + }, + DoesNotRaise(), + ), # data dict with a single np.array field and integer np.array index + ( + { + "test_1": np.array([1, 2, 3]), + }, + np.array([True, True, True]), + { + "test_1": np.array([1, 2, 3]), + }, + DoesNotRaise(), + ), # data dict with a single np.array field and all-true bool np.array index + ( + { + "test_1": np.array([1, 2, 3]), + }, + np.array([False, False, False]), + { + "test_1": np.array([]), + }, + DoesNotRaise(), + ), # data dict with a single np.array field and all-false bool np.array index + ( + { + "test_1": np.array([1, 2, 3]), + }, + np.array([False, True, False]), + { + "test_1": np.array([2]), + }, + DoesNotRaise(), + ), # data dict with a single np.array field and mixed bool np.array index + ( + {"test_1": np.array([1, 2, 3]), "test_2": ["a", "b", "c"]}, + 0, + {"test_1": np.array([1]), "test_2": ["a"]}, + DoesNotRaise(), + ), # data dict with two fields and integer index + ( + {"test_1": np.array([1, 2, 3]), "test_2": ["a", "b", "c"]}, + -1, + {"test_1": np.array([3]), "test_2": ["c"]}, + DoesNotRaise(), + ), # data dict with two fields and negative integer index + ( + {"test_1": np.array([1, 2, 3]), "test_2": ["a", "b", "c"]}, + np.array([False, True, False]), + {"test_1": np.array([2]), "test_2": ["b"]}, + DoesNotRaise(), + ), # data dict with two fields and mixed bool np.array index + ], +) +def test_get_data_item( + data: dict[str, Any], + index: Any, + expected_result: dict[str, Any] | None, + exception: Exception, +): + with exception: + result = get_data_item(data=data, index=index) + for key in result: + if isinstance(result[key], np.ndarray): + assert np.array_equal(result[key], expected_result[key]), ( + f"Mismatch in arrays for key {key}" + ) + else: + assert result[key] == expected_result[key], ( + f"Mismatch in non-array data for key {key}" + ) + + +@pytest.mark.parametrize( + "metadata_list, expected_result, exception", + [ + # Identical metadata with a single key + ([{"key1": "value1"}, {"key1": "value1"}], {"key1": "value1"}, DoesNotRaise()), + # Identical metadata with multiple keys + ( + [ + {"key1": "value1", "key2": "value2"}, + {"key1": "value1", "key2": "value2"}, + ], + {"key1": "value1", "key2": "value2"}, + DoesNotRaise(), + ), + # Conflicting values for the same key + ([{"key1": "value1"}, {"key1": "value2"}], None, pytest.raises(ValueError)), + # Different sets of keys across dictionaries + ([{"key1": "value1"}, {"key2": "value2"}], None, pytest.raises(ValueError)), + # Empty metadata list + ([], {}, DoesNotRaise()), + # Empty metadata dictionaries + ([{}, {}], {}, DoesNotRaise()), + # Different declaration order for keys + ( + [ + {"key1": "value1", "key2": "value2"}, + {"key2": "value2", "key1": "value1"}, + ], + {"key1": "value1", "key2": "value2"}, + DoesNotRaise(), + ), + # Nested metadata dictionaries + ( + [{"key1": {"sub_key": "sub_value"}}, {"key1": {"sub_key": "sub_value"}}], + {"key1": {"sub_key": "sub_value"}}, + DoesNotRaise(), + ), + # Large metadata dictionaries with many keys + ( + [ + {f"key{i}": f"value{i}" for i in range(100)}, + {f"key{i}": f"value{i}" for i in range(100)}, + ], + {f"key{i}": f"value{i}" for i in range(100)}, + DoesNotRaise(), + ), + # Mixed types in list metadata values + ( + [{"key1": ["value1", 2, True]}, {"key1": ["value1", 2, True]}], + {"key1": ["value1", 2, True]}, + DoesNotRaise(), + ), + # Identical lists across metadata dictionaries + ( + [{"key1": [1, 2, 3]}, {"key1": [1, 2, 3]}], + {"key1": [1, 2, 3]}, + DoesNotRaise(), + ), + # Identical numpy arrays across metadata dictionaries + ( + [{"key1": np.array([1, 2, 3])}, {"key1": np.array([1, 2, 3])}], + {"key1": np.array([1, 2, 3])}, + DoesNotRaise(), + ), + # Identical numpy arrays across metadata dictionaries, different datatype + ( + [ + {"key1": np.array([1, 2, 3], dtype=np.int32)}, + {"key1": np.array([1, 2, 3], dtype=np.int64)}, + ], + {"key1": np.array([1, 2, 3])}, + DoesNotRaise(), + ), + # Conflicting lists for the same key + ([{"key1": [1, 2, 3]}, {"key1": [4, 5, 6]}], None, pytest.raises(ValueError)), + # Conflicting numpy arrays for the same key + ( + [{"key1": np.array([1, 2, 3])}, {"key1": np.array([4, 5, 6])}], + None, + pytest.raises(ValueError), + ), + # Mixed data types: list and numpy array for the same key + ( + [{"key1": [1, 2, 3]}, {"key1": np.array([1, 2, 3])}], + None, + pytest.raises(ValueError), + ), + # Empty lists and numpy arrays for the same key + ([{"key1": []}, {"key1": np.array([])}], None, pytest.raises(ValueError)), + # Identical multi-dimensional lists across metadata dictionaries + ( + [{"key1": [[1, 2], [3, 4]]}, {"key1": [[1, 2], [3, 4]]}], + {"key1": [[1, 2], [3, 4]]}, + DoesNotRaise(), + ), + # Identical multi-dimensional numpy arrays across metadata dictionaries + ( + [ + {"key1": np.arange(4).reshape(2, 2)}, + {"key1": np.arange(4).reshape(2, 2)}, + ], + {"key1": np.arange(4).reshape(2, 2)}, + DoesNotRaise(), + ), + # Conflicting multi-dimensional lists for the same key + ( + [{"key1": [[1, 2], [3, 4]]}, {"key1": [[5, 6], [7, 8]]}], + None, + pytest.raises(ValueError), + ), + # Conflicting multi-dimensional numpy arrays for the same key + ( + [ + {"key1": np.arange(4).reshape(2, 2)}, + {"key1": np.arange(4, 8).reshape(2, 2)}, + ], + None, + pytest.raises(ValueError), + ), + # Mixed types with multi-dimensional list and array for the same key + ( + [{"key1": [[1, 2], [3, 4]]}, {"key1": np.arange(4).reshape(2, 2)}], + None, + pytest.raises(ValueError), + ), + # Identical higher-dimensional (3D) numpy arrays across + # metadata dictionaries + ( + [ + {"key1": np.arange(8).reshape(2, 2, 2)}, + {"key1": np.arange(8).reshape(2, 2, 2)}, + ], + {"key1": np.arange(8).reshape(2, 2, 2)}, + DoesNotRaise(), + ), + # Differently-shaped higher-dimensional (3D) numpy arrays + # across metadata dictionaries + ( + [ + {"key1": np.arange(8).reshape(2, 2, 2)}, + {"key1": np.arange(8).reshape(4, 1, 2)}, + ], + None, + pytest.raises(ValueError), + ), + ], +) +def test_merge_metadata(metadata_list, expected_result, exception): + with exception: + result = merge_metadata(metadata_list) + if expected_result is None: + assert result is None, f"Expected an error, but got a result {result}" + for key, value in result.items(): + assert key in expected_result + if isinstance(value, np.ndarray): + np.testing.assert_array_equal(value, expected_result[key]) + else: + assert value == expected_result[key] diff --git a/test/detection/test_overlap_filter.py b/test/detection/utils/test_iou_and_nms.py similarity index 99% rename from test/detection/test_overlap_filter.py rename to test/detection/utils/test_iou_and_nms.py index d870f897..abd19b88 100644 --- a/test/detection/test_overlap_filter.py +++ b/test/detection/utils/test_iou_and_nms.py @@ -5,12 +5,8 @@ from contextlib import ExitStack as DoesNotRaise import numpy as np import pytest -from supervision.detection.overlap_filter import ( - box_non_max_suppression, - group_overlapping_boxes, - mask_non_max_merge, - mask_non_max_suppression, -) +from supervision.detection.utils.iou_and_nms import box_non_max_suppression, \ + mask_non_max_suppression, mask_non_max_merge, _group_overlapping_boxes @pytest.mark.parametrize( @@ -133,7 +129,7 @@ def test_group_overlapping_boxes( exception: Exception, ) -> None: with exception: - result = group_overlapping_boxes( + result = _group_overlapping_boxes( predictions=predictions, iou_threshold=iou_threshold ) diff --git a/test/detection/utils/test_masks.py b/test/detection/utils/test_masks.py new file mode 100644 index 00000000..15fb4945 --- /dev/null +++ b/test/detection/utils/test_masks.py @@ -0,0 +1,498 @@ +from __future__ import annotations + +from contextlib import ExitStack as DoesNotRaise + +import numpy as np +import numpy.typing as npt +import pytest + +from supervision.detection.utils.masks import move_masks, calculate_masks_centroids, \ + contains_holes, contains_multiple_segments + + +@pytest.mark.parametrize( + "masks, offset, resolution_wh, expected_result, exception", + [ + ( + np.array( + [ + [ + [False, False, False, False], + [False, True, True, False], + [False, True, True, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + np.array([0, 0]), + (4, 4), + np.array( + [ + [ + [False, False, False, False], + [False, True, True, False], + [False, True, True, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + DoesNotRaise(), + ), + ( + np.array( + [ + [ + [False, False, False, False], + [False, True, True, False], + [False, True, True, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + np.array([-1, -1]), + (4, 4), + np.array( + [ + [ + [True, True, False, False], + [True, True, False, False], + [False, False, False, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + DoesNotRaise(), + ), + ( + np.array( + [ + [ + [False, False, False, False], + [False, True, True, False], + [False, True, True, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + np.array([-2, -2]), + (4, 4), + np.array( + [ + [ + [True, False, False, False], + [False, False, False, False], + [False, False, False, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + DoesNotRaise(), + ), + ( + np.array( + [ + [ + [False, False, False, False], + [False, True, True, False], + [False, True, True, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + np.array([-3, -3]), + (4, 4), + np.array( + [ + [ + [False, False, False, False], + [False, False, False, False], + [False, False, False, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + DoesNotRaise(), + ), + ( + np.array( + [ + [ + [False, False, False, False], + [False, True, True, False], + [False, True, True, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + np.array([-2, -1]), + (4, 4), + np.array( + [ + [ + [True, False, False, False], + [True, False, False, False], + [False, False, False, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + DoesNotRaise(), + ), + ( + np.array( + [ + [ + [False, False, False, False], + [False, True, True, False], + [False, True, True, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + np.array([-1, -2]), + (4, 4), + np.array( + [ + [ + [True, True, False, False], + [False, False, False, False], + [False, False, False, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + DoesNotRaise(), + ), + ( + np.array( + [ + [ + [False, False, False, False], + [False, True, True, False], + [False, True, True, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + np.array([-2, 2]), + (4, 4), + np.array( + [ + [ + [False, False, False, False], + [False, False, False, False], + [False, False, False, False], + [True, False, False, False], + ] + ], + dtype=bool, + ), + DoesNotRaise(), + ), + ( + np.array( + [ + [ + [False, False, False, False], + [False, True, True, False], + [False, True, True, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + np.array([3, 3]), + (4, 4), + np.array( + [ + [ + [False, False, False, False], + [False, False, False, False], + [False, False, False, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + DoesNotRaise(), + ), + ( + np.array( + [ + [ + [False, False, False, False], + [False, True, True, False], + [False, True, True, False], + [False, False, False, False], + ] + ], + dtype=bool, + ), + np.array([3, 3]), + (6, 6), + np.array( + [ + [ + [False, False, False, False, False, False], + [False, False, False, False, False, False], + [False, False, False, False, False, False], + [False, False, False, False, False, False], + [False, False, False, False, True, True], + [False, False, False, False, True, True], + ] + ], + dtype=bool, + ), + DoesNotRaise(), + ), + ], +) +def test_move_masks( + masks: np.ndarray, + offset: np.ndarray, + resolution_wh: tuple[int, int], + expected_result: np.ndarray, + exception: Exception, +) -> None: + with exception: + result = move_masks(masks=masks, offset=offset, resolution_wh=resolution_wh) + np.testing.assert_array_equal(result, expected_result) + + +@pytest.mark.parametrize( + "masks, expected_result, exception", + [ + ( + np.array( + [ + [ + [0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0], + ] + ] + ), + np.array([[0, 0]]), + DoesNotRaise(), + ), # single mask with all zeros + ( + np.array( + [ + [ + [1, 1, 1, 1], + [1, 1, 1, 1], + [1, 1, 1, 1], + [1, 1, 1, 1], + ] + ] + ), + np.array([[2, 2]]), + DoesNotRaise(), + ), # single mask with all ones + ( + np.array( + [ + [ + [0, 1, 1, 0], + [1, 1, 1, 1], + [1, 1, 1, 1], + [0, 1, 1, 0], + ] + ] + ), + np.array([[2, 2]]), + DoesNotRaise(), + ), # single mask with symmetric ones + ( + np.array( + [ + [ + [0, 0, 0, 0], + [0, 0, 1, 1], + [0, 0, 1, 1], + [0, 0, 0, 0], + ] + ] + ), + np.array([[3, 2]]), + DoesNotRaise(), + ), # single mask with asymmetric ones + ( + np.array( + [ + [ + [0, 1, 1, 0], + [1, 1, 1, 1], + [1, 1, 1, 1], + [0, 1, 1, 0], + ], + [ + [0, 0, 0, 0], + [0, 0, 1, 1], + [0, 0, 1, 1], + [0, 0, 0, 0], + ], + ] + ), + np.array([[2, 2], [3, 2]]), + DoesNotRaise(), + ), # two masks + ], +) +def test_calculate_masks_centroids( + masks: np.ndarray, + expected_result: np.ndarray, + exception: Exception, +) -> None: + with exception: + result = calculate_masks_centroids(masks=masks) + assert np.array_equal(result, expected_result) + + +@pytest.mark.parametrize( + "mask, expected_result, exception", + [ + ( + np.array([[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 0, 0], [0, 1, 1, 0]]).astype( + bool + ), + False, + DoesNotRaise(), + ), # foreground object in one continuous piece + ( + np.array([[1, 0, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0], [0, 1, 1, 0]]).astype( + bool + ), + False, + DoesNotRaise(), + ), # foreground object in 2 separate elements + ( + np.array([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]).astype( + bool + ), + False, + DoesNotRaise(), + ), # no foreground pixels in mask + ( + np.array([[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]).astype( + bool + ), + False, + DoesNotRaise(), + ), # only foreground pixels in mask + ( + np.array([[1, 1, 1, 0], [1, 0, 1, 0], [1, 1, 1, 0], [0, 0, 0, 0]]).astype( + bool + ), + True, + DoesNotRaise(), + ), # foreground object has 1 hole + ( + np.array([[1, 1, 1, 0], [1, 0, 1, 1], [1, 1, 0, 1], [0, 1, 1, 1]]).astype( + bool + ), + True, + DoesNotRaise(), + ), # foreground object has 2 holes + ], +) +def test_contains_holes( + mask: npt.NDArray[np.bool_], expected_result: bool, exception: Exception +) -> None: + with exception: + result = contains_holes(mask) + assert result == expected_result + + +@pytest.mark.parametrize( + "mask, connectivity, expected_result, exception", + [ + ( + np.array([[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 0, 0], [0, 1, 1, 0]]).astype( + bool + ), + 4, + False, + DoesNotRaise(), + ), # foreground object in one continuous piece + ( + np.array([[1, 0, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0], [0, 1, 1, 0]]).astype( + bool + ), + 4, + True, + DoesNotRaise(), + ), # foreground object in 2 separate elements + ( + np.array([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]).astype( + bool + ), + 4, + False, + DoesNotRaise(), + ), # no foreground pixels in mask + ( + np.array([[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]).astype( + bool + ), + 4, + False, + DoesNotRaise(), + ), # only foreground pixels in mask + ( + np.array([[1, 1, 1, 0], [1, 0, 1, 1], [1, 1, 0, 1], [0, 1, 1, 1]]).astype( + bool + ), + 4, + False, + DoesNotRaise(), + ), # foreground object has 2 holes, but is in single piece + ( + np.array([[1, 1, 0, 0], [1, 1, 0, 1], [1, 0, 1, 1], [0, 0, 1, 1]]).astype( + bool + ), + 4, + True, + DoesNotRaise(), + ), # foreground object in 2 elements with respect to 4-way connectivity + ( + np.array([[1, 1, 0, 0], [1, 1, 0, 1], [1, 0, 1, 1], [0, 0, 1, 1]]).astype( + bool + ), + 8, + False, + DoesNotRaise(), + ), # foreground object in single piece with respect to 8-way connectivity + ( + np.array([[1, 1, 0, 0], [1, 1, 0, 1], [1, 0, 1, 1], [0, 0, 1, 1]]).astype( + bool + ), + 5, + None, + pytest.raises(ValueError), + ), # Incorrect connectivity parameter value, raises ValueError + ], +) +def test_contains_multiple_segments( + mask: npt.NDArray[np.bool_], + connectivity: int, + expected_result: bool, + exception: Exception, +) -> None: + with exception: + result = contains_multiple_segments(mask=mask, connectivity=connectivity) + assert result == expected_result diff --git a/test/detection/utils/test_polygons.py b/test/detection/utils/test_polygons.py new file mode 100644 index 00000000..a3c02342 --- /dev/null +++ b/test/detection/utils/test_polygons.py @@ -0,0 +1,102 @@ +from __future__ import annotations + +from contextlib import ExitStack as DoesNotRaise + +import numpy as np +import pytest + +from supervision.detection.utils.polygons import filter_polygons_by_area + + +@pytest.mark.parametrize( + "polygons, min_area, max_area, expected_result, exception", + [ + ( + [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], + None, + None, + [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], + DoesNotRaise(), + ), # single polygon without area constraints + ( + [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], + 50, + None, + [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], + DoesNotRaise(), + ), # single polygon with min_area constraint + ( + [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], + None, + 50, + [], + DoesNotRaise(), + ), # single polygon with max_area constraint + ( + [ + np.array([[0, 0], [0, 10], [10, 10], [10, 0]]), + np.array([[0, 0], [0, 20], [20, 20], [20, 0]]), + ], + 200, + None, + [np.array([[0, 0], [0, 20], [20, 20], [20, 0]])], + DoesNotRaise(), + ), # two polygons with min_area constraint + ( + [ + np.array([[0, 0], [0, 10], [10, 10], [10, 0]]), + np.array([[0, 0], [0, 20], [20, 20], [20, 0]]), + ], + None, + 200, + [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], + DoesNotRaise(), + ), # two polygons with max_area constraint + ( + [ + np.array([[0, 0], [0, 10], [10, 10], [10, 0]]), + np.array([[0, 0], [0, 20], [20, 20], [20, 0]]), + ], + 200, + 200, + [], + DoesNotRaise(), + ), # two polygons with both area constraints + ( + [ + np.array([[0, 0], [0, 10], [10, 10], [10, 0]]), + np.array([[0, 0], [0, 20], [20, 20], [20, 0]]), + ], + 100, + 100, + [np.array([[0, 0], [0, 10], [10, 10], [10, 0]])], + DoesNotRaise(), + ), # two polygons with min_area and + # max_area equal to the area of the first polygon + ( + [ + np.array([[0, 0], [0, 10], [10, 10], [10, 0]]), + np.array([[0, 0], [0, 20], [20, 20], [20, 0]]), + ], + 400, + 400, + [np.array([[0, 0], [0, 20], [20, 20], [20, 0]])], + DoesNotRaise(), + ), # two polygons with min_area and + # max_area equal to the area of the second polygon + ], +) +def test_filter_polygons_by_area( + polygons: list[np.ndarray], + min_area: float | None, + max_area: float | None, + expected_result: list[np.ndarray], + exception: Exception, +) -> None: + with exception: + result = filter_polygons_by_area( + polygons=polygons, min_area=min_area, max_area=max_area + ) + assert len(result) == len(expected_result) + for result_polygon, expected_result_polygon in zip(result, expected_result): + assert np.array_equal(result_polygon, expected_result_polygon) \ No newline at end of file From 592a649b502badf58c53c512a9d54ec369c2eb4e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 17:25:55 +0000 Subject: [PATCH 088/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/__init__.py | 76 +++++++++---------- supervision/annotators/core.py | 10 ++- supervision/dataset/formats/coco.py | 1 - supervision/dataset/utils.py | 6 +- supervision/detection/core.py | 16 +++- supervision/detection/utils/polygons.py | 2 +- supervision/metrics/f1_score.py | 8 +- supervision/metrics/mean_average_recall.py | 8 +- supervision/metrics/precision.py | 7 +- supervision/metrics/recall.py | 8 +- test/detection/tools/test_inference_slicer.py | 2 +- test/detection/utils/test_boxes.py | 2 +- test/detection/utils/test_converters.py | 10 ++- test/detection/utils/test_internal.py | 9 ++- test/detection/utils/test_iou_and_nms.py | 8 +- test/detection/utils/test_masks.py | 8 +- test/detection/utils/test_polygons.py | 2 +- 17 files changed, 110 insertions(+), 73 deletions(-) diff --git a/supervision/__init__.py b/supervision/__init__.py index 62da6460..3e5c418c 100644 --- a/supervision/__init__.py +++ b/supervision/__init__.py @@ -46,35 +46,11 @@ from supervision.detection.line_zone import ( LineZoneAnnotator, LineZoneAnnotatorMulticlass, ) -from supervision.detection.utils.iou_and_nms import ( - box_iou, - box_iou_batch, - box_iou_batch_with_jaccard, - oriented_box_iou_batch, - mask_iou_batch, - OverlapFilter, - OverlapMetric, - box_non_max_merge, - box_non_max_suppression, - mask_non_max_suppression, -) -from supervision.detection.utils.masks import ( - move_masks, - calculate_masks_centroids, - contains_holes, - contains_multiple_segments -) -from supervision.detection.utils.converters import ( - xcycwh_to_xyxy, - xywh_to_xyxy, - xyxy_to_polygons, - xyxy_to_xcycarh, - xyxy_to_xywh, - mask_to_polygons, - mask_to_xyxy, - polygon_to_mask, - polygon_to_xyxy, -) +from supervision.detection.tools.csv_sink import CSVSink +from supervision.detection.tools.inference_slicer import InferenceSlicer +from supervision.detection.tools.json_sink import JSONSink +from supervision.detection.tools.polygon_zone import PolygonZone, PolygonZoneAnnotator +from supervision.detection.tools.smoother import DetectionsSmoother from supervision.detection.utils.boxes import ( clip_boxes, denormalize_boxes, @@ -82,15 +58,39 @@ from supervision.detection.utils.boxes import ( pad_boxes, scale_boxes, ) -from supervision.detection.utils.polygons import ( - filter_polygons_by_area, - approximate_polygon +from supervision.detection.utils.converters import ( + mask_to_polygons, + mask_to_xyxy, + polygon_to_mask, + polygon_to_xyxy, + xcycwh_to_xyxy, + xywh_to_xyxy, + xyxy_to_polygons, + xyxy_to_xcycarh, + xyxy_to_xywh, +) +from supervision.detection.utils.iou_and_nms import ( + OverlapFilter, + OverlapMetric, + box_iou, + box_iou_batch, + box_iou_batch_with_jaccard, + box_non_max_merge, + box_non_max_suppression, + mask_iou_batch, + mask_non_max_suppression, + oriented_box_iou_batch, +) +from supervision.detection.utils.masks import ( + calculate_masks_centroids, + contains_holes, + contains_multiple_segments, + move_masks, +) +from supervision.detection.utils.polygons import ( + approximate_polygon, + filter_polygons_by_area, ) -from supervision.detection.tools.csv_sink import CSVSink -from supervision.detection.tools.inference_slicer import InferenceSlicer -from supervision.detection.tools.json_sink import JSONSink -from supervision.detection.tools.polygon_zone import PolygonZone, PolygonZoneAnnotator -from supervision.detection.tools.smoother import DetectionsSmoother from supervision.detection.vlm import LMM, VLM from supervision.draw.color import Color, ColorPalette from supervision.draw.utils import ( @@ -192,6 +192,7 @@ __all__ = [ "VertexLabelAnnotator", "VideoInfo", "VideoSink", + "approximate_polygon", "box_iou", "box_iou_batch", "box_iou_batch_with_jaccard", @@ -244,5 +245,4 @@ __all__ = [ "xyxy_to_polygons", "xyxy_to_xcycarh", "xyxy_to_xywh", - "approximate_polygon" ] diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 096198c5..6c142db1 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -22,10 +22,12 @@ from supervision.annotators.utils import ( ) from supervision.config import ORIENTED_BOX_COORDINATES from supervision.detection.core import Detections -from supervision.detection.utils.boxes import spread_out_boxes, clip_boxes -from supervision.detection.utils.converters import mask_to_polygons, xyxy_to_polygons, \ - polygon_to_mask - +from supervision.detection.utils.boxes import clip_boxes, spread_out_boxes +from supervision.detection.utils.converters import ( + mask_to_polygons, + polygon_to_mask, + xyxy_to_polygons, +) from supervision.draw.color import Color, ColorPalette from supervision.draw.utils import draw_polygon, draw_rounded_rectangle, draw_text from supervision.geometry.core import Point, Position, Rect diff --git a/supervision/dataset/formats/coco.py b/supervision/dataset/formats/coco.py index 34fb3fe1..b4827f29 100644 --- a/supervision/dataset/formats/coco.py +++ b/supervision/dataset/formats/coco.py @@ -15,7 +15,6 @@ from supervision.dataset.utils import ( from supervision.detection.core import Detections from supervision.detection.utils.converters import polygon_to_mask from supervision.detection.utils.masks import contains_holes, contains_multiple_segments - from supervision.utils.file import read_json_file, save_json_file if TYPE_CHECKING: diff --git a/supervision/dataset/utils.py b/supervision/dataset/utils.py index eb9af0b2..74050114 100644 --- a/supervision/dataset/utils.py +++ b/supervision/dataset/utils.py @@ -13,8 +13,10 @@ import numpy.typing as npt from supervision.detection.core import Detections from supervision.detection.utils.converters import mask_to_polygons -from supervision.detection.utils.polygons import filter_polygons_by_area, \ - approximate_polygon +from supervision.detection.utils.polygons import ( + approximate_polygon, + filter_polygons_by_area, +) if TYPE_CHECKING: from supervision.dataset.core import DetectionDataset diff --git a/supervision/detection/core.py b/supervision/detection/core.py index d492c52e..a616a821 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -18,15 +18,23 @@ from supervision.detection.tools.transformers import ( process_transformers_v5_segmentation_result, ) from supervision.detection.utils.converters import mask_to_xyxy, xywh_to_xyxy -from supervision.detection.utils.internal import get_data_item, is_data_equal, \ - is_metadata_equal, extract_ultralytics_masks, process_roboflow_result, merge_data, \ - merge_metadata +from supervision.detection.utils.internal import ( + extract_ultralytics_masks, + get_data_item, + is_data_equal, + is_metadata_equal, + merge_data, + merge_metadata, + process_roboflow_result, +) from supervision.detection.utils.iou_and_nms import ( OverlapMetric, + box_iou_batch, box_non_max_merge, box_non_max_suppression, + mask_iou_batch, mask_non_max_merge, - mask_non_max_suppression, mask_iou_batch, box_iou_batch, + mask_non_max_suppression, ) from supervision.detection.utils.masks import calculate_masks_centroids from supervision.detection.vlm import ( diff --git a/supervision/detection/utils/polygons.py b/supervision/detection/utils/polygons.py index 3998e700..c2773f2b 100644 --- a/supervision/detection/utils/polygons.py +++ b/supervision/detection/utils/polygons.py @@ -82,4 +82,4 @@ def approximate_polygon( else: break - return np.squeeze(approximated_points, axis=1) \ No newline at end of file + return np.squeeze(approximated_points, axis=1) diff --git a/supervision/metrics/f1_score.py b/supervision/metrics/f1_score.py index c68ebbad..a327eebe 100644 --- a/supervision/metrics/f1_score.py +++ b/supervision/metrics/f1_score.py @@ -9,9 +9,11 @@ from matplotlib import pyplot as plt from supervision.config import ORIENTED_BOX_COORDINATES from supervision.detection.core import Detections -from supervision.detection.utils.iou_and_nms import box_iou_batch, mask_iou_batch, \ - oriented_box_iou_batch - +from supervision.detection.utils.iou_and_nms import ( + box_iou_batch, + mask_iou_batch, + oriented_box_iou_batch, +) from supervision.draw.color import LEGACY_COLOR_PALETTE from supervision.metrics.core import AveragingMethod, Metric, MetricTarget from supervision.metrics.utils.object_size import ( diff --git a/supervision/metrics/mean_average_recall.py b/supervision/metrics/mean_average_recall.py index b96582d9..07933cf0 100644 --- a/supervision/metrics/mean_average_recall.py +++ b/supervision/metrics/mean_average_recall.py @@ -9,9 +9,11 @@ from matplotlib import pyplot as plt from supervision.config import ORIENTED_BOX_COORDINATES from supervision.detection.core import Detections -from supervision.detection.utils.iou_and_nms import box_iou_batch, mask_iou_batch, \ - oriented_box_iou_batch - +from supervision.detection.utils.iou_and_nms import ( + box_iou_batch, + mask_iou_batch, + oriented_box_iou_batch, +) from supervision.draw.color import LEGACY_COLOR_PALETTE from supervision.metrics.core import Metric, MetricTarget from supervision.metrics.utils.object_size import ( diff --git a/supervision/metrics/precision.py b/supervision/metrics/precision.py index 4916094a..04b4e256 100644 --- a/supervision/metrics/precision.py +++ b/supervision/metrics/precision.py @@ -9,8 +9,11 @@ from matplotlib import pyplot as plt from supervision.config import ORIENTED_BOX_COORDINATES from supervision.detection.core import Detections -from supervision.detection.utils.iou_and_nms import box_iou_batch, mask_iou_batch, \ - oriented_box_iou_batch +from supervision.detection.utils.iou_and_nms import ( + box_iou_batch, + mask_iou_batch, + oriented_box_iou_batch, +) from supervision.draw.color import LEGACY_COLOR_PALETTE from supervision.metrics.core import AveragingMethod, Metric, MetricTarget from supervision.metrics.utils.object_size import ( diff --git a/supervision/metrics/recall.py b/supervision/metrics/recall.py index 582eb8ba..4a555072 100644 --- a/supervision/metrics/recall.py +++ b/supervision/metrics/recall.py @@ -9,9 +9,11 @@ from matplotlib import pyplot as plt from supervision.config import ORIENTED_BOX_COORDINATES from supervision.detection.core import Detections -from supervision.detection.utils.iou_and_nms import box_iou_batch, mask_iou_batch, \ - oriented_box_iou_batch - +from supervision.detection.utils.iou_and_nms import ( + box_iou_batch, + mask_iou_batch, + oriented_box_iou_batch, +) from supervision.draw.color import LEGACY_COLOR_PALETTE from supervision.metrics.core import AveragingMethod, Metric, MetricTarget from supervision.metrics.utils.object_size import ( diff --git a/test/detection/tools/test_inference_slicer.py b/test/detection/tools/test_inference_slicer.py index ba66cbe1..2185b77f 100644 --- a/test/detection/tools/test_inference_slicer.py +++ b/test/detection/tools/test_inference_slicer.py @@ -6,8 +6,8 @@ import numpy as np import pytest from supervision.detection.core import Detections -from supervision.detection.utils.iou_and_nms import OverlapFilter from supervision.detection.tools.inference_slicer import InferenceSlicer +from supervision.detection.utils.iou_and_nms import OverlapFilter @pytest.fixture diff --git a/test/detection/utils/test_boxes.py b/test/detection/utils/test_boxes.py index d6bf1acc..91998928 100644 --- a/test/detection/utils/test_boxes.py +++ b/test/detection/utils/test_boxes.py @@ -141,4 +141,4 @@ def test_scale_boxes( ) -> None: with exception: result = scale_boxes(xyxy=xyxy, factor=factor) - assert np.array_equal(result, expected_result) \ No newline at end of file + assert np.array_equal(result, expected_result) diff --git a/test/detection/utils/test_converters.py b/test/detection/utils/test_converters.py index 55146a99..e13b1500 100644 --- a/test/detection/utils/test_converters.py +++ b/test/detection/utils/test_converters.py @@ -3,8 +3,12 @@ from __future__ import annotations import numpy as np import pytest -from supervision.detection.utils.converters import xywh_to_xyxy, xyxy_to_xywh, \ - xyxy_to_xcycarh, xcycwh_to_xyxy +from supervision.detection.utils.converters import ( + xcycwh_to_xyxy, + xywh_to_xyxy, + xyxy_to_xcycarh, + xyxy_to_xywh, +) @pytest.mark.parametrize( @@ -124,4 +128,4 @@ def test_xyxy_to_xcycarh(xyxy: np.ndarray, expected_result: np.ndarray) -> None: ) def test_xcycwh_to_xyxy(xcycwh: np.ndarray, expected_result: np.ndarray) -> None: result = xcycwh_to_xyxy(xcycwh) - np.testing.assert_array_equal(result, expected_result) \ No newline at end of file + np.testing.assert_array_equal(result, expected_result) diff --git a/test/detection/utils/test_internal.py b/test/detection/utils/test_internal.py index 525cf3b3..0164d323 100644 --- a/test/detection/utils/test_internal.py +++ b/test/detection/utils/test_internal.py @@ -7,8 +7,12 @@ import numpy as np import pytest from supervision.config import CLASS_NAME_DATA_FIELD -from supervision.detection.utils.internal import process_roboflow_result, merge_data, \ - get_data_item, merge_metadata +from supervision.detection.utils.internal import ( + get_data_item, + merge_data, + merge_metadata, + process_roboflow_result, +) TEST_MASK = np.zeros((1, 1000, 1000), dtype=bool) TEST_MASK[:, 300:351, 200:251] = True @@ -245,6 +249,7 @@ def test_process_roboflow_result( f"Mismatch in non-array data for key {key}" ) + @pytest.mark.parametrize( "data_list, expected_result, exception", [ diff --git a/test/detection/utils/test_iou_and_nms.py b/test/detection/utils/test_iou_and_nms.py index abd19b88..8039bf24 100644 --- a/test/detection/utils/test_iou_and_nms.py +++ b/test/detection/utils/test_iou_and_nms.py @@ -5,8 +5,12 @@ from contextlib import ExitStack as DoesNotRaise import numpy as np import pytest -from supervision.detection.utils.iou_and_nms import box_non_max_suppression, \ - mask_non_max_suppression, mask_non_max_merge, _group_overlapping_boxes +from supervision.detection.utils.iou_and_nms import ( + _group_overlapping_boxes, + box_non_max_suppression, + mask_non_max_merge, + mask_non_max_suppression, +) @pytest.mark.parametrize( diff --git a/test/detection/utils/test_masks.py b/test/detection/utils/test_masks.py index 15fb4945..2097f608 100644 --- a/test/detection/utils/test_masks.py +++ b/test/detection/utils/test_masks.py @@ -6,8 +6,12 @@ import numpy as np import numpy.typing as npt import pytest -from supervision.detection.utils.masks import move_masks, calculate_masks_centroids, \ - contains_holes, contains_multiple_segments +from supervision.detection.utils.masks import ( + calculate_masks_centroids, + contains_holes, + contains_multiple_segments, + move_masks, +) @pytest.mark.parametrize( diff --git a/test/detection/utils/test_polygons.py b/test/detection/utils/test_polygons.py index a3c02342..c1ac0f3a 100644 --- a/test/detection/utils/test_polygons.py +++ b/test/detection/utils/test_polygons.py @@ -99,4 +99,4 @@ def test_filter_polygons_by_area( ) assert len(result) == len(expected_result) for result_polygon, expected_result_polygon in zip(result, expected_result): - assert np.array_equal(result_polygon, expected_result_polygon) \ No newline at end of file + assert np.array_equal(result_polygon, expected_result_polygon) From d52fcf17a82f4bd49792276b777516db4a43e6c1 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 20:41:38 +0300 Subject: [PATCH 089/110] =?UTF-8?q?fix:=20=F0=9F=90=9B=20add=20future=20an?= =?UTF-8?q?notations=20import=20for=20compatibility=20and=20fix=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/utils/polygons.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/supervision/detection/utils/polygons.py b/supervision/detection/utils/polygons.py index c2773f2b..c3ded1e7 100644 --- a/supervision/detection/utils/polygons.py +++ b/supervision/detection/utils/polygons.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import cv2 import numpy as np From 6b905f2d186784324a9ed76fc6a9bfc5433c9439 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 15 Jul 2025 19:56:04 +0200 Subject: [PATCH 090/110] works with python 3.9; docs update --- docs/detection/double_detection_filter.md | 35 ------ docs/detection/utils.md | 144 ---------------------- docs/detection/utils/boxes.md | 36 ++++++ docs/detection/utils/converters.md | 60 +++++++++ docs/detection/utils/iou_and_nms.md | 72 +++++++++++ docs/detection/utils/masks.md | 24 ++++ docs/detection/utils/polygons.md | 18 +++ mkdocs.yml | 7 +- supervision/detection/utils/boxes.py | 33 ++--- supervision/detection/utils/masks.py | 2 + supervision/detection/utils/polygons.py | 2 + 11 files changed, 237 insertions(+), 196 deletions(-) delete mode 100644 docs/detection/double_detection_filter.md delete mode 100644 docs/detection/utils.md create mode 100644 docs/detection/utils/boxes.md create mode 100644 docs/detection/utils/converters.md create mode 100644 docs/detection/utils/iou_and_nms.md create mode 100644 docs/detection/utils/masks.md create mode 100644 docs/detection/utils/polygons.md diff --git a/docs/detection/double_detection_filter.md b/docs/detection/double_detection_filter.md deleted file mode 100644 index 24384a13..00000000 --- a/docs/detection/double_detection_filter.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -comments: true ---- - -# Double Detection Filter - - - -:::supervision.detection.overlap_filter.OverlapFilter - - - -:::supervision.detection.overlap_filter.box_non_max_suppression - - - -:::supervision.detection.overlap_filter.mask_non_max_suppression - - - -:::supervision.detection.overlap_filter.box_non_max_merge - - - -:::supervision.detection.overlap_filter.mask_non_max_merge diff --git a/docs/detection/utils.md b/docs/detection/utils.md deleted file mode 100644 index cd18be64..00000000 --- a/docs/detection/utils.md +++ /dev/null @@ -1,144 +0,0 @@ ---- -comments: true -status: new ---- - -# Detection Utils - - - -:::supervision.detection.overlap_filter.OverlapMetric - -
-

box_iou

-
- -:::supervision.detection.utils.box_iou - - - -:::supervision.detection.utils.box_iou_batch - - - -:::supervision.detection.utils.box_iou_batch_with_jaccard - - - -:::supervision.detection.utils.mask_iou_batch - - - -:::supervision.detection.utils.oriented_box_iou_batch - - - -:::supervision.detection.utils.polygon_to_mask - - - -:::supervision.detection.utils.mask_to_xyxy - - - -:::supervision.detection.utils.mask_to_polygons - - - -:::supervision.detection.utils.polygon_to_xyxy - - - -:::supervision.detection.utils.filter_polygons_by_area - - - -:::supervision.detection.utils.move_boxes - - - -:::supervision.detection.utils.move_masks - - - -:::supervision.detection.utils.scale_boxes - - - -:::supervision.detection.utils.clip_boxes - - - -:::supervision.detection.utils.pad_boxes - - - -:::supervision.detection.utils.xywh_to_xyxy - - - -:::supervision.detection.utils.xyxy_to_xywh - - - -:::supervision.detection.utils.denormalize_boxes - - - -:::supervision.detection.utils.xyxy_to_xcycarh - - - -:::supervision.detection.utils.xcycwh_to_xyxy - - - -:::supervision.detection.utils.contains_holes - - - -:::supervision.detection.utils.contains_multiple_segments diff --git a/docs/detection/utils/boxes.md b/docs/detection/utils/boxes.md new file mode 100644 index 00000000..499578da --- /dev/null +++ b/docs/detection/utils/boxes.md @@ -0,0 +1,36 @@ +--- +comments: true +status: new +--- + +# Boxes Utils + + + +:::supervision.detection.utils.boxes.move_boxes + + + +:::supervision.detection.utils.boxes.scale_boxes + + + +:::supervision.detection.utils.boxes.clip_boxes + + + +:::supervision.detection.utils.boxes.pad_boxes + + + +:::supervision.detection.utils.boxes.denormalize_boxes \ No newline at end of file diff --git a/docs/detection/utils/converters.md b/docs/detection/utils/converters.md new file mode 100644 index 00000000..48bec65f --- /dev/null +++ b/docs/detection/utils/converters.md @@ -0,0 +1,60 @@ +--- +comments: true +status: new +--- + +# Converters Utils + + + +:::supervision.detection.utils.converters.xyxy_to_xywh + + + +:::supervision.detection.utils.converters.xywh_to_xyxy + + + +:::supervision.detection.utils.converters.xyxy_to_xcycarh + + + +:::supervision.detection.utils.converters.xcycwh_to_xyxy + + + +:::supervision.detection.utils.converters.xyxy_to_polygons + + + +:::supervision.detection.utils.converters.mask_to_xyxy + + + +:::supervision.detection.utils.converters.mask_to_polygons + + + +:::supervision.detection.utils.converters.polygon_to_mask + + + +:::supervision.detection.utils.converters.polygon_to_xyxy diff --git a/docs/detection/utils/iou_and_nms.md b/docs/detection/utils/iou_and_nms.md new file mode 100644 index 00000000..2b4e4fc3 --- /dev/null +++ b/docs/detection/utils/iou_and_nms.md @@ -0,0 +1,72 @@ +--- +comments: true +status: new +--- + +# IoU and NMS Utils + + + +:::supervision.detection.utils.iou_and_nms.OverlapFilter + + + +:::supervision.detection.utils.iou_and_nms.OverlapMetric + +
+

box_iou

+
+ +:::supervision.detection.utils.iou_and_nms.box_iou + + + +:::supervision.detection.utils.iou_and_nms.box_iou_batch + + + +:::supervision.detection.utils.iou_and_nms.box_iou_batch_with_jaccard + + + +:::supervision.detection.utils.iou_and_nms.mask_iou_batch + + + +:::supervision.detection.utils.iou_and_nms.oriented_box_iou_batch + + + +:::supervision.detection.utils.iou_and_nms.box_non_max_suppression + + + +:::supervision.detection.utils.iou_and_nms.mask_non_max_suppression + + + +:::supervision.detection.utils.iou_and_nms.box_non_max_merge + + + +:::supervision.detection.utils.iou_and_nms.mask_non_max_merge diff --git a/docs/detection/utils/masks.md b/docs/detection/utils/masks.md new file mode 100644 index 00000000..cf473762 --- /dev/null +++ b/docs/detection/utils/masks.md @@ -0,0 +1,24 @@ +--- +comments: true +status: new +--- + +# Masks Utils + + + +:::supervision.detection.utils.masks.move_masks + + + +:::supervision.detection.utils.masks.contains_holes + + + +:::supervision.detection.utils.masks.contains_multiple_segments \ No newline at end of file diff --git a/docs/detection/utils/polygons.md b/docs/detection/utils/polygons.md new file mode 100644 index 00000000..cd952534 --- /dev/null +++ b/docs/detection/utils/polygons.md @@ -0,0 +1,18 @@ +--- +comments: true +status: new +--- + +# Polygons Utils + + + +:::supervision.detection.utils.polygons.filter_polygons_by_area + + + +:::supervision.detection.utils.polygons.approximate_polygon diff --git a/mkdocs.yml b/mkdocs.yml index d3120939..f2501534 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -42,8 +42,11 @@ nav: - Detection and Segmentation: - Core: detection/core.md - Annotators: detection/annotators.md - - Double Detection Filter: detection/double_detection_filter.md - - Utils: detection/utils.md + - Converters: detection/utils/converters.md + - IoU and NMS: detection/utils/iou_and_nms.md + - Boxes: detection/utils/boxes.md + - Masks: detection/utils/masks.md + - Polygons: detection/utils/polygons.md - Keypoint Detection: - Core: keypoint/core.md - Annotators: keypoint/annotators.md diff --git a/supervision/detection/utils/boxes.py b/supervision/detection/utils/boxes.py index 0beb3903..3b01fcb6 100644 --- a/supervision/detection/utils/boxes.py +++ b/supervision/detection/utils/boxes.py @@ -100,25 +100,27 @@ def denormalize_boxes( normalization_factor: float = 1.0, ) -> np.ndarray: """ - Convert normalized xyxy coordinates to absolute XYXY coordinates. By default, assumes - normalized values are between 0 and 1, but supports custom ranges via normalization_factor parameter. + Converts normalized bounding box coordinates to absolute pixel values. + Args: - normalized_xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each row contains - normalized coordinates in format `(x1, y1, x2, y2)` with values between 0 and normalization_factor. - resolution_wh (Tuple[int, int]): A tuple of the form `(width, height)` representing - the target resolution. - normalization_factor (float): The maximum value of the normalization range. For example: - - normalization_factor=1.0 means input coordinates are normalized between 0 and 1 - - normalization_factor=100.0 means input coordinates are normalized between 0 and 100 - - normalization_factor=1000.0 means input coordinates are normalized between 0 and 1000 + normalized_xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each row + contains normalized coordinates in the format `(x_min, y_min, x_max, y_max)`, + with values between 0 and `normalization_factor`. + resolution_wh (Tuple[int, int]): A tuple `(width, height)` representing the + target image resolution. + normalization_factor (float, optional): The normalization range of the input + coordinates. Defaults to 1.0. + Returns: - np.ndarray: A numpy array of shape `(N, 4)` containing the absolute coordinates - in format `(x1, y1, x2, y2)`. + np.ndarray: An array of shape `(N, 4)` with absolute coordinates in + `(x_min, y_min, x_max, y_max)` format. + Examples: ```python import numpy as np import supervision as sv - # Example with default normalization (0-1) + + # Default normalization (0-1) normalized_xyxy = np.array([ [0.1, 0.2, 0.5, 0.6], [0.3, 0.4, 0.7, 0.8] @@ -129,12 +131,13 @@ def denormalize_boxes( # [ 10., 40., 50., 120.], # [ 30., 80., 70., 160.] # ]) - # Example with custom normalization (0-100) + + # Custom normalization (0-100) normalized_xyxy = np.array([ [10., 20., 50., 60.], [30., 40., 70., 80.] ]) - sv.denormalize_boxes(normalized_xyxy, resolution_wh, max_value=100.0) + sv.denormalize_boxes(normalized_xyxy, resolution_wh, normalization_factor=100.0) # array([ # [ 10., 40., 50., 120.], # [ 30., 80., 70., 160.] diff --git a/supervision/detection/utils/masks.py b/supervision/detection/utils/masks.py index f2063a88..c5cfee01 100644 --- a/supervision/detection/utils/masks.py +++ b/supervision/detection/utils/masks.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import cv2 import numpy as np import numpy.typing as npt diff --git a/supervision/detection/utils/polygons.py b/supervision/detection/utils/polygons.py index 3998e700..6da145c8 100644 --- a/supervision/detection/utils/polygons.py +++ b/supervision/detection/utils/polygons.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import cv2 import numpy as np From b507ed90dd3fe815f41268e9106c162293dabce7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 17:56:34 +0000 Subject: [PATCH 091/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/detection/utils/boxes.md | 2 +- docs/detection/utils/masks.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/detection/utils/boxes.md b/docs/detection/utils/boxes.md index 499578da..63a32317 100644 --- a/docs/detection/utils/boxes.md +++ b/docs/detection/utils/boxes.md @@ -33,4 +33,4 @@ status: new

denormalize_boxes

-:::supervision.detection.utils.boxes.denormalize_boxes \ No newline at end of file +:::supervision.detection.utils.boxes.denormalize_boxes diff --git a/docs/detection/utils/masks.md b/docs/detection/utils/masks.md index cf473762..9e53a6ba 100644 --- a/docs/detection/utils/masks.md +++ b/docs/detection/utils/masks.md @@ -21,4 +21,4 @@ status: new

contains_multiple_segments

-:::supervision.detection.utils.masks.contains_multiple_segments \ No newline at end of file +:::supervision.detection.utils.masks.contains_multiple_segments From 5b42be9b4a7b15c7d0b29ee38fd3cd6b151d359b Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 15 Jul 2025 20:10:35 +0200 Subject: [PATCH 092/110] make sure only recently updated pages have new status --- docs/detection/tools/line_zone.md | 1 - docs/keypoint/annotators.md | 1 - docs/keypoint/core.md | 1 - docs/metrics/common_values.md | 1 - docs/metrics/f1_score.md | 1 - docs/metrics/mean_average_recall.md | 1 - docs/metrics/precision.md | 1 - docs/metrics/recall.md | 1 - docs/trackers.md | 1 - 9 files changed, 9 deletions(-) diff --git a/docs/detection/tools/line_zone.md b/docs/detection/tools/line_zone.md index 014687f9..8bca3cfd 100644 --- a/docs/detection/tools/line_zone.md +++ b/docs/detection/tools/line_zone.md @@ -1,6 +1,5 @@ --- comments: true -status: new ---
diff --git a/docs/keypoint/annotators.md b/docs/keypoint/annotators.md index 30a970ec..32f30626 100644 --- a/docs/keypoint/annotators.md +++ b/docs/keypoint/annotators.md @@ -1,6 +1,5 @@ --- comments: true -status: new --- # Annotators diff --git a/docs/keypoint/core.md b/docs/keypoint/core.md index 7354baba..6f42c254 100644 --- a/docs/keypoint/core.md +++ b/docs/keypoint/core.md @@ -1,6 +1,5 @@ --- comments: true -status: new --- # Keypoint Detection diff --git a/docs/metrics/common_values.md b/docs/metrics/common_values.md index b7600f3f..c1ab8634 100644 --- a/docs/metrics/common_values.md +++ b/docs/metrics/common_values.md @@ -1,6 +1,5 @@ --- comments: true -status: new --- # Common Values diff --git a/docs/metrics/f1_score.md b/docs/metrics/f1_score.md index e31a9557..5cf0cd77 100644 --- a/docs/metrics/f1_score.md +++ b/docs/metrics/f1_score.md @@ -1,6 +1,5 @@ --- comments: true -status: new --- # F1 Score diff --git a/docs/metrics/mean_average_recall.md b/docs/metrics/mean_average_recall.md index 5cc0bf0a..06fd991a 100644 --- a/docs/metrics/mean_average_recall.md +++ b/docs/metrics/mean_average_recall.md @@ -1,6 +1,5 @@ --- comments: true -status: new --- # Mean Average Recall diff --git a/docs/metrics/precision.md b/docs/metrics/precision.md index c704452e..2689f055 100644 --- a/docs/metrics/precision.md +++ b/docs/metrics/precision.md @@ -1,6 +1,5 @@ --- comments: true -status: new --- # Precision diff --git a/docs/metrics/recall.md b/docs/metrics/recall.md index 78dde833..516fd7cd 100644 --- a/docs/metrics/recall.md +++ b/docs/metrics/recall.md @@ -1,6 +1,5 @@ --- comments: true -status: new --- # Recall diff --git a/docs/trackers.md b/docs/trackers.md index 47f70061..cb44441f 100644 --- a/docs/trackers.md +++ b/docs/trackers.md @@ -1,6 +1,5 @@ --- comments: true -status: new --- # ByteTrack From ab9d12882873b2539e6a8960b4e8806b368089a6 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 15 Jul 2025 20:21:27 +0200 Subject: [PATCH 093/110] mark from_lmm as deprecated in docs --- supervision/detection/core.py | 4 +++ supervision/detection/vlm.py | 62 +++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index a616a821..bb52c579 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -815,6 +815,10 @@ class Detections: ) def from_lmm(cls, lmm: LMM | str, result: str | dict, **kwargs: Any) -> Detections: """ + !!! deprecated "Deprecated" + `Detections.from_lmm` is **deprecated** and will be removed in `supervision-0.31.0`. + Please use `Detections.from_vlm` instead. + Creates a Detections object from the given result string based on the specified Large Multimodal Model (LMM). diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index d6f293af..a35cd379 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -21,6 +21,18 @@ from supervision.validators import validate_resolution "`supervision-0.31.0`. Use VLM instead." ) class LMM(Enum): + """ + Enum specifying supported Large Multimodal Models (LMMs). + + Attributes: + PALIGEMMA: Google’s PaliGemma vision-language model. + FLORENCE_2: Microsoft Florence-2 vision-language model. + QWEN_2_5_VL: Qwen2.5-VL open vision-language model from Alibaba. + GOOGLE_GEMINI_2_0: Google Gemini 2.0 vision-language model. + GOOGLE_GEMINI_2_5: Google Gemini 2.5 vision-language model. + MOONDREAM: The Moondream vision-language model. + """ + PALIGEMMA = "paligemma" FLORENCE_2 = "florence_2" QWEN_2_5_VL = "qwen_2_5_vl" @@ -28,8 +40,39 @@ class LMM(Enum): GOOGLE_GEMINI_2_5 = "gemini_2_5" MOONDREAM = "moondream" + @classmethod + def list(cls): + return list(map(lambda c: c.value, cls)) + + @classmethod + def from_value(cls, value: LMM | str) -> LMM: + if isinstance(value, cls): + return value + if isinstance(value, str): + value = value.lower() + try: + return cls(value) + except ValueError: + raise ValueError(f"Invalid value: {value}. Must be one of {cls.list()}") + raise ValueError( + f"Invalid value type: {type(value)}. Must be an instance of " + f"{cls.__name__} or str." + ) + class VLM(Enum): + """ + Enum specifying supported Vision-Language Models (VLMs). + + Attributes: + PALIGEMMA: Google’s PaliGemma vision-language model. + FLORENCE_2: Microsoft Florence-2 vision-language model. + QWEN_2_5_VL: Qwen2.5-VL open vision-language model from Alibaba. + GOOGLE_GEMINI_2_0: Google Gemini 2.0 vision-language model. + GOOGLE_GEMINI_2_5: Google Gemini 2.5 vision-language model. + MOONDREAM: The Moondream vision-language model. + """ + PALIGEMMA = "paligemma" FLORENCE_2 = "florence_2" QWEN_2_5_VL = "qwen_2_5_vl" @@ -37,6 +80,25 @@ class VLM(Enum): GOOGLE_GEMINI_2_5 = "gemini_2_5" MOONDREAM = "moondream" + @classmethod + def list(cls): + return list(map(lambda c: c.value, cls)) + + @classmethod + def from_value(cls, value: VLM | str) -> VLM: + if isinstance(value, cls): + return value + if isinstance(value, str): + value = value.lower() + try: + return cls(value) + except ValueError: + raise ValueError(f"Invalid value: {value}. Must be one of {cls.list()}") + raise ValueError( + f"Invalid value type: {type(value)}. Must be an instance of " + f"{cls.__name__} or str." + ) + RESULT_TYPES: dict[VLM, type] = { VLM.PALIGEMMA: str, From b8d646ac9871b8c8d302b659bd43609d47af97f1 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 21:23:28 +0300 Subject: [PATCH 094/110] =?UTF-8?q?fix:=20=F0=9F=90=9E=20type=20annotation?= =?UTF-8?q?s=20for=20internal.py=20vars?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/utils/internal.py | 37 +++++++++++++++---------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/supervision/detection/utils/internal.py b/supervision/detection/utils/internal.py index 2bcaf955..bc6579a8 100644 --- a/supervision/detection/utils/internal.py +++ b/supervision/detection/utils/internal.py @@ -68,12 +68,12 @@ def process_roboflow_result( {CLASS_NAME_DATA_FIELD: np.empty(0)}, ) - xyxy = [] - confidence = [] - class_id = [] - class_name = [] - masks = [] - tracker_ids = [] + xyxy: list[list[float]] = [] + confidence: list[float] = [] + class_id: list[int] = [] + class_name: list[str] = [] + masks: list[np.ndarray] = [] + tracker_ids: list[int] = [] image_width = int(roboflow_result["image"]["width"]) image_height = int(roboflow_result["image"]["height"]) @@ -108,15 +108,22 @@ def process_roboflow_result( if "tracker_id" in prediction: tracker_ids.append(prediction["tracker_id"]) - xyxy = np.array(xyxy) if len(xyxy) > 0 else np.empty((0, 4)) - confidence = np.array(confidence) if len(confidence) > 0 else np.empty(0) - class_id = np.array(class_id).astype(int) if len(class_id) > 0 else np.empty(0) - class_name = np.array(class_name) if len(class_name) > 0 else np.empty(0) - masks = np.array(masks, dtype=bool) if len(masks) > 0 else None - tracker_id = np.array(tracker_ids).astype(int) if len(tracker_ids) > 0 else None - data = {CLASS_NAME_DATA_FIELD: class_name} + xyxy_arr = np.array(xyxy) if len(xyxy) > 0 else np.empty((0, 4)) + confidence_arr = np.array(confidence) if len(confidence) > 0 else np.empty(0) + class_id_arr = np.array(class_id).astype(int) if len(class_id) > 0 else np.empty(0) + class_name_arr = np.array(class_name) if len(class_name) > 0 else np.empty(0) + masks_arr = np.array(masks, dtype=bool) if len(masks) > 0 else None + tracker_id_arr = np.array(tracker_ids).astype(int) if len(tracker_ids) > 0 else None + data: dict[str, np.ndarray] = {CLASS_NAME_DATA_FIELD: class_name_arr} - return xyxy, confidence, class_id, masks, tracker_id, data + return ( + xyxy_arr, + confidence_arr, + class_id_arr, + masks_arr, + tracker_id_arr, + data, + ) def is_data_equal(data_a: dict[str, np.ndarray], data_b: dict[str, np.ndarray]) -> bool: @@ -285,7 +292,7 @@ def get_data_item( Returns: A subset of the data dictionary corresponding to the specified index. """ - subset_data = {} + subset_data: dict[str, np.ndarray | list] = {} for key, value in data.items(): if isinstance(value, np.ndarray): subset_data[key] = value[index] From 3ba5c122111d614bdff349ac850f2c73d45a8933 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 18:26:11 +0000 Subject: [PATCH 095/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index bb52c579..ad7bff5e 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -818,7 +818,7 @@ class Detections: !!! deprecated "Deprecated" `Detections.from_lmm` is **deprecated** and will be removed in `supervision-0.31.0`. Please use `Detections.from_vlm` instead. - + Creates a Detections object from the given result string based on the specified Large Multimodal Model (LMM). From 8710bde5b2f8d09b64503ebd94d71ffb6b78988e Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 21:31:13 +0300 Subject: [PATCH 096/110] =?UTF-8?q?docs:=20=F0=9F=93=9D=20=20add=20docstri?= =?UTF-8?q?ng=20to=20validate=5Fvlm=5Fparameters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/vlm.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index a35cd379..e9af3d28 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -142,6 +142,20 @@ SUPPORTED_TASKS_FLORENCE_2 = [ def validate_vlm_parameters(vlm: VLM | str, result: Any, kwargs: dict[str, Any]) -> VLM: + """ + Validates the parameters and result type for a given Vision-Language Model (VLM). + + Args: + vlm: The VLM enum or string specifying the model. + result: The result object to validate (type depends on VLM). + kwargs: Dictionary of arguments to validate against required/allowed lists. + + Returns: + VLM: The validated VLM enum value. + + Raises: + ValueError: If the VLM, result type, or arguments are invalid. + """ if isinstance(vlm, str): try: vlm = VLM(vlm.lower()) From 334d8e650605bd6bea61d731f944586c4a2b0864 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 21:34:24 +0300 Subject: [PATCH 097/110] =?UTF-8?q?fix:=20=F0=9F=90=9E=20correct=20possess?= =?UTF-8?q?ive=20form=20in=20docstring=20for=20LMM=20and=20VLM=20enums?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/vlm.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index e9af3d28..1a5ad231 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -25,8 +25,8 @@ class LMM(Enum): Enum specifying supported Large Multimodal Models (LMMs). Attributes: - PALIGEMMA: Google’s PaliGemma vision-language model. - FLORENCE_2: Microsoft Florence-2 vision-language model. + PALIGEMMA: Google's PaliGemma vision-language model. + FLORENCE_2: Microsoft's Florence-2 vision-language model. QWEN_2_5_VL: Qwen2.5-VL open vision-language model from Alibaba. GOOGLE_GEMINI_2_0: Google Gemini 2.0 vision-language model. GOOGLE_GEMINI_2_5: Google Gemini 2.5 vision-language model. @@ -65,8 +65,8 @@ class VLM(Enum): Enum specifying supported Vision-Language Models (VLMs). Attributes: - PALIGEMMA: Google’s PaliGemma vision-language model. - FLORENCE_2: Microsoft Florence-2 vision-language model. + PALIGEMMA: Google's PaliGemma vision-language model. + FLORENCE_2: Microsoft's Florence-2 vision-language model. QWEN_2_5_VL: Qwen2.5-VL open vision-language model from Alibaba. GOOGLE_GEMINI_2_0: Google Gemini 2.0 vision-language model. GOOGLE_GEMINI_2_5: Google Gemini 2.5 vision-language model. From 2dca99d0dc77747d903b473aa4549249ebcffdb0 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 15 Jul 2025 20:35:44 +0200 Subject: [PATCH 098/110] added mask_non_max_merge to quick imports --- supervision/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/supervision/__init__.py b/supervision/__init__.py index 3e5c418c..2e227b57 100644 --- a/supervision/__init__.py +++ b/supervision/__init__.py @@ -79,6 +79,7 @@ from supervision.detection.utils.iou_and_nms import ( box_non_max_suppression, mask_iou_batch, mask_non_max_suppression, + mask_non_max_merge, oriented_box_iou_batch, ) from supervision.detection.utils.masks import ( @@ -222,6 +223,7 @@ __all__ = [ "list_files_with_extensions", "mask_iou_batch", "mask_non_max_suppression", + "mask_non_max_merge", "mask_to_polygons", "mask_to_rle", "mask_to_xyxy", From facc64bb3a41da2724a5834058affd18a2e274e1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 18:38:06 +0000 Subject: [PATCH 099/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supervision/__init__.py b/supervision/__init__.py index 2e227b57..925628be 100644 --- a/supervision/__init__.py +++ b/supervision/__init__.py @@ -78,8 +78,8 @@ from supervision.detection.utils.iou_and_nms import ( box_non_max_merge, box_non_max_suppression, mask_iou_batch, - mask_non_max_suppression, mask_non_max_merge, + mask_non_max_suppression, oriented_box_iou_batch, ) from supervision.detection.utils.masks import ( @@ -222,8 +222,8 @@ __all__ = [ "letterbox_image", "list_files_with_extensions", "mask_iou_batch", - "mask_non_max_suppression", "mask_non_max_merge", + "mask_non_max_suppression", "mask_to_polygons", "mask_to_rle", "mask_to_xyxy", From 14d3b7938791b763c7ae21e4dbe60c7a7a3c10d5 Mon Sep 17 00:00:00 2001 From: soumik12345 <19soumik.rakshit96@gmail.com> Date: Wed, 16 Jul 2025 00:17:00 +0530 Subject: [PATCH 100/110] fix: formula in box_iou docstring --- supervision/detection/utils/iou_and_nms.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/supervision/detection/utils/iou_and_nms.py b/supervision/detection/utils/iou_and_nms.py index 07602a2d..b795ccd9 100644 --- a/supervision/detection/utils/iou_and_nms.py +++ b/supervision/detection/utils/iou_and_nms.py @@ -92,9 +92,7 @@ def box_iou( Mathematically, it is defined as: - \\[ - \text{IoU} = \frac{|\text{box}_{\text{true}} \\cap \text{box}_{\text{detection}}|}{|\text{box}_{\text{true}} \\cup \text{box}_{\text{detection}}|} - \\] + $$ IoU(A, B) = \\frac{|A \\cap B|}{|A \\cup B|} $$ Note: Use `box_iou` when computing IoU between two individual boxes. From 1bc672afd3bfd4bc2b28ae98563825aaaf7273ab Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 18:47:19 +0000 Subject: [PATCH 101/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/utils/iou_and_nms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/detection/utils/iou_and_nms.py b/supervision/detection/utils/iou_and_nms.py index b795ccd9..b0be153b 100644 --- a/supervision/detection/utils/iou_and_nms.py +++ b/supervision/detection/utils/iou_and_nms.py @@ -120,7 +120,7 @@ def box_iou( sv.box_iou(box_true=box_true, box_detection=box_detection) # 0.14285814285714285 ``` - """ # noqa: E501 + """ box_true = np.array(box_true) box_detection = np.array(box_detection) From d854e23e9a13074255eda041ace298cf4cde48d6 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 15 Jul 2025 20:55:12 +0200 Subject: [PATCH 102/110] fix latex problems --- supervision/detection/utils/iou_and_nms.py | 10 ++++------ supervision/metrics/mean_average_precision.py | 2 -- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/supervision/detection/utils/iou_and_nms.py b/supervision/detection/utils/iou_and_nms.py index 07602a2d..56bdff71 100644 --- a/supervision/detection/utils/iou_and_nms.py +++ b/supervision/detection/utils/iou_and_nms.py @@ -87,14 +87,12 @@ def box_iou( box_true: list[float] | np.ndarray, box_detection: list[float] | np.ndarray, ) -> float: - """ + r""" Compute the Intersection over Union (IoU) between two bounding boxes. - Mathematically, it is defined as: - - \\[ - \text{IoU} = \frac{|\text{box}_{\text{true}} \\cap \text{box}_{\text{detection}}|}{|\text{box}_{\text{true}} \\cup \text{box}_{\text{detection}}|} - \\] + \[ + \text{IoU} = \frac{|\text{box}_{\text{true}} \cap \text{box}_{\text{detection}}|}{|\text{box}_{\text{true}} \cup \text{box}_{\text{detection}}|} + \] Note: Use `box_iou` when computing IoU between two individual boxes. diff --git a/supervision/metrics/mean_average_precision.py b/supervision/metrics/mean_average_precision.py index 89e461fc..5100f39a 100644 --- a/supervision/metrics/mean_average_precision.py +++ b/supervision/metrics/mean_average_precision.py @@ -214,8 +214,6 @@ class EvaluationDataset: """ Class used representing a dataset in the right format needed by the `COCOEvaluator` class. - - Reference: https://github.com/rafaelpadilla/review_object_detection_metrics """ def __init__(self, targets: dict[str, Any] | None = None): From a135bd6268360e2eb65eba69d9bec775e44b8ba3 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 15 Jul 2025 21:12:50 +0200 Subject: [PATCH 103/110] add deprecation message to old mAP --- supervision/metrics/detection.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/supervision/metrics/detection.py b/supervision/metrics/detection.py index 438b6a80..52bf96e0 100644 --- a/supervision/metrics/detection.py +++ b/supervision/metrics/detection.py @@ -10,6 +10,7 @@ import numpy as np from supervision.dataset.core import DetectionDataset from supervision.detection.core import Detections from supervision.detection.utils.iou_and_nms import box_iou_batch +from supervision.utils.internal import deprecated def detections_to_tensor( @@ -492,10 +493,23 @@ class ConfusionMatrix: ) return fig - +@deprecated( + "`MeanAveragePrecision` is deprecated and will be removed in " + "`supervision-0.31.0`. Use " + "`supervision.metrics.mean_average_precision.MeanAveragePrecision` instead." +) @dataclass(frozen=True) class MeanAveragePrecision: """ + !!! deprecated "Deprecated" + `MeanAveragePrecision` is **deprecated** and will be removed in + `supervision-0.31.0`. + + The current implementation provides results that are inconsistent with + `pycocotools`. Please use + `supervision.metrics.mean_average_precision.MeanAveragePrecision` instead, + which matches the results of `pycocotools` and is now the recommended approach. + Mean Average Precision for object detection tasks. Attributes: From c4ede20a2d0628f2b34e73aac9f0176efc696a61 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 15 Jul 2025 21:13:46 +0200 Subject: [PATCH 104/110] add deprecation message to old mAP --- supervision/metrics/detection.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/supervision/metrics/detection.py b/supervision/metrics/detection.py index 52bf96e0..946ccd21 100644 --- a/supervision/metrics/detection.py +++ b/supervision/metrics/detection.py @@ -496,7 +496,8 @@ class ConfusionMatrix: @deprecated( "`MeanAveragePrecision` is deprecated and will be removed in " "`supervision-0.31.0`. Use " - "`supervision.metrics.mean_average_precision.MeanAveragePrecision` instead." + "`supervision.metrics.mean_average_precision.MeanAveragePrecision` instead. The " + "deprecated implementation provides results that are inconsistent with pycocotools." ) @dataclass(frozen=True) class MeanAveragePrecision: @@ -505,7 +506,7 @@ class MeanAveragePrecision: `MeanAveragePrecision` is **deprecated** and will be removed in `supervision-0.31.0`. - The current implementation provides results that are inconsistent with + The deprecated implementation provides results that are inconsistent with `pycocotools`. Please use `supervision.metrics.mean_average_precision.MeanAveragePrecision` instead, which matches the results of `pycocotools` and is now the recommended approach. From 5397031cee9e8ab4e5c46fb49eec714219a102a4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 19:14:40 +0000 Subject: [PATCH 105/110] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/metrics/detection.py | 1 + 1 file changed, 1 insertion(+) diff --git a/supervision/metrics/detection.py b/supervision/metrics/detection.py index 946ccd21..bc393469 100644 --- a/supervision/metrics/detection.py +++ b/supervision/metrics/detection.py @@ -493,6 +493,7 @@ class ConfusionMatrix: ) return fig + @deprecated( "`MeanAveragePrecision` is deprecated and will be removed in " "`supervision-0.31.0`. Use " From 880a9e8eb52840bc61b8431a144f6a8cf0e588e3 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 15 Jul 2025 21:21:05 +0200 Subject: [PATCH 106/110] fix double decorator bug --- supervision/metrics/detection.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/supervision/metrics/detection.py b/supervision/metrics/detection.py index bc393469..17a41795 100644 --- a/supervision/metrics/detection.py +++ b/supervision/metrics/detection.py @@ -500,7 +500,6 @@ class ConfusionMatrix: "`supervision.metrics.mean_average_precision.MeanAveragePrecision` instead. The " "deprecated implementation provides results that are inconsistent with pycocotools." ) -@dataclass(frozen=True) class MeanAveragePrecision: """ !!! deprecated "Deprecated" @@ -526,10 +525,17 @@ class MeanAveragePrecision: provided for each individual class. """ - map50_95: float - map50: float - map75: float - per_class_ap50_95: np.ndarray + def __init__( + self, + map50_95: float, + map50: float, + map75: float, + per_class_ap50_95: np.ndarray, + ): + self.map50_95 = map50_95 + self.map50 = map50 + self.map75 = map75 + self.per_class_ap50_95 = per_class_ap50_95 @classmethod def from_detections( From bbadfb3cbdedad30b5eef6912aa4ea29761f919e Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 15 Jul 2025 21:27:48 +0200 Subject: [PATCH 107/110] Revert "fix double decorator bug" This reverts commit 880a9e8eb52840bc61b8431a144f6a8cf0e588e3. --- supervision/metrics/detection.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/supervision/metrics/detection.py b/supervision/metrics/detection.py index 17a41795..bc393469 100644 --- a/supervision/metrics/detection.py +++ b/supervision/metrics/detection.py @@ -500,6 +500,7 @@ class ConfusionMatrix: "`supervision.metrics.mean_average_precision.MeanAveragePrecision` instead. The " "deprecated implementation provides results that are inconsistent with pycocotools." ) +@dataclass(frozen=True) class MeanAveragePrecision: """ !!! deprecated "Deprecated" @@ -525,17 +526,10 @@ class MeanAveragePrecision: provided for each individual class. """ - def __init__( - self, - map50_95: float, - map50: float, - map75: float, - per_class_ap50_95: np.ndarray, - ): - self.map50_95 = map50_95 - self.map50 = map50 - self.map75 = map75 - self.per_class_ap50_95 = per_class_ap50_95 + map50_95: float + map50: float + map75: float + per_class_ap50_95: np.ndarray @classmethod def from_detections( From 2b47d8e4ccb9d679be764b23d9da085755c74850 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 15 Jul 2025 21:28:58 +0200 Subject: [PATCH 108/110] fix double decorator bug --- supervision/metrics/detection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/metrics/detection.py b/supervision/metrics/detection.py index bc393469..dcc90726 100644 --- a/supervision/metrics/detection.py +++ b/supervision/metrics/detection.py @@ -500,7 +500,7 @@ class ConfusionMatrix: "`supervision.metrics.mean_average_precision.MeanAveragePrecision` instead. The " "deprecated implementation provides results that are inconsistent with pycocotools." ) -@dataclass(frozen=True) +@dataclass() class MeanAveragePrecision: """ !!! deprecated "Deprecated" From 5d6f5bfde3516f7c86ac2b318899f6df7190c02f Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 15 Jul 2025 22:41:25 +0300 Subject: [PATCH 109/110] fix(deprecated): change MeanAveragePrecision to frozen dataclass and enhance deprecated decorator for classes --- supervision/metrics/detection.py | 2 +- supervision/utils/internal.py | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/supervision/metrics/detection.py b/supervision/metrics/detection.py index dcc90726..bc393469 100644 --- a/supervision/metrics/detection.py +++ b/supervision/metrics/detection.py @@ -500,7 +500,7 @@ class ConfusionMatrix: "`supervision.metrics.mean_average_precision.MeanAveragePrecision` instead. The " "deprecated implementation provides results that are inconsistent with pycocotools." ) -@dataclass() +@dataclass(frozen=True) class MeanAveragePrecision: """ !!! deprecated "Deprecated" diff --git a/supervision/utils/internal.py b/supervision/utils/internal.py index 242a4172..1cced171 100644 --- a/supervision/utils/internal.py +++ b/supervision/utils/internal.py @@ -114,13 +114,25 @@ def deprecated_parameter( def deprecated(reason: str): - def decorator(func): - @functools.wraps(func) - def wrapper(*args, **kwargs): - warn_deprecated(f"{func.__name__} is deprecated: {reason}") - return func(*args, **kwargs) + def decorator(cls_or_func): + if inspect.isclass(cls_or_func): + original_init = cls_or_func.__init__ - return wrapper + @functools.wraps(original_init) + def new_init(self, *args, **kwargs): + warn_deprecated(f"{cls_or_func.__name__} is deprecated: {reason}") + original_init(self, *args, **kwargs) + + cls_or_func.__init__ = new_init + return cls_or_func + else: + + @functools.wraps(cls_or_func) + def wrapper(*args, **kwargs): + warn_deprecated(f"{cls_or_func.__name__} is deprecated: {reason}") + return cls_or_func(*args, **kwargs) + + return wrapper return decorator From 4e832b2cf4bcd7dbdf23b44f8edea2e6a2ef66cf Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 15 Jul 2025 22:12:22 +0200 Subject: [PATCH 110/110] bump version from `0.26.0rc7` to `0.26.0rc8` --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d96a0ae0..a198889b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "supervision" description = "A set of easy-to-use utils that will come in handy in any Computer Vision project" license = { text = "MIT" } -version = "0.26.0rc7" +version = "0.26.0rc8" readme = "README.md" requires-python = ">=3.9" authors = [