10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 13:53:48 +01:00

Fix prefix instead of suffix

This commit is contained in:
Mickaël Véril 2020-06-17 13:19:44 +02:00
parent 3ec9a2e6f4
commit 17bbe7b953
2 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@ parser.add_argument('--file', type=argparse.FileType('r'))
parser.add_argument('--defaultType', type=str, choices=[t.name for t in list(dataType)]) parser.add_argument('--defaultType', type=str, choices=[t.name for t in list(dataType)])
parser.add_argument('--format',type=str, choices=[t.name for t in list(Format)],default=Format.LINE.name) parser.add_argument('--format',type=str, choices=[t.name for t in list(Format)],default=Format.LINE.name)
parser.add_argument('--debug', action='store_true', help='Debug mode') parser.add_argument('--debug', action='store_true', help='Debug mode')
parser.add_argument('--prefix',type=str,default=None) parser.add_argument('--suffix',type=str,default=None)
args = parser.parse_args() args = parser.parse_args()
print(args) print(args)
lines=args.file.readlines() lines=args.file.readlines()
@ -29,4 +29,4 @@ if not datapath.exists():
datapath.mkdir() datapath.mkdir()
datalst=dataFileBase.readFromTable(dat,format=Format[args.format],default=dataType[args.defaultType],commands=commands) datalst=dataFileBase.readFromTable(dat,format=Format[args.format],default=dataType[args.defaultType],commands=commands)
for data in datalst: for data in datalst:
data.toFile(datapath,args.prefix) data.toFile(datapath,args.suffix)

View File

@ -326,7 +326,7 @@ class dataFileBase(object):
dic["DOI"]="" if self.DOI is None else self.DOI dic["DOI"]="" if self.DOI is None else self.DOI
return dic return dic
def toFile(self,datadir,prefix=None): def toFile(self,datadir,suffix=None):
subpath=datadir/self.GetFileType().name.lower() subpath=datadir/self.GetFileType().name.lower()
if not subpath.exists(): if not subpath.exists():
subpath.mkdir() subpath.mkdir()
@ -337,8 +337,8 @@ class dataFileBase(object):
fileNameComp=[molfilename,self.method.name] fileNameComp=[molfilename,self.method.name]
if self.method.basis: if self.method.basis:
fileNameComp.append(self.method.basis) fileNameComp.append(self.method.basis)
if prefix: if suffix:
fileNameComp.append(prefix) fileNameComp.append(suffix)
fileName="_".join(fileNameComp)+".dat" fileName="_".join(fileNameComp)+".dat"
file=subpath/fileName file=subpath/fileName
if not file.exists(): if not file.exists():