CredentialSet

class cometa.proposal_procedures.credential_set.CredentialSet(ptr=None)[source]

Bases: Set[Credential]

Represents a set of credentials.

This collection type is used in governance actions to specify sets of committee member credentials that should be added or removed.

__init__(ptr=None)[source]

Initializes a new CredentialSet.

Parameters:

ptr – Optional internal pointer to an existing credential set. If None, creates a new empty set.

Raises:

CardanoError – If initialization fails or ptr is invalid.

Return type:

None

__enter__()[source]

Enters the context manager.

Return type:

CredentialSet

__exit__(exc_type, exc_val, exc_tb)[source]

Exits the context manager.

Return type:

None

__repr__()[source]

Returns a string representation of the credential set.

Return type:

str

classmethod from_cbor(reader)[source]

Deserializes a CredentialSet from CBOR data.

Parameters:

reader (CborReader) – A CborReader positioned at the credential set data.

Returns:

A new CredentialSet deserialized from the CBOR data.

Raises:

CardanoError – If deserialization fails.

Return type:

CredentialSet

classmethod from_list(credentials)[source]

Creates a CredentialSet from an iterable of Credential objects.

Parameters:

credentials (Iterable[Credential]) – An iterable of Credential objects.

Returns:

A new CredentialSet containing all the credentials.

Raises:

CardanoError – If creation fails.

Return type:

CredentialSet

to_cbor(writer)[source]

Serializes the credential set to CBOR format.

Parameters:

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

Raises:

CardanoError – If serialization fails.

Return type:

None

add(credential)[source]

Adds a credential to the set.

Parameters:

credential (Credential) – The credential to add.

Raises:

CardanoError – If addition fails.

Return type:

None

get(index)[source]

Retrieves a credential at the specified 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

__len__()[source]

Returns the number of credentials in the set.

Return type:

int

__iter__()[source]

Iterates over all credentials in the set.

Return type:

Iterator[Credential]

__getitem__(index)[source]

Gets a credential by index using bracket notation.

Parameters:

index (int)

Return type:

Credential

__bool__()[source]

Returns True if the set is not empty.

Return type:

bool

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

__contains__(item)[source]

Checks if an item is in the set.

Parameters:

item (object)

Return type:

bool

isdisjoint(other)[source]

Returns True if the set has no elements in common with other.

Parameters:

other (Iterable[Credential]) – Another iterable to compare with.

Returns:

True if the sets are disjoint.

Return type:

bool