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

35 lines
1.0 KiB
Python
Raw Normal View History

2019-09-20 13:19:04 +02:00
"""
src/messagetypes/vote.py
=================================
"""
from debug import logger
from messagetypes import MsgBase
2019-09-20 13:19:04 +02:00
# pylint: disable=attribute-defined-outside-init
class Vote(MsgBase):
2019-09-20 13:19:04 +02:00
"""Base method, helps to decode, encode and process the message"""
def __init__(self): # pylint: disable=super-init-not-called
return
def decode(self, data):
2019-09-20 13:19:04 +02:00
"""Method used for decoding the message"""
self.msgid = data["msgid"]
self.vote = data["vote"]
def encode(self, data):
2019-09-20 13:19:04 +02:00
"""Method used for encoding the message"""
# pylint: disable=no-member
super(Vote, self).encode()
try:
self.data["msgid"] = data["msgid"]
self.data["vote"] = data["vote"]
except KeyError as e:
logger.error("Missing key %s", e.name)
return self.data
def process(self):
2019-09-20 13:19:04 +02:00
"""Method used for process the message"""
logger.debug("msgid: %s", self.msgid)
logger.debug("vote: %s", self.vote)