merge commit conflicts

This commit is contained in:
Navjot 2019-09-30 19:27:57 +05:30
parent 19d6588db6
commit 0a5379f7ab
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
4 changed files with 15 additions and 20 deletions

View File

@ -2,7 +2,6 @@
src/messagetypes/__init__.py
============================
"""
# pylint: disable=import-error
from importlib import import_module
from os import path, listdir
from string import lower
@ -22,7 +21,7 @@ class MsgBase(object): # pylint: disable=too-few-public-methods
def constructObject(data):
"""Construct an object"""
"""Constructing an object"""
whitelist = ["message"]
if data[""] not in whitelist:
return None

View File

@ -9,26 +9,22 @@ from messagetypes import MsgBase
class Message(MsgBase):
"""Base method, helps to decode, encode and process the message"""
def __init__(self): # pylint: disable=super-init-not-called
return
def decode(self, data):
"""Method used for decoding the message"""
"""Decode a message"""
# UTF-8 and variable type validator
# pylint: disable=unidiomatic-typecheck
if type(data["subject"]) is str:
if isinstance(data["subject"], str):
self.subject = unicode(data["subject"], 'utf-8', 'replace')
else:
self.subject = unicode(str(data["subject"]), 'utf-8', 'replace')
if type(data["body"]) is str:
if isinstance(data["body"], str):
self.body = unicode(data["body"], 'utf-8', 'replace')
else:
self.body = unicode(str(data["body"]), 'utf-8', 'replace')
def encode(self, data):
"""Method used for encoding the message"""
# pylint: disable=no-member
super(Message, self).encode()
"""Encode a message"""
super(Message, self).__init__()
try:
self.data["subject"] = data["subject"]
self.data["body"] = data["body"]
@ -37,6 +33,6 @@ class Message(MsgBase):
return self.data
def process(self):
"""Method used for process the message"""
"""Process a message"""
logger.debug("Subject: %i bytes", len(self.subject))
logger.debug("Body: %i bytes", len(self.body))

View File

@ -7,28 +7,27 @@ from messagetypes import MsgBase
# pylint: disable=attribute-defined-outside-init
class Vote(MsgBase):
"""Base method, helps to decode, encode and process the message"""
def __init__(self): # pylint: disable=super-init-not-called
return
def decode(self, data):
"""Method used for decoding the message"""
"""decode a vote"""
# pylint: disable=attribute-defined-outside-init
self.msgid = data["msgid"]
self.vote = data["vote"]
def encode(self, data):
"""Method used for encoding the message"""
# pylint: disable=no-member
super(Vote, self).encode()
"""Encode a vote"""
super(Vote, self).__init__()
try:
self.data["msgid"] = data["msgid"]
self.data["vote"] = data["vote"]
except KeyError as e:
logger.error("Missing key %s", e.name)
logger.error("Missing key %s", e)
return self.data
def process(self):
"""Method used for process the message"""
"""Encode a vote"""
logger.debug("msgid: %s", self.msgid)
logger.debug("vote: %s", self.vote)

View File

@ -657,6 +657,7 @@ class _OpenSSL:
def loadOpenSSL():
"""Method find and load the OpenSSL library"""
# pylint: disable=global-statement, protected-access, too-many-branches
global OpenSSL
from os import path, environ
from ctypes.util import find_library