Skip to content

Commit 18bed26

Browse files
committed
add docstinrgs and annotations
1 parent eaa424f commit 18bed26

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

bioimageio/core/_settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010

1111

1212
class Settings(SpecSettings):
13-
"""environment variables"""
13+
"""environment variables for bioimageio.spec and bioimageio.core"""
1414

1515
keras_backend: Annotated[
1616
Literal["torch", "tensorflow", "jax"], Field(alias="KERAS_BACKEND")
1717
] = "torch"
1818

1919

2020
settings = Settings()
21+
"""parsed environment variables for bioimageio.spec and bioimageio.core"""

bioimageio/core/digest_spec.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ class IO_SampleBlockMeta(NamedTuple):
190190

191191

192192
def get_input_halo(model: v0_5.ModelDescr, output_halo: PerMember[PerAxis[Halo]]):
193-
"""returns which halo input tensors need to be divided into blocks with such that
194-
`output_halo` can be cropped from their outputs without intorducing gaps."""
193+
"""returns which halo input tensors need to be divided into blocks with, such that
194+
`output_halo` can be cropped from their outputs without introducing gaps."""
195195
input_halo: Dict[MemberId, Dict[AxisId, Halo]] = {}
196196
outputs = {t.id: t for t in model.outputs}
197197
all_tensors = {**{t.id: t for t in model.inputs}, **outputs}
@@ -221,8 +221,10 @@ def get_input_halo(model: v0_5.ModelDescr, output_halo: PerMember[PerAxis[Halo]]
221221
return input_halo
222222

223223

224-
def get_block_transform(model: v0_5.ModelDescr):
225-
"""returns how a model's output tensor shapes relate to its input shapes"""
224+
def get_block_transform(
225+
model: v0_5.ModelDescr,
226+
) -> PerMember[PerAxis[Union[LinearSampleAxisTransform, int]]]:
227+
"""returns how a model's output tensor shapes relates to its input shapes"""
226228
ret: Dict[MemberId, Dict[AxisId, Union[LinearSampleAxisTransform, int]]] = {}
227229
batch_axis_trf = None
228230
for ipt in model.inputs:

bioimageio/core/sample.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,10 @@ def get_transformed_meta(
293293

294294
@dataclass
295295
class SampleBlockWithOrigin(SampleBlock):
296+
"""A `SampleBlock` with a reference (`origin`) to the whole `Sample`"""
297+
296298
origin: Sample
297-
"""the sample this sample black was taken from"""
299+
"""the sample this sample block was taken from"""
298300

299301

300302
class _ConsolidatedMemberBlocks:
@@ -330,7 +332,7 @@ def sample_block_generator(
330332
*,
331333
origin: Sample,
332334
pad_mode: PadMode,
333-
):
335+
) -> Iterable[SampleBlockWithOrigin]:
334336
for member_blocks in blocks:
335337
cons = _ConsolidatedMemberBlocks(member_blocks)
336338
yield SampleBlockWithOrigin(

0 commit comments

Comments
 (0)