File tree 1 file changed +17
-6
lines changed
1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -149,9 +149,17 @@ def picode_parse(picode:str):
149
149
150
150
# Add param1 to result dict
151
151
result ["c" ] = pulses_type
152
-
153
- # All checks OK
154
- return result
152
+
153
+ # Check for uniq pulses_type count equal to pulses_length count
154
+ if len (set (pulses_type )) > len (pulses_length ):
155
+ # error: uniq pulses_type > pulses_length
156
+ return
157
+ elif len (set (pulses_type )) < len (pulses_length ):
158
+ # error: pulses_length > uniq pulses_type
159
+ return
160
+ else :
161
+ # All checks OK
162
+ return result
155
163
else :
156
164
# error: invalid params number (;)
157
165
return
@@ -197,9 +205,12 @@ def picode_pulselist(picode:dict):
197
205
if isinstance (picode ["c" ], list ) and isinstance (picode ["p" ], list ):
198
206
# Pulses loop
199
207
for pulse_type in picode ["c" ]:
200
- # Add pulse value to pulse list
201
- pulse_list .append ((picode ["p" ][pulse_type ]))
202
-
208
+ try :
209
+ # Add pulse value to pulse list
210
+ pulse_list .append ((picode ["p" ][pulse_type ]))
211
+ except :
212
+ # error: list index out of range
213
+ return
203
214
# All checks OK
204
215
return pulse_list
205
216
else :
You can’t perform that action at this time.
0 commit comments