Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def GotCode(self, freqs, code):
median_freq = sorted(freqs)[len(freqs)/2]
if self.dialogEnabled:
self.carrierFreqCtrl.SetLabel(
"%d.%03d kHz" % (median_freq / 1000, median_freq % 1000)
)
self.code1.append(ConvertIrCodeToProntoRaw(median_freq,code))
if self.tryes==0:
self.firstLength=len(self.code1[self.tryes])
self.tryes+=1
print "IR: "+str(self.tryes)+"/"+str(self.maxTryes)+" IR codes received successfully!"
elif len(self.code1[self.tryes])==self.firstLength:
self.tryes+=1
print "IR: "+str(self.tryes)+"/"+str(self.maxTryes)+" IR codes received successfully!"
else:
del self.code1[-1]
print "IR ERROR: Length of the latest IR code is not equal to the length of the first IR code, please try again!"
if self.tryes==self.maxTryes:
self.tryes=0
print "IR: calculating..."
time.sleep(1)
for i in range(self.maxTryes):
if i==0: