diff --git a/src/pyrecest/_backend/pytorch/random.py b/src/pyrecest/_backend/pytorch/random.py index 2c1cdf5b..6cb1e9a4 100644 --- a/src/pyrecest/_backend/pytorch/random.py +++ b/src/pyrecest/_backend/pytorch/random.py @@ -190,7 +190,9 @@ def _integer_population_size(a): return None -def _choice_indices(population_size, size, num_samples, replace, p, device, *, shuffle=True): +def _choice_indices( + population_size, size, num_samples, replace, p, device, *, shuffle=True +): if population_size <= 0: if num_samples == 0: return _torch.empty(size or (0,), dtype=_torch.long, device=device) diff --git a/src/pyrecest/evaluation/generate_measurements.py b/src/pyrecest/evaluation/generate_measurements.py index d27a5ac3..8cd852ba 100644 --- a/src/pyrecest/evaluation/generate_measurements.py +++ b/src/pyrecest/evaluation/generate_measurements.py @@ -250,13 +250,16 @@ def generate_measurements(groundtruth, simulation_config): measurements[t] = curr_dist.sample(n_meas) elif isinstance(meas_noise, GaussianDistribution): noise_samples = meas_noise.sample(n_meas) - measurements[t] = tile( - groundtruth[t], - ( - n_meas, - 1, - ), - ) + noise_samples + measurements[t] = ( + tile( + groundtruth[t], + ( + n_meas, + 1, + ), + ) + + noise_samples + ) return measurements diff --git a/src/pyrecest/evaluation/pareto.py b/src/pyrecest/evaluation/pareto.py index 32c79a62..8de17e2a 100644 --- a/src/pyrecest/evaluation/pareto.py +++ b/src/pyrecest/evaluation/pareto.py @@ -369,5 +369,7 @@ def _coerce_finite_threshold(value: Any, column: str) -> float: f"Constraint threshold for {column!r} must be a finite scalar." ) from exc if not np.isfinite(threshold): - raise ValueError(f"Constraint threshold for {column!r} must be a finite scalar.") + raise ValueError( + f"Constraint threshold for {column!r} must be a finite scalar." + ) return threshold diff --git a/src/pyrecest/filters/association_hypotheses.py b/src/pyrecest/filters/association_hypotheses.py index 5f837393..ee4650ea 100644 --- a/src/pyrecest/filters/association_hypotheses.py +++ b/src/pyrecest/filters/association_hypotheses.py @@ -337,7 +337,9 @@ def filter( ), ) for hypothesis in sorted_group[: self.k]: - accepted_keys.add((_track_index(hypothesis), _measurement_index(hypothesis))) + accepted_keys.add( + (_track_index(hypothesis), _measurement_index(hypothesis)) + ) result = [] for hypothesis in hypotheses: diff --git a/src/pyrecest/models/__init__.py b/src/pyrecest/models/__init__.py index 2107bb19..7bec898c 100644 --- a/src/pyrecest/models/__init__.py +++ b/src/pyrecest/models/__init__.py @@ -4,6 +4,7 @@ and capability-oriented so filters can opt into the pieces they need. """ +from ._validated_motion_models import nearly_coordinated_turn_model from .adapters import ( LinearMeasurementArguments, LinearTransitionArguments, @@ -66,7 +67,6 @@ white_noise_jerk_covariance, white_noise_snap_covariance, ) -from ._validated_motion_models import nearly_coordinated_turn_model from .sensor_models import ( bearing_only_measurement, bearing_only_model, diff --git a/src/pyrecest/models/_validated_motion_models.py b/src/pyrecest/models/_validated_motion_models.py index 2efa1e08..f97618bd 100644 --- a/src/pyrecest/models/_validated_motion_models.py +++ b/src/pyrecest/models/_validated_motion_models.py @@ -19,9 +19,11 @@ def nearly_coordinated_turn_model( dt, "dt", ) - turn_rate_variance = _motion_models._as_nonnegative_float( # pylint: disable=protected-access - turn_rate_variance, - "turn_rate_variance", + turn_rate_variance = ( + _motion_models._as_nonnegative_float( # pylint: disable=protected-access + turn_rate_variance, + "turn_rate_variance", + ) ) return _nearly_coordinated_turn_model_impl( dt=dt, diff --git a/tests/backend/test_numpy_random_backend.py b/tests/backend/test_numpy_random_backend.py index 620d4bb6..aff46f3f 100644 --- a/tests/backend/test_numpy_random_backend.py +++ b/tests/backend/test_numpy_random_backend.py @@ -29,9 +29,7 @@ def test_choice_without_replacement_shuffle_false_preserves_order(): matrix = np.array([[10, 20, 30], [40, 50, 60]]) random.seed(0) - samples = random.choice( - values, size=values.shape[0], replace=False, shuffle=False - ) + samples = random.choice(values, size=values.shape[0], replace=False, shuffle=False) column_samples = random.choice( matrix, size=matrix.shape[1], diff --git a/tests/backend/test_pytorch_random_backend.py b/tests/backend/test_pytorch_random_backend.py index c77df870..3eed1a44 100644 --- a/tests/backend/test_pytorch_random_backend.py +++ b/tests/backend/test_pytorch_random_backend.py @@ -124,9 +124,7 @@ def test_choice_without_replacement_shuffle_false_preserves_order(): matrix = torch.tensor([[10, 20, 30], [40, 50, 60]]) random.seed(0) - samples = random.choice( - values, size=values.shape[0], replace=False, shuffle=False - ) + samples = random.choice(values, size=values.shape[0], replace=False, shuffle=False) column_samples = random.choice( matrix, size=matrix.shape[1], diff --git a/tests/models/test_validation.py b/tests/models/test_validation.py index c106407d..f9429ea6 100644 --- a/tests/models/test_validation.py +++ b/tests/models/test_validation.py @@ -119,7 +119,9 @@ class DistributionWithCallableDimAndMean: mu = array([0.0, 1.0]) def dim(self): - raise AssertionError("dim() must not be called when methods are disabled") + raise AssertionError( + "dim() must not be called when methods are disabled" + ) self.assertEqual( infer_state_dim_from_distribution( diff --git a/tests/test_multisession_assignment_observation_costs_gap.py b/tests/test_multisession_assignment_observation_costs_gap.py index ba4fa70b..6421317d 100644 --- a/tests/test_multisession_assignment_observation_costs_gap.py +++ b/tests/test_multisession_assignment_observation_costs_gap.py @@ -2,7 +2,10 @@ import unittest -from pyrecest.backend import __backend_name__, array # pylint: disable=no-name-in-module +from pyrecest.backend import ( # pylint: disable=no-name-in-module + __backend_name__, + array, +) from pyrecest.utils import solve_multisession_assignment_with_observation_costs diff --git a/tests/test_track_completion.py b/tests/test_track_completion.py index 42454e74..8917f2f3 100644 --- a/tests/test_track_completion.py +++ b/tests/test_track_completion.py @@ -5,7 +5,6 @@ import unittest import numpy as np - from pyrecest.utils.track_completion import ( CompletionCandidate, enumerate_fragment_completion_paths, @@ -69,6 +68,7 @@ def test_rejects_negative_candidate_observations(self) -> None: for invalid_candidate in invalid_candidates: with self.subTest(invalid_candidate=invalid_candidate): + def provider(session: int, observation: int, target_session: int): del session, observation, target_session return [invalid_candidate]