Skip to content

Commit f4c20f3

Browse files
author
Ben Cipollini
committed
Tweak docstrings / parameter name.
1 parent 3d2777e commit f4c20f3

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

nibabel/openers.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,38 @@ def __exit__(self, exc_type, exc_val, exc_tb):
150150

151151
class ImageOpener(Opener):
152152
""" Opener-type class passed to image classes to collect compressed extensions
153-
"""
153+
154+
This class allows itself to have image extensions added to its class
155+
attributes, via the `register_ex_from_images`. The class can therefore
156+
change state when image classes are defined.
157+
"""
158+
154159
@classmethod
155-
def register_ext_from_image(opener_klass, ext, func):
156-
"""Decorator"""
160+
def register_ext_from_image(opener_klass, ext, func_def):
161+
"""Decorator for adding extension / opener_function associations.
162+
163+
Should be used to decorate classes.
164+
165+
Parameters
166+
----------
167+
opener_klass : decorated class
168+
ext : file extension to associate `func_def` with.
169+
should start with '.'
170+
func_def : opener function/parameter tuple
171+
Should be a `(function, (args,))` tuple, where `function` accepts
172+
a filename as the first parameter, and `args` defines the
173+
other arguments that `function` accepts. These arguments must
174+
be any (unordered) subset of `mode`, `compresslevel`,
175+
and `buffering`.
176+
177+
Returns
178+
-------
179+
opener_klass, with a side-effect of updating the ImageOpener class
180+
with the desired extension / opener association.
181+
"""
157182
def decorate(klass):
158183
assert ext not in opener_klass.compress_ext_map, \
159184
"Cannot redefine extension-function mappings."
160-
opener_klass.compress_ext_map[ext] = func
185+
opener_klass.compress_ext_map[ext] = func_def
161186
return klass
162187
return decorate

nibabel/volumeutils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,8 +1537,7 @@ def rec2dict(rec):
15371537

15381538

15391539
class BinOpener(Opener):
1540-
""" Deprecated class that used to handle .mgz
1541-
through specialized logic."""
1540+
""" Deprecated class that used to handle .mgz through specialized logic."""
15421541
__doc__ = Opener.__doc__
15431542

15441543
def __init__(self, *args, **kwargs):

0 commit comments

Comments
 (0)