def record_timings(self):
        import_error = ""
        try:
            import xlrd
        except:
            import_error += "ERROR: the xlrd modules is needed to record timings\n"
        try:
            import xlwt
        except:
            import_error += "ERROR: the xlwt modules is needed to record timings\n"
        if import_error != "":
            print >> self.stderr, import_error
            return
        rec_time_filename = self.config.record_timings_filename
        try:
            workbook = xlrd.open_workbook(filename=rec_time_filename,
                                          formatting_info=True)
        except:
            workbook = None
            summary = {}
        if workbook:
            summary = self.read_timings_sheet(workbook)
            if len(summary["date"]) > 100:
                # Need to rotate the file
                # 1) make a summary and save this
                self.report_timings_summary(summary, rec_time_filename)
                # 2) archive the file
                from zipfile import ZipFile
                import os
                zip_filename = os.path.join(self.config.path, "rec_time.zip")
                archive = ZipFile(zip_filename, "a")
                arc_name = "%s-%s.xls" % (rec_time_filename[len(self.config.path):-4],
                                          current.request.now.date()
                                          )
                archive.write(rec_time_filename,arc_name)
                archive.close()
                # 3) clear the current file
                os.unlink(rec_time_filename)
                summary = {}
        if "date" not in summary:
            last_col = 0
            summary["date"] = [current.request.now.date()]
        else:
            last_col = len(summary["date"])
            summary["date"].append(current.request.now.date())
        for (url, rd_obj) in self.results.items():
            if summary not in url:
                summary[url] = []
            # ensure that the row is as long as the number of dates
            shortage = last_col - len(summary[url])
            if shortage > 0:
                summary[url] = summary[url] + ['']*shortage
            summary[url].append((rd_obj.get_duration(), rd_obj.is_broken()))
        self.write_timings_sheet(summary, rec_time_filename)
dataset/ETHPy150Open sahana/eden/modules/tests/smoke/broken_links.py/BrokenLinkTest.record_timings/swapped operands of `not in`