From 15addd9bfc18a0e87beb97040b431c872b783662 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Thu, 20 Jan 2022 09:59:23 -0800 Subject: [PATCH] doc fix --- docs/parsers/universal.md | 5 +---- jc/parsers/universal.py | 7 +++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/parsers/universal.md b/docs/parsers/universal.md index ea782b34..1b25f899 100644 --- a/docs/parsers/universal.md +++ b/docs/parsers/universal.md @@ -7,10 +7,7 @@ jc - JSON CLI output utility universal Parsers simple_table_parse(data) ``` -Parse simple tables. The last column may contain data with spaces - -code adapted from Conor Heine at: -https://gist.github.com/cahna/43a1a3ff4d075bcd71f9d7120037a501 +Parse simple tables. The last column may contain data with spaces. Parameters: diff --git a/jc/parsers/universal.py b/jc/parsers/universal.py index c35fc218..9d1bfa64 100644 --- a/jc/parsers/universal.py +++ b/jc/parsers/universal.py @@ -6,10 +6,7 @@ import string def simple_table_parse(data): """ - Parse simple tables. The last column may contain data with spaces - - code adapted from Conor Heine at: - https://gist.github.com/cahna/43a1a3ff4d075bcd71f9d7120037a501 + Parse simple tables. The last column may contain data with spaces. Parameters: @@ -26,6 +23,8 @@ def simple_table_parse(data): List of Dictionaries """ + # code adapted from Conor Heine at: + # https://gist.github.com/cahna/43a1a3ff4d075bcd71f9d7120037a501 headers = [h for h in ' '.join(data[0].strip().split()).split() if h] raw_data = map(lambda s: s.strip().split(None, len(headers) - 1), data[1:]) raw_output = [dict(zip(headers, r)) for r in raw_data]