TSVZ 3.26__py3-none-any.whl → 3.28__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 +32 -25
- {tsvz-3.26.dist-info → tsvz-3.28.dist-info}/METADATA +1 -1
- tsvz-3.28.dist-info/RECORD +6 -0
- {tsvz-3.26.dist-info → tsvz-3.28.dist-info}/WHEEL +1 -1
- tsvz-3.26.dist-info/RECORD +0 -6
- {tsvz-3.26.dist-info → tsvz-3.28.dist-info}/entry_points.txt +0 -0
- {tsvz-3.26.dist-info → tsvz-3.28.dist-info}/top_level.txt +0 -0
TSVZ.py
CHANGED
|
@@ -22,10 +22,10 @@ if os.name == 'nt':
|
|
|
22
22
|
elif os.name == 'posix':
|
|
23
23
|
import fcntl
|
|
24
24
|
|
|
25
|
-
version = '3.
|
|
25
|
+
version = '3.28'
|
|
26
26
|
__version__ = version
|
|
27
27
|
author = 'pan@zopyr.us'
|
|
28
|
-
COMMIT_DATE = '2025-
|
|
28
|
+
COMMIT_DATE = '2025-07-07'
|
|
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':
|
|
@@ -1408,16 +1410,21 @@ memoryOnly:{self.memoryOnly}
|
|
|
1408
1410
|
return self
|
|
1409
1411
|
|
|
1410
1412
|
def stopAppendThread(self):
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1413
|
+
try:
|
|
1414
|
+
if self.shutdownEvent.is_set():
|
|
1415
|
+
# if self.verbose:
|
|
1416
|
+
# self.__teePrintOrNot(f"Append thread for {self._fileName} already stopped")
|
|
1417
|
+
return
|
|
1418
|
+
self.rewrite(force=self.rewrite_on_exit) # Ensure any final sync operations are performed
|
|
1419
|
+
# self.appendEvent.set()
|
|
1420
|
+
self.shutdownEvent.set() # Signal the append thread to shut down
|
|
1421
|
+
self.appendThread.join() # Wait for the append thread to complete
|
|
1422
|
+
if self.verbose:
|
|
1423
|
+
self.__teePrintOrNot(f"Append thread for {self._fileName} stopped")
|
|
1424
|
+
except Exception as e:
|
|
1425
|
+
self.__teePrintOrNot(f"Failed to stop append thread for {self._fileName}: {e}",'error')
|
|
1426
|
+
import traceback
|
|
1427
|
+
self.__teePrintOrNot(traceback.format_exc(),'error')
|
|
1421
1428
|
|
|
1422
1429
|
def get_file_obj(self,modes = 'ab'):
|
|
1423
1430
|
self.writeLock.acquire()
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
TSVZ.py,sha256=HWooYlke-QDgcX5KbE0j8QJB1hH0ttb7t13ZILuoIbA,77718
|
|
2
|
+
tsvz-3.28.dist-info/METADATA,sha256=eceR8HsdOc71TCXrUKk89IK4-kOEZIHxGqTvt40_Q88,1826
|
|
3
|
+
tsvz-3.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
4
|
+
tsvz-3.28.dist-info/entry_points.txt,sha256=WeXidyV5yKCRLaVsnAY35xGa08QgytOfvr1CK9aescI,60
|
|
5
|
+
tsvz-3.28.dist-info/top_level.txt,sha256=OPx4LvOpaYykaos7oL_jGaObSWXxLzhHiWLuz-K147g,5
|
|
6
|
+
tsvz-3.28.dist-info/RECORD,,
|
tsvz-3.26.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
TSVZ.py,sha256=WanY7DemCKyfMB4qOiAFkYj_95AaeqQ4R6x02UTg89Q,77385
|
|
2
|
-
tsvz-3.26.dist-info/METADATA,sha256=hfHZtBL5SxPxkPvar3SWXLrA9Vps5HqFPNxhnqSAh2k,1826
|
|
3
|
-
tsvz-3.26.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
|
4
|
-
tsvz-3.26.dist-info/entry_points.txt,sha256=WeXidyV5yKCRLaVsnAY35xGa08QgytOfvr1CK9aescI,60
|
|
5
|
-
tsvz-3.26.dist-info/top_level.txt,sha256=OPx4LvOpaYykaos7oL_jGaObSWXxLzhHiWLuz-K147g,5
|
|
6
|
-
tsvz-3.26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|