def Decloture(self): self.cloture = True del self.inscrit.factures_cloturees[self.date] if sql_connection: print u'Suppression clôture', self.inscrit.idx, self.date sql_connection.execute('DELETE FROM FACTURES where inscrit=? AND date=?', (self.inscrit.idx, self.date)) # print "sql_connection.execute('DELETE FROM FACTURES where inscrit=%d AND date=%r)'" % (self.inscrit.idx, self.date) history.append(None)
def Cloture(self, date=None): if not self.cloture: if date is None: date = datetime.date(self.annee, self.mois, 1) self.cloture = True self.inscrit.factures_cloturees[date] = self if sql_connection: sql_connection.execute('INSERT INTO FACTURES (idx, inscrit, date, cotisation_mensuelle, total_contractualise, total_realise, total_facture, supplement_activites, supplement, deduction) VALUES (NULL,?,?,?,?,?,?,?,?,?)', (self.inscrit.idx, date, self.cotisation_mensuelle, self.total_contractualise, self.total_realise, self.total_facture, self.supplement_activites, self.supplement, self.deduction)) history.append(None)
def expect(name, box, hash, retry=None): global cnt, waiting_count, history while True: im, consumed_time = get_screenshot_raw() history.append(consumed_time) im2 = im.crop(box) # im2.save('temp.png') h = hamming(avhash(im2), hash) # logging.info(f'h = {h}') if h <= 5: logging.info(f'expect {name} success') return else: if retry: tap(*retry) if len(history) > 50: logging.error(f'error maximum exceeded') exit()