OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 """The parsers and plugins manager.""" | 2 """The parsers and plugins manager.""" |
3 | 3 |
4 import logging | 4 import logging |
5 | 5 |
6 import pysigscan | 6 import pysigscan |
7 | 7 |
8 from plaso.lib import definitions | 8 from plaso.lib import definitions |
9 from plaso.lib import specification | 9 from plaso.lib import specification |
10 from plaso.parsers import presets | 10 from plaso.parsers import presets |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 raise KeyError(u'Parser class not set for name: {0:s}.'.format( | 163 raise KeyError(u'Parser class not set for name: {0:s}.'.format( |
164 parser_class.NAME)) | 164 parser_class.NAME)) |
165 | 165 |
166 del cls._parser_classes[parser_name] | 166 del cls._parser_classes[parser_name] |
167 | 167 |
168 @classmethod | 168 @classmethod |
169 def GetNamesOfParsersWithPlugins(cls): | 169 def GetNamesOfParsersWithPlugins(cls): |
170 """Retrieves the names of all parsers with plugins. | 170 """Retrieves the names of all parsers with plugins. |
171 | 171 |
172 Returns: | 172 Returns: |
173 A list of parser names. | 173 list[str]: names of all parsers with plugins. |
174 """ | 174 """ |
175 parser_names = [] | 175 parser_names = [] |
176 | 176 |
177 for parser_name, parser_class in cls.GetParsers(): | 177 for parser_name, parser_class in cls.GetParsers(): |
178 if parser_class.SupportsPlugins(): | 178 if parser_class.SupportsPlugins(): |
179 parser_names.append(parser_name) | 179 parser_names.append(parser_name) |
180 | 180 |
181 return sorted(parser_names) | 181 return sorted(parser_names) |
182 | 182 |
183 @classmethod | 183 @classmethod |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 The parser classes are identified based on their lower case name. | 473 The parser classes are identified based on their lower case name. |
474 | 474 |
475 Args: | 475 Args: |
476 parser_classes: a list of class objects of the parsers. | 476 parser_classes: a list of class objects of the parsers. |
477 | 477 |
478 Raises: | 478 Raises: |
479 KeyError: if parser class is already set for the corresponding name. | 479 KeyError: if parser class is already set for the corresponding name. |
480 """ | 480 """ |
481 for parser_class in parser_classes: | 481 for parser_class in parser_classes: |
482 cls.RegisterParser(parser_class) | 482 cls.RegisterParser(parser_class) |
OLD | NEW |