Component

class appstream_python.Component.InternetRelationDict

the type for the content of the Internet attribute

value: Literal['alwaysoffline-onlyfirst-run']
bandwidth_mbitps: Optional[int]
class appstream_python.Component.Image

Represents a <image> tag

url: str

The image URL

type: Literal['source', 'thumbnail']

The image type

width: Optional[int]

The width

height: Optional[int]

The height

language: Optional[str]

The language

load_tag(tag: Element) None

Loads a image tag

Parameters

tag (Element) –

Return type

None

class appstream_python.Component.Screenshot

Represents a <screenshot> tag

images: list[appstream_python.Component.Image]

the list with thumbnail images

caption: TranslateableTag

The caption

get_source_image() Optional[Image]

Returns the soucre image

Return type

Optional[Image]

get_thumbnail_images() list[appstream_python.Component.Image]

Returns the thumbnail images

Return type

list[appstream_python.Component.Image]

load_tag(tag: Element) None

Load a screenshot tag

Parameters

tag (Element) –

Return type

None

class appstream_python.Component.DisplayLength(px: int = 0, compare: str = 'ge')

Represents a <display_length> tag

Parameters
  • px (int) –

  • compare (str) –

px: int

The logical pixels

compare: str

Compare

compare_px(value: int) bool

Compares the length with the given logical pixels

Parameters

value (int) – The logical pixels to compare

Returns

If it is valid

Return type

bool

get_tag() Element

Returns the XML Tag

Returns

The Tag

Return type

Element

classmethod from_tag(tag: Element) DisplayLength

Creates the Object from an XML Tag

Parameters

tag (Element) –

Return type

DisplayLength

static string_to_px(string: str) int

Converts a Lenght String (e.g.small) to logical pixels value

Parameters

string (str) – The String

Raises

ValueError – The Length String is invalid

Returns

The logical pixels pixels

Return type

int

class appstream_python.Component.AppstreamComponent

Represents AppStream Component

id: str

The component ID

type: str

The type

name: TranslateableTag

The component name

developer_name: TranslateableTag

The developer name

summary: TranslateableTag

The component summary

description: Description

The description

metadata_license: str

The metadata license

project_license: str

The project license

urls: dict[Literal['homepage', 'bugtracker', 'faq', 'help', 'donation', 'translate', 'contact', 'vcs-browser', 'contribute'], str]

The URLs

launchables: dict[['desktop-id', 'service', 'cockpit-manifest', 'url'], str]

The launchables

oars: dict[Literal['violence-cartoon', 'violence-fantasy', 'violence-realistic', 'violence-bloodshed', 'violence-sexual', 'violence-desecration', 'violence-slavery', 'drugs-alcohol', 'drugs-narcotics', 'drugs_tobacco', 'sex_nudity', 'sex-themes', 'language-profanity', 'language-humor', 'language-discrimination', 'money-advertising', 'money-gambling', 'money-purchasing', 'social-chat', 'social-audio', 'social-contacts', 'social-info', 'social-location'], Literal['none', 'mild', 'moderate', 'intense']]

The content rating

categories: list[str]

The categories

provides: dict[Literal['mediatype', 'library', 'binary', 'font', 'modalias', 'firmware', 'python2', 'python3', 'dbus', 'id'], list[str]]

The provides. The content of the depracted mimetype tag goes intp provides[‘mimetype’]

releases: ReleaseList

The releases

screenshots: list[appstream_python.Component.Screenshot]

The screenshots

project_group: Optional[str]

The project group

translation: list[dict[str, str]]

The translations

languages: dict[str, int]

The languages

keywords: TranslateableList

The Keywords

controls: dict[Literal['pointing', 'keyboard', 'console', 'tablet', 'touch', 'gamepad', 'tv-remote', 'voice', 'vision'], Optional[Literal['requires', 'recommends', 'supports']]]

The Controls

display_length: dict[Literal['requires', 'recommends', 'supports'], list[appstream_python.Component.DisplayLength]]

The Display Length

kudos: list[str]

The Kudos

update_contact: Optional[str]

The update contact

replaces: list[str]

The replaces tag

suggests: list[str]

The suggests tag

custom: dict[str, str]

The custom tag

extends: list[str]

The extends tag for addons

clear() None

Resets the Component

Return type

None

get_available_languages() list[str]

Returns a list with all available languages of the Component

Return type

list[str]

parse_component_tag(tag: _ElementTree) None

Parses a XML tag

Parameters

tag (_ElementTree) –

Return type

None

classmethod from_component_tag(root: _Element) AppstreamComponent

Load an appdata.xml or metainfo.xml file

Parameters

root (_Element) –

Return type

AppstreamComponent

load_file(path: Union[str, PathLike, RawIOBase]) None

Load an appdata.xml or metainfo.xml file

Parameters

path (Union[str, PathLike, RawIOBase]) –

Return type

None

classmethod from_file(path: Union[str, PathLike, RawIOBase]) AppstreamComponent

Load an appdata.xml or metainfo.xml file

Parameters

path (Union[str, PathLike, RawIOBase]) –

Return type

AppstreamComponent

load_bytes(data: bytes, encoding: Optional[str] = None) None

Load an appdata.xml or metainfo.xml byte string

Parameters
  • data (bytes) –

  • encoding (Optional[str]) –

Return type

None

classmethod from_bytes(data: bytes, encoding: Optional[str] = None) AppstreamComponent

Load an appdata.xml or metainfo.xml byte string

Parameters
  • data (bytes) –

  • encoding (Optional[str]) –

Return type

AppstreamComponent

load_string(text: str) None

Load an appdata.xml or metainfo.xml string

Parameters

text (str) –

Return type

None

classmethod from_string(text: str) AppstreamComponent

Load an appdata.xml or metainfo.xml string

Parameters

text (str) –

Return type

AppstreamComponent

get_component_tag() Element

Creates a XML tag from the Component

Return type

Element

get_xml_string() str

Returns the XML data of the Component as string

Return type

str

save_file(path: str) None

Saves the Component as XML file

Parameters

path (str) –

Return type

None