2 from bs4
import BeautifulSoup
5 url = os.path.abspath(sys.argv[1])
6 report_dir = os.path.dirname(url)
8 soup = BeautifulSoup(page.read(),
'html.parser')
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')
28 if key
in seen.keys():
29 seen[key] = seen[key]+1
30 href = cells[6].
find(
'a', href=
True)
32 report = href[
'href'].
split(
"#")[0]
33 report_file = os.path.join(report_dir, report)
34 if report.startswith(
"report-")
and os.path.exists(report_file):
35 os.remove(report_file)
41 rowsbody = tables[2].
find(
'tbody')
42 rows = rowsbody.find_all(
'tr')
44 cells = row.find_all(
'td')
46 key =
str(cells[2])+
str(cells[3])+
str(cells[4])
47 tag = soup.new_tag(
'td')
48 tag.string =
'{}'.
format(seen[key])
51 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)
def split(sequence, size)