File tree Expand file tree Collapse file tree 3 files changed +18
-17
lines changed
Expand file tree Collapse file tree 3 files changed +18
-17
lines changed Original file line number Diff line number Diff line change 11import logging
2- from importlib import import_module
3- from os import listdir , path
42
5- from pybitmessage import paths
3+ from importlib import import_module
64
75logger = logging .getLogger ('default' )
86
97
10- class MsgBase (object ): # pylint: disable=too-few-public-methods
11- """Base class for message types"""
12- def __init__ (self ):
13- self .data = {"" : type (self ).__name__ .lower ()}
14-
15-
168def constructObject (data ):
179 """Constructing an object"""
1810 whitelist = ["message" ]
@@ -40,14 +32,19 @@ def constructObject(data):
4032 return returnObj
4133
4234
43- if paths .frozen is not None :
44- import message # noqa : F401 flake8: disable=unused-import
45- import vote # noqa : F401 flake8: disable=unused-import
35+ try :
36+ from pybitmessage import paths
37+ except ImportError :
38+ paths = None
39+
40+ if paths and paths .frozen is not None :
41+ from . import message , vote # noqa: F401 flake8: disable=unused-import
4642else :
47- for mod in listdir (path .dirname (__file__ )):
43+ import os
44+ for mod in os .listdir (os .path .dirname (__file__ )):
4845 if mod == "__init__.py" :
4946 continue
50- splitted = path .splitext (mod )
47+ splitted = os . path .splitext (mod )
5148 if splitted [1 ] != ".py" :
5249 continue
5350 try :
Original file line number Diff line number Diff line change 11import logging
22
3- from pybitmessage .messagetypes import MsgBase
4-
53logger = logging .getLogger ('default' )
64
75
6+ class MsgBase (object ): # pylint: disable=too-few-public-methods
7+ """Base class for message types"""
8+ def __init__ (self ):
9+ self .data = {"" : type (self ).__name__ .lower ()}
10+
11+
812class Message (MsgBase ):
913 """Encapsulate a message"""
1014 # pylint: disable=attribute-defined-outside-init
Original file line number Diff line number Diff line change 11import logging
22
3- from pybitmessage . messagetypes import MsgBase
3+ from . message import MsgBase
44
55logger = logging .getLogger ('default' )
66
You can’t perform that action at this time.
0 commit comments