Skip to content

Commit

Permalink
Docstrings describing inputs to writer functions (#154)
Browse files Browse the repository at this point in the history
* Docstrings describing inputs to writer functions

* Update writer docstrings (include meta kwarg)

* Add @Czaki's explanation of the meta dictionary

* Update _writer.py docstring (kwargs -> meta)

* Update _writer.py docstrings

* Update {{cookiecutter.plugin_name}}/src/{{cookiecutter.module_name}}/_writer.py

Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>

* Update {{cookiecutter.plugin_name}}/src/{{cookiecutter.module_name}}/_writer.py

Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>

* fix typo, missing `

---------

Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>
Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
  • Loading branch information
4 people authored Aug 18, 2023
1 parent 55922cd commit e410d03
Showing 1 changed file with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,22 @@


def write_single_image(path: str, data: Any, meta: dict) -> List[str]:
"""Writes a single image layer"""
"""Writes a single image layer.
Parameters
----------
path : str
A string path indicating where to save the image file.
data : The layer data
The `.data` attribute from the napari layer.
meta : dict
A dictionary containing all other attributes from the napari layer
(excluding the `.data` layer attribute).
Returns
-------
[path] : A list containing the string path to the saved file.
"""

# implement your writer logic here ...

Expand All @@ -25,7 +40,23 @@ def write_single_image(path: str, data: Any, meta: dict) -> List[str]:


def write_multiple(path: str, data: List[FullLayerData]) -> List[str]:
"""Writes multiple layers of different types."""
"""Writes multiple layers of different types.
Parameters
----------
path : str
A string path indicating where to save the data file(s).
data : A list of layer tuples.
Tuples contain three elements: (data, meta, layer_type)
`data` is the layer data
`meta` is a dictionary containing all other metadata attributes
from the napari layer (excluding the `.data` layer attribute).
`layer_type` is a string, eg: "image", "labels", "surface", etc.
Returns
-------
[path] : A list containing (potentially multiple) string paths to the saved file(s).
"""

# implement your writer logic here ...

Expand Down

0 comments on commit e410d03

Please sign in to comment.