CommitteeMembersMap

class cometa.proposal_procedures.committee_members_map.CommitteeMembersMap(ptr=None)[source]

Bases: Mapping[Credential, int]

Represents a map of committee member credentials to their term epochs.

This collection type is used in governance actions to specify committee members and when their terms expire.

__init__(ptr=None)[source]
Return type:

None

__enter__()[source]
Return type:

CommitteeMembersMap

__exit__(exc_type, exc_val, exc_tb)[source]
Return type:

None

__repr__()[source]

Return repr(self).

Return type:

str

classmethod from_cbor(reader)[source]

Deserializes a CommitteeMembersMap from CBOR data.

Parameters:

reader (CborReader) – A CborReader positioned at the committee members map data.

Returns:

A new CommitteeMembersMap deserialized from the CBOR data.

Raises:

CardanoError – If deserialization fails.

Return type:

CommitteeMembersMap

to_cbor(writer)[source]

Serializes the committee members map to CBOR format.

Parameters:

writer (CborWriter) – A CborWriter to write the serialized data to.

Raises:

CardanoError – If serialization fails.

Return type:

None

insert(key, value)[source]

Inserts or updates a committee member credential with its term epoch.

Parameters:
  • key (Credential) – The credential of the committee member.

  • value (int) – The epoch when the member’s term expires.

Raises:

CardanoError – If insertion fails.

Return type:

None

get(key, default=None)[source]

Retrieves the term epoch for a given committee member credential.

Parameters:
  • key (Credential) – The credential to look up.

  • default (int | None) – Value to return if key is not found. Defaults to None.

Returns:

The epoch when the member’s term expires, or default if not found.

Return type:

int | None

get_keys()[source]

Retrieves all keys (credentials) from the map.

Returns:

A CredentialSet containing all committee member credentials.

Raises:

CardanoError – If retrieval fails.

Return type:

CredentialSet

get_key_at(index)[source]

Retrieves the credential at a specific index.

Parameters:

index (int) – The index of the credential to retrieve.

Returns:

The Credential at the specified index.

Raises:
  • CardanoError – If retrieval fails.

  • IndexError – If index is out of bounds.

Return type:

Credential

get_value_at(index)[source]

Retrieves the term epoch at a specific index.

Parameters:

index (int) – The index of the epoch to retrieve.

Returns:

The term epoch at the specified index.

Raises:
  • CardanoError – If retrieval fails.

  • IndexError – If index is out of bounds.

Return type:

int

get_key_value_at(index)[source]

Retrieves the key-value pair at a specific index.

Parameters:

index (int) – The index of the key-value pair to retrieve.

Returns:

A tuple containing the Credential and term epoch at the specified index.

Raises:
  • CardanoError – If retrieval fails.

  • IndexError – If index is out of bounds.

Return type:

tuple[Credential, int]

__len__()[source]

Returns the number of entries in the map.

Return type:

int

__iter__()[source]

Iterates over all keys (like Python dict).

Return type:

Iterator[Credential]

__getitem__(key)[source]

Gets a value by key using bracket notation.

Parameters:

key (Credential)

Return type:

int

__setitem__(key, value)[source]

Sets a value by key using bracket notation.

Parameters:
Return type:

None

__bool__()[source]

Returns True if the map is not empty.

Return type:

bool

__contains__(item)[source]

Checks if a credential is in the map.

Parameters:

item (Credential)

Return type:

bool

keys()[source]

Returns an iterator over keys (like Python dict).

Return type:

Iterator[Credential]

values()[source]

Returns an iterator over values (like Python dict).

Return type:

Iterator[int]

items()[source]

Returns an iterator over (key, value) pairs (like Python dict).

Return type:

Iterator[Tuple[Credential, int]]

to_cip116_json(writer)[source]

Serializes this object to CIP-116 compliant JSON.

Parameters:

writer (JsonWriter) – The JsonWriter to write the JSON to.

Raises:

CardanoError – If serialization fails.

Return type:

None