messagetypes init flake and pylint fixes

This commit is contained in:
lakshyacis 2019-09-27 19:31:55 +05:30
parent fba2d6d837
commit 40e15579fd
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB

View File

@ -1,3 +1,7 @@
"""
src/messagetypes/__init__.py
============================
"""
from importlib import import_module from importlib import import_module
from os import path, listdir from os import path, listdir
from string import lower from string import lower
@ -6,12 +10,15 @@ from debug import logger
import messagetypes import messagetypes
import paths import paths
class MsgBase(object):
def encode(self): class MsgBase(object): # pylint: disable=too-few-public-methods
"""Base class for message types"""
def __init__(self):
self.data = {"": lower(type(self).__name__)} self.data = {"": lower(type(self).__name__)}
def constructObject(data): def constructObject(data):
"""Constructing an object"""
whitelist = ["message"] whitelist = ["message"]
if data[""] not in whitelist: if data[""] not in whitelist:
return None return None
@ -32,6 +39,7 @@ def constructObject(data):
else: else:
return returnObj return returnObj
if paths.frozen is not None: if paths.frozen is not None:
import messagetypes.message import messagetypes.message
import messagetypes.vote import messagetypes.vote