1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2026-04-24 20:56:11 +02:00

tighten up blank line checking

This commit is contained in:
Kelly Brazil
2022-11-22 13:10:58 -08:00
parent 975b4f5e4f
commit bbd227caf4
7 changed files with 16 additions and 12 deletions
+4
View File
@@ -117,6 +117,10 @@ def parse(
streaming_line_input_type_check(line)
output_line: Dict = {}
# skip blank lines
if not line.strip():
continue
# parse the content here
# check out helper functions in jc.utils
# and jc.parsers.universal
+2 -2
View File
@@ -108,7 +108,7 @@ import jc.parsers.universal
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.2'
version = '1.3'
description = '`iostat` command streaming parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -196,7 +196,7 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
output_line = {}
# ignore blank lines and header line
if line == '\n' or line == '' or line.startswith('Linux'):
if not line.strip() or line.startswith('Linux'):
continue
if line.startswith('avg-cpu:'):
+2 -2
View File
@@ -77,7 +77,7 @@ from jc.exceptions import ParseError
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.1'
version = '1.2'
description = '`ls` command streaming parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -148,7 +148,7 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
continue
# skip blank lines
if line.strip() == '':
if not line.strip():
continue
# Look for parent line if glob or -R is used
+2 -2
View File
@@ -85,7 +85,7 @@ from jc.exceptions import ParseError
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.1'
version = '1.2'
description = '`ping` and `ping6` command streaming parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -492,7 +492,7 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
output_line = {}
# skip blank lines
if line.strip() == '':
if not line.strip():
continue
# skip warning lines
+2 -2
View File
@@ -88,7 +88,7 @@ from jc.streaming import (
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.1'
version = '1.2'
description = '`rsync` command streaming parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -267,7 +267,7 @@ def parse(
output_line: Dict = {}
# ignore blank lines
if line == '':
if not line.strip():
continue
file_line = file_line_re.match(line)
+2 -2
View File
@@ -84,7 +84,7 @@ from jc.exceptions import ParseError
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.2'
version = '1.3'
description = '`stat` command streaming parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -165,7 +165,7 @@ def parse(
line = line.rstrip()
# ignore blank lines
if line == '':
if not line.strip():
continue
# linux output
+2 -2
View File
@@ -100,7 +100,7 @@ from jc.exceptions import ParseError
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.1'
version = '1.2'
description = '`vmstat` command streaming parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@@ -177,7 +177,7 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
output_line = {}
# skip blank lines
if line.strip() == '':
if not line.strip():
continue
# detect output type