mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-23 00:29:59 +02:00
add standard and streaming list functions
This commit is contained in:
@ -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
|
Get a list of plugin parser module names to be used in
|
||||||
`parse()`, `parser_info()`, and `get_help()`. This list is a subset of
|
`parse()`, `parser_info()`, and `get_help()`. This list is a subset of
|
||||||
`parser_mod_list()`.
|
`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,
|
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)
|
parser_info, all_parser_info, get_help)
|
||||||
|
25
jc/lib.py
25
jc/lib.py
@ -228,6 +228,31 @@ def plugin_parser_mod_list() -> List[str]:
|
|||||||
"""
|
"""
|
||||||
return [_cliname_to_modname(p) for p in local_parsers]
|
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:
|
def parser_info(parser_mod_name: str) -> Dict:
|
||||||
"""
|
"""
|
||||||
Returns a dictionary that includes the module metadata.
|
Returns a dictionary that includes the module metadata.
|
||||||
|
Reference in New Issue
Block a user