def rc (self, val = None):
"""
Get/Set the return code
@params:
`val`: The return code to be set. If it is None, return the return code. Default: `None`
If val == -1000: the return code will be negative of current one. 0 will be '-0'
@returns:
The return code if `val` is `None`
If rcfile does not exist or is empty, return 9999, otherwise return -rc
A negative rc (including -0) means output files not generated
"""
if val is None:
if not path.exists (self.rcfile):
return -1
with open (self.rcfile) as f:
return int(f.read().strip())
else:
with open (self.rcfile, 'w') as f:
f.write (str(val))
评论列表
文章目录