# Python imports:
import sys
import os, stat
-import string, re
+import re
import time
import getopt
import fpformat
mymatch = re.match(r"^(?P<value>\d+)(?P<unit>[GMKBgmkb])?$",size)
mysize = int(mymatch.group('value'))
if mymatch.group('unit'):
- mysize *= myunits[string.capitalize(mymatch.group('unit'))]
+ mysize *= myunits[mymatch.group('unit').capitalize()]
except:
raise ParseArgsException('size')
return mysize
mymatch = re.match(r"^(?P<value>\d+)(?P<unit>[YMWDHymwdh])?$",timespec)
myvalue = int(mymatch.group('value'))
if not mymatch.group('unit'): myunit = 'D'
- else: myunit = string.capitalize(mymatch.group('unit'))
+ else: myunit = mymatch.group('unit').capitalize()
except: raise ParseArgsException('time')
# calculate the limit EPOCH date
mytime = time.time() - (myvalue * myunits[myunit])