:mod:`lookout.style.format.model` ================================= .. py:module:: lookout.style.format.model .. autoapi-nested-parse:: Modelforge model for the format analyzer. Module Contents --------------- .. py:class:: FormatModel(**kwargs) Bases::class:`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. .. attribute:: LICENSE .. attribute:: languages Return the languages for which this model has trained rules available. .. method:: dump(self) Serialize this model and return the result as a string. .. method:: _generate_tree(self) .. method:: _load_tree(self, tree:dict) .. method:: __len__(self) .. method:: __getitem__(self, lang:str) Get the Rules estimator by its language. :param lang: Estimator language. :return: Rules estimator instance. .. method:: __setitem__(self, lang:str, rules:Rules) Set a new Rules estimator to the model by its language. .. method:: __iter__(self) .. method:: __contains__(self, lang:str) .. staticmethod:: _assemble_classification_report(report:dict) .. staticmethod:: _disassemble_classification_report(report:dict) .. staticmethod:: _assemble_rules(rules_tree:dict) .. staticmethod:: _disassemble_rules(rules:Iterable[Rule])