Skip to content

Commit

Permalink
lint with updated black
Browse files Browse the repository at this point in the history
  • Loading branch information
yrkim98 committed Feb 6, 2024
1 parent e78626f commit 34e92aa
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ def test_build_overrides() -> None:
prediction_model.set_image_input_channel_index(3)

# act
overrides: Dict[
str, Union[str, int, float, bool]
] = prediction_service.build_overrides(
experiments_model.get_experiment_name(),
experiments_model.get_checkpoint(),
overrides: Dict[str, Union[str, int, float, bool]] = (
prediction_service.build_overrides(
experiments_model.get_experiment_name(),
experiments_model.get_checkpoint(),
)
)

# assert
Expand Down Expand Up @@ -183,11 +183,11 @@ def test_build_overrides_experiment_none() -> None:
# act/assert
# Experiment name is None, so build_overrides should throw a ValueError
with pytest.raises(ValueError):
overrides: Dict[
str, Union[str, int, float, bool]
] = prediction_service.build_overrides(
experiments_model.get_experiment_name(),
experiments_model.get_checkpoint(),
overrides: Dict[str, Union[str, int, float, bool]] = (
prediction_service.build_overrides(
experiments_model.get_experiment_name(),
experiments_model.get_checkpoint(),
)
)


Expand Down Expand Up @@ -217,9 +217,9 @@ def test_build_overrides_checkpoint_none() -> None:
# act/assert
# Checkpoint is None, so build_overrides should throw a ValueError
with pytest.raises(ValueError):
overrides: Dict[
str, Union[str, int, float, bool]
] = prediction_service.build_overrides(
experiments_model.get_experiment_name(),
experiments_model.get_checkpoint(),
overrides: Dict[str, Union[str, int, float, bool]] = (
prediction_service.build_overrides(
experiments_model.get_experiment_name(),
experiments_model.get_checkpoint(),
)
)
10 changes: 4 additions & 6 deletions src/allencell_ml_segmenter/curation/curation_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,7 @@ def update_curation_record(self, use_image: bool) -> None:
Update the curation record with the users selection for the current image
"""
# DEAL WITH EXCLUDING MASKS
excluding_mask_path: Union[
Path, str
] = (
excluding_mask_path: Union[Path, str] = (
self._curation_model.get_current_excluding_mask_path_and_reset_mask()
)
if excluding_mask_path is not None:
Expand All @@ -406,9 +404,9 @@ def update_curation_record(self, use_image: bool) -> None:
excluding_mask_path = ""

# DEAL WITH MERGING MASKS
merging_mask_path: Union[
Path, str
] = self._curation_model.get_current_merging_mask_path()
merging_mask_path: Union[Path, str] = (
self._curation_model.get_current_merging_mask_path()
)
if merging_mask_path is not None:
# user has drawn and saved merging masks.
merging_mask_path = str(merging_mask_path)
Expand Down
1 change: 0 additions & 1 deletion src/allencell_ml_segmenter/main/i_experiments_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class IExperimentsModel(Publisher):

"""
Interface for implementing and testing ExperimentsModel
"""
Expand Down
1 change: 1 addition & 0 deletions src/allencell_ml_segmenter/napari/napari_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
implement multiple readers or even other plugin contributions. see:
https://napari.org/stable/plugins/guides.html?#readers
"""

import numpy as np
from typing import Union, Callable, List, Tuple, Dict

Expand Down
1 change: 1 addition & 0 deletions src/allencell_ml_segmenter/napari/napari_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Replace code below according to your needs.
"""

from __future__ import annotations

from typing import TYPE_CHECKING, Any, List, Sequence, Tuple, Union
Expand Down
1 change: 1 addition & 0 deletions src/allencell_ml_segmenter/napari/sample_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Replace code below according to your needs.
"""

from __future__ import annotations
from typing import List, Tuple, Dict

Expand Down
6 changes: 3 additions & 3 deletions src/allencell_ml_segmenter/services/prediction_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def build_overrides(
# if channel is not set, will default to same channel used to train
channel: int = self._prediction_model.get_image_input_channel_index()
if channel:
overrides[
"data.transforms.predict.transforms[0].reader[0].C"
] = channel
overrides["data.transforms.predict.transforms[0].reader[0].C"] = (
channel
)

return overrides
6 changes: 3 additions & 3 deletions src/allencell_ml_segmenter/training/training_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def __init__(
self._hardware_type: Hardware = None
self._images_directory: Path = None
self._channel_index: Union[int, None] = None
self._model_path: Union[
Path, None
] = None # if None, start a new model
self._model_path: Union[Path, None] = (
None # if None, start a new model
)
self._patch_size: PatchSize = None
self._spatial_dims: int = None
self._max_epoch: int = None
Expand Down

0 comments on commit 34e92aa

Please sign in to comment.