forked from lucaswerkmeister/tool-lexeme-forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwikibase_types.py
71 lines (47 loc) · 1.75 KB
/
wikibase_types.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from typing import Literal, TypedDict
class CoreTerm(TypedDict):
language: str
value: str
class Term(CoreTerm, total=False):
remove: Literal[''] # only needed when editing
WikibaseEntityIdDataValueValue = TypedDict('WikibaseEntityIdDataValueValue', {
'entity-type': Literal['item'],
'id': str,
})
class WikibaseEntityIdDataValue(TypedDict):
type: Literal['wikibase-entityid']
value: WikibaseEntityIdDataValueValue
class Snak(TypedDict):
snaktype: Literal['value'] # other snak types not used in this tool
property: str
datatype: Literal['wikibase-item'] # other data types not used in this tool
datavalue: WikibaseEntityIdDataValue
class Statement(TypedDict):
mainsnak: Snak
# qualifiers and references not used in this tool
type: Literal['statement']
rank: Literal['normal'] # other ranks not used in this tool
StatementGroup = list[Statement]
Statements = dict[str, StatementGroup]
LexemeFormRepresentations = dict[str, Term]
LexemeLemmas = dict[str, Term]
class CoreLexemeForm(TypedDict):
representations: LexemeFormRepresentations
grammaticalFeatures: list[str]
claims: Statements
class LexemeForm(CoreLexemeForm, total=False):
add: Literal[''] # only needed when creating
remove: Literal[''] # only needed when editing
id: Literal[''] # only present when editing
class CoreLexeme(TypedDict):
type: Literal['lexeme']
lemmas: LexemeLemmas
language: str
lexicalCategory: str
claims: Statements
forms: list[LexemeForm]
# senses not used in this tool
class Lexeme(CoreLexeme, total=False):
id: str # only needed when editing
base_revision_id: str # only needed when editing
lastrevid: int # only available when data returned by API