From aa59a75c767c7855c84856cd556d508b88cccffe Mon Sep 17 00:00:00 2001 From: Santiago Martinez Date: Mon, 27 Nov 2023 19:51:08 +0000 Subject: [PATCH] formatted with black and isort --- src/soundevent/data/clip_annotations.py | 2 +- src/soundevent/evaluation/tasks/common.py | 5 ++--- src/soundevent/io/__init__.py | 2 +- src/soundevent/io/aoef/recording.py | 3 ++- src/soundevent/io/aoef/user.py | 2 +- tests/test_evaluation/test_clip_classification.py | 8 ++++++-- tests/test_io/test_aoef/test_sequence.py | 1 + 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/soundevent/data/clip_annotations.py b/src/soundevent/data/clip_annotations.py index 9f52e2f..46da2db 100644 --- a/src/soundevent/data/clip_annotations.py +++ b/src/soundevent/data/clip_annotations.py @@ -13,8 +13,8 @@ from soundevent.data.clips import Clip from soundevent.data.notes import Note -from soundevent.data.sound_event_annotations import SoundEventAnnotation from soundevent.data.sequence_annotations import SequenceAnnotation +from soundevent.data.sound_event_annotations import SoundEventAnnotation from soundevent.data.tags import Tag __all__ = [ diff --git a/src/soundevent/evaluation/tasks/common.py b/src/soundevent/evaluation/tasks/common.py index a76d164..0e2cb58 100644 --- a/src/soundevent/evaluation/tasks/common.py +++ b/src/soundevent/evaluation/tasks/common.py @@ -1,4 +1,4 @@ -from typing import Iterable, Tuple, Sequence +from typing import Iterable, Sequence, Tuple from soundevent import data @@ -8,8 +8,7 @@ def iterate_over_valid_clips( clip_annotations: Sequence[data.ClipAnnotation], ) -> Iterable[Tuple[data.ClipAnnotation, data.ClipPrediction]]: annotated_clips = { - example.clip.uuid: example - for example in clip_annotations + example.clip.uuid: example for example in clip_annotations } for predictions in clip_predictions: diff --git a/src/soundevent/io/__init__.py b/src/soundevent/io/__init__.py index 6e8aacb..97bb4e1 100644 --- a/src/soundevent/io/__init__.py +++ b/src/soundevent/io/__init__.py @@ -3,8 +3,8 @@ This module contains the classes and functions for reading and writing sound event data. """ -from soundevent.io.saver import save from soundevent.io.loader import load +from soundevent.io.saver import save from soundevent.io.types import DataCollections __all__ = [ diff --git a/src/soundevent/io/aoef/recording.py b/src/soundevent/io/aoef/recording.py index a94373d..5a81958 100644 --- a/src/soundevent/io/aoef/recording.py +++ b/src/soundevent/io/aoef/recording.py @@ -58,7 +58,8 @@ def assemble_aoef( notes = [self._note_adapter.to_aoef(note) for note in obj.notes] owners = [ - self._user_adapter.to_aoef(owner).uuid for owner in obj.owners or [] + self._user_adapter.to_aoef(owner).uuid + for owner in obj.owners or [] ] path = obj.path diff --git a/src/soundevent/io/aoef/user.py b/src/soundevent/io/aoef/user.py index 585fa30..241d296 100644 --- a/src/soundevent/io/aoef/user.py +++ b/src/soundevent/io/aoef/user.py @@ -1,4 +1,4 @@ -from typing import Optional, Hashable +from typing import Hashable, Optional from uuid import UUID, uuid4 from pydantic import BaseModel diff --git a/tests/test_evaluation/test_clip_classification.py b/tests/test_evaluation/test_clip_classification.py index 74ce9a3..be8a681 100644 --- a/tests/test_evaluation/test_clip_classification.py +++ b/tests/test_evaluation/test_clip_classification.py @@ -244,7 +244,11 @@ def test_each_example_score_is_the_probability_of_the_true_class( assert len(evaluation.clip_evaluations[1].metrics) == 1 assert evaluation.clip_evaluations[0].score is not None - assert math.isclose(evaluation.clip_evaluations[0].score, 0.9, rel_tol=1e-6) + assert math.isclose( + evaluation.clip_evaluations[0].score, 0.9, rel_tol=1e-6 + ) assert evaluation.clip_evaluations[1].score is not None - assert math.isclose(evaluation.clip_evaluations[1].score, 0.1, rel_tol=1e-6) + assert math.isclose( + evaluation.clip_evaluations[1].score, 0.1, rel_tol=1e-6 + ) diff --git a/tests/test_io/test_aoef/test_sequence.py b/tests/test_io/test_aoef/test_sequence.py index 091b022..b700479 100644 --- a/tests/test_io/test_aoef/test_sequence.py +++ b/tests/test_io/test_aoef/test_sequence.py @@ -6,6 +6,7 @@ SequenceObject, ) + def test_sequence_can_be_converted_to_aoef( sequence: data.Sequence, sequence_adapter: SequenceAdapter,