lookout.style.format.model
¶
Modelforge model for the format analyzer.
Module Contents¶
-
class
lookout.style.format.model.
FormatModel
(**kwargs)¶ Bases:
lookout.core.analyzer.AnalyzerModel
A modelforge model to store Rules instances.
It is required to store all the Rules for different programming languages in a single model, named after each language. Note that Rules must be fitted and Rules.base_model is not saved.
Developer note: Each Rules must provide enough information to reproduce it bit-to-bit in form of a configuration dictionary. Model is simple and must remain simple.
-
LICENSE
¶
-
languages
¶ Return the languages for which this model has trained rules available.
-
dump
(self)¶ Serialize this model and return the result as a string.
-
_generate_tree
(self)¶
-
_load_tree
(self, tree:dict)¶
-
__len__
(self)¶
-
__getitem__
(self, lang:str)¶ Get the Rules estimator by its language.
Parameters: lang – Estimator language. Returns: Rules estimator instance.
-
__setitem__
(self, lang:str, rules:Rules)¶ Set a new Rules estimator to the model by its language.
-
__iter__
(self)¶
-
__contains__
(self, lang:str)¶
-
static
_assemble_classification_report
(report:dict)¶
-
static
_disassemble_classification_report
(report:dict)¶
-
static
_assemble_rules
(rules_tree:dict)¶
-
static
_disassemble_rules
(rules:Iterable[Rule])¶
-