wikibaseintegrator.models.language_values
- class wikibaseintegrator.models.language_values.LanguageValue(language, value=None)[source]
Bases:
BaseModel
- Parameters:
language (str) –
value (str | None) –
- property language: str
- property removed: bool
- property value: str | None
The value of the LanguageValue instance. :return: A string with the value of the LanguageValue instance.
- class wikibaseintegrator.models.language_values.LanguageValues[source]
Bases:
BaseModel
- add(language_value)[source]
Add a LanguageValue object to the list
- Parameters:
language_value (
LanguageValue
) – A LanguageValue object- Return type:
- Returns:
The current LanguageValues object
- from_json(json_data)[source]
Create a new LanguageValues object from a JSON/dict object.
- Parameters:
json_data (
dict
[str
,dict
]) – A dict object who use the same format as Wikibase.- Return type:
- Returns:
The newly created or updated object.
- get(language=None)[source]
Get a LanguageValue object with the specified language. Use the default language in wbi_config if none specified.
- Parameters:
language (
str
|None
) – The requested language.- Return type:
LanguageValue
|None
- Returns:
The related LanguageValue object or None if none found.
- get_json()[source]
Get a formatted dict who respect the Wikibase format.
- Return type:
dict
[str
,dict
]- Returns:
A dict using Wikibase format.
- set(language=None, value=None, action_if_exists=ActionIfExists.REPLACE_ALL)[source]
Create or update the specified language with the valued passed in arguments.
- Parameters:
language (
str
|None
) – The desired language.value (
str
|None
) – The desired value of the LanguageValue object. Use None to delete an existing LanguageValue object from the list.action_if_exists (
ActionIfExists
) – The action if the LanguageValue object is already defined. Can be ActionIfExists.REPLACE_ALL (default) or ActionIfExists.KEEP.
- Return type:
LanguageValue
|None
- Returns:
The created or updated LanguageValue. None if there’s no LanguageValue object with this language.
- property values: dict[str, wikibaseintegrator.models.language_values.LanguageValue]
A dict of LanguageValue with the language as key.