rail.utils.interactive.docstring_utils module
Utility functions to generate the docstrings attatched to the interactive versions of RailStages
- class rail.utils.interactive.docstring_utils.InteractiveParameter
Bases:
objectClass to hold a small amount of information about a parameter to be passed to an interactive RailStage function
We don’t just re-use ceci’s StageParameter as the information structure doesn’t match what we want for docstrings
- __init__(name, annotation, description, parameter_usage)
- Parameters:
name (str | None)
annotation (str | type)
description (str)
parameter_usage (Literal['required', 'optional', 'return'])
- Return type:
None
- annotation: str | type
- description: str
- classmethod from_ceci(name, ceci_param)
Create an InteractiveParameter object from the ceci config_options items, branchs for cases where the item is a single item, config set, or not actually set as a StageParameter
- Parameters:
name (str)
ceci_param (Any)
- Return type:
- classmethod from_ceci_parameter(name, ceci_param)
Parse a ceci StageParameter to reformat the information as desired by InteractiveParameter
- Parameters:
name (str)
ceci_param (StageParameter)
- Return type:
- merge(other)
Combine two InteractiveParameters to create a new one.
- Parameters:
other (InteractiveParameter) – The object to merge in
- Returns:
A merger ofthe two objects
- Return type:
- name: str | None
- parameter_usage: Literal['required', 'optional', 'return']
- rail.utils.interactive.docstring_utils.create_interactive_docstring(stage_name)
Merge the relevant information from the class and entrypoint function of a RAIL stage to create a docstring for the interactive function
- Parameters:
stage_name (str) – Name of the RAIL stage
- Returns:
The final docstring for the interactive function
- Return type:
str