lookout.style.format.utils¶
Commonly used utils.
Module Contents¶
-
class
lookout.style.format.utils.FakeDataStub(files:Iterable[File])¶ Fake data source.
-
GetFiles(self, _)¶ Return sequence of files.
Parameters: _ – noop. Returns: sequence of files.
-
-
lookout.style.format.utils.generate_comment(filename:str, confidence:int, line:int, text:str)¶ Generate comment.
Parameters: - filename – filename.
- confidence – confidence of comment. Should be in range [0, 100].
- line – line number for comment. Expecting 1-based indexing. If 0 - comment for the whole file.
- text – comment text.
Returns: generated comment.
-
lookout.style.format.utils.get_classification_report(y_pred:numpy.ndarray, y_true:numpy.ndarray, target_names:Sequence[str])¶ Colllect the main information that is needed for quality report generation.
Parameters: - y_pred – predicted target values.
- y_true – true targets.
- target_names – labels to names mapping.
Returns: Dictionary with the report information inside.
-
lookout.style.format.utils.get_uast_parents(uast:'bblfsh.Node')¶ Create a mapping from id of the node in the UAST to its parent Node.
Parameters: uast – UAST to get parents mapping for. Returns: Parents mapping.