Data Container

class hal_py.DataContainer

Container to hold data that is associated with an entity.

property data

A dict from ((1) category, (2) key) to ((1) type, (2) value) containing all stored data entries.

Type

dict[tuple(str,str),tuple(str,str)]

delete_data(self: hal_py.DataContainer, category: str, key: str, log_with_info_level: bool = False) → bool

Delete a data entry.

Parameters
  • category (str) – The data category.

  • key (str) – The data key.

  • log_with_info_level (bool) – Force explicit logging channel ‘netlist’ with log level ‘info’ to trace GUI events.

Returns

True on success, False otherwise.

Return type

bool

delete_parameter(self: hal_py.DataContainer, name: str) → bool

Delete an explicitly stored parameter value, if any.

Parameters

name (str) – The parameter name.

Returns

True if a value was deleted, False otherwise.

Return type

bool

get_data(self: hal_py.DataContainer, category: str, key: str) → Tuple[str, str]

Get the data entry specified by the given category and key.

Parameters
  • category (str) – The data category.

  • key (str) – The data key.

Returns

The tuple ((1) type, (2) value).

Return type

tuple(str,str)

get_data_map(self: hal_py.DataContainer) → Dict[Tuple[str, str], Tuple[str, str]]

Get a dict from ((1) category, (2) key) to ((1) type, (2) value) containing all stored data entries.

Returns

The stored data as a dict.

Return type

dict[tuple(str,str),tuple(str,str)]

get_parameter_declaration(self: hal_py.DataContainer, name: str) → Optional[hal_py.Parameter]

Get the full declaration of a typed parameter.

Parameters

name (str) – The parameter name.

Returns

The parameter declaration on success, None otherwise.

Return type

hal_py.Parameter or None

get_parameter_value(*args, **kwargs)

Overloaded function.

  1. get_parameter_value(self: hal_py.DataContainer, name: str) -> Optional[str]

    Get the value of a typed parameter. Returns the explicitly-stored value or None if the parameter does not exist.

    param str name

    The parameter name.

    returns

    The value string on success, None otherwise.

    rtype

    str or None

  2. get_parameter_value(self: hal_py.DataContainer, name: hal_py.Parameter) -> Optional[str]

    Get the value of a typed parameter. Returns the explicitly-stored value or None if the parameter does not exist.

    param hal_py.Parameter param

    The parameter.

    returns

    The value string on success, None otherwise.

    rtype

    str or None

get_parameters(self: hal_py.DataContainer) → Dict[str, Tuple[hal_py.Parameter, str]]

Get all explicitly stored parameter values as a dict from name to (declaration, value).

Returns

The parameter dict.

Return type

dict[str,tuple(hal_py.Parameter,str)]

has_data(self: hal_py.DataContainer, category: str, key: str) → bool

Determine whether an entry of given category and key exists.

Parameters
  • category (str) – The data category.

  • key (str) – The data key.

Returns

True if the entry exists, False otherwise.

Return type

bool

has_parameter(*args, **kwargs)

Overloaded function.

  1. has_parameter(self: hal_py.DataContainer, name: str) -> bool

    Check whether a parameter with the given name exists and has an explicitly stored value.

    param str name

    The parameter name.

    returns

    True if the parameter is explicitly set, False otherwise.

    rtype

    bool

  2. has_parameter(self: hal_py.DataContainer, param: hal_py.Parameter) -> bool

    Check whether a parameter exists and has an explicitly stored value.

    param hal_py.Parameter param

    The parameter.

    returns

    True if the parameter is explicitly set, False otherwise.

    rtype

    bool

property parameters

All explicitly stored parameter values as a dict from name to (declaration, value).

Type

dict[str,tuple(hal_py.Parameter,str)]

set_data(self: hal_py.DataContainer, category: str, key: str, data_type: str, value: str, log_with_info_level: bool = False) → bool

Add a data entry.<br> May overwrite an existing entry.

Parameters
  • category (str) – The data category.

  • key (str) – The data key.

  • data_type (str) – The data type.

  • value (str) – The data value.

  • log_with_info_level (bool) – Force explicit logging channel ‘netlist’ with log level ‘info’ to trace GUI events.

Returns

True on success, False otherwise.

Return type

bool

set_parameter(self: hal_py.DataContainer, param: hal_py.Parameter, value: str) → bool

Set (or overwrite) the value of a typed parameter as a string. The value is validated, normalized, and stored; any existing entry with the same name is replaced.

Parameters
  • param (hal_py.Parameter) – The parameter declaration.

  • value (str) – The value to store as a string.

Returns

True on success, False otherwise.

Return type

bool