Component

class appstream_python.Component.InternetRelationDict

the type for the content of the Internet attribute

value: Literal['always', 'offline-only', 'first-run']
bandwidth_mbitps: int | None
class appstream_python.Component.Image

Represents a <image> tag

url: str

The image URL

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

The image type

width: int | None

The width

height: int | None

The height

language: str | None

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[Image]

the list with thumbnail images

caption: TranslateableTag

The caption

get_source_image() Image | None

Returns the soucre image

Return type:

Image | None

get_thumbnail_images() list[Image]

Returns the thumbnail images

Return type:

list[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: Literal['eq', 'ne', 'lt', 'gt', 'le', 'ge']

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

Creates the Object from an XML Tag

Parameters:

tag (_Element)

Return type:

Self

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.Developer(id: str | None = None, name: TranslateableTag = <factory>)

Represents a <developer> tag

Parameters:
id: str | None = None
name: TranslateableTag
load_tag(tag: _Element) None

Loads the data from a XML tag

Parameters:

tag (_Element)

Return type:

None

get_tag() _Element

Returns the XML Tag

Returns:

The Tag

Return type:

_Element

clear() None

Resets all data

Return type:

None

is_empty() bool

Checks if the developer tag is empty

Return type:

bool

class appstream_python.Component.AppstreamComponent

Represents AppStream Component

id: str

The component ID

type: str

The type

name: TranslateableTag

The component name

developer: Developer

The developer

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[Literal['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[Screenshot]

The screenshots

project_group: str | None

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'], Literal['requires', 'recommends', 'supports'] | None]

The Controls

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

The Display Length

internet: dict[Literal['requires', 'recommends', 'supports'], InternetRelationDict]
kudos: list[str]

The Kudos

update_contact: str | None

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: _Element) None

Parses a XML tag

Parameters:

tag (_Element)

Return type:

None

classmethod from_component_tag(root: _Element) Self

Load an appdata.xml or metainfo.xml file

Parameters:

root (_Element)

Return type:

Self

load_file(path: str | PathLike | IO[Any]) None

Load an appdata.xml or metainfo.xml file

Parameters:

path (str | PathLike | IO[Any])

Return type:

None

classmethod from_file(path: str | PathLike | IO[Any]) Self

Load an appdata.xml or metainfo.xml file

Parameters:

path (str | PathLike | IO[Any])

Return type:

Self

load_bytes(data: bytes, encoding: str | None = None) None

Load an appdata.xml or metainfo.xml byte string

Parameters:
  • data (bytes)

  • encoding (str | None)

Return type:

None

classmethod from_bytes(data: bytes, encoding: str | None = None) Self

Load an appdata.xml or metainfo.xml byte string

Parameters:
  • data (bytes)

  • encoding (str | None)

Return type:

Self

load_string(text: str) None

Load an appdata.xml or metainfo.xml string

Parameters:

text (str)

Return type:

None

classmethod from_string(text: str) Self

Load an appdata.xml or metainfo.xml string

Parameters:

text (str)

Return type:

Self

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