1414
1515# You should have received a copy of the GNU Lesser General Public
1616# License along with C-PAC. If not, see <https://www.gnu.org/licenses/>.
17- """Classes and decorator for :py:class: `NodeBlock`\u200b s and :py:class: `NodeBlockFunction`\u200b s ."""
17+ """Classes and decorator for :`NodeBlock`s and :`NodeBlockFunction`s ."""
1818
1919from typing import Any , Callable , Optional , TYPE_CHECKING
2020
3636
3737
3838class NodeBlockFunction :
39- """Store a reference to the nodeblock function and all of its meta-data ."""
39+ """Store a reference to the nodeblock function and all of its metadata ."""
4040
4141 def __init__ (
4242 self ,
@@ -50,22 +50,24 @@ def __init__(
5050 outputs : Optional [NODEBLOCK_OUTPUTS ] = None ,
5151 ) -> None :
5252 self .func = func
53- """`Nodeblock` function reference."""
53+ """:py:class: `Nodeblock` function reference."""
5454 self .name : str = name
55- """Used in the graph and logging to identify the :py:class:`NodeBlock` and its component :py:class:`~nipype.pipeline.engine.Node`\u200b s."""
55+ """Used in the graph and logging to identify the :py:class:`NodeBlock` and its
56+ component :py:class:`~nipype.pipeline.engine.Node` s."""
5657 self .config : Optional [list [str ]] = config
5758 """
58- Indicates the nested keys in a C-PAC pipeline :py:class:`Configuration`
59- should configure a `NodeBlock` built from this function. If `config` is set to
60- `None`, then all other configuration-related entities must be specified from the
61- root of the configuration.
59+ Indicates the nested keys in a C-PAC pipeline
60+ :py:class:`~CPAC.utils.configuration.Configuration` should configure a
61+ :py:class:`NodeBlock` built from this function. If `config` is set to ``None``,
62+ then all other :py:class:`~CPAC.utils.configuration.Configuration` -related
63+ entities must be specified from the root of the :py:class:`~CPAC.utils.configuration.Configuration` .
6264 """
6365 self .switch : Optional [list [str ] | list [list [str ]]] = switch
6466 """
65- Indicates any keys that should evaluate to `True` for this :py:class:`NodeBlock`
66- to be active. A list of lists of strings indicates multiple `switch`\u200b es
67- that must all be `True` to run, and is currently only an option if `config` is
68- set to `None`.
67+ Indicates any keys that should evaluate to `` True` ` for this :py:class:`NodeBlock`
68+ to be active. A list of lists of strings indicates multiple `switch` es
69+ that must all be `` True` ` to run, and is currently only an option if `config` is
70+ set to `` None` `.
6971 """
7072 self .option_key : Optional [str | list [str ]] = option_key
7173 """
@@ -76,12 +78,12 @@ def __init__(
7678 """Indicates values for which this :py:class:`NodeBlock` should be active."""
7779 self .inputs : list [str | list | tuple ] = inputs if inputs else []
7880 """:py:class:`~CPAC.pipeline.engine.resource.ResourcePool` keys indicating
79- resources needed for the :py:class:`NodeBlock`\u200b 's functionality."""
81+ resources needed for the :py:class:`NodeBlock`'s functionality."""
8082 self .outputs : list [str ] | dict [str , Any ] = outputs if outputs else []
8183 """
8284 :py:class:`~CPAC.pipeline.engine.resource.ResourcePool` keys indicating
83- resources generated or updated by the `NodeBlock`, optionally including metadata
84- for the outputs' respective sidecars.
85+ resources generated or updated by the :py:class: `NodeBlock`, optionally
86+ including metadata for the outputs' respective sidecars.
8587 """
8688
8789 # Forward function attributes similar to functools.update_wrapper:
@@ -106,9 +108,9 @@ def __call__(
106108 pipe_num : Optional [int | str ],
107109 opt : Optional [str ] = None ,
108110 ) -> tuple [Workflow , dict [str , "ResourceData" ]]:
109- """Call a `NodeBlockFunction`.
111+ """Call a :py:class: `NodeBlockFunction`.
110112
111- All `NodeBlockFunction`\u200b s have the same signature.
113+ All :py:class: `NodeBlockFunction` s have the same signature.
112114 """
113115 return self .func (wf , cfg , strat_pool , pipe_num , opt )
114116
@@ -128,7 +130,7 @@ def legacy_nodeblock_dict(self):
128130 }
129131
130132 def __repr__ (self ) -> str :
131- """Return reproducible string representation of a `NodeBlockFunction`."""
133+ """Return reproducible string representation of a :py:class: `NodeBlockFunction`."""
132134 return (
133135 f"NodeBlockFunction({ self .func .__module__ } ."
134136 f'{ self .func .__name__ } , "{ self .name } ", '
@@ -139,19 +141,19 @@ def __repr__(self) -> str:
139141 )
140142
141143 def __str__ (self ) -> str :
142- """Return string representation of a `NodeBlockFunction`."""
144+ """Return string representation of a :py:class: `NodeBlockFunction`."""
143145 return f"NodeBlockFunction({ self .name } )"
144146
145147
146148class NodeBlock :
147- """A :py:class:`Workflow` subgraph composed of :py:class:`NodeBlockFunction`\u200b s ."""
149+ """A :py:class:`~nipype.pipeline.engine. Workflow` subgraph composed of :py:class:`NodeBlockFunction`s ."""
148150
149151 def __init__ (
150152 self ,
151153 node_block_functions : NodeBlockFunction | PIPELINE_BLOCKS ,
152154 debug : bool = False ,
153155 ) -> None :
154- """Create a `NodeBlock` from a list of py:class:`NodeBlockFunction`\u200b s ."""
156+ """Create a :py:class: `NodeBlock` from a list of : py:class:`NodeBlockFunction` s ."""
155157 if not isinstance (node_block_functions , list ):
156158 node_block_functions = [node_block_functions ]
157159
@@ -223,7 +225,7 @@ def __init__(
223225 logging .update_logging (config )
224226
225227 def check_output (self , outputs : NODEBLOCK_OUTPUTS , label : str , name : str ) -> None :
226- """Check if a label is listed in a `NodeBlock`\u200b 's `outputs`.
228+ """Check if a label is listed in a :py:class: `NodeBlock` 's `outputs`.
227229
228230 Raises
229231 ------
@@ -242,20 +244,20 @@ def check_output(self, outputs: NODEBLOCK_OUTPUTS, label: str, name: str) -> Non
242244 def list_blocks (
243245 pipeline_blocks : PIPELINE_BLOCKS , indent : Optional [int ] = None
244246 ) -> str :
245- """List :py:class:`NodeBlockFunction`\u200b s line by line.
247+ """List :py:class:`NodeBlockFunction` s line by line.
246248
247249 Parameters
248250 ----------
249251 pipeline_blocks
250- list of :py:class:`NodeBlockFunction`\u200b s
252+ list of :py:class:`NodeBlockFunction` s
251253
252254 indent
253255 number of spaces after a tab indent
254256
255257 Returns
256258 -------
257259 str
258- formatted list of :py:class:`NodeBlockFunction`\u200b s
260+ formatted list of :py:class:`NodeBlockFunction` s
259261 """
260262 blockstring = yaml .dump (
261263 [
@@ -292,46 +294,48 @@ def nodeblock(
292294 inputs : Optional [NODEBLOCK_INPUTS ] = None ,
293295 outputs : Optional [list [str ] | dict [str , Any ]] = None ,
294296):
295- """Define a :py:class:`NodeBlockFunction`\u200b .
297+ """Define a :py:class:`NodeBlockFunction` .
296298
297- Connections to the pipeline :py:class:`Configuration` and to other :py:class:`NodeBlockFunction`\u200b s .
299+ Connections to the pipeline :py:class:`~CPAC.utils.configuration. Configuration` and to other :py:class:`NodeBlockFunction` s .
298300
299301 Parameters
300302 ----------
301303 name
302304 Used in the graph and logging to identify the :py:class:`NodeBlock` and its
303- component :py:class:`~nipype.pipeline.engine.Node`\u200b s .
304- The :py:class:`NodeBlockFunction`\u200b 's `.__name__` is used if `name` is not
305+ component :py:class:`~nipype.pipeline.engine.Node` s .
306+ The :py:class:`NodeBlockFunction`'s `.__name__` is used if `name` is not
305307 provided.
306308
307309 config
308- Indicates the nested keys in a C-PAC pipeline :py:class:`Configuration` should
309- configure a :py:class:`NodeBlock` built from this
310- :py:class:`NodeBlockFunction`\u200b . If `config` is set to `None`, then all other
311- :py:class:`Configuration`\u200b -related entities must be specified from the root
312- of the :py:class:`Configuration`\u200b .
310+ Indicates the nested keys in a C-PAC pipeline
311+ :py:class:`~CPAC.pipeline.configuration.Configuration` should configure a
312+ :py:class:`NodeBlock` built from this :py:class:`NodeBlockFunction`. If `config`
313+ is set to ``None``, then all other
314+ :py:class:`~CPAC.pipeline.configuration.Configuration` -related entities
315+ must be specified from the root of the
316+ :py:class:`~CPAC.pipeline.configuration.Configuration` .
313317
314318 switch
315- Indicates any keys that should evaluate to `True` for this :py:class:`NodeBlock`
316- to be active. A list of lists of strings indicates multiple switches that must
317- all be `True` to run, and is currently only an option if config is set to
318- ` None`.
319+ Indicates any keys that should evaluate to `` True`` for this
320+ :py:class:`NodeBlock` to be active. A list of lists of strings indicates
321+ multiple switches that must all be `` True`` to run, and is currently only an
322+ option if config is set to `` None` `.
319323
320324 option_key
321325 Indicates the nested keys (starting at the nested key indicated by `config`)
322- that should configure this :py:class:`NodeBlock`\u200b .
326+ that should configure this :py:class:`NodeBlock`.
323327
324328 option_val
325329 Indicates values for which this :py:class:`NodeBlock` should be active.
326330
327331 inputs
328- ResourcePool keys indicating files needed for the :py:class:`NodeBlock`\u200b 's
332+ :py:class:`~CPAC.pipeline.engine.resource. ResourcePool` keys indicating files needed for the :py:class:`NodeBlock` 's
329333 functionality.
330334
331335 outputs
332336 :py:class:`~CPAC.pipeline.engine.resource.ResourcePool` keys indicating files
333337 generated or updated by the :py:class:`NodeBlock`, optionally including metadata
334- for the outputs' respective sidecars.
338+ for the ` outputs` ' respective sidecars.
335339 """
336340 return lambda func : NodeBlockFunction (
337341 func ,
0 commit comments