Libosinfo.Entity

g GObject.Object GObject.Object Libosinfo.Entity Libosinfo.Entity GObject.Object->Libosinfo.Entity

Subclasses:

Libosinfo.AvatarFormat, Libosinfo.Datamap, Libosinfo.Deployment, Libosinfo.Device, Libosinfo.DeviceDriver, Libosinfo.DeviceLink, Libosinfo.Firmware, Libosinfo.Image, Libosinfo.InstallConfig, Libosinfo.InstallConfigParam, Libosinfo.InstallScript, Libosinfo.Media, Libosinfo.OsVariant, Libosinfo.Product, Libosinfo.Resources, Libosinfo.Tree

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

add_param (key, value)

clear_param (key)

get_id ()

get_param_keys ()

get_param_value (key)

get_param_value_boolean (key)

get_param_value_boolean_with_default (key, default_value)

get_param_value_enum (key, enum_type, default_value)

get_param_value_int64 (key)

get_param_value_int64_with_default (key, default_value)

get_param_value_list (key)

set_param (key, value)

set_param_boolean (key, value)

set_param_enum (key, value, enum_type)

set_param_int64 (key, value)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

id

str

r/w/c

Unique identifier

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Libosinfo.Entity(**kwargs)
Bases:

GObject.Object

Abstract:

Yes

Structure:

Libosinfo.EntityClass

add_param(key, value)
Parameters:
  • key (str) – the name of the key

  • value (str) – the data to associated with that key

Adds a new parameter against the entity. A key can have multiple values associated. Thus repeated calls with the same key will build up a list of possible values.

clear_param(key)
Parameters:

key (str) – the name of the key

Remove all values associated with a key

get_id()
Returns:

the unique key for the entity

Return type:

str

Retrieves the unique key for the entity. The format of identifiers is undefined, but the recommended practice is to use a URI.

get_param_keys()
Returns:

The list of string parameters

Return type:

[str]

Retrieve all the known parameter keys associated with the entity

get_param_value(key)
Parameters:

key (str) – the name of the key

Returns:

the value associated with the key, or None

Return type:

str

Retrieve the parameter value associated with a named key. If multiple values are stored against the key, only the first value is returned. If no value is associated, None is returned

get_param_value_boolean(key)
Parameters:

key (str) – the name of the key

Returns:

the value associated with the key as a boolean, or False

Return type:

bool

Retrieve the parameter value associated with a named key as a boolean. If multiple values are stored against the key, only the first value is returned. If no value is associated, False is returned

New in version 0.2.0.

get_param_value_boolean_with_default(key, default_value)
Parameters:
  • key (str) – the name of the key

  • default_value (bool) – the value to be returned in case there’s no value associated with the key

Returns:

the value associated with the key as a boolean, or default_value

Return type:

bool

Retrieve the parameter value associated with a named key as a boolean. If multiple values are stored against the key, only the first value is returned. If no value is associated, default_value is returned.

New in version 0.2.1.

get_param_value_enum(key, enum_type, default_value)
Parameters:
  • key (str) – the name of the key

  • enum_type (GObject.GType) – the enum type

  • default_value (int) – the default value to be used, in case there’s no value associated with the key

Returns:

the enum value associated with the key, or default_value.

Return type:

int

Retrieve the parameter value associated with a named key as an enum value. If multiple values are stored against the key, only the first value is returned. If no value is associated, the default_value is returned.

New in version 0.2.2.

get_param_value_int64(key)
Parameters:

key (str) – the name of the key

Returns:

the value associated with the key as an int64, or -1.

Return type:

int

Retrieve the parameter value associated with a named key as an int64. If multiple values are stored against the key, only the first value is returned. If no value is associated, -1 is returned.

New in version 0.2.1.

get_param_value_int64_with_default(key, default_value)
Parameters:
  • key (str) – the name of the key

  • default_value (int) – the value to be returned in case there’s no value associated with the key

Returns:

the value associated with the key as an int64, or default_value

Return type:

int

Retrieve the parameter value associated with a named key as an int64. If multiple values are stored against the key, only the first value is returned. If no value is associated, default_value is returned.

New in version 0.2.1.

get_param_value_list(key)
Parameters:

key (str) – the name of the key

Returns:

the values associated with the key

Return type:

[str]

Retrieve all the parameter values associated with a named key. If no values are associated, None is returned

set_param(key, value)
Parameters:
  • key (str) – the name of the key

  • value (str) – the data to associated with that key

Sets a new parameter against the entity. If the key already has a value associated with it, the existing value will be cleared.

set_param_boolean(key, value)
Parameters:
  • key (str) – the name of the key

  • value (bool) – the boolean value to be associated with that key

Sets a new parameter against the entity. If the key already has a value associated with it, the existing value will be cleared.

New in version 0.2.0.

set_param_enum(key, value, enum_type)
Parameters:
  • key (str) – the name of the key

  • value (int) – the enum value to be associated with that key

  • enum_type (GObject.GType) – the enum type

Sets a new parameter against the entity. If the key already has a value associated with it, the existing value will be cleared.

New in version 0.2.2.

set_param_int64(key, value)
Parameters:
  • key (str) – the name of the key

  • value (int) – the int64 value to be associated with that key

Sets a new parameter against the entity. If the key already has a value associated with it, the existing value will be cleared.

New in version 0.2.1.

Property Details

Libosinfo.Entity.props.id
Name:

id

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

The unique identifier for the entity The format of identifiers is undefined, but the recommended practice is to use a URI. This parameter must be set at time of construction as no default value is provided.