def parse_row(r: ResultSet) -> Tuple[str, List[str]]: """Break up a villager's table row into the individual parts Arguments: r {ResultSet} -- The row to be parsed Returns: Tuple[str, List[str]] -- A villager's name and their attributes """ bad_vals = re.compile(r'\W') cols = [re.sub(bad_vals, '', val.text) for val in r.find_all('td')] return (cols[0], cols[2:])
def helper_rename_tags(element: ResultSet, tags_to_rename: Optional[List[TagRenameInfo]] = None, debug=False): for tag_to_rename in tags_to_rename: for tag in element.find_all(tag_to_rename[0]): tag.name = tag_to_rename[1]