TSVZ 3.15__py3-none-any.whl → 3.16__py3-none-any.whl
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.
- TSVZ.py +31 -13
- {TSVZ-3.15.dist-info → tsvz-3.16.dist-info}/METADATA +1 -1
- tsvz-3.16.dist-info/RECORD +6 -0
- {TSVZ-3.15.dist-info → tsvz-3.16.dist-info}/WHEEL +1 -1
- TSVZ-3.15.dist-info/RECORD +0 -6
- {TSVZ-3.15.dist-info → tsvz-3.16.dist-info}/entry_points.txt +0 -0
- {TSVZ-3.15.dist-info → tsvz-3.16.dist-info}/top_level.txt +0 -0
TSVZ.py
CHANGED
|
@@ -22,7 +22,7 @@ if os.name == 'nt':
|
|
|
22
22
|
elif os.name == 'posix':
|
|
23
23
|
import fcntl
|
|
24
24
|
|
|
25
|
-
version = '3.
|
|
25
|
+
version = '3.16'
|
|
26
26
|
__version__ = version
|
|
27
27
|
author = 'pan@zopyr.us'
|
|
28
28
|
|
|
@@ -56,8 +56,8 @@ def get_delimiter(delimiter,file_name = ''):
|
|
|
56
56
|
DEFAULT_DELIMITER = rtn
|
|
57
57
|
return rtn
|
|
58
58
|
|
|
59
|
-
def pretty_format_table(data, delimiter = DEFAULT_DELIMITER):
|
|
60
|
-
version = 1.
|
|
59
|
+
def pretty_format_table(data, delimiter = DEFAULT_DELIMITER,header = None):
|
|
60
|
+
version = 1.1
|
|
61
61
|
if not data:
|
|
62
62
|
return ''
|
|
63
63
|
if type(data) == str:
|
|
@@ -90,16 +90,34 @@ def pretty_format_table(data, delimiter = DEFAULT_DELIMITER):
|
|
|
90
90
|
# Build the row format string
|
|
91
91
|
row_format = ' | '.join('{{:<{}}}'.format(width) for width in col_widths)
|
|
92
92
|
# Print the header
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
if not header:
|
|
94
|
+
header = data[0]
|
|
95
|
+
outTable = []
|
|
96
|
+
outTable.append(row_format.format(*header))
|
|
97
|
+
outTable.append('-+-'.join('-' * width for width in col_widths))
|
|
98
|
+
for row in data[1:]:
|
|
99
|
+
# if the row is empty, print an divider
|
|
100
|
+
if not any(row):
|
|
101
|
+
outTable.append('-+-'.join('-' * width for width in col_widths))
|
|
102
|
+
else:
|
|
103
|
+
outTable.append(row_format.format(*row))
|
|
104
|
+
else:
|
|
105
|
+
# pad / truncate header to appropriate length
|
|
106
|
+
if isinstance(header,str):
|
|
107
|
+
header = header.split(delimiter)
|
|
108
|
+
if len(header) < num_cols:
|
|
109
|
+
header += ['']*(num_cols-len(header))
|
|
110
|
+
elif len(header) > num_cols:
|
|
111
|
+
header = header[:num_cols]
|
|
112
|
+
outTable = []
|
|
113
|
+
outTable.append(row_format.format(*header))
|
|
114
|
+
outTable.append('-+-'.join('-' * width for width in col_widths))
|
|
115
|
+
for row in data:
|
|
116
|
+
# if the row is empty, print an divider
|
|
117
|
+
if not any(row):
|
|
118
|
+
outTable.append('-+-'.join('-' * width for width in col_widths))
|
|
119
|
+
else:
|
|
120
|
+
outTable.append(row_format.format(*row))
|
|
103
121
|
return '\n'.join(outTable) + '\n'
|
|
104
122
|
|
|
105
123
|
def format_bytes(size, use_1024_bytes=None, to_int=False, to_str=False,str_format='.2f'):
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
TSVZ.py,sha256=TpzTN4ExxJt2QO2IvOfGyMyo2f_2kzdk5jmel_aN53A,67863
|
|
2
|
+
tsvz-3.16.dist-info/METADATA,sha256=6yN2gCJs5LgREHWMC_Cj5pHtdmu_9R24L9xIm1g-eSQ,1826
|
|
3
|
+
tsvz-3.16.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
4
|
+
tsvz-3.16.dist-info/entry_points.txt,sha256=WeXidyV5yKCRLaVsnAY35xGa08QgytOfvr1CK9aescI,60
|
|
5
|
+
tsvz-3.16.dist-info/top_level.txt,sha256=OPx4LvOpaYykaos7oL_jGaObSWXxLzhHiWLuz-K147g,5
|
|
6
|
+
tsvz-3.16.dist-info/RECORD,,
|
TSVZ-3.15.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
TSVZ.py,sha256=ubb2xT12PS2kIMMQDDkSUcjexKI3UnYkjqJwOF6uOp8,67076
|
|
2
|
-
TSVZ-3.15.dist-info/METADATA,sha256=IDGBJjOXdGAg3o5U96P_GHaCspv1F_Y5HRFSrazvdH4,1826
|
|
3
|
-
TSVZ-3.15.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
4
|
-
TSVZ-3.15.dist-info/entry_points.txt,sha256=WeXidyV5yKCRLaVsnAY35xGa08QgytOfvr1CK9aescI,60
|
|
5
|
-
TSVZ-3.15.dist-info/top_level.txt,sha256=OPx4LvOpaYykaos7oL_jGaObSWXxLzhHiWLuz-K147g,5
|
|
6
|
-
TSVZ-3.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|