python scripts now pack "a a-1 a-2 ... a-n" to "a to a-n"
This commit is contained in:
parent
aa3dc56949
commit
8eb93a3274
|
@ -600,8 +600,11 @@ class ASCIItable():
|
|||
while i < N and self.data_read():
|
||||
items = self.data
|
||||
if len(items) > 2:
|
||||
if items[1].lower() == 'of': items = np.ones(datatype(items[0]))*datatype(items[2])
|
||||
elif items[1].lower() == 'to': items = np.arange(datatype(items[0]),1+datatype(items[2]))
|
||||
if items[1].lower() == 'of':
|
||||
items = np.ones(datatype(items[0]))*datatype(items[2])
|
||||
elif items[1].lower() == 'to':
|
||||
items = np.linspace(datatype(items[0]),datatype(items[2]),
|
||||
abs(datatype(items[2])-datatype(items[0]))+1,dtype=int)
|
||||
else: items = list(map(datatype,items))
|
||||
else: items = list(map(datatype,items))
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ for name in filenames:
|
|||
else: items = map(int,items)
|
||||
|
||||
for current in items:
|
||||
if current == former+1 and start+reps == former+1:
|
||||
if abs(current - former) == 1 and abs(start-former) == reps - 1:
|
||||
compressType = 'to'
|
||||
reps += 1
|
||||
elif current == former and start == former:
|
||||
|
|
Loading…
Reference in New Issue