Skip to content

Commit

Permalink
Black format
Browse files Browse the repository at this point in the history
  • Loading branch information
talmo committed Feb 27, 2024
1 parent f4b50d8 commit 295e1c7
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 12 deletions.
13 changes: 7 additions & 6 deletions sleap_io/io/nwb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions to write and read from the neurodata without borders (NWB) format."""

from copy import deepcopy
from typing import List, Optional, Union
from pathlib import Path
Expand Down Expand Up @@ -91,12 +92,12 @@ def read_nwb(path: str) -> Labels:
frame_inds = np.searchsorted(
timestamps, get_timestamps(pose_estimation_series)
)
tracks_numpy[
frame_inds, track_idx, node_idx, :
] = pose_estimation_series.data[:]
confidence[
frame_inds, track_idx, node_idx
] = pose_estimation_series.confidence[:]
tracks_numpy[frame_inds, track_idx, node_idx, :] = (
pose_estimation_series.data[:]
)
confidence[frame_inds, track_idx, node_idx] = (
pose_estimation_series.confidence[:]
)

video_tracks[Path(pose_estimation.original_videos[0]).as_posix()] = (
tracks_numpy,
Expand Down
6 changes: 3 additions & 3 deletions sleap_io/io/slp.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def write_videos(labels_path: str, videos: list[Video]):
elif type(video.backend) == HDF5Video:
video_json = {
"backend": {
"filename": "."
if video.backend.has_embedded_images
else video.filename,
"filename": (
"." if video.backend.has_embedded_images else video.filename
),
"dataset": video.backend.dataset,
"input_format": video.backend.input_format,
"convert_range": False,
Expand Down
8 changes: 5 additions & 3 deletions sleap_io/model/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ def _convert_points(self, attr, points):
for node in points.keys()
]
vals = [
point
if type(point) == self._POINT_TYPE
else self._make_default_point(*point)
(
point
if type(point) == self._POINT_TYPE
else self._make_default_point(*point)
)
for point in points.values()
]
points = {k: v for k, v in zip(keys, vals)}
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/jabs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fixtures that return paths to jabs .h5 files."""

import pytest


Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/labels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fixtures that return `Labels` objects."""

import pytest
import sleap_io

Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/labelstudio.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fixtures that return paths to label-studio .json files."""

import pytest
from sleap_io import Skeleton, Node, Edge

Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/slp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fixtures that return paths to .slp files."""

import pytest


Expand Down
1 change: 1 addition & 0 deletions tests/io/test_jabs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for functions in the sleap_io.io.jabs file."""

import numpy as np
import h5py

Expand Down
1 change: 1 addition & 0 deletions tests/io/test_labelstudio.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for functions in the sleap_io.io.labelstudio file."""

from sleap_io import Labels
from sleap_io.io.labelstudio import parse_tasks, read_labels, convert_labels
from sleap_io.io.slp import read_labels as slp_read_labels
Expand Down
1 change: 1 addition & 0 deletions tests/io/test_main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for functions in the sleap_io.io.main file."""

from sleap_io import Labels
from sleap_io.io.main import (
load_slp,
Expand Down
1 change: 1 addition & 0 deletions tests/io/test_slp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for functions in the sleap_io.io.slp file."""

from sleap_io import (
Video,
Skeleton,
Expand Down
1 change: 1 addition & 0 deletions tests/io/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the sleap_io.io.test_utils file."""

import pytest
import h5py
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/model/test_instance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for methods in the sleap_io.model.instance file."""

from pickletools import pyset
import numpy as np
from numpy.testing import assert_equal
Expand Down
1 change: 1 addition & 0 deletions tests/model/test_labeled_frame.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for methods in sleap_io.model.labeled_frame file."""

from numpy.testing import assert_equal
from sleap_io import Video, Skeleton, Instance, PredictedInstance
from sleap_io.model.labeled_frame import LabeledFrame
Expand Down
1 change: 1 addition & 0 deletions tests/model/test_labels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test methods and functions in the sleap_io.model.labels file."""

from numpy.testing import assert_equal
import pytest
from sleap_io import (
Expand Down
1 change: 1 addition & 0 deletions tests/model/test_skeleton.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for methods in the sleap_io.model.skeleton file."""

import pytest
from sleap_io.model.skeleton import Node, Edge, Symmetry, Skeleton

Expand Down
1 change: 1 addition & 0 deletions tests/model/test_video.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for methods in the sleap_io.model.video file."""

from sleap_io import Video
from sleap_io.io.video import MediaVideo
import numpy as np
Expand Down

0 comments on commit 295e1c7

Please sign in to comment.