TSVZ 3.24__py3-none-any.whl → 3.25__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 +10 -6
- {tsvz-3.24.dist-info → tsvz-3.25.dist-info}/METADATA +1 -1
- tsvz-3.25.dist-info/RECORD +6 -0
- {tsvz-3.24.dist-info → tsvz-3.25.dist-info}/WHEEL +1 -1
- tsvz-3.24.dist-info/RECORD +0 -6
- {tsvz-3.24.dist-info → tsvz-3.25.dist-info}/entry_points.txt +0 -0
- {tsvz-3.24.dist-info → tsvz-3.25.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.25'
|
|
26
26
|
__version__ = version
|
|
27
27
|
author = 'pan@zopyr.us'
|
|
28
28
|
|
|
@@ -280,7 +280,7 @@ def __teePrintOrNot(message,level = 'info',teeLogger = None):
|
|
|
280
280
|
except Exception:
|
|
281
281
|
print(message,flush=True)
|
|
282
282
|
|
|
283
|
-
def _processLine(line,taskDic,correctColumnNum,verbose = False,teeLogger = None,strict = True,delimiter = DEFAULT_DELIMITER,defaults =
|
|
283
|
+
def _processLine(line,taskDic,correctColumnNum,verbose = False,teeLogger = None,strict = True,delimiter = DEFAULT_DELIMITER,defaults = ...):
|
|
284
284
|
"""
|
|
285
285
|
Process a line of text and update the task dictionary.
|
|
286
286
|
|
|
@@ -297,7 +297,7 @@ def _processLine(line,taskDic,correctColumnNum,verbose = False,teeLogger = None,
|
|
|
297
297
|
tuple: A tuple containing the updated correctColumnNum and the processed lineCache.
|
|
298
298
|
|
|
299
299
|
"""
|
|
300
|
-
if
|
|
300
|
+
if defaults is ...:
|
|
301
301
|
defaults = []
|
|
302
302
|
line = line.strip(' ').strip('\x00').rstrip('\r\n')
|
|
303
303
|
# we throw away the lines that start with '#'
|
|
@@ -367,7 +367,7 @@ def _processLine(line,taskDic,correctColumnNum,verbose = False,teeLogger = None,
|
|
|
367
367
|
__teePrintOrNot(f"Key {lineCache[0]} added",teeLogger=teeLogger)
|
|
368
368
|
return correctColumnNum, lineCache
|
|
369
369
|
|
|
370
|
-
def read_last_valid_line(fileName, taskDic, correctColumnNum, verbose=False, teeLogger=None, strict=False,encoding = 'utf8',delimiter = ...,defaults =
|
|
370
|
+
def read_last_valid_line(fileName, taskDic, correctColumnNum, verbose=False, teeLogger=None, strict=False,encoding = 'utf8',delimiter = ...,defaults = ...):
|
|
371
371
|
"""
|
|
372
372
|
Reads the last valid line from a file.
|
|
373
373
|
|
|
@@ -387,6 +387,8 @@ def read_last_valid_line(fileName, taskDic, correctColumnNum, verbose=False, tee
|
|
|
387
387
|
"""
|
|
388
388
|
chunk_size = 1024 # Read in chunks of 1024 bytes
|
|
389
389
|
last_valid_line = []
|
|
390
|
+
if defaults is ...:
|
|
391
|
+
defaults = []
|
|
390
392
|
delimiter = get_delimiter(delimiter,file_name=fileName)
|
|
391
393
|
if verbose:
|
|
392
394
|
__teePrintOrNot(f"Reading last line only from {fileName}",teeLogger=teeLogger)
|
|
@@ -528,7 +530,7 @@ def _verifyFileExistence(fileName,createIfNotExist = True,teeLogger = None,heade
|
|
|
528
530
|
return False
|
|
529
531
|
return True
|
|
530
532
|
|
|
531
|
-
def readTSV(fileName,teeLogger = None,header = '',createIfNotExist = False, lastLineOnly = False,verifyHeader = True,verbose = False,taskDic = None,encoding = 'utf8',strict = True,delimiter = '\t',defaults =
|
|
533
|
+
def readTSV(fileName,teeLogger = None,header = '',createIfNotExist = False, lastLineOnly = False,verifyHeader = True,verbose = False,taskDic = None,encoding = 'utf8',strict = True,delimiter = '\t',defaults = ...):
|
|
532
534
|
"""
|
|
533
535
|
Compatibility method, calls readTabularFile.
|
|
534
536
|
Read a Tabular (CSV / TSV / NSV) file and return the data as a dictionary.
|
|
@@ -556,7 +558,7 @@ def readTSV(fileName,teeLogger = None,header = '',createIfNotExist = False, last
|
|
|
556
558
|
"""
|
|
557
559
|
return readTabularFile(fileName,teeLogger = teeLogger,header = header,createIfNotExist = createIfNotExist,lastLineOnly = lastLineOnly,verifyHeader = verifyHeader,verbose = verbose,taskDic = taskDic,encoding = encoding,strict = strict,delimiter = delimiter,defaults=defaults)
|
|
558
560
|
|
|
559
|
-
def readTabularFile(fileName,teeLogger = None,header = '',createIfNotExist = False, lastLineOnly = False,verifyHeader = True,verbose = False,taskDic = None,encoding = 'utf8',strict = True,delimiter = ...,defaults =
|
|
561
|
+
def readTabularFile(fileName,teeLogger = None,header = '',createIfNotExist = False, lastLineOnly = False,verifyHeader = True,verbose = False,taskDic = None,encoding = 'utf8',strict = True,delimiter = ...,defaults = ...):
|
|
560
562
|
"""
|
|
561
563
|
Read a Tabular (CSV / TSV / NSV) file and return the data as a dictionary.
|
|
562
564
|
|
|
@@ -583,6 +585,8 @@ def readTabularFile(fileName,teeLogger = None,header = '',createIfNotExist = Fal
|
|
|
583
585
|
"""
|
|
584
586
|
if taskDic is None:
|
|
585
587
|
taskDic = {}
|
|
588
|
+
if defaults is ...:
|
|
589
|
+
defaults = []
|
|
586
590
|
delimiter = get_delimiter(delimiter,file_name=fileName)
|
|
587
591
|
header = _formatHeader(header,verbose = verbose,teeLogger = teeLogger, delimiter = delimiter)
|
|
588
592
|
if not _verifyFileExistence(fileName,createIfNotExist = createIfNotExist,teeLogger = teeLogger,header = header,encoding = encoding,strict = strict,delimiter=delimiter):
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
TSVZ.py,sha256=LGbNbhS3BS9AH1AD9UQCyMk-f-iAgfBk7CXUdRr5Vy4,69461
|
|
2
|
+
tsvz-3.25.dist-info/METADATA,sha256=8ArDrlBsAE26X80qLBeZ9gVJp8HFlFzd2o4EzhMTPUI,1826
|
|
3
|
+
tsvz-3.25.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
4
|
+
tsvz-3.25.dist-info/entry_points.txt,sha256=WeXidyV5yKCRLaVsnAY35xGa08QgytOfvr1CK9aescI,60
|
|
5
|
+
tsvz-3.25.dist-info/top_level.txt,sha256=OPx4LvOpaYykaos7oL_jGaObSWXxLzhHiWLuz-K147g,5
|
|
6
|
+
tsvz-3.25.dist-info/RECORD,,
|
tsvz-3.24.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
TSVZ.py,sha256=PPylrxbtSuTUVlyuLj1tfD3DpLasLyrI0oRrCgbyr50,69364
|
|
2
|
-
tsvz-3.24.dist-info/METADATA,sha256=SrxVDXR15_46qKjCRRZIdkEt0HqMAgJIeKjW48y6szk,1826
|
|
3
|
-
tsvz-3.24.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
|
|
4
|
-
tsvz-3.24.dist-info/entry_points.txt,sha256=WeXidyV5yKCRLaVsnAY35xGa08QgytOfvr1CK9aescI,60
|
|
5
|
-
tsvz-3.24.dist-info/top_level.txt,sha256=OPx4LvOpaYykaos7oL_jGaObSWXxLzhHiWLuz-K147g,5
|
|
6
|
-
tsvz-3.24.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|