| 1 | 1 |  | from ..oval_node import restore_dict_to_tree | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 | 1 |  | from ..converter import Converter | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 | 1 |  | from ..exceptions import NotChecked | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 | 1 |  | from .client_html_output import ClientHtmlOutput | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 | 1 |  | from .client_json_input import ClientJsonInput | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 | 1 |  | class JsonToHtml(ClientHtmlOutput, ClientJsonInput): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 | 1 |  |     def __init__(self, args): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 | 1 |  |         super().__init__(args) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 | 1 |  |         self.oval_tree = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 | 1 |  |     def _get_message(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 | 1 |  |         MESSAGES = { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |             'description': 'Client for visualization of JSON created by command arf-to-json', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |             'source_filename': 'JSON file', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 | 1 |  |         return MESSAGES | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 | 1 |  |     def load_json_to_oval_tree(self, rule): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 | 1 |  |         dict_of_tree = self.json_data_file[rule] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 | 1 |  |         if isinstance(dict_of_tree, str): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |             raise NotChecked(dict_of_tree) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 | 1 |  |         try: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 | 1 |  |             return restore_dict_to_tree(dict_of_tree) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 | 1 |  |         except Exception as error: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 | 1 |  |             raise ValueError('Data is not valid for OVAL tree.') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 | 1 |  |     def create_dict_of_oval_node(self, oval_node): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 | 1 |  |         converter = Converter(oval_node) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 | 1 |  |         return converter.to_JsTree_dict(self.hide_passing_tests) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 | 1 |  |     def create_dict_of_rule(self, rule): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 | 1 |  |         self.oval_tree = self.load_json_to_oval_tree(rule) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 | 1 |  |         return self.create_dict_of_oval_node(self.oval_tree) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 | 1 |  |     def _put_to_dict_oval_trees(self, dict_oval_trees, rule): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 | 1 |  |         dict_oval_trees[rule.replace( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |             self.START_OF_FILE_NAME, '')] = self.create_dict_of_rule(rule) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 | 1 |  |     def _get_src_for_one_graph(self, rule): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 | 1 |  |         return self.get_save_src(rule.replace(self.START_OF_FILE_NAME, '')) | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 44 | 1 |  |     def prepare_parser(self): | 
            
                                                        
            
                                    
            
            
                | 45 | 1 |  |         super().prepare_parser() | 
            
                                                        
            
                                    
            
            
                | 46 |  |  |         self.prepare_args_when_output_is_html() | 
            
                                                        
            
                                    
            
            
                | 47 |  |  |  |