Coverage for src/wiktextract/extractor/tr/etymology.py: 71%
14 statements
« prev ^ index » next coverage.py v7.10.3, created at 2025-08-15 05:18 +0000
« prev ^ index » next coverage.py v7.10.3, created at 2025-08-15 05:18 +0000
1from wikitextprocessor.parser import LEVEL_KIND_FLAGS, LevelNode, NodeKind
3from ...page import clean_node
4from ...wxr_context import WiktextractContext
5from .models import WordEntry
8def extract_etymology_section(
9 wxr: WiktextractContext, base_data: WordEntry, level_node: LevelNode
10) -> None:
11 for list_node in level_node.find_child(NodeKind.LIST):
12 for list_item in list_node.find_child(NodeKind.LIST_ITEM):
13 e_str = clean_node(wxr, base_data, list_item.children)
14 if e_str != "": 14 ↛ 12line 14 didn't jump to line 12 because the condition on line 14 was always true
15 base_data.etymology_texts.append(e_str)
16 if len(base_data.etymology_texts) == 0: 16 ↛ 17line 16 didn't jump to line 17 because the condition on line 16 was never true
17 e_str = clean_node(
18 wxr, base_data, list(level_node.invert_find_child(LEVEL_KIND_FLAGS))
19 )
20 if e_str != "":
21 base_data.etymology_texts.append(e_str)