This repository has been archived on 2024-12-02. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-02/src/messagetypes/vote.py

32 lines
793 B
Python
Raw Normal View History

2019-09-30 15:12:50 +02:00
"""
src/messagetypes/vote.py
========================
"""
from debug import logger
from messagetypes import MsgBase
2019-09-30 15:12:50 +02:00
class Vote(MsgBase):
2019-09-30 15:12:50 +02:00
"""Module used to vote"""
def decode(self, data):
2019-09-30 15:12:50 +02:00
"""decode a vote"""
# pylint: disable=attribute-defined-outside-init
self.msgid = data["msgid"]
self.vote = data["vote"]
def encode(self, data):
2019-09-30 15:12:50 +02:00
"""Encode a vote"""
super(Vote, self).__init__()
try:
self.data["msgid"] = data["msgid"]
self.data["vote"] = data["vote"]
except KeyError as e:
2019-09-30 15:12:50 +02:00
logger.error("Missing key %s", e)
return self.data
def process(self):
2019-09-30 15:12:50 +02:00
"""Encode a vote"""
logger.debug("msgid: %s", self.msgid)
logger.debug("vote: %s", self.vote)