CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
postprocess-scan-build.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 from bs4 import BeautifulSoup
3 import sys
4 import os
5 url = os.path.abspath(sys.argv[1])
6 report_dir = os.path.dirname(url)
7 page = open(url)
8 soup = BeautifulSoup(page.read(), 'html.parser')
9 page.close()
10 seen = dict()
11 tables = soup.find_all('table', recursive=True)
12 
13 rowheader = tables[2].find('thead')
14 rowheaders = rowheader.find_all('tr')
15 htag = soup.new_tag('td')
16 htag.string = 'Num reports'
17 htag['class'] = 'Q'
18 rowheaders[-1].insert(7, htag)
19 sortable = rowheaders[-1].find_all('span')
20 sortable[0].string.replace_with(' ▾')
21 
22 rowsbody = tables[2].find('tbody')
23 rows = rowsbody.find_all('tr')
24 for row in rows:
25  cells = row.find_all('td')
26  key = str(cells[2])+str(cells[3])+str(cells[4])
27  if key in seen.keys():
28  seen[key] = seen[key]+1
29  href = cells[6].find('a', href=True)
30  if href:
31  report = href['href'].split("#")[0]
32  report_file = os.path.join(report_dir, report)
33  if report.startswith("report-") and os.path.exists(report_file):
34  os.remove(report_file)
35  row.decompose()
36  else:
37  seen[key] = 1
38 
39 
40 rowsbody = tables[2].find('tbody')
41 rows = rowsbody.find_all('tr')
42 for row in rows:
43  cells = row.find_all('td')
44  key = str(cells[2])+str(cells[3])+str(cells[4])
45  tag = soup.new_tag('td')
46  tag.string = '{}'.format(seen[key])
47  tag['class'] = 'Q'
48  row.insert(3, tag)
49 print(soup.prettify(formatter=None))
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
#define str(s)