diff --git a/jc/__init__.py b/jc/__init__.py index ca1f952a..4d9f44ca 100644 --- a/jc/__init__.py +++ b/jc/__init__.py @@ -98,6 +98,23 @@ Get a list of all available parser module names to be used in Get a list of plugin parser module names to be used in `parse()`, `parser_info()`, and `get_help()`. This list is a subset of `parser_mod_list()`. + +### standard_parser_mod_list + + standard_parser_mod_list() -> list + +Get a list of standard parser module names to be used in +`parse()`, `parser_info()`, and `get_help()`. This list is a subset of +`parser_mod_list()` and does not contain any streaming parsers. + +### streaming_parser_mod_list + + streaming_parser_mod_list() -> list + +Get a list of streaming parser module names to be used in +`parse()`, `parser_info()`, and `get_help()`. This list is a subset of +`parser_mod_list()`. """ from .lib import (__version__, parse, parser_mod_list, plugin_parser_mod_list, + standard_parser_mod_list, streaming_parser_mod_list, parser_info, all_parser_info, get_help) diff --git a/jc/lib.py b/jc/lib.py index 18c96d5f..b8403c96 100644 --- a/jc/lib.py +++ b/jc/lib.py @@ -228,6 +228,31 @@ def plugin_parser_mod_list() -> List[str]: """ return [_cliname_to_modname(p) for p in local_parsers] +def standard_parser_mod_list() -> List[str]: + """ + Returns a list of standard parser module names. This function is a + subset of `parser_mod_list()` and does not contain any streaming + parsers. + """ + plist = [] + for p in parsers: + parser = _get_parser(p) + if not getattr(parser.info, 'streaming', None): + plist.append(p) + return plist + +def streaming_parser_mod_list() -> List[str]: + """ + Returns a list of streaming parser module names. This function is a + subset of `parser_mod_list()`. + """ + plist = [] + for p in parsers: + parser = _get_parser(p) + if getattr(parser.info, 'streaming', None): + plist.append(p) + return plist + def parser_info(parser_mod_name: str) -> Dict: """ Returns a dictionary that includes the module metadata.