TSVZ 3.16__tar.gz → 3.17__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: TSVZ
3
- Version: 3.16
3
+ Version: 3.17
4
4
  Summary: An simple in memory wrapper around a TSV file to function as a database
5
5
  Home-page: https://github.com/yufei-pan/TSVZ
6
6
  Author: Yufei Pan
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: TSVZ
3
- Version: 3.16
3
+ Version: 3.17
4
4
  Summary: An simple in memory wrapper around a TSV file to function as a database
5
5
  Home-page: https://github.com/yufei-pan/TSVZ
6
6
  Author: Yufei Pan
@@ -22,7 +22,7 @@ if os.name == 'nt':
22
22
  elif os.name == 'posix':
23
23
  import fcntl
24
24
 
25
- version = '3.16'
25
+ version = '3.17'
26
26
  __version__ = version
27
27
  author = 'pan@zopyr.us'
28
28
 
@@ -57,7 +57,7 @@ def get_delimiter(delimiter,file_name = ''):
57
57
  return rtn
58
58
 
59
59
  def pretty_format_table(data, delimiter = DEFAULT_DELIMITER,header = None):
60
- version = 1.1
60
+ version = 1.11
61
61
  if not data:
62
62
  return ''
63
63
  if type(data) == str:
@@ -87,6 +87,9 @@ def pretty_format_table(data, delimiter = DEFAULT_DELIMITER,header = None):
87
87
  #col_widths[c] = max(len(row[c]) for row in data)
88
88
  # handle ansii escape sequences
89
89
  col_widths[c] = max(len(re.sub(r'\x1b\[[0-?]*[ -/]*[@-~]','',row[c])) for row in data)
90
+ if header:
91
+ header_widths = [len(re.sub(r'\x1b\[[0-?]*[ -/]*[@-~]', '', col)) for col in header]
92
+ col_widths = [max(col_widths[i], header_widths[i]) for i in range(num_cols)]
90
93
  # Build the row format string
91
94
  row_format = ' | '.join('{{:<{}}}'.format(width) for width in col_widths)
92
95
  # Print the header
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes