@@ -6528,7 +6528,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:Optiona
6528
6528
#Example1 "Y2[-7]" = "Y20070" Example2 "Y2[+9]" = "Y21191"
6529
6529
mathexpression = evaltimeexpression.join((mathexpression[:i],mathexpression[i+offset+6:]))
6530
6530
#direct index access: e.g. "Y2{CHARGE}" or "Y2{12}"
6531
- elif i+5 +offset < len(mathexpression) and mathexpression[i+offset+2] == '{' and mathexpression.find('}',i+offset+3) > -1:
6531
+ elif i+4 +offset < mlen and mathexpression[i+offset+2] == '{' and mathexpression.find('}',i+offset+3) > -1:
6532
6532
end_idx = mathexpression.index('}',i+offset+3)
6533
6533
body = mathexpression[i+3:end_idx]
6534
6534
val = -1
@@ -6602,7 +6602,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:Optiona
6602
6602
if mathexpression[i+k+1].isdigit():
6603
6603
nint = int(mathexpression[i+k+1]) #Rnumber int
6604
6604
#check for TIMESHIFT 0-9 (one digit). Example: "R1[-2]" or RB1[-2]
6605
- if i+k+5 < len(mathexpression) and mathexpression[i+k+2] == '[':
6605
+ if i+k+5 < mlen and mathexpression[i+k+2] == '[':
6606
6606
Yshiftval = int(mathexpression[i+k+4])
6607
6607
sign = mathexpression[i+k+3]
6608
6608
@@ -6642,7 +6642,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:Optiona
6642
6642
mathexpression = evaltimeexpression.join((mathexpression[:i],mathexpression[i+k+6:]))
6643
6643
6644
6644
#direct index access: e.g. "R2{CHARGE}" or "R2{12}"
6645
- elif i+k+5 < len(mathexpression) and mathexpression[i+k+2] == '{' and mathexpression.find('}',i+k+3) > -1:
6645
+ elif i+k+5 < mlen and mathexpression[i+k+2] == '{' and mathexpression.find('}',i+k+3) > -1:
6646
6646
end_idx = mathexpression.index('}',i+k+3)
6647
6647
body = mathexpression[i+k+3:end_idx]
6648
6648
val = -1
@@ -6757,7 +6757,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:Optiona
6757
6757
else:
6758
6758
timex = self.abs_timeB
6759
6759
seconddigitstr = ''
6760
- if i+4 < len(mathexpression) and mathexpression[i+1] == '[':
6760
+ if i+4 < mlen and mathexpression[i+1] == '[':
6761
6761
Yshiftval = int(mathexpression[i+3])
6762
6762
sign = mathexpression[i+2]
6763
6763
@@ -6775,7 +6775,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:Optiona
6775
6775
timeshiftexpressionsvalues.append(val)
6776
6776
mathexpression = evaltimeexpression.join((mathexpression[:i],mathexpression[i+5:]))
6777
6777
#direct index access: e.g. "t{CHARGE}" or "t{12}"
6778
- elif i+3 < len(mathexpression) and mathexpression[i+1] == '{' and mathexpression.find('}',i+2) > -1:
6778
+ elif i+3 < mlen and mathexpression[i+1] == '{' and mathexpression.find('}',i+2) > -1:
6779
6779
end_idx = mathexpression.index('}',i+2)
6780
6780
body = mathexpression[i+2:end_idx]
6781
6781
if mathexpression[i]=='b':
@@ -6803,7 +6803,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:Optiona
6803
6803
elif mathexpression[i] == 'P' and i+1 < mlen and mathexpression[i+1].isdigit(): #check for out of range
6804
6804
nint = int(mathexpression[i+1]) #Ynumber int
6805
6805
#check for TIMESHIFT 0-9 (one digit). Example: "Y1[-2]"
6806
- if i+5 < len(mathexpression) and mathexpression[i+2] == '[' and mathexpression[i+5] == ']':
6806
+ if i+5 < mlen and mathexpression[i+2] == '[' and mathexpression[i+5] == ']':
6807
6807
Yshiftval = int(mathexpression[i+4])
6808
6808
sign = mathexpression[i+3]
6809
6809
evaltimeexpression = ''.join(('P',mathexpression[i+1],'1'*2,mathexpression[i+4],'1'))
@@ -6827,7 +6827,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:Optiona
6827
6827
if mathexpression[i+1].isdigit():
6828
6828
nint = int(mathexpression[i+1]) #Bnumber int
6829
6829
#check for TIMESHIFT 0-9 (one digit). Example: "B1[-2]"
6830
- if i+5 < len(mathexpression) and mathexpression[i+2] == '[':
6830
+ if i+5 < mlen and mathexpression[i+2] == '[':
6831
6831
Yshiftval = int(mathexpression[i+4])
6832
6832
sign = mathexpression[i+3]
6833
6833
@@ -6877,7 +6877,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:Optiona
6877
6877
timeshiftexpressionsvalues.append(val)
6878
6878
mathexpression = evaltimeexpression.join((mathexpression[:i],mathexpression[i+6:]))
6879
6879
#direct index access: e.g. "B2{CHARGE}" or "B2{12}"
6880
- elif i+5 < len(mathexpression) and mathexpression[i+2] == '{' and mathexpression.find('}',i+3) > -1:
6880
+ elif i+5 < mlen and mathexpression[i+2] == '{' and mathexpression.find('}',i+3) > -1:
6881
6881
end_idx = mathexpression.index('}',i+3)
6882
6882
body = mathexpression[i+3:end_idx]
6883
6883
val = -1
0 commit comments