Model

The setup editors describe ZOS-API members once and reuse that description for reading and writing.

Attribute is one member copied into a result field. Rows is a 1-based row list. Section and Listing are System Explorer groups.

Shared descriptions of ZOS-API members and row lists.

class Attribute(name: str, source: str | tuple[str, ...], convert: Callable[[object], object], call: bool = False, writable: bool = True, enumeration: str | None = None)

One ZOS-API member copied into a result field.

Parameters:
  • name (str) – Key in the result.

  • source (str | tuple[str, ...]) – Property name, or a path of property names. The last member is called when call is true.

  • convert (collections.abc.Callable[[object], object]) – Converts the raw value.

  • call (bool) – When true, call the last member before converting it.

  • writable (bool) – When true, a write tool may change this member.

  • enumeration (str | None) – ZOS-API enumeration type in ZOSAPI.SystemData. None when the member is not an enumeration.

assign(data, value: object) → None

Assign a tool value to this member.

Parameters:
  • data – Object that exposes source.

  • value (object) – Value supplied for this member.

Raises:

ValueError – value does not match this member.

call: bool = False

When true, call the last member before converting it.

convert: Callable[[object], object]

Converts the raw value.

enumeration: str | None = None

ZOS-API enumeration type in ZOSAPI.SystemData. None when the member is not an enumeration.

name: str

Key in the result.

read(data) → object

Read this member from a ZOS-API object.

Parameters:

data – Object that exposes source.

Returns:

The converted value.

Return type:

object

classmethod record(data, attributes: tuple[Attribute, ...]) → dict[str, object]

Copy attributes of one object into a dictionary.

Parameters:
  • data – Object that exposes each attribute.

  • attributes (tuple[Attribute, ...]) – Attributes to copy.

Returns:

Values keyed by attribute name.

Return type:

dict[str, object]

source: str | tuple[str, ...]

Property name, or a path of property names.

value_for_write(value: object) → object

Convert a tool value into the value stored by ZOS-API.

Parameters:

value (object) – Value supplied for this member.

Returns:

The value to assign.

Return type:

object

Raises:

ValueError – value does not match this member.

writable: bool = True

When true, a write tool may change this member.

class Listing(source: str, rows: Rows)

One SystemData child copied into a list of dictionaries.

Parameters:
  • source (str) – Property name on SystemData.

  • rows (Rows) – The 1-based collection on that child.

read(system_data) → list[dict[str, object]]

Read this listing from system data.

Parameters:

system_data – The ZOS-API SystemData object.

Returns:

One dictionary per row.

Return type:

list[dict[str, object]]

rows: Rows

The 1-based collection on that child.

source: str

Property name on SystemData.

write(system_data, values: dict[str, object]) → None

Reject a write to a list of rows.

Parameters:
  • system_data – The ZOS-API SystemData object.

  • values (dict[str, object]) – Keys to change.

Raises:

ValueError – This group is a list of rows.

class Rows(count: str, item: str, attributes: tuple[Attribute, ...], add: str | None = None, add_arguments: tuple[str, ...] = (), remove: str | None = None, primary: str | None = None)

A 1-based ZOS-API list copied into a list of dictionaries.

Parameters:
  • count (str) – Property that holds the number of rows.

  • item (str) – Method that returns one row. The argument is a 1-based index.

  • attributes (tuple[Attribute, ...]) – Attributes copied from each row.

  • add (str | None) – Method that appends a row. None when rows cannot be added.

  • add_arguments (tuple[str, ...]) – Attribute names passed to add, in order.

  • remove (str | None) – Method that removes a 1-based row. None when rows cannot be removed.

  • primary (str | None) – Method on one row that makes it primary. None when the list has no primary row.

add: str | None = None

Method that appends a row. None when rows cannot be added.

add_arguments: tuple[str, ...] = ()

Attribute names passed to add, in order.

attributes: tuple[Attribute, ...]

Attributes copied from each row.

count: str

Property that holds the number of rows.

edit(data, action: str, number: int | None, values: dict[str, object] | None) → None

Change, add, or remove one row.

add appends a row. make_primary calls primary on the selected row.

Parameters:
  • data – Object that exposes count and item.

  • action (str) – change, add, remove, or make_primary.

  • number (int | None) – 1-based row. Required except for add.

  • values (dict[str, object] | None) – Keys to write. Names match read().

Raises:

ValueError – The action, number, or values cannot be applied.

item: str

Method that returns one row. The argument is a 1-based index.

primary: str | None = None

Method on one row that makes it primary. None when the list has no primary row.

read(data) → list[dict[str, object]]

Read every row.

Parameters:

data – Object that exposes count and item.

Returns:

One dictionary per row.

Return type:

list[dict[str, object]]

remove: str | None = None

Method that removes a 1-based row. None when rows cannot be removed.

class Section(source: str, attributes: tuple[Attribute, ...] = (), rows: tuple[tuple[str, Rows], ...] = ())

One SystemData child copied into a dictionary.

Parameters:
  • source (str) – Property name on SystemData.

  • attributes (tuple[Attribute, ...]) – Members read from that child.

  • rows (tuple[tuple[str, Rows], ...]) – Named collections read from that child.

attributes: tuple[Attribute, ...] = ()

Members read from that child.

read(system_data) → dict[str, object]

Read this section from system data.

Parameters:

system_data – The ZOS-API SystemData object.

Returns:

Members and named collections.

Return type:

dict[str, object]

rows: tuple[tuple[str, Rows], ...] = ()

Named collections read from that child. Each entry is a result key and the rows to read.

source: str

Property name on SystemData.

write(system_data, values: dict[str, object]) → None

Change selected members of this section.

Parameters:
  • system_data – The ZOS-API SystemData object.

  • values (dict[str, object]) – Keys to change. Names match read().

Raises:

ValueError – A key is unknown, read-only, or names a list of rows.

text(value: object) → str

Return a ZOS-API string, using an empty string when the value is missing.

Parameters:

value (object) – Value returned by ZOS-API. None is missing.

Returns:

The text, or an empty string when value is None.

Return type:

str