Skip to content

extract_param_dependencies

Extract all dependencies.

Parameters:

Name Type Description Default
param_qname str

qname of the parameter to be examined.

required
description str

description string of the parameter to be examined.

required

Returns:

Type Description
list[tuple]

List of all found dependencies. A dependency tuple always consists of the parameter name, the condition and the resulting action.

Source code in src/library_analyzer/processing/api/_extract_dependencies.py
def extract_param_dependencies(
    param_qname: str,
    description: str,
) -> list[tuple[str, _CONDTION_TYPE, _ACTION_TYPE]]:
    """Extract all dependencies.

    Parameters
    ----------
    param_qname
        qname of the parameter to be examined.

    description
        description string of the parameter to be examined.


    Returns
    -------
    list[tuple]
        List of all found dependencies.
        A dependency tuple always consists of the parameter name, the condition and the resulting action.

    """
    _condition_list.clear()
    _action_list.clear()
    _combined_condition.clear()
    dependency_tuples: list[tuple[str, _CONDTION_TYPE, _ACTION_TYPE]] = []

    description_preprocessed = _preprocess_docstring(description)
    description_doc = _nlp(description_preprocessed)
    for sent in description_doc.sents:
        _dep_matcher(sent)

    for idx, cond in enumerate(_condition_list):
        dependency_tuples.append((param_qname, cond, _action_list[idx]))

    return dependency_tuples