diff --git a/CHANGELOG b/CHANGELOG index dba15d22..78b89fc2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,11 @@ jc changelog +20210408 v1.15.1 +- New feature to show parser documentation interactively with -h --parsername + for example: $ jc -h --arp +- Add man page to pypi package for easier packaging in homebrew +- Add Systeminfo parser tested on Windows 10 + 20210407 v1.15.0 - Add acpi command parser tested on linux - Add upower command parser tested on linux diff --git a/docs/parsers/uname.md b/docs/parsers/uname.md index 7060cc43..264f7bfc 100644 --- a/docs/parsers/uname.md +++ b/docs/parsers/uname.md @@ -17,6 +17,19 @@ Usage (module): import jc.parsers.uname result = jc.parsers.uname.parse(uname_command_output) +Schema: + + { + "kernel_name": string, + "node_name": string, + "kernel_release": string, + "operating_system": string, + "hardware_platform": string, + "processor": string, + "machine": string, + "kernel_version": string + } + Compatibility: 'linux', 'darwin', 'freebsd' @@ -40,34 +53,7 @@ Example: ```python info() ``` - - -## process -```python -process(proc_data) -``` - -Final processing to conform to the schema. - -Parameters: - - proc_data: (Dictionary) raw structured data to process - -Returns: - - Dictionary. Structured data with the following schema: - - { - "kernel_name": string, - "node_name": string, - "kernel_release": string, - "operating_system": string, - "hardware_platform": string, - "processor": string, - "machine": string, - "kernel_version": string - } - +Provides parser metadata (version, author, etc.) ## parse ```python diff --git a/docs/parsers/upower.md b/docs/parsers/upower.md index fdb240fd..52c9e109 100644 --- a/docs/parsers/upower.md +++ b/docs/parsers/upower.md @@ -19,6 +19,68 @@ Usage (module): import jc.parsers.upower result = jc.parsers.upower.parse(upower_command_output) +Schema: + + [ + { + "type": string, + "device_name": string, + "native_path": string, + "power_supply": boolean, + "updated": string, + "updated_epoch": integer, # null if date-time conversion fails + "updated_epoch_utc": integer, # null if date-time conversion fails + "updated_seconds_ago": integer, + "has_history": boolean, + "has_statistics": boolean, + "detail": { + "type": string, + "warning_level": string, # null if none + "online": boolean, + "icon_name": string + "present": boolean, + "rechargeable": boolean, + "state": string, + "energy": float, + "energy_unit": string, + "energy_empty": float, + "energy_empty_unit": string, + "energy_full": float, + "energy_full_unit": string, + "energy_full_design": float, + "energy_full_design_unit": string, + "energy_rate": float, + "energy_rate_unit": string, + "voltage": float, + "voltage_unit": string, + "time_to_full": float, + "time_to_full_unit": string, + "percentage": float, + "capacity": float, + "technology": string + }, + "history_charge": [ + { + "time": integer, + "percent_charged": float, + "status": string + } + ], + "history_rate":[ + { + "time": integer, + "percent_charged": float, + "status": string + } + ], + "daemon_version": string, + "on_battery": boolean, + "lid_is_closed": boolean, + "lid_is_present": boolean, + "critical_action": string + } + ] + Compatibility: 'linux' @@ -138,83 +200,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: - - [ - { - "type": string, - "device_name": string, - "native_path": string, - "power_supply": boolean, - "updated": string, - "updated_epoch": integer, # null if date-time conversion fails - "updated_epoch_utc": integer, # null if date-time conversion fails - "updated_seconds_ago": integer, - "has_history": boolean, - "has_statistics": boolean, - "detail": { - "type": string, - "warning_level": string, # null if none - "online": boolean, - "icon_name": string - "present": boolean, - "rechargeable": boolean, - "state": string, - "energy": float, - "energy_unit": string, - "energy_empty": float, - "energy_empty_unit": string, - "energy_full": float, - "energy_full_unit": string, - "energy_full_design": float, - "energy_full_design_unit": string, - "energy_rate": float, - "energy_rate_unit": string, - "voltage": float, - "voltage_unit": string, - "time_to_full": float, - "time_to_full_unit": string, - "percentage": float, - "capacity": float, - "technology": string - }, - "history_charge": [ - { - "time": integer, - "percent_charged": float, - "status": string - } - ], - "history_rate":[ - { - "time": integer, - "percent_charged": float, - "status": string - } - ], - "daemon_version": string, - "on_battery": boolean, - "lid_is_closed": boolean, - "lid_is_present": boolean, - "critical_action": string - } - ] - +Provides parser metadata (version, author, etc.) ## parse ```python diff --git a/docs/parsers/uptime.md b/docs/parsers/uptime.md index 0fa7e7c7..31107897 100644 --- a/docs/parsers/uptime.md +++ b/docs/parsers/uptime.md @@ -15,6 +15,24 @@ Usage (module): import jc.parsers.uptime result = jc.parsers.uptime.parse(uptime_command_output) +Schema: + + { + "time": string, + "time_hour": integer, + "time_minute": integer, + "time_second": integer, # null if not displayed + "uptime": string, + "uptime_days": integer, + "uptime_hours": integer, + "uptime_minutes": integer, + "uptime_total_seconds": integer, + "users": integer, + "load_1m": float, + "load_5m": float, + "load_15m": float + } + Compatibility: 'linux', 'darwin', 'cygwin', 'aix', 'freebsd' @@ -53,39 +71,7 @@ Example: ```python info() ``` - - -## process -```python -process(proc_data) -``` - -Final processing to conform to the schema. - -Parameters: - - proc_data: (Dictionary) raw structured data to process - -Returns: - - Dictionary. Structured data with the following schema: - - { - "time": string, - "time_hour": integer, - "time_minute": integer, - "time_second": integer, # null if not displayed - "uptime": string, - "uptime_days": integer, - "uptime_hours": integer, - "uptime_minutes": integer, - "uptime_total_seconds": integer, - "users": integer, - "load_1m": float, - "load_5m": float, - "load_15m": float - } - +Provides parser metadata (version, author, etc.) ## parse ```python diff --git a/docs/parsers/w.md b/docs/parsers/w.md index 7082229a..7c997771 100644 --- a/docs/parsers/w.md +++ b/docs/parsers/w.md @@ -15,6 +15,21 @@ Usage (module): import jc.parsers.w result = jc.parsers.w.parse(w_command_output) +Schema: + + [ + { + "user": string, # '-'' = null + "tty": string, # '-'' = null + "from": string, # '-'' = null + "login_at": string, # '-'' = null + "idle": string, # '-'' = null + "jcpu": string, + "pcpu": string, + "what": string # '-'' = null + } + ] + Compatibility: 'linux', 'darwin', 'cygwin', 'aix', 'freebsd' @@ -94,36 +109,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: - - [ - { - "user": string, # '-'' = null - "tty": string, # '-'' = null - "from": string, # '-'' = null - "login_at": string, # '-'' = null - "idle": string, # '-'' = null - "jcpu": string, - "pcpu": string, - "what": string # '-'' = null - } - ] - +Provides parser metadata (version, author, etc.) ## parse ```python diff --git a/docs/parsers/wc.md b/docs/parsers/wc.md index 754e0052..861a8656 100644 --- a/docs/parsers/wc.md +++ b/docs/parsers/wc.md @@ -15,6 +15,17 @@ Usage (module): import jc.parsers.wc result = jc.parsers.wc.parse(wc_command_output) +Schema: + + [ + { + "filename": string, + "lines": integer, + "words": integer, + "characters": integer + } + ] + Compatibility: 'linux', 'darwin', 'cygwin', 'aix', 'freebsd' @@ -49,32 +60,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: - - [ - { - "filename": string, - "lines": integer, - "words": integer, - "characters": integer - } - ] - +Provides parser metadata (version, author, etc.) ## parse ```python diff --git a/docs/parsers/who.md b/docs/parsers/who.md index 0dfe152c..c11bbf7d 100644 --- a/docs/parsers/who.md +++ b/docs/parsers/who.md @@ -19,6 +19,23 @@ Usage (module): import jc.parsers.who result = jc.parsers.who.parse(who_command_output) +Schema: + + [ + { + "user": string, + "event": string, + "writeable_tty": string, + "tty": string, + "time": string, + "epoch": integer, # naive timestamp. null if time cannot be converted + "idle": string, + "pid": integer, + "from": string, + "comment": string + } + ] + Compatibility: 'linux', 'darwin', 'cygwin', 'aix', 'freebsd' @@ -121,38 +138,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: - - [ - { - "user": string, - "event": string, - "writeable_tty": string, - "tty": string, - "time": string, - "epoch": integer, # naive timestamp. null if time cannot be converted - "idle": string, - "pid": integer, - "from": string, - "comment": string - } - ] - +Provides parser metadata (version, author, etc.) ## parse ```python diff --git a/docs/parsers/xml.md b/docs/parsers/xml.md index ab081418..6dd49dd5 100644 --- a/docs/parsers/xml.md +++ b/docs/parsers/xml.md @@ -11,6 +11,16 @@ Usage (module): import jc.parsers.xml result = jc.parsers.xml.parse(xml_file_output) +Schema: + + XML Document converted to a Dictionary + See https://github.com/martinblech/xmltodict for details + + { + "key1": string/object, + "key2": string/object + } + Compatibility: 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' @@ -66,28 +76,7 @@ Examples: ```python info() ``` - - -## process -```python -process(proc_data) -``` - -Final processing to conform to the schema. - -Parameters: - - proc_data: (Dictionary) raw structured data to process - -Returns: - - Dictionary representing an XML document: - - { - XML Document converted to a Dictionary - See https://github.com/martinblech/xmltodict for details - } - +Provides parser metadata (version, author, etc.) ## parse ```python diff --git a/docs/parsers/yaml.md b/docs/parsers/yaml.md index ddc808ed..2c3f48d9 100644 --- a/docs/parsers/yaml.md +++ b/docs/parsers/yaml.md @@ -11,6 +11,18 @@ Usage (module): import jc.parsers.yaml result = jc.parsers.yaml.parse(yaml_file_output) +Schema: + + YAML Document converted to a Dictionary + See https://pypi.org/project/ruamel.yaml for details + + [ + { + "key1": string/int/float/boolean/null/array/object, + "key2": string/int/float/boolean/null/array/object + } + ] + Compatibility: 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' @@ -78,30 +90,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. Each dictionary represents a YAML document: - - [ - { - YAML Document converted to a Dictionary - See https://pypi.org/project/ruamel.yaml for details - } - ] - +Provides parser metadata (version, author, etc.) ## parse ```python diff --git a/jc/parsers/uname.py b/jc/parsers/uname.py index 587cc09a..73991e06 100644 --- a/jc/parsers/uname.py +++ b/jc/parsers/uname.py @@ -15,6 +15,19 @@ Usage (module): import jc.parsers.uname result = jc.parsers.uname.parse(uname_command_output) +Schema: + + { + "kernel_name": string, + "node_name": string, + "kernel_release": string, + "operating_system": string, + "hardware_platform": string, + "processor": string, + "machine": string, + "kernel_version": string + } + Compatibility: 'linux', 'darwin', 'freebsd' @@ -37,7 +50,8 @@ import jc.utils class info(): - version = '1.4' + """Provides parser metadata (version, author, etc.)""" + version = '1.5' description = '`uname -a` command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -54,7 +68,7 @@ class ParseError(Exception): pass -def process(proc_data): +def _process(proc_data): """ Final processing to conform to the schema. @@ -64,18 +78,7 @@ def process(proc_data): Returns: - Dictionary. Structured data with the following schema: - - { - "kernel_name": string, - "node_name": string, - "kernel_release": string, - "operating_system": string, - "hardware_platform": string, - "processor": string, - "machine": string, - "kernel_version": string - } + Dictionary. Structured data to conform to the schema. """ # nothing to process return proc_data @@ -138,4 +141,4 @@ def parse(data, raw=False, quiet=False): if raw: return raw_output else: - return process(raw_output) + return _process(raw_output) diff --git a/jc/parsers/upower.py b/jc/parsers/upower.py index adeac2ab..eb09e978 100644 --- a/jc/parsers/upower.py +++ b/jc/parsers/upower.py @@ -17,6 +17,68 @@ Usage (module): import jc.parsers.upower result = jc.parsers.upower.parse(upower_command_output) +Schema: + + [ + { + "type": string, + "device_name": string, + "native_path": string, + "power_supply": boolean, + "updated": string, + "updated_epoch": integer, # null if date-time conversion fails + "updated_epoch_utc": integer, # null if date-time conversion fails + "updated_seconds_ago": integer, + "has_history": boolean, + "has_statistics": boolean, + "detail": { + "type": string, + "warning_level": string, # null if none + "online": boolean, + "icon_name": string + "present": boolean, + "rechargeable": boolean, + "state": string, + "energy": float, + "energy_unit": string, + "energy_empty": float, + "energy_empty_unit": string, + "energy_full": float, + "energy_full_unit": string, + "energy_full_design": float, + "energy_full_design_unit": string, + "energy_rate": float, + "energy_rate_unit": string, + "voltage": float, + "voltage_unit": string, + "time_to_full": float, + "time_to_full_unit": string, + "percentage": float, + "capacity": float, + "technology": string + }, + "history_charge": [ + { + "time": integer, + "percent_charged": float, + "status": string + } + ], + "history_rate":[ + { + "time": integer, + "percent_charged": float, + "status": string + } + ], + "daemon_version": string, + "on_battery": boolean, + "lid_is_closed": boolean, + "lid_is_present": boolean, + "critical_action": string + } + ] + Compatibility: 'linux' @@ -135,7 +197,8 @@ import jc.utils class info(): - version = '1.0' + """Provides parser metadata (version, author, etc.)""" + version = '1.1' description = '`upower` command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -149,7 +212,7 @@ class info(): __version__ = info.version -def process(proc_data): +def _process(proc_data): """ Final processing to conform to the schema. @@ -159,67 +222,7 @@ def process(proc_data): Returns: - List of Dictionaries. Structured data with the following schema: - - [ - { - "type": string, - "device_name": string, - "native_path": string, - "power_supply": boolean, - "updated": string, - "updated_epoch": integer, # null if date-time conversion fails - "updated_epoch_utc": integer, # null if date-time conversion fails - "updated_seconds_ago": integer, - "has_history": boolean, - "has_statistics": boolean, - "detail": { - "type": string, - "warning_level": string, # null if none - "online": boolean, - "icon_name": string - "present": boolean, - "rechargeable": boolean, - "state": string, - "energy": float, - "energy_unit": string, - "energy_empty": float, - "energy_empty_unit": string, - "energy_full": float, - "energy_full_unit": string, - "energy_full_design": float, - "energy_full_design_unit": string, - "energy_rate": float, - "energy_rate_unit": string, - "voltage": float, - "voltage_unit": string, - "time_to_full": float, - "time_to_full_unit": string, - "percentage": float, - "capacity": float, - "technology": string - }, - "history_charge": [ - { - "time": integer, - "percent_charged": float, - "status": string - } - ], - "history_rate":[ - { - "time": integer, - "percent_charged": float, - "status": string - } - ], - "daemon_version": string, - "on_battery": boolean, - "lid_is_closed": boolean, - "lid_is_present": boolean, - "critical_action": string - } - ] + List of Dictionaries. Structured data to conform to the schema. """ for entry in proc_data: # time conversions @@ -414,4 +417,4 @@ def parse(data, raw=False, quiet=False): if raw: return raw_output else: - return process(raw_output) + return _process(raw_output) diff --git a/jc/parsers/uptime.py b/jc/parsers/uptime.py index 871555bb..337aa336 100644 --- a/jc/parsers/uptime.py +++ b/jc/parsers/uptime.py @@ -13,6 +13,24 @@ Usage (module): import jc.parsers.uptime result = jc.parsers.uptime.parse(uptime_command_output) +Schema: + + { + "time": string, + "time_hour": integer, + "time_minute": integer, + "time_second": integer, # null if not displayed + "uptime": string, + "uptime_days": integer, + "uptime_hours": integer, + "uptime_minutes": integer, + "uptime_total_seconds": integer, + "users": integer, + "load_1m": float, + "load_5m": float, + "load_15m": float + } + Compatibility: 'linux', 'darwin', 'cygwin', 'aix', 'freebsd' @@ -50,7 +68,8 @@ import jc.utils class info(): - version = '1.3' + """Provides parser metadata (version, author, etc.)""" + version = '1.4' description = '`uptime` command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -63,7 +82,7 @@ class info(): __version__ = info.version -def process(proc_data): +def _process(proc_data): """ Final processing to conform to the schema. @@ -73,23 +92,7 @@ def process(proc_data): Returns: - Dictionary. Structured data with the following schema: - - { - "time": string, - "time_hour": integer, - "time_minute": integer, - "time_second": integer, # null if not displayed - "uptime": string, - "uptime_days": integer, - "uptime_hours": integer, - "uptime_minutes": integer, - "uptime_total_seconds": integer, - "users": integer, - "load_1m": float, - "load_5m": float, - "load_15m": float - } + Dictionary. Structured data to conform to the schema. """ if 'time' in proc_data: time_list = proc_data['time'].split(':') @@ -186,4 +189,4 @@ def parse(data, raw=False, quiet=False): if raw: return raw_output else: - return process(raw_output) + return _process(raw_output) diff --git a/jc/parsers/w.py b/jc/parsers/w.py index a0386bd0..126b4233 100644 --- a/jc/parsers/w.py +++ b/jc/parsers/w.py @@ -13,6 +13,21 @@ Usage (module): import jc.parsers.w result = jc.parsers.w.parse(w_command_output) +Schema: + + [ + { + "user": string, # '-'' = null + "tty": string, # '-'' = null + "from": string, # '-'' = null + "login_at": string, # '-'' = null + "idle": string, # '-'' = null + "jcpu": string, + "pcpu": string, + "what": string # '-'' = null + } + ] + Compatibility: 'linux', 'darwin', 'cygwin', 'aix', 'freebsd' @@ -92,7 +107,8 @@ import jc.utils class info(): - version = '1.3' + """Provides parser metadata (version, author, etc.)""" + version = '1.4' description = '`w` command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -105,7 +121,7 @@ class info(): __version__ = info.version -def process(proc_data): +def _process(proc_data): """ Final processing to conform to the schema. @@ -115,20 +131,7 @@ def process(proc_data): Returns: - List of Dictionaries. Structured data with the following schema: - - [ - { - "user": string, # '-'' = null - "tty": string, # '-'' = null - "from": string, # '-'' = null - "login_at": string, # '-'' = null - "idle": string, # '-'' = null - "jcpu": string, - "pcpu": string, - "what": string # '-'' = null - } - ] + List of Dictionaries. Structured data to conform to the schema. """ for entry in proc_data: null_list = ['user', 'tty', 'from', 'login_at', 'idle', 'what'] @@ -196,4 +199,4 @@ def parse(data, raw=False, quiet=False): if raw: return raw_output else: - return process(raw_output) + return _process(raw_output) diff --git a/jc/parsers/wc.py b/jc/parsers/wc.py index aeb368b8..d180fa8a 100644 --- a/jc/parsers/wc.py +++ b/jc/parsers/wc.py @@ -13,6 +13,17 @@ Usage (module): import jc.parsers.wc result = jc.parsers.wc.parse(wc_command_output) +Schema: + + [ + { + "filename": string, + "lines": integer, + "words": integer, + "characters": integer + } + ] + Compatibility: 'linux', 'darwin', 'cygwin', 'aix', 'freebsd' @@ -46,7 +57,8 @@ import jc.utils class info(): - version = '1.0' + """Provides parser metadata (version, author, etc.)""" + version = '1.1' description = '`wc` command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -59,7 +71,7 @@ class info(): __version__ = info.version -def process(proc_data): +def _process(proc_data): """ Final processing to conform to the schema. @@ -69,16 +81,7 @@ def process(proc_data): Returns: - List of Dictionaries. Structured data with the following schema: - - [ - { - "filename": string, - "lines": integer, - "words": integer, - "characters": integer - } - ] + List of Dictionaries. Structured data to conform to the schema. """ for entry in proc_data: @@ -126,4 +129,4 @@ def parse(data, raw=False, quiet=False): if raw: return raw_output else: - return process(raw_output) + return _process(raw_output) diff --git a/jc/parsers/who.py b/jc/parsers/who.py index 455c90c5..b517be7b 100644 --- a/jc/parsers/who.py +++ b/jc/parsers/who.py @@ -17,6 +17,23 @@ Usage (module): import jc.parsers.who result = jc.parsers.who.parse(who_command_output) +Schema: + + [ + { + "user": string, + "event": string, + "writeable_tty": string, + "tty": string, + "time": string, + "epoch": integer, # naive timestamp. null if time cannot be converted + "idle": string, + "pid": integer, + "from": string, + "comment": string + } + ] + Compatibility: 'linux', 'darwin', 'cygwin', 'aix', 'freebsd' @@ -119,7 +136,8 @@ import jc.utils class info(): - version = '1.2' + """Provides parser metadata (version, author, etc.)""" + version = '1.3' description = '`who` command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -133,7 +151,7 @@ class info(): __version__ = info.version -def process(proc_data): +def _process(proc_data): """ Final processing to conform to the schema. @@ -143,22 +161,7 @@ def process(proc_data): Returns: - List of Dictionaries. Structured data with the following schema: - - [ - { - "user": string, - "event": string, - "writeable_tty": string, - "tty": string, - "time": string, - "epoch": integer, # naive timestamp. null if time cannot be converted - "idle": string, - "pid": integer, - "from": string, - "comment": string - } - ] + List of Dictionaries. Structured data to conform to the schema. """ for entry in proc_data: int_list = ['pid'] @@ -302,4 +305,4 @@ def parse(data, raw=False, quiet=False): if raw: return raw_output else: - return process(raw_output) + return _process(raw_output) diff --git a/jc/parsers/xml.py b/jc/parsers/xml.py index 0484d7eb..9b20d22d 100644 --- a/jc/parsers/xml.py +++ b/jc/parsers/xml.py @@ -9,6 +9,16 @@ Usage (module): import jc.parsers.xml result = jc.parsers.xml.parse(xml_file_output) +Schema: + + XML Document converted to a Dictionary + See https://github.com/martinblech/xmltodict for details + + { + "key1": string/object, + "key2": string/object + } + Compatibility: 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' @@ -70,7 +80,8 @@ except Exception: class info(): - version = '1.3' + """Provides parser metadata (version, author, etc.)""" + version = '1.4' description = 'XML file parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -83,7 +94,7 @@ class info(): __version__ = info.version -def process(proc_data): +def _process(proc_data): """ Final processing to conform to the schema. @@ -93,12 +104,7 @@ def process(proc_data): Returns: - Dictionary representing an XML document: - - { - XML Document converted to a Dictionary - See https://github.com/martinblech/xmltodict for details - } + Dictionary representing an XML document. """ # No further processing @@ -131,4 +137,4 @@ def parse(data, raw=False, quiet=False): if raw: return raw_output else: - return process(raw_output) + return _process(raw_output) diff --git a/jc/parsers/yaml.py b/jc/parsers/yaml.py index 8248b082..f98a6eac 100644 --- a/jc/parsers/yaml.py +++ b/jc/parsers/yaml.py @@ -9,6 +9,18 @@ Usage (module): import jc.parsers.yaml result = jc.parsers.yaml.parse(yaml_file_output) +Schema: + + YAML Document converted to a Dictionary + See https://pypi.org/project/ruamel.yaml for details + + [ + { + "key1": string/int/float/boolean/null/array/object, + "key2": string/int/float/boolean/null/array/object + } + ] + Compatibility: 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' @@ -82,7 +94,8 @@ except Exception: class info(): - version = '1.3' + """Provides parser metadata (version, author, etc.)""" + version = '1.4' description = 'YAML file parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -95,7 +108,7 @@ class info(): __version__ = info.version -def process(proc_data): +def _process(proc_data): """ Final processing to conform to the schema. @@ -105,14 +118,7 @@ def process(proc_data): Returns: - List of Dictionaries. Each dictionary represents a YAML document: - - [ - { - YAML Document converted to a Dictionary - See https://pypi.org/project/ruamel.yaml for details - } - ] + List of Dictionaries. Each dictionary represents a YAML document. """ # No further processing @@ -153,4 +159,4 @@ def parse(data, raw=False, quiet=False): if raw: return raw_output else: - return process(raw_output) + return _process(raw_output) diff --git a/man/jc.1.gz b/man/jc.1.gz index b2656eee..19befb35 100644 Binary files a/man/jc.1.gz and b/man/jc.1.gz differ diff --git a/setup.py b/setup.py index 7ab3b3c4..1b4a45f6 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open('README.md', 'r') as f: setuptools.setup( name='jc', - version='1.15.0', + version='1.15.1', author='Kelly Brazil', author_email='kellyjonbrazil@gmail.com', description='Converts the output of popular command-line tools and file-types to JSON.',