jpcli 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jpcli-0.1.2/jpcli.egg-info → jpcli-0.1.3}/PKG-INFO +1 -1
- jpcli-0.1.3/jpcli/parsers/lsmem_parser.py +24 -0
- {jpcli-0.1.2 → jpcli-0.1.3/jpcli.egg-info}/PKG-INFO +1 -1
- {jpcli-0.1.2 → jpcli-0.1.3}/setup.py +1 -1
- jpcli-0.1.2/jpcli/parsers/lsmem_parser.py +0 -11
- {jpcli-0.1.2 → jpcli-0.1.3}/LICENCE +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/MANIFEST.in +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/README.md +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/jpcli/__init__.py +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/jpcli/main.py +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/jpcli/parsers/__init__.py +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/jpcli/parsers/free_parser.py +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/jpcli/parsers/other_command_parser.py +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/jpcli.egg-info/SOURCES.txt +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/jpcli.egg-info/dependency_links.txt +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/jpcli.egg-info/entry_points.txt +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/jpcli.egg-info/top_level.txt +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/setup.cfg +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/tests/__init__.py +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/tests/test_lsmem_parser.py +0 -0
- {jpcli-0.1.2 → jpcli-0.1.3}/tests/test_other_command_parser.py +0 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
def parse(command_output):
|
2
|
+
lines = command_output.splitlines()
|
3
|
+
data = []
|
4
|
+
headers = []
|
5
|
+
|
6
|
+
# Extract headers from the first line
|
7
|
+
if lines:
|
8
|
+
headers = [header.strip() for header in lines[0].split() if header.strip()]
|
9
|
+
lines = lines[1:]
|
10
|
+
|
11
|
+
for line in lines:
|
12
|
+
if not line.strip(): # Skip empty lines
|
13
|
+
continue
|
14
|
+
|
15
|
+
values = [value.strip() for value in line.split() if value.strip()]
|
16
|
+
if len(values) != len(headers):
|
17
|
+
# For handling lines with different formats (like summary lines)
|
18
|
+
data.append({headers[0]: " ".join(values)})
|
19
|
+
else:
|
20
|
+
entry = {headers[i]: values[i] for i in range(len(headers))}
|
21
|
+
data.append(entry)
|
22
|
+
|
23
|
+
return data
|
24
|
+
|
@@ -1,11 +0,0 @@
|
|
1
|
-
def parse(command_output):
|
2
|
-
lines = command_output.strip().splitlines()
|
3
|
-
headers = [header.strip() for header in lines[0].split()]
|
4
|
-
data = []
|
5
|
-
|
6
|
-
for line in lines[1:]:
|
7
|
-
values = line.split()
|
8
|
-
entry = {headers[i]: values[i] for i in range(len(values))}
|
9
|
-
data.append(entry)
|
10
|
-
|
11
|
-
return data
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|