diff --git a/docs/parsers/arp.md b/docs/parsers/arp.md index f6a4330e..c243101c 100644 --- a/docs/parsers/arp.md +++ b/docs/parsers/arp.md @@ -17,6 +17,21 @@ Usage (module): import jc.parsers.arp result = jc.parsers.arp.parse(arp_command_output) +Schema: + + [ + { + "name": string, + "address": string, + "hwtype": string, + "hwaddress": string, + "flags_mask": string, + "iface": string, + "permanent": boolean, + "expires": integer + } + ] + Compatibility: 'linux', 'aix', 'freebsd', 'darwin' @@ -108,36 +123,7 @@ Examples: ```python info() ``` - - -## process -```python -process(proc_data) -``` - -Final processing to conform to the schema. - -Parameters: - - proc_data: (List of Dictionaries) raw structured data to process - -Returns: - - List of Dictionaries. Structured data with the following schema: - - [ - { - "name": string, - "address": string, - "hwtype": string, - "hwaddress": string, - "flags_mask": string, - "iface": string, - "permanent": boolean, - "expires": integer - } - ] - +Provides parser metadata (version, author, etc.) ## parse ```python diff --git a/jc/parsers/arp.py b/jc/parsers/arp.py index e52d71ca..f441f2e2 100644 --- a/jc/parsers/arp.py +++ b/jc/parsers/arp.py @@ -15,6 +15,21 @@ Usage (module): import jc.parsers.arp result = jc.parsers.arp.parse(arp_command_output) +Schema: + + [ + { + "name": string, + "address": string, + "hwtype": string, + "hwaddress": string, + "flags_mask": string, + "iface": string, + "permanent": boolean, + "expires": integer + } + ] + Compatibility: 'linux', 'aix', 'freebsd', 'darwin' @@ -106,7 +121,8 @@ import jc.parsers.universal class info(): - version = '1.6' + """Provides parser metadata (version, author, etc.)""" + version = '1.7' description = '`arp` command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -119,7 +135,7 @@ class info(): __version__ = info.version -def process(proc_data): +def _process(proc_data): """ Final processing to conform to the schema. @@ -129,20 +145,7 @@ def process(proc_data): Returns: - List of Dictionaries. Structured data with the following schema: - - [ - { - "name": string, - "address": string, - "hwtype": string, - "hwaddress": string, - "flags_mask": string, - "iface": string, - "permanent": boolean, - "expires": integer - } - ] + List of Dictionaries. Structured data to conform to the schema: """ # in BSD style, change name to null if it is a question mark @@ -212,7 +215,7 @@ def parse(data, raw=False, quiet=False): if raw: return raw_output else: - return process(raw_output) + return _process(raw_output) # detect if linux style was used elif cleandata[0].startswith('Address'): @@ -239,4 +242,4 @@ def parse(data, raw=False, quiet=False): if raw: return raw_output else: - return process(raw_output) + return _process(raw_output)