Coverage for src/wiktextract/extractor/tr/etymology.py: 71%
14 statements
« prev ^ index » next coverage.py v7.10.7, created at 2025-10-13 10:14 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2025-10-13 10:14 +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,
19 base_data,
20 list(
21 level_node.invert_find_child(
22 LEVEL_KIND_FLAGS, include_empty_str=True
23 )
24 ),
25 )
26 if e_str != "":
27 base_data.etymology_texts.append(e_str)