mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
linting
This commit is contained in:
@ -113,7 +113,7 @@ def _process(proc_data):
|
|||||||
ts = jc.utils.timestamp(f'{proc_data["timestamp"]} {proc_data["timezone"]}')
|
ts = jc.utils.timestamp(f'{proc_data["timestamp"]} {proc_data["timezone"]}')
|
||||||
proc_data['epoch'] = ts.naive
|
proc_data['epoch'] = ts.naive
|
||||||
proc_data['epoch_utc'] = ts.utc
|
proc_data['epoch_utc'] = ts.utc
|
||||||
|
|
||||||
return proc_data
|
return proc_data
|
||||||
|
|
||||||
|
|
||||||
@ -155,12 +155,12 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
|
|||||||
# detect output type
|
# detect output type
|
||||||
if not procs and not disk and line.startswith('procs'):
|
if not procs and not disk and line.startswith('procs'):
|
||||||
procs = True
|
procs = True
|
||||||
tstamp = True if '-timestamp-' in line else False
|
tstamp = '-timestamp-' in line
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not procs and not disk and line.startswith('disk'):
|
if not procs and not disk and line.startswith('disk'):
|
||||||
disk = True
|
disk = True
|
||||||
tstamp = True if '-timestamp-' in line else False
|
tstamp = '-timestamp-' in line
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
|
|||||||
tz = line.strip().split()[-1] if tstamp else None
|
tz = line.strip().split()[-1] if tstamp else None
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif 'swpd' in line and 'free' in line and 'inact' in line and 'active' in line:
|
if 'swpd' in line and 'free' in line and 'inact' in line and 'active' in line:
|
||||||
buff_cache = False
|
buff_cache = False
|
||||||
tz = line.strip().split()[-1] if tstamp else None
|
tz = line.strip().split()[-1] if tstamp else None
|
||||||
continue
|
continue
|
||||||
@ -227,6 +227,6 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
|
|||||||
}
|
}
|
||||||
|
|
||||||
yield stream_success(output_line, ignore_exceptions) if raw else stream_success(_process(output_line), ignore_exceptions)
|
yield stream_success(output_line, ignore_exceptions) if raw else stream_success(_process(output_line), ignore_exceptions)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
yield stream_error(e, ignore_exceptions, line)
|
yield stream_error(e, ignore_exceptions, line)
|
||||||
|
Reference in New Issue
Block a user