def get_abstract(parsed_document: etree, alt_text: str = 'n/a') -> str: try: abstract = parsed_document.find('front/article-meta/abstract/p').text if abstract is None: abstract = '' for section in parsed_document.findall( 'front/article-meta/abstract/sec/p'): # for sectioned abstracts abstract += str(section.text) if abstract == '': abstract = alt_text except AttributeError: abstract = alt_text return abstract
def __init__(self, root: etree) -> None: self.mode = get_xml_attrib(root, "mode") self.stages = [Stage(x) for x in root.findall("stage")] self.session = int(root.find("session").text)
def __init__(self, root: etree) -> None: self.card = get_xml_attrib(root, "card") self.no = int(get_xml_attrib(root, "no")) self.playerinfo = Playerinfo(root.find("playerinfo")) self.playdata = [Playdata(x) for x in root.findall("playdata")]
def __init__(self, root: etree) -> None: self.musicids = [int(x.text) for x in root.findall("musicid")]
def __init__(self, root: etree) -> None: self.syogo = [int(x.text) for x in root.findall("syogo")]