Coverage for src / wiktextract / extractor / ru / etymology.py: 81%
20 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-12 08:09 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-12 08:09 +0000
1from wikitextprocessor import LevelNode, NodeKind, TemplateNode, WikiNode
3from ...page import clean_node
4from ...wxr_context import WiktextractContext
5from .models import WordEntry
8def extract_etymology(
9 wxr: WiktextractContext, word_entry: WordEntry, level_node: LevelNode
10):
11 e_nodes = []
12 for node in level_node.children:
13 if isinstance(node, LevelNode): 13 ↛ 14line 13 didn't jump to line 14 because the condition on line 13 was never true
14 break
15 elif isinstance(node, WikiNode) and node.kind == NodeKind.LIST:
16 for list_item in node.find_child(NodeKind.LIST_ITEM):
17 e_text = clean_node(wxr, word_entry, list_item.children)
18 if e_text != "": 18 ↛ 16line 18 didn't jump to line 16 because the condition on line 18 was always true
19 word_entry.etymology_texts.append(e_text)
20 elif not ( 20 ↛ 12line 20 didn't jump to line 12 because the condition on line 20 was always true
21 isinstance(node, TemplateNode) and node.template_name == "improve"
22 ):
23 e_nodes.append(node)
24 if len(e_nodes) > 0: 24 ↛ exitline 24 didn't return from function 'extract_etymology' because the condition on line 24 was always true
25 e_str = clean_node(wxr, word_entry, e_nodes)
26 if e_str != "": 26 ↛ 27line 26 didn't jump to line 27 because the condition on line 26 was never true
27 word_entry.etymology_texts.append(e_str)