Coverage for src/wiktextract/extractor/en/type_utils.py: 100%

137 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-25 10:11 +0000

1from typing import ( 

2 Sequence, 

3 TypedDict, 

4 Union, 

5) 

6 

7from wikitextprocessor.core import TemplateArgs 

8 

9 

10class AltOf(TypedDict, total=False): 

11 word: str 

12 extra: str 

13 

14 

15class LinkageData(TypedDict, total=False): 

16 alt: str 

17 english: str 

18 extra: str 

19 qualifier: str 

20 roman: str 

21 ruby: Union[list[Sequence[str]], list[tuple[str, str]]] 

22 sense: str 

23 source: str 

24 tags: list[str] 

25 taxonomic: str 

26 topics: list[str] 

27 urls: list[str] 

28 word: str 

29 

30 

31class ExampleData(TypedDict, total=False): 

32 english: str 

33 note: str 

34 ref: str 

35 roman: str 

36 ruby: Union[list[tuple[str, str]], list[Sequence[str]]] 

37 text: str 

38 type: str 

39 literal_meaning: str 

40 tags: list[str] 

41 raw_tags: list[str] 

42 

43 

44class FormOf(TypedDict, total=False): 

45 word: str 

46 extra: str 

47 roman: str 

48 

49 

50LinkData = list[Sequence[str]] 

51 

52 

53class PlusObjTemplateData(TypedDict, total=False): 

54 tags: list[str] 

55 words: list[str] 

56 meaning: str 

57 

58 

59ExtraTemplateData = Union[PlusObjTemplateData] 

60 

61 

62class TemplateData(TypedDict, total=False): 

63 args: TemplateArgs 

64 expansion: str 

65 name: str 

66 extra_data: ExtraTemplateData 

67 

68 

69class DescendantData(TypedDict, total=False): 

70 depth: int 

71 tags: list[str] 

72 templates: list[TemplateData] 

73 text: str 

74 

75 

76class FormData(TypedDict, total=False): 

77 form: str 

78 head_nr: int 

79 ipa: str 

80 roman: str 

81 ruby: Union[list[tuple[str, str]], list[Sequence[str]]] 

82 source: str 

83 tags: list[str] 

84 raw_tags: list[str] 

85 topics: list[str] 

86 

87 

88SoundData = TypedDict( 

89 "SoundData", 

90 { 

91 "audio": str, 

92 "audio-ipa": str, 

93 "enpr": str, 

94 "form": str, 

95 "hangeul": str, 

96 "homophone": str, 

97 "ipa": str, 

98 "mp3_url": str, 

99 "note": str, 

100 "ogg_url": str, 

101 "other": str, 

102 "rhymes": str, 

103 "tags": list[str], 

104 "text": str, 

105 "topics": list[str], 

106 "zh-pron": str, 

107 }, 

108 total=False, 

109) 

110 

111 

112class TranslationData(TypedDict, total=False): 

113 alt: str 

114 code: str 

115 english: str 

116 lang: str 

117 note: str 

118 roman: str 

119 sense: str 

120 tags: list[str] 

121 taxonomic: str 

122 topics: list[str] 

123 word: str 

124 

125 

126class SenseData(TypedDict, total=False): 

127 alt_of: list[AltOf] 

128 antonyms: list[LinkageData] 

129 categories: list[str] 

130 compound_of: list[AltOf] 

131 coordinate_terms: list[LinkageData] 

132 examples: list[ExampleData] 

133 form_of: list[FormOf] 

134 glosses: list[str] 

135 head_nr: int 

136 holonyms: list[LinkageData] 

137 hypernyms: list[LinkageData] 

138 hyponyms: list[LinkageData] 

139 instances: list[LinkageData] 

140 links: list[LinkData] 

141 meronyms: list[LinkageData] 

142 qualifier: str 

143 raw_glosses: list[str] 

144 related: list[LinkageData] 

145 senseid: list[str] 

146 synonyms: list[LinkageData] 

147 tags: list[str] 

148 taxonomic: str 

149 topics: list[str] 

150 wikidata: list[str] 

151 wikipedia: list[str] 

152 

153 

154class WordData(TypedDict, total=False): 

155 abbreviations: list[LinkageData] 

156 alt_of: list[AltOf] 

157 antonyms: list[LinkageData] 

158 categories: list[str] 

159 coordinate_terms: list[LinkageData] 

160 derived: list[LinkageData] 

161 descendants: list[DescendantData] 

162 etymology_number: int 

163 etymology_templates: list[TemplateData] 

164 etymology_text: str 

165 form_of: list[FormOf] 

166 forms: list[FormData] 

167 head_templates: list[TemplateData] 

168 holonyms: list[LinkageData] 

169 hyphenation: list[str] 

170 hypernyms: list[LinkageData] 

171 hyponyms: list[LinkageData] 

172 inflection_templates: list[TemplateData] 

173 info_templates: list[TemplateData] 

174 instances: list[LinkageData] 

175 lang: str 

176 lang_code: str 

177 literal_meaning: str 

178 meronyms: list[LinkageData] 

179 original_title: str 

180 pos: str 

181 proverbs: list[LinkageData] 

182 redirects: list[str] 

183 related: list[LinkageData] 

184 senses: list[SenseData] 

185 sounds: list[SoundData] 

186 synonyms: list[LinkageData] 

187 translations: list[TranslationData] 

188 troponyms: list[LinkageData] 

189 wikidata: list[str] 

190 wikipedia: list[str] 

191 word: str