Skip to content

Commit

Permalink
Format: formatted with black v24
Browse files Browse the repository at this point in the history
  • Loading branch information
mbsantiago committed Jan 31, 2024
1 parent 9542923 commit d92b4c5
Show file tree
Hide file tree
Showing 98 changed files with 324 additions and 237 deletions.
1 change: 1 addition & 0 deletions back/src/whombat/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Python API for Whombat."""

from whombat.api.annotation_projects import annotation_projects
from whombat.api.annotation_tasks import annotation_tasks
from whombat.api.audio import load_audio, load_clip_bytes
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/api/audio.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API functions to load audio."""

import struct
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/api/clip_evaluations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API functions to interact with clip evaluations."""

from pathlib import Path
from typing import Sequence
from uuid import UUID
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/api/datasets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API functions for interacting with datasets."""

import datetime
import uuid
import warnings
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/api/evaluation_sets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API functions for interacting with evaluation sets."""

import uuid
from pathlib import Path
from typing import Sequence
Expand Down
10 changes: 6 additions & 4 deletions back/src/whombat/api/io/aoef/clips.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@

async def get_clips(
session: AsyncSession,
obj: AnnotationSetObject
| EvaluationObject
| PredictionSetObject
| AnnotationProjectObject,
obj: (
AnnotationSetObject
| EvaluationObject
| PredictionSetObject
| AnnotationProjectObject
),
recordings: dict[UUID, int],
feature_names: dict[str, int],
should_import: bool = True,
Expand Down
10 changes: 6 additions & 4 deletions back/src/whombat/api/io/aoef/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@

async def get_feature_names(
session: AsyncSession,
obj: AnnotationSetObject
| EvaluationObject
| PredictionSetObject
| RecordingSetObject,
obj: (
AnnotationSetObject
| EvaluationObject
| PredictionSetObject
| RecordingSetObject
),
) -> dict[str, int]:
names: set[str] = set(feat.value for feat in GeometricFeature)

Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/api/model_runs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API functions to interact with model runs."""

from pathlib import Path
from typing import Sequence
from uuid import UUID
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/api/recordings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API functions for interacting with recordings."""

import datetime
import logging
from functools import partial
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/api/sessions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Python API to manage database sessions."""

from contextlib import asynccontextmanager
from typing import AsyncGenerator

Expand Down
8 changes: 5 additions & 3 deletions back/src/whombat/api/sound_event_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,11 @@ async def to_soundevent(
return data.SoundEventAnnotation(
uuid=annotation.uuid,
created_on=annotation.created_on,
created_by=users.to_soundevent(annotation.created_by)
if annotation.created_by
else None,
created_by=(
users.to_soundevent(annotation.created_by)
if annotation.created_by
else None
),
sound_event=await sound_events.to_soundevent(
session,
annotation.sound_event,
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/api/sound_event_evaluations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API functions to interact with sound event evaluations."""

from pathlib import Path
from uuid import UUID

Expand Down
8 changes: 5 additions & 3 deletions back/src/whombat/api/sound_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,11 @@ async def update_geometric_features(
sound_event = sound_event.model_copy(
update=dict(
features=[
f
if f.name not in feature_mapping
else feature_mapping[f.name]
(
f
if f.name not in feature_mapping
else feature_mapping[f.name]
)
for f in sound_event.features
]
)
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/api/spectrograms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API functions to generate spectrograms."""

from pathlib import Path

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/api/tags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API functions to interact with tags."""

from typing import Any, Sequence

from soundevent import data
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/api/users.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Whombat Python API to interact with user objects in the database."""

import secrets
from uuid import UUID

Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
It contains the FastAPI instance and the root endpoint.
"""

from whombat.system import create_app, get_settings

settings = get_settings()
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Cache functions."""

from contextlib import AbstractContextManager
from functools import wraps
from typing import (
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/core/files.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""File handling functions."""

import logging
from dataclasses import dataclass
from pathlib import Path
Expand Down
1 change: 0 additions & 1 deletion back/src/whombat/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Custom exceptions for Whombat."""


__all__ = [
"NotFoundError",
"DuplicateObjectError",
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/filters/annotation_tasks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Filters for Annotation Tasks."""

from uuid import UUID

from soundevent import data
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/filters/clip_predictions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Filters for Clip Predictions."""

from uuid import UUID

from sqlalchemy import Select, and_, select
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/filters/evaluations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Filters for Evaluations."""

from uuid import UUID

from sqlalchemy import Select, or_, select
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/filters/feature_names.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Filters for featuren names."""

from uuid import UUID

from sqlalchemy import Select
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/filters/notes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Filters for Notes."""

from uuid import UUID

from sqlalchemy import Select
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/filters/sound_event_annotations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Filters for Annotations."""

from uuid import UUID

from sqlalchemy import Select, select, tuple_
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/filters/sound_event_predictions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Filters for Predictions."""

from uuid import UUID

from sqlalchemy import Select, and_
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/filters/sound_events.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Filters for Sound Events."""

from uuid import UUID

from sqlalchemy import Select
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/filters/tags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Filters for tags."""

from uuid import UUID

from sqlalchemy import Select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2024-01-10 20:08:09.823754
"""

from typing import Sequence, Union

import fastapi_users_db_sqlalchemy.generics
Expand Down
1 change: 1 addition & 0 deletions back/src/whombat/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
models into other modules without having to import the entire database
module.
"""

from whombat.models.annotation_project import (
AnnotationProject,
AnnotationProjectTag,
Expand Down
12 changes: 6 additions & 6 deletions back/src/whombat/models/annotation_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ class AnnotationProject(Base):
)

# Secondary relationships
annotation_project_tags: orm.Mapped[
list["AnnotationProjectTag"]
] = orm.relationship(
"AnnotationProjectTag",
default_factory=list,
cascade="all, delete-orphan",
annotation_project_tags: orm.Mapped[list["AnnotationProjectTag"]] = (
orm.relationship(
"AnnotationProjectTag",
default_factory=list,
cascade="all, delete-orphan",
)
)


Expand Down
18 changes: 9 additions & 9 deletions back/src/whombat/models/annotation_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ class AnnotationTask(Base):
init=False,
single_parent=True,
)
status_badges: orm.Mapped[
list["AnnotationStatusBadge"]
] = orm.relationship(
back_populates="annotation_task",
cascade="all",
lazy="joined",
init=False,
repr=False,
default_factory=list,
status_badges: orm.Mapped[list["AnnotationStatusBadge"]] = (
orm.relationship(
back_populates="annotation_task",
cascade="all",
lazy="joined",
init=False,
repr=False,
default_factory=list,
)
)


Expand Down
46 changes: 23 additions & 23 deletions back/src/whombat/models/clip_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,21 @@ class ClipAnnotation(Base):
)

# Secondary relations
clip_annotation_notes: orm.Mapped[
list["ClipAnnotationNote"]
] = orm.relationship(
default_factory=list,
cascade="all, delete-orphan",
repr=False,
init=False,
)
clip_annotation_tags: orm.Mapped[
list["ClipAnnotationTag"]
] = orm.relationship(
default_factory=list,
cascade="all, delete-orphan",
repr=False,
init=False,
clip_annotation_notes: orm.Mapped[list["ClipAnnotationNote"]] = (
orm.relationship(
default_factory=list,
cascade="all, delete-orphan",
repr=False,
init=False,
)
)
clip_annotation_tags: orm.Mapped[list["ClipAnnotationTag"]] = (
orm.relationship(
default_factory=list,
cascade="all, delete-orphan",
repr=False,
init=False,
)
)

# Backrefs
Expand All @@ -127,14 +127,14 @@ class ClipAnnotation(Base):
default_factory=list,
viewonly=True,
)
evaluation_set_annotations: orm.Mapped[
list["EvaluationSetAnnotation"]
] = orm.relationship(
back_populates="clip_annotation",
init=False,
repr=False,
default_factory=list,
cascade="all, delete-orphan",
evaluation_set_annotations: orm.Mapped[list["EvaluationSetAnnotation"]] = (
orm.relationship(
back_populates="clip_annotation",
init=False,
repr=False,
default_factory=list,
cascade="all, delete-orphan",
)
)


Expand Down
18 changes: 9 additions & 9 deletions back/src/whombat/models/clip_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ class ClipEvaluation(Base):
init=False,
lazy="selectin",
)
sound_event_evaluations: orm.Mapped[
list[SoundEventEvaluation]
] = orm.relationship(
back_populates="clip_evaluation",
cascade="all",
lazy="joined",
init=False,
repr=False,
default_factory=list,
sound_event_evaluations: orm.Mapped[list[SoundEventEvaluation]] = (
orm.relationship(
back_populates="clip_evaluation",
cascade="all",
lazy="joined",
init=False,
repr=False,
default_factory=list,
)
)
metrics: orm.Mapped[list["ClipEvaluationMetric"]] = orm.relationship(
back_populates="clip_evaluation",
Expand Down
18 changes: 9 additions & 9 deletions back/src/whombat/models/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ class Dataset(Base):
)

# Secondary relations
dataset_recordings: orm.Mapped[
list["DatasetRecording"]
] = orm.relationship(
"DatasetRecording",
init=False,
repr=False,
back_populates="dataset",
cascade="all, delete-orphan",
default_factory=list,
dataset_recordings: orm.Mapped[list["DatasetRecording"]] = (
orm.relationship(
"DatasetRecording",
init=False,
repr=False,
back_populates="dataset",
cascade="all, delete-orphan",
default_factory=list,
)
)


Expand Down
Loading

0 comments on commit d92b4c5

Please sign in to comment.