2 from bs4
import BeautifulSoup
5 url = os.path.abspath(sys.argv[1])
6 report_dir = os.path.dirname(url)
11 tables = soup.find_all(
'table', recursive=
True)
13 rowheader = tables[2].
find(
'thead')
14 rowheaders = rowheader.find_all(
'tr')
15 htag = soup.new_tag(
'td')
16 htag.string =
'Num reports'
18 rowheaders[-1].
insert(7, htag)
19 sortable = rowheaders[-1].find_all(
'span')
20 sortable[0].string.replace_with(
' ▾')
22 rowsbody = tables[2].
find(
'tbody')
23 rows = rowsbody.find_all(
'tr')
25 cells = row.find_all(
'td')
27 if key
in seen.keys():
28 seen[key] = seen[key]+1
29 href = cells[6].
find(
'a', href=
True)
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)
40 rowsbody = tables[2].
find(
'tbody')
41 rows = rowsbody.find_all(
'tr')
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])
49 print(soup.prettify(formatter=
None))
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)