TSVZ 3.21__py3-none-any.whl → 3.23__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 CHANGED
@@ -22,7 +22,7 @@ if os.name == 'nt':
22
22
  elif os.name == 'posix':
23
23
  import fcntl
24
24
 
25
- version = '3.21'
25
+ version = '3.23'
26
26
  __version__ = version
27
27
  author = 'pan@zopyr.us'
28
28
 
@@ -498,10 +498,16 @@ def _verifyFileExistence(fileName,createIfNotExist = True,teeLogger = None,heade
498
498
  __teePrintOrNot(f'Warning: Filename {fileName} does not end with .psv','warning',teeLogger=teeLogger)
499
499
  if not os.path.isfile(fileName):
500
500
  if createIfNotExist:
501
- with open(fileName, mode ='w',encoding=encoding)as file:
502
- file.write(header+'\n')
503
- __teePrintOrNot('Created '+fileName,teeLogger=teeLogger)
504
- return True
501
+ try:
502
+ with open(fileName, mode ='w',encoding=encoding)as file:
503
+ file.write(header+'\n')
504
+ __teePrintOrNot('Created '+fileName,teeLogger=teeLogger)
505
+ return True
506
+ except:
507
+ __teePrintOrNot('Failed to create '+fileName,'error',teeLogger=teeLogger)
508
+ if strict:
509
+ raise FileNotFoundError("Failed to create file")
510
+ return False
505
511
  elif strict:
506
512
  __teePrintOrNot('File not found','error',teeLogger=teeLogger)
507
513
  raise FileNotFoundError("File not found")
@@ -666,6 +672,10 @@ def appendLinesTabularFile(fileName,linesToAppend,teeLogger = None,header = '',c
666
672
  if (not line or line[0] != key):
667
673
  line = [key]+line
668
674
  formatedLines.append(line)
675
+ if not formatedLines:
676
+ if verbose:
677
+ __teePrintOrNot(f"No lines to append to {fileName}",teeLogger=teeLogger)
678
+ return
669
679
  with open(fileName, mode ='r+b')as file:
670
680
  correctColumnNum = max([len(line) for line in formatedLines])
671
681
  if header.rstrip() and verifyHeader:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: TSVZ
3
- Version: 3.21
3
+ Version: 3.23
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
@@ -0,0 +1,6 @@
1
+ TSVZ.py,sha256=PG3VoplnSdmgvm2vuor_nPXLSlwQ-B9ZBN-psDfefK0,68850
2
+ tsvz-3.23.dist-info/METADATA,sha256=kK-NSB38DG_p6rzFmiu2qcijSOb1U2xI-SkglShvxDk,1826
3
+ tsvz-3.23.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
4
+ tsvz-3.23.dist-info/entry_points.txt,sha256=WeXidyV5yKCRLaVsnAY35xGa08QgytOfvr1CK9aescI,60
5
+ tsvz-3.23.dist-info/top_level.txt,sha256=OPx4LvOpaYykaos7oL_jGaObSWXxLzhHiWLuz-K147g,5
6
+ tsvz-3.23.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.0.0)
2
+ Generator: setuptools (76.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,6 +0,0 @@
1
- TSVZ.py,sha256=eRZASSHRWU-POztnPYvqZq9ufarsBq65VAnVQ2RB9vY,68436
2
- tsvz-3.21.dist-info/METADATA,sha256=OFhlK4nFVUhqiBS9L9rpg8WPwcP0in8eKlyT2qps9PQ,1826
3
- tsvz-3.21.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
4
- tsvz-3.21.dist-info/entry_points.txt,sha256=WeXidyV5yKCRLaVsnAY35xGa08QgytOfvr1CK9aescI,60
5
- tsvz-3.21.dist-info/top_level.txt,sha256=OPx4LvOpaYykaos7oL_jGaObSWXxLzhHiWLuz-K147g,5
6
- tsvz-3.21.dist-info/RECORD,,