Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tds = row.find_all('td')
table_content.append([clear_text(td.text) for td in tds])
# convert left, top, and table headers to sets for easier tagging
if left_header:
left_header = [{cell} for cell in left_header]
else:
left_header = [set() for _ in table_content]
if top_header:
top_header = [{cell} for cell in top_header]
else:
top_header = [set() for _ in table_content[0]]
table_tag = {table_name} if table_name else set()
if table_name in [PRASENS, PRATERITUM]:
person_tags = [{PERSON_1}, {PERSON_2}, {PERSON_3}]
else:
person_tags = [set(), set(), set()]
# create a list of tagged strings
tagged_strings = []
for row, row_tag, person_tag \
in zip(table_content, left_header, cycle(person_tags)):
for cell, col_tag in zip(row, top_header):
taglist = table_tag \
.union(row_tag) \
.union(col_tag) \
.union(person_tag)
tagged_strings.append((taglist, cell))
return tagged_strings