wikibaseintegrator.models.descriptions

class wikibaseintegrator.models.descriptions.Descriptions[source]

Bases: LanguageValues

__init__()
Return type:

None

add(language_value)

Add a LanguageValue object to the list

Parameters:

language_value (LanguageValue) – A LanguageValue object

Return type:

LanguageValues

Returns:

The current LanguageValues object

from_json(json_data)[source]

Create a new Descriptions object from a JSON/dict object.

Parameters:

json_data (dict[str, dict]) – A dict object who use the same format as Wikibase.

Return type:

Descriptions

Returns:

The newly created or updated object.

get(language=None)

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()

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)

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.