1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-15 01:24:29 +02:00

change values to null if -

This commit is contained in:
Kelly Brazil
2019-11-14 17:36:29 -08:00
parent 7e2fa48ed4
commit 8bfa41dbf4
3 changed files with 22 additions and 14 deletions

View File

@ -1165,7 +1165,7 @@ $ stat /bin/* | jc --stat -p
"access_time": "2019-11-14 08:18:03.509681766 +0000",
"modify_time": "2019-06-06 22:28:15.000000000 +0000",
"change_time": "2019-08-12 17:21:29.521945390 +0000",
"birth_time": "-"
"birth_time": null
},
{
"file": "/bin/btrfs",
@ -1185,7 +1185,7 @@ $ stat /bin/* | jc --stat -p
"access_time": "2019-11-14 08:18:28.990834276 +0000",
"modify_time": "2018-03-12 23:04:27.000000000 +0000",
"change_time": "2019-08-12 17:21:29.545944399 +0000",
"birth_time": "-"
"birth_time": null
},
...
]

View File

@ -46,7 +46,7 @@ Examples:
"access_time": "2019-11-14 08:18:28.990834276 +0000",
"modify_time": "2018-03-12 23:04:27.000000000 +0000",
"change_time": "2019-08-12 17:21:29.545944399 +0000",
"birth_time": "-"
"birth_time": null
},
...
]
@ -91,7 +91,7 @@ Examples:
"access_time": "2019-11-14 08:18:28.990834276 +0000",
"modify_time": "2018-03-12 23:04:27.000000000 +0000",
"change_time": "2019-08-12 17:21:29.545944399 +0000",
"birth_time": "-"
"birth_time": null
},
..
]
@ -128,10 +128,10 @@ Returns:
"user": string,
"gid": integer,
"group": string,
"access_time": string,
"modify_time": string,
"change_time": string,
"birth_time": string
"access_time": string, # - = null
"modify_time": string, # - = null
"change_time": string, # - = null
"birth_time": string # - = null
}
]

View File

@ -45,7 +45,7 @@ Examples:
"access_time": "2019-11-14 08:18:28.990834276 +0000",
"modify_time": "2018-03-12 23:04:27.000000000 +0000",
"change_time": "2019-08-12 17:21:29.545944399 +0000",
"birth_time": "-"
"birth_time": null
},
...
]
@ -90,7 +90,7 @@ Examples:
"access_time": "2019-11-14 08:18:28.990834276 +0000",
"modify_time": "2018-03-12 23:04:27.000000000 +0000",
"change_time": "2019-08-12 17:21:29.545944399 +0000",
"birth_time": "-"
"birth_time": null
},
..
]
@ -127,10 +127,10 @@ def process(proc_data):
"user": string,
"gid": integer,
"group": string,
"access_time": string,
"modify_time": string,
"change_time": string,
"birth_time": string
"access_time": string, # - = null
"modify_time": string, # - = null
"change_time": string, # - = null
"birth_time": string # - = null
}
]
"""
@ -144,6 +144,14 @@ def process(proc_data):
except (ValueError):
entry[key] = None
# turn - into null for time fields
for entry in proc_data:
null_list = ['access_time', 'modify_time', 'change_time', 'birth_time']
for key in null_list:
if key in entry:
if entry[key] == '-':
entry[key] = None
return proc_data