TSVZ 3.27__py3-none-any.whl → 3.29__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 +43 -15
- {tsvz-3.27.dist-info → tsvz-3.29.dist-info}/METADATA +1 -1
- tsvz-3.29.dist-info/RECORD +6 -0
- {tsvz-3.27.dist-info → tsvz-3.29.dist-info}/entry_points.txt +0 -0
- {tsvz-3.27.dist-info → tsvz-3.29.dist-info}/top_level.txt +0 -0
- tsvz-3.27.dist-info/RECORD +0 -6
- {tsvz-3.27.dist-info → tsvz-3.29.dist-info}/WHEEL +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.29'
|
|
26
26
|
__version__ = version
|
|
27
27
|
author = 'pan@zopyr.us'
|
|
28
|
-
COMMIT_DATE = '2025-
|
|
28
|
+
COMMIT_DATE = '2025-08-11'
|
|
29
29
|
|
|
30
30
|
DEFAULT_DELIMITER = '\t'
|
|
31
31
|
DEFAULTS_INDICATOR_KEY = '#_defaults_#'
|
|
@@ -885,6 +885,29 @@ def scrubTabularFile(fileName,teeLogger = None,header = '',createIfNotExist = Fa
|
|
|
885
885
|
appendLinesTabularFile(fileName,file,teeLogger = teeLogger,header = header,createIfNotExist = createIfNotExist,verifyHeader = verifyHeader,verbose = verbose,encoding = encoding,strict = strict,delimiter = delimiter)
|
|
886
886
|
return file
|
|
887
887
|
|
|
888
|
+
def getListView(tsvzDic,header = [],delimiter = DEFAULT_DELIMITER):
|
|
889
|
+
if header:
|
|
890
|
+
if isinstance(header,str):
|
|
891
|
+
header = header.split(delimiter)
|
|
892
|
+
elif not isinstance(header,list):
|
|
893
|
+
try:
|
|
894
|
+
header = list(header)
|
|
895
|
+
except:
|
|
896
|
+
header = []
|
|
897
|
+
if not tsvzDic:
|
|
898
|
+
if not header:
|
|
899
|
+
return []
|
|
900
|
+
else:
|
|
901
|
+
return [header]
|
|
902
|
+
if not header:
|
|
903
|
+
return list(tsvzDic.values())
|
|
904
|
+
else:
|
|
905
|
+
values = list(tsvzDic.values())
|
|
906
|
+
if values[0] and values[0] == header:
|
|
907
|
+
return values
|
|
908
|
+
else:
|
|
909
|
+
return [header] + values
|
|
910
|
+
|
|
888
911
|
# create a tsv class that functions like a ordered dictionary but will update the file when modified
|
|
889
912
|
class TSVZed(OrderedDict):
|
|
890
913
|
def __teePrintOrNot(self,message,level = 'info'):
|
|
@@ -1105,6 +1128,9 @@ class TSVZed(OrderedDict):
|
|
|
1105
1128
|
self.__teePrintOrNot(f"Appending {emptyLine} to the appendQueue")
|
|
1106
1129
|
self.appendQueue.append(emptyLine)
|
|
1107
1130
|
return self
|
|
1131
|
+
|
|
1132
|
+
def getListView(self):
|
|
1133
|
+
return getListView(self,header=self.header,delimiter=self.delimiter)
|
|
1108
1134
|
|
|
1109
1135
|
def clear(self):
|
|
1110
1136
|
# clear the dictionary and update the file
|
|
@@ -1410,16 +1436,21 @@ memoryOnly:{self.memoryOnly}
|
|
|
1410
1436
|
return self
|
|
1411
1437
|
|
|
1412
1438
|
def stopAppendThread(self):
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1439
|
+
try:
|
|
1440
|
+
if self.shutdownEvent.is_set():
|
|
1441
|
+
# if self.verbose:
|
|
1442
|
+
# self.__teePrintOrNot(f"Append thread for {self._fileName} already stopped")
|
|
1443
|
+
return
|
|
1444
|
+
self.rewrite(force=self.rewrite_on_exit) # Ensure any final sync operations are performed
|
|
1445
|
+
# self.appendEvent.set()
|
|
1446
|
+
self.shutdownEvent.set() # Signal the append thread to shut down
|
|
1447
|
+
self.appendThread.join() # Wait for the append thread to complete
|
|
1448
|
+
if self.verbose:
|
|
1449
|
+
self.__teePrintOrNot(f"Append thread for {self._fileName} stopped")
|
|
1450
|
+
except Exception as e:
|
|
1451
|
+
self.__teePrintOrNot(f"Failed to stop append thread for {self._fileName}: {e}",'error')
|
|
1452
|
+
import traceback
|
|
1453
|
+
self.__teePrintOrNot(traceback.format_exc(),'error')
|
|
1423
1454
|
|
|
1424
1455
|
def get_file_obj(self,modes = 'ab'):
|
|
1425
1456
|
self.writeLock.acquire()
|
|
@@ -1534,6 +1565,3 @@ def __main__():
|
|
|
1534
1565
|
print("Invalid operation")
|
|
1535
1566
|
if __name__ == '__main__':
|
|
1536
1567
|
__main__()
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
TSVZ.py,sha256=mULdGJvv_LcO4bGGRWjg-esutV3EahLywvRa6oRkynQ,78467
|
|
2
|
+
tsvz-3.29.dist-info/METADATA,sha256=kS1cnrQ2wyqj5qVhnVlbCSjdWLeJkhbPqLwFnDX-QpY,1826
|
|
3
|
+
tsvz-3.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
4
|
+
tsvz-3.29.dist-info/entry_points.txt,sha256=WeXidyV5yKCRLaVsnAY35xGa08QgytOfvr1CK9aescI,60
|
|
5
|
+
tsvz-3.29.dist-info/top_level.txt,sha256=OPx4LvOpaYykaos7oL_jGaObSWXxLzhHiWLuz-K147g,5
|
|
6
|
+
tsvz-3.29.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
tsvz-3.27.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
TSVZ.py,sha256=G4SZbuw8WNALDqGegzrI7eEkgyKv7tyYDCa06Ux7lS0,77440
|
|
2
|
-
tsvz-3.27.dist-info/METADATA,sha256=9pwd-LcsbXgET3ZRZgRaqatgL6kCsKgGh5zodE1JACo,1826
|
|
3
|
-
tsvz-3.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
4
|
-
tsvz-3.27.dist-info/entry_points.txt,sha256=WeXidyV5yKCRLaVsnAY35xGa08QgytOfvr1CK9aescI,60
|
|
5
|
-
tsvz-3.27.dist-info/top_level.txt,sha256=OPx4LvOpaYykaos7oL_jGaObSWXxLzhHiWLuz-K147g,5
|
|
6
|
-
tsvz-3.27.dist-info/RECORD,,
|
|
File without changes
|