From 00129f4b407cd95c73278b375e13b2c21ec0b2fb Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Mon, 26 Sep 2022 11:41:23 -0700 Subject: [PATCH] doc update --- docs/parsers/proc_driver_rtc.md | 12 ++++++------ jc/parsers/proc.py | 2 +- jc/parsers/proc_driver_rtc.py | 14 +++++++------- tests/test_proc.py | 7 ++++--- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/docs/parsers/proc_driver_rtc.md b/docs/parsers/proc_driver_rtc.md index 05ea5972..8b7e3de9 100644 --- a/docs/parsers/proc_driver_rtc.md +++ b/docs/parsers/proc_driver_rtc.md @@ -3,19 +3,19 @@ # jc.parsers.proc\_driver\_rtc -jc - JSON Convert `/proc/driver_rtc` file parser +jc - JSON Convert `/proc/driver/rtc` file parser Usage (cli): - $ cat /proc/driver_rtc | jc --proc + $ cat /proc/driver/rtc | jc --proc or - $ jc /proc/driver_rtc + $ jc /proc/driver/rtc or - $ cat /proc/driver_rtc | jc --proc-driver-rtc + $ cat /proc/driver/rtc | jc --proc-driver-rtc Usage (module): @@ -56,7 +56,7 @@ are attempted. If you do not want this behavior, then use `--raw` (cli) or Examples: - $ cat /proc/driver_rtc | jc --proc -p + $ cat /proc/driver/rtc | jc --proc -p { "rtc_time": "16:09:21", "rtc_date": "2022-09-03", @@ -78,7 +78,7 @@ Examples: "batt_status": "okay" } - $ cat /proc/driver_rtc | jc --proc -p -r + $ cat /proc/driver/rtc | jc --proc -p -r { "rtc_time": "16:09:21", "rtc_date": "2022-09-03", diff --git a/jc/parsers/proc.py b/jc/parsers/proc.py index cfe59399..574f1aab 100644 --- a/jc/parsers/proc.py +++ b/jc/parsers/proc.py @@ -201,9 +201,9 @@ def parse( pid_mountinfo_p = re.compile(r'^\d+ \d+ \d+:\d+ /.+\n') pid_numa_maps_p = re.compile(r'^[a-f0-9]{12} default [^\n]+\n') pid_smaps_p = re.compile(r'^[0-9a-f]{12}-[0-9a-f]{12} [rwxsp\-]{4} [0-9a-f]{8} [0-9a-f]{2}:[0-9a-f]{2} \d+ [^\n]+\nSize:\s+\d+ \S\S\n') + pid_stat_p = re.compile(r'^\d+ \(.{1,16}\) \w \d+ \d+ \d+ \d+ -?\d+ (?:\d+ ){43}\d+$') pid_statm_p = re.compile(r'^\d+ \d+ \d+\s\d+\s\d+\s\d+\s\d+$') pid_status_p = re.compile(r'^Name:\t.+\nUmask:\t\d+\nState:\t.+\nTgid:\t\d+\n') - pid_stat_p = re.compile(r'^\d+ \(.{1,16}\) \w \d+ \d+ \d+ \d+ -?\d+ (?:\d+ ){43}\d+$') scsi_device_info = re.compile(r"^'\w+' '.+' 0x\d+") scsi_scsi_p = re.compile(r'^Attached devices:\nHost: \w+ ') diff --git a/jc/parsers/proc_driver_rtc.py b/jc/parsers/proc_driver_rtc.py index 2bc40f33..2b046cbc 100644 --- a/jc/parsers/proc_driver_rtc.py +++ b/jc/parsers/proc_driver_rtc.py @@ -1,16 +1,16 @@ -"""jc - JSON Convert `/proc/driver_rtc` file parser +"""jc - JSON Convert `/proc/driver/rtc` file parser Usage (cli): - $ cat /proc/driver_rtc | jc --proc + $ cat /proc/driver/rtc | jc --proc or - $ jc /proc/driver_rtc + $ jc /proc/driver/rtc or - $ cat /proc/driver_rtc | jc --proc-driver-rtc + $ cat /proc/driver/rtc | jc --proc-driver-rtc Usage (module): @@ -51,7 +51,7 @@ are attempted. If you do not want this behavior, then use `--raw` (cli) or Examples: - $ cat /proc/driver_rtc | jc --proc -p + $ cat /proc/driver/rtc | jc --proc -p { "rtc_time": "16:09:21", "rtc_date": "2022-09-03", @@ -73,7 +73,7 @@ Examples: "batt_status": "okay" } - $ cat /proc/driver_rtc | jc --proc -p -r + $ cat /proc/driver/rtc | jc --proc -p -r { "rtc_time": "16:09:21", "rtc_date": "2022-09-03", @@ -102,7 +102,7 @@ import jc.utils class info(): """Provides parser metadata (version, author, etc.)""" version = '1.0' - description = '`/proc/driver_rtc` file parser' + description = '`/proc/driver/rtc` file parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' compatible = ['linux'] diff --git a/tests/test_proc.py b/tests/test_proc.py index e2f83b1b..a57f2e2f 100644 --- a/tests/test_proc.py +++ b/tests/test_proc.py @@ -47,9 +47,6 @@ class MyTests(unittest.TestCase): 'proc_diskstats': ( 'fixtures/linux-proc/diskstats', 'fixtures/linux-proc/diskstats.json'), - 'proc_driver_rtc': ( - 'fixtures/linux-proc/driver_rtc', - 'fixtures/linux-proc/driver_rtc.json'), 'proc_filesystems': ( 'fixtures/linux-proc/filesystems', 'fixtures/linux-proc/filesystems.json'), @@ -123,6 +120,10 @@ class MyTests(unittest.TestCase): 'fixtures/linux-proc/zoneinfo2', 'fixtures/linux-proc/zoneinfo2.json'), + 'proc_driver_rtc': ( + 'fixtures/linux-proc/driver_rtc', + 'fixtures/linux-proc/driver_rtc.json'), + 'proc_net_arp': ( 'fixtures/linux-proc/net_arp', 'fixtures/linux-proc/net_arp.json'),