Opinion Module
- class hivemind.opinion.HivemindOpinion(cid: str | None = None)[source]
Bases:
IPFSDict
A class representing a voter’s opinion in the Hivemind protocol.
This class handles the storage and management of a voter’s ranked choices for a particular hivemind issue question.
- Variables:
- __init__(cid: str | None = None) None [source]
Initialize a new HivemindOpinion.
- Parameters:
cid (str | None) – The IPFS hash of the Opinion object
- Returns:
None
- info() str [source]
Get the details of this Opinion object in string format.
- Returns:
Formatted string containing the opinion details
- Return type:
- load(cid: str) None [source]
Load the opinion from IPFS.
This method handles the conversion of the stored ranking dictionary back into a Ranking object.
- Parameters:
cid (str) – The IPFS hash to load
- Returns:
None
- save() str [source]
Save the opinion to IPFS.
This method handles the conversion of the Ranking object into a JSON-serializable dictionary before saving the opinion to IPFS.
- Returns:
The IPFS hash of the saved opinion
- Return type: