ska_sdp_piper.piper.configurations.doc_utils module
- ska_sdp_piper.piper.configurations.doc_utils.convert_description_to_line_string(desc)[source]
Converts the description of config param to a single line string suitable for sphinx node parsing
- ska_sdp_piper.piper.configurations.doc_utils.convert_allowed_values_to_string(values)[source]
Convert "allowed values" parameter of Config Param to a string.
- ska_sdp_piper.piper.configurations.doc_utils.get_resolved_path(tp)[source]
Gets the fully qualified name of a type For builtins like int, str; the module name i.e. 'builtins' is not part of the output.
- Return type:
Examples
>>> get_resolved_path(int) "int" >>> get_resolved_path(Any) "typing.Any"
- ska_sdp_piper.piper.configurations.doc_utils.convert_type_to_reST_string(tp)[source]
Convert a type to string compatible for intersphinx mapping
The input can be:
single type
an Annotated type — only the first arg (the actual type) is used
a union type (Union or UnionType)
a generic collection type (list, dict, set, etc.) — both the collection and its element types are linked
For cases 3 and 4, the types are converted to sphinx compatible string and joined using a comma.
- Parameters:
tp (
Type) -- type or tuple of type to convert to string- Return type:
- Returns:
String representation of type / tuple of type
Examples
>>> convert_type_to_reST_string(int) ":py:class:`int`" >>> convert_type_to_reST_string(float, Any) ":py:class:`float`, :py:class:`typing.Any`" >>> convert_type_to_reST_string(float | int) ":py:class:`float` | :py:class:`int`" >>> convert_type_to_reST_string(list[int]) ":py:class:`~list`\[:py:class:`~int`\]" >>> convert_type_to_reST_string(Annotated[int, "some metadata"]) ":py:class:`~int`"