mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-13 01:20:24 +02:00
tighten up blank line checking
This commit is contained in:
@ -117,6 +117,10 @@ def parse(
|
|||||||
streaming_line_input_type_check(line)
|
streaming_line_input_type_check(line)
|
||||||
output_line: Dict = {}
|
output_line: Dict = {}
|
||||||
|
|
||||||
|
# skip blank lines
|
||||||
|
if not line.strip():
|
||||||
|
continue
|
||||||
|
|
||||||
# parse the content here
|
# parse the content here
|
||||||
# check out helper functions in jc.utils
|
# check out helper functions in jc.utils
|
||||||
# and jc.parsers.universal
|
# and jc.parsers.universal
|
||||||
|
@ -108,7 +108,7 @@ import jc.parsers.universal
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.2'
|
version = '1.3'
|
||||||
description = '`iostat` command streaming parser'
|
description = '`iostat` command streaming parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -196,7 +196,7 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
|
|||||||
output_line = {}
|
output_line = {}
|
||||||
|
|
||||||
# ignore blank lines and header 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
|
continue
|
||||||
|
|
||||||
if line.startswith('avg-cpu:'):
|
if line.startswith('avg-cpu:'):
|
||||||
|
@ -77,7 +77,7 @@ from jc.exceptions import ParseError
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.1'
|
version = '1.2'
|
||||||
description = '`ls` command streaming parser'
|
description = '`ls` command streaming parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -148,7 +148,7 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# skip blank lines
|
# skip blank lines
|
||||||
if line.strip() == '':
|
if not line.strip():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Look for parent line if glob or -R is used
|
# Look for parent line if glob or -R is used
|
||||||
|
@ -85,7 +85,7 @@ from jc.exceptions import ParseError
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.1'
|
version = '1.2'
|
||||||
description = '`ping` and `ping6` command streaming parser'
|
description = '`ping` and `ping6` command streaming parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -492,7 +492,7 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
|
|||||||
output_line = {}
|
output_line = {}
|
||||||
|
|
||||||
# skip blank lines
|
# skip blank lines
|
||||||
if line.strip() == '':
|
if not line.strip():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# skip warning lines
|
# skip warning lines
|
||||||
|
@ -88,7 +88,7 @@ from jc.streaming import (
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.1'
|
version = '1.2'
|
||||||
description = '`rsync` command streaming parser'
|
description = '`rsync` command streaming parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -267,7 +267,7 @@ def parse(
|
|||||||
output_line: Dict = {}
|
output_line: Dict = {}
|
||||||
|
|
||||||
# ignore blank lines
|
# ignore blank lines
|
||||||
if line == '':
|
if not line.strip():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
file_line = file_line_re.match(line)
|
file_line = file_line_re.match(line)
|
||||||
|
@ -84,7 +84,7 @@ from jc.exceptions import ParseError
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.2'
|
version = '1.3'
|
||||||
description = '`stat` command streaming parser'
|
description = '`stat` command streaming parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -165,7 +165,7 @@ def parse(
|
|||||||
line = line.rstrip()
|
line = line.rstrip()
|
||||||
|
|
||||||
# ignore blank lines
|
# ignore blank lines
|
||||||
if line == '':
|
if not line.strip():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# linux output
|
# linux output
|
||||||
|
@ -100,7 +100,7 @@ from jc.exceptions import ParseError
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.1'
|
version = '1.2'
|
||||||
description = '`vmstat` command streaming parser'
|
description = '`vmstat` command streaming parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -177,7 +177,7 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
|
|||||||
output_line = {}
|
output_line = {}
|
||||||
|
|
||||||
# skip blank lines
|
# skip blank lines
|
||||||
if line.strip() == '':
|
if not line.strip():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# detect output type
|
# detect output type
|
||||||
|
Reference in New Issue
Block a user