Extract all CalledAfter functions of the function to be examined.
Parameters:
| Name |
Type |
Description |
Default |
function_qname |
str
|
Quality name of the function to be examined.
|
required
|
description |
str
|
Description of the function to be examined.
|
required
|
Returns:
| Type |
Description |
CalledAfterValues
|
All Called-After functions are returned that were found in the context of the function to be examined.
|
Source code in src/library_analyzer/processing/api/_extract_called_after_functions.py
| def extract_called_after_functions(function_qname: str, description: str) -> CalledAfterValues | None:
"""Extract all CalledAfter functions of the function to be examined.
Parameters
----------
function_qname
Quality name of the function to be examined.
description
Description of the function to be examined.
Returns
-------
CalledAfterValues
All Called-After functions are returned that were found in the context of the function to be examined.
"""
_called_after_functions.clear()
description_preprocessed = _preprocess_docstring(description)
description_doc = _nlp.make_doc(description_preprocessed)
matches = _matcher(description_doc)
if matches:
match_id_str = _nlp.vocab.strings[matches[0][0]]
after_or_before = ""
if match_id_str in ["CALLED_AFTER:MUST_BE_CALLED_AFTER", "CALLED_AFTER:IS_CALLED"]:
after_or_before = "after"
elif match_id_str == "CALLED_AFTER:MUST_BE_CALLED_BEFORE":
after_or_before = "before"
return CalledAfterValues(function_qname, _called_after_functions, after_or_before)
else:
return None
|