Skip to content

Commit

Permalink
Bring existing deprecated methods in compliance with deprecation poli…
Browse files Browse the repository at this point in the history
…cy. (#1529)

Add a ..deprecated:: docstring.  This will serve as a helpful example next time someone wants to deprecate something.

Part of #1508
  • Loading branch information
Tony Tung committed Sep 16, 2019
1 parent b1c23cf commit 54c2a69
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
8 changes: 5 additions & 3 deletions starfish/core/experiment/builder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,18 @@ def write_irregular_experiment_json(
Generates the path for a FOV's json file. If one is not provided, the default generates
the FOV's json file at the same level as the top-level json file for an image. If this is
not provided, a reasonable default will be provided. If this is provided, writer_contract
should not be provided.
should not be provided. This parameter is deprecated and `writer_contract` should be used
instead.
tile_opener : Optional[Callable[[Path, Tile, str], BinaryIO]]
Callable that gets invoked with the following arguments: 1. the directory of the experiment
that is being constructed, 2. the tile that is being written, and 3. the file extension
that the tile should be written with. The callable is expected to return an open file
handle. If this is not provided, a reasonable default will be provided. If this is
provided, writer_contract should not be provided.
provided, `writer_contract` should not be provided. This parameter is deprecated and
`writer_contract` should be used instead.
writer_contract : Optional[WriterContract]
Contract for specifying how the slicedimage image is to be laid out. If this is provided,
fov_path_generator and tile_opener should not be provided.
`fov_path_generator` and `tile_opener` should not be provided.
"""
if postprocess_func is None:
postprocess_func = lambda doc: doc
Expand Down
5 changes: 5 additions & 0 deletions starfish/core/experiment/builder/inplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ def write_tile(


def enable_inplace_mode():
"""
.. deprecated:: 0.1.4
This method is no longer necessary. Call `write_experiment_json` with
`writer_contract=InplaceWriterContract()`.
"""
warnings.warn("`enable_inplace_mode()` is no longer necessary.", DeprecationWarning)


Expand Down
8 changes: 8 additions & 0 deletions starfish/core/experiment/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,19 @@ def image_types(self) -> Set[str]:
return set(self._images.keys())

def show_aligned_image_groups(self) -> None:
"""
.. deprecated:: 0.1.4
Use `FieldOfView.get_images()` to retrieve all the aligned image groups.
"""
raise DeprecationWarning("This method has been deprecated. Aligned groups are now parsed "
"as a part of, FieldOfView.get_images() and are determined by the "
"selected axes provided to the method.")

def iterate_image_type(self, image_type: str) -> Iterator[ImageStack]:
"""
.. deprecated:: 0.1.4
Use `FieldOfView.get_images()` to retrieve all the aligned image groups.
"""
raise DeprecationWarning("This method has been deprecated. Instead use "
"FieldOfView.get_images(image_type)")

Expand Down
3 changes: 3 additions & 0 deletions starfish/core/image/Filter/max_proj.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class MaxProject(FilterAlgorithmBase):
"""
Creates a maximum projection over one or more axis of the image tensor
.. deprecated:: 0.1.2
Use `Filter.Reduce(func='max')` instead.
Parameters
----------
dims : Axes
Expand Down

0 comments on commit 54c2a69

Please sign in to comment.