TSVZ 3.26__tar.gz → 3.27__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.4
2
2
  Name: TSVZ
3
- Version: 3.26
3
+ Version: 3.27
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.4
2
2
  Name: TSVZ
3
- Version: 3.26
3
+ Version: 3.27
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,10 +22,10 @@ if os.name == 'nt':
22
22
  elif os.name == 'posix':
23
23
  import fcntl
24
24
 
25
- version = '3.26'
25
+ version = '3.27'
26
26
  __version__ = version
27
27
  author = 'pan@zopyr.us'
28
- COMMIT_DATE = '2025-05-19'
28
+ COMMIT_DATE = '2025-06-25'
29
29
 
30
30
  DEFAULT_DELIMITER = '\t'
31
31
  DEFAULTS_INDICATOR_KEY = '#_defaults_#'
@@ -736,20 +736,22 @@ def appendLinesTabularFile(fileName,linesToAppend,teeLogger = None,header = '',c
736
736
  if verbose:
737
737
  __teePrintOrNot(f"No lines to append to {fileName}",teeLogger=teeLogger)
738
738
  return
739
+ correctColumnNum = max([len(line) for line in formatedLines])
740
+
741
+ if header.rstrip() and verifyHeader:
742
+ with openFileAsCompressed(fileName, mode ='rb',encoding=encoding,teeLogger=teeLogger)as file:
743
+ line = file.readline().decode(encoding=encoding,errors='replace')
744
+ if _lineContainHeader(header,line,verbose = verbose,teeLogger = teeLogger,strict = strict):
745
+ correctColumnNum = len(header.split(delimiter))
746
+ if verbose:
747
+ __teePrintOrNot(f"correctColumnNum: {correctColumnNum}",teeLogger=teeLogger)
748
+ # truncate / fill the lines to the correct number of columns
749
+ for i in range(len(formatedLines)):
750
+ if len(formatedLines[i]) < correctColumnNum:
751
+ formatedLines[i] += ['']*(correctColumnNum-len(formatedLines[i]))
752
+ elif len(formatedLines[i]) > correctColumnNum:
753
+ formatedLines[i] = formatedLines[i][:correctColumnNum]
739
754
  with openFileAsCompressed(fileName, mode ='ab',encoding=encoding,teeLogger=teeLogger)as file:
740
- correctColumnNum = max([len(line) for line in formatedLines])
741
- if header.rstrip() and verifyHeader:
742
- line = file.readline().decode(encoding=encoding,errors='replace')
743
- if _lineContainHeader(header,line,verbose = verbose,teeLogger = teeLogger,strict = strict):
744
- correctColumnNum = len(header.split(delimiter))
745
- if verbose:
746
- __teePrintOrNot(f"correctColumnNum: {correctColumnNum}",teeLogger=teeLogger)
747
- # truncate / fill the lines to the correct number of columns
748
- for i in range(len(formatedLines)):
749
- if len(formatedLines[i]) < correctColumnNum:
750
- formatedLines[i] += ['']*(correctColumnNum-len(formatedLines[i]))
751
- elif len(formatedLines[i]) > correctColumnNum:
752
- formatedLines[i] = formatedLines[i][:correctColumnNum]
753
755
  # check if the file ends in a newline
754
756
  # file.seek(-1, os.SEEK_END)
755
757
  # if file.read(1) != b'\n':
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes