From 0a5379f7ab426f539d6b95a3beb6303b191e2741 Mon Sep 17 00:00:00 2001 From: Navjot Date: Mon, 30 Sep 2019 19:27:57 +0530 Subject: [PATCH] merge commit conflicts --- src/messagetypes/__init__.py | 3 +-- src/messagetypes/message.py | 16 ++++++---------- src/messagetypes/vote.py | 15 +++++++-------- src/pyelliptic/openssl.py | 1 + 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/messagetypes/__init__.py b/src/messagetypes/__init__.py index 95eee595..53d23de7 100644 --- a/src/messagetypes/__init__.py +++ b/src/messagetypes/__init__.py @@ -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 diff --git a/src/messagetypes/message.py b/src/messagetypes/message.py index 263a2e4a..46816d82 100644 --- a/src/messagetypes/message.py +++ b/src/messagetypes/message.py @@ -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)) diff --git a/src/messagetypes/vote.py b/src/messagetypes/vote.py index a77e1cc7..fb5ad6c8 100644 --- a/src/messagetypes/vote.py +++ b/src/messagetypes/vote.py @@ -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) diff --git a/src/pyelliptic/openssl.py b/src/pyelliptic/openssl.py index 17bf52c8..0b9be0ab 100644 --- a/src/pyelliptic/openssl.py +++ b/src/pyelliptic/openssl.py @@ -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