From e3c751f00e55bb026d5f9fc10b22999322d972c3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 20:03:09 +0000 Subject: [PATCH] style(pre-commit.ci): auto fixes [...] --- src/traccuracy/__init__.py | 1 + src/traccuracy/_tracking_graph.py | 4 ++-- src/traccuracy/loaders/__init__.py | 1 + src/traccuracy/matchers/__init__.py | 1 + src/traccuracy/matchers/_compute_overlap.py | 1 + src/traccuracy/metrics/_divisions.py | 1 + src/traccuracy/metrics/_track_overlap.py | 1 + 7 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/traccuracy/__init__.py b/src/traccuracy/__init__.py index 662c5f31..537b8fc8 100644 --- a/src/traccuracy/__init__.py +++ b/src/traccuracy/__init__.py @@ -1,4 +1,5 @@ """package description.""" + from importlib.metadata import PackageNotFoundError, version try: diff --git a/src/traccuracy/_tracking_graph.py b/src/traccuracy/_tracking_graph.py index 45dd65de..db60a204 100644 --- a/src/traccuracy/_tracking_graph.py +++ b/src/traccuracy/_tracking_graph.py @@ -195,13 +195,13 @@ def __init__( self.nodes_by_frame[frame].add(node) # store node id in nodes_by_flag mapping for node_flag in NodeFlag: - if node_flag in attrs and attrs[node_flag]: + if attrs.get(node_flag): self.nodes_by_flag[node_flag].add(node) # store edge id in edges_by_flag for edge, attrs in self.graph.edges.items(): for edge_flag in EdgeFlag: - if edge_flag in attrs and attrs[edge_flag]: + if attrs.get(edge_flag): self.edges_by_flag[edge_flag].add(edge) # Store first and last frames for reference diff --git a/src/traccuracy/loaders/__init__.py b/src/traccuracy/loaders/__init__.py index eab93295..edb98eac 100644 --- a/src/traccuracy/loaders/__init__.py +++ b/src/traccuracy/loaders/__init__.py @@ -5,6 +5,7 @@ Each loading function must return one TrackingGraph object which has a track graph and optionally contains a corresponding segmentation. """ + from ._ctc import _check_ctc, _get_node_attributes, _load_tiffs, load_ctc_data __all__ = ["load_ctc_data", "_check_ctc", "_load_tiffs", "_get_node_attributes"] diff --git a/src/traccuracy/matchers/__init__.py b/src/traccuracy/matchers/__init__.py index e7a641b1..f662ecc3 100644 --- a/src/traccuracy/matchers/__init__.py +++ b/src/traccuracy/matchers/__init__.py @@ -25,6 +25,7 @@ While we specify ground truth and prediction, it is possible to write a matching function that matches two arbitrary tracking solutions. """ + from ._base import Matched from ._compute_overlap import get_labels_with_overlap from ._ctc import CTCMatcher diff --git a/src/traccuracy/matchers/_compute_overlap.py b/src/traccuracy/matchers/_compute_overlap.py index abd04085..ee904736 100644 --- a/src/traccuracy/matchers/_compute_overlap.py +++ b/src/traccuracy/matchers/_compute_overlap.py @@ -5,6 +5,7 @@ Licensed under The MIT License [see LICENSE for details] Copyright (c) 2015 Microsoft """ + from typing import Tuple import numpy as np diff --git a/src/traccuracy/metrics/_divisions.py b/src/traccuracy/metrics/_divisions.py index b3ed3d7e..9cc9f6d3 100644 --- a/src/traccuracy/metrics/_divisions.py +++ b/src/traccuracy/metrics/_divisions.py @@ -32,6 +32,7 @@ of the early division, by advancing along the graph to find nodes in the same frame as the late division daughters. """ + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/src/traccuracy/metrics/_track_overlap.py b/src/traccuracy/metrics/_track_overlap.py index 4326a74a..7a9ff5de 100644 --- a/src/traccuracy/metrics/_track_overlap.py +++ b/src/traccuracy/metrics/_track_overlap.py @@ -10,6 +10,7 @@ - TP is defined analogously, with T^g_j and T^p_j being swapped in the definition. """ + from __future__ import annotations from itertools import groupby, product