def try_parsing_annotations(ann_data, graph_list): for graph in graph_list: try: annotate.get(ann_data, graph, '', parse_date('2001-01-01'), parse_date('2100-12-31'), '') except: print('Error parsing annotations for "{0}"\n'.format(graph)) traceback.print_exc() exit(-1)
def try_parsing_annotations(ann_data, graph_list): """Parse annotations for every possible graph for all valid date ranges""" for graph in graph_list: try: start_date = parse_date('2001-01-01') end_date = parse_date('2100-12-31') annotate.get(ann_data, graph, '', start_date, end_date, '') except Exception as e: print('Error parsing annotations for "{0}"\n'.format(graph)) raise e
def genGraphInfo(self, ginfo): if not self.firstGraph: self.gfile.write(',\n') else: self.firstGraph = False series = ginfo.annotationSeries # generate the annotations for this graph if series and annotate and self.all_annotations and not numericX: ginfo.annotations = annotate.get( self.all_annotations, ginfo.name, series, parse_date(ginfo.startdate, '%Y-%m-%d'), parse_date(ginfo.enddate,'%Y-%m-%d'), self.config_name) self.gfile.write('{\n') if ginfo.title != '': self.gfile.write(' "title" : "%s",\n'%(ginfo.title)) elif ginfo.graphname != '': sys.stdout.write('WARNING: \'graphname\' is deprecated. Use \'graphtitle\' instead.\n') self.gfile.write(' "title" : "%s",\n'%(ginfo.graphname)) else: sys.stdout.write('WARNING: No graph title found.\n') self.gfile.write(' "title" : "%s",\n'%(ginfo.name)) suites = (', '.join('"' + s + '"' for s in ginfo.suites if s)) self.gfile.write(' "suites" : [%s],\n'%(suites)) self.gfile.write(' "datfname" : "%s",\n'%(ginfo.datfname)) self.gfile.write(' "ylabel" : "%s",\n'%(ginfo.ylabel)) self.gfile.write(' "startdate" : "%s",\n'%(ginfo.startdate)) self.gfile.write(' "enddate" : "%s",\n'%(ginfo.enddate)) self.gfile.write(' "displayrange" : %s,\n'%(str(ginfo.displayrange).lower())) self.gfile.write(' "defaultexpand" : %s,\n'%(str(ginfo.expand).lower())) self.gfile.write(' "annotations" : [') if ginfo.annotations: self.gfile.write('\n ') self.gfile.write(',\n '.join(ginfo.annotations)) self.gfile.write('\n ') self.gfile.write(']\n') self.gfile.write('}')