Coverage for src/wiktextract/extractor/pl/etymology.py: 75%
20 statements
« prev ^ index » next coverage.py v7.6.10, created at 2024-12-27 08:07 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2024-12-27 08:07 +0000
1from wikitextprocessor.parser import NodeKind, WikiNode
3from ...page import clean_node
4from ...wxr_context import WiktextractContext
5from .models import WordEntry
8def extract_etymology_section(
9 wxr: WiktextractContext,
10 page_data: list[WordEntry],
11 base_data: WordEntry,
12 level_node: WikiNode,
13) -> None:
14 etymology_texts = []
15 has_list = False
16 for list_item_node in level_node.find_child_recursively(NodeKind.LIST_ITEM):
17 text = clean_node(wxr, None, list_item_node.children)
18 if len(text) > 0: 18 ↛ 16line 18 didn't jump to line 16 because the condition on line 18 was always true
19 etymology_texts.append(text)
20 has_list = True
21 if not has_list: 21 ↛ 22line 21 didn't jump to line 22 because the condition on line 21 was never true
22 text = clean_node(wxr, None, level_node.children)
23 if len(text) > 0:
24 etymology_texts.append(text)
26 for data in page_data:
27 if data.lang_code == base_data.lang_code: 27 ↛ 26line 27 didn't jump to line 26 because the condition on line 27 was always true
28 data.etymology_texts = etymology_texts
29 base_data.etymology_texts = etymology_texts