Merge pull request #35 from jaicis/py3codefix
Logging and modules issues fixes
This commit is contained in:
commit
ab55013b72
|
@ -1 +0,0 @@
|
||||||
src
|
|
|
@ -1,8 +1,8 @@
|
||||||
"""
|
"""
|
||||||
Bitmessage android(mobile) interface
|
Bitmessage android(mobile) interface
|
||||||
"""
|
"""
|
||||||
# pylint: disable=import-error,no-name-in-module,unused-argument,too-few-public-methods,too-many-arguments
|
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument
|
||||||
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation,attribute-defined-outside-init
|
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from bitmessagekivy import identiconGeneration
|
from bitmessagekivy import identiconGeneration
|
||||||
|
@ -62,7 +62,7 @@ from semaphores import kivyuisignaler
|
||||||
|
|
||||||
import state
|
import state
|
||||||
from addresses import decodeAddress
|
from addresses import decodeAddress
|
||||||
|
# pylint: disable=too-few-public-methods,too-many-arguments,attribute-defined-outside-init
|
||||||
|
|
||||||
KVFILES = [
|
KVFILES = [
|
||||||
'settings', 'popup', 'allmails', 'draft',
|
'settings', 'popup', 'allmails', 'draft',
|
||||||
|
@ -509,7 +509,8 @@ class AddressBook(Screen):
|
||||||
def delete_address(self, address, instance, *args):
|
def delete_address(self, address, instance, *args):
|
||||||
"""Delete inbox mail from inbox listing"""
|
"""Delete inbox mail from inbox listing"""
|
||||||
self.ids.ml.remove_widget(instance.parent.parent)
|
self.ids.ml.remove_widget(instance.parent.parent)
|
||||||
if len(self.ids.ml.children) == 0:
|
# if len(self.ids.ml.children) == 0:
|
||||||
|
if self.ids.ml.children is not None:
|
||||||
self.ids.identi_tag.children[0].text = ''
|
self.ids.identi_tag.children[0].text = ''
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"DELETE FROM addressbook WHERE address = '{}';".format(address))
|
"DELETE FROM addressbook WHERE address = '{}';".format(address))
|
||||||
|
@ -1263,7 +1264,7 @@ class Setting(Screen):
|
||||||
|
|
||||||
class NavigateApp(MDApp):
|
class NavigateApp(MDApp):
|
||||||
"""Navigation Layout of class"""
|
"""Navigation Layout of class"""
|
||||||
# pylint: disable=too-many-public-methods
|
# pylint: disable=too-many-public-methods,inconsistent-return-statements
|
||||||
|
|
||||||
# theme_cls = ThemeManager()
|
# theme_cls = ThemeManager()
|
||||||
previous_date = ObjectProperty()
|
previous_date = ObjectProperty()
|
||||||
|
@ -1280,8 +1281,7 @@ class NavigateApp(MDApp):
|
||||||
def build(self):
|
def build(self):
|
||||||
"""Method builds the widget"""
|
"""Method builds the widget"""
|
||||||
for kv_file in KVFILES:
|
for kv_file in KVFILES:
|
||||||
Builder.load_file(
|
Builder.load_file(os.path.join(os.path.dirname(__file__), "kv/{}.kv").format(kv_file))
|
||||||
os.path.join(os.path.dirname(__file__), f"kv/{kv_file}.kv"))
|
|
||||||
self.obj_1 = AddressBook()
|
self.obj_1 = AddressBook()
|
||||||
kivysignalthread = UIkivySignaler()
|
kivysignalthread = UIkivySignaler()
|
||||||
kivysignalthread.daemon = True
|
kivysignalthread.daemon = True
|
||||||
|
@ -1298,7 +1298,6 @@ class NavigateApp(MDApp):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def showmeaddresses(name="text"):
|
def showmeaddresses(name="text"):
|
||||||
"""Show the addresses in spinner to make as dropdown"""
|
"""Show the addresses in spinner to make as dropdown"""
|
||||||
# pylint: disable=inconsistent-return-statements
|
|
||||||
if name == "text":
|
if name == "text":
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
return BMConfigParser().addresses()[0][:16] + '..'
|
return BMConfigParser().addresses()[0][:16] + '..'
|
||||||
|
@ -1590,6 +1589,7 @@ class NavigateApp(MDApp):
|
||||||
msg_counter_objs.allmail_cnt.badge_text = state.all_count
|
msg_counter_objs.allmail_cnt.badge_text = state.all_count
|
||||||
|
|
||||||
def on_start(self):
|
def on_start(self):
|
||||||
|
"""Setting message count"""
|
||||||
self.set_message_count()
|
self.set_message_count()
|
||||||
|
|
||||||
# @staticmethod
|
# @staticmethod
|
||||||
|
@ -2585,6 +2585,7 @@ class NavigationDrawerDivider(OneLineListItem):
|
||||||
_txt_bot_pad = NumericProperty(dp(8))
|
_txt_bot_pad = NumericProperty(dp(8))
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
# pylint: disable=bad-super-call
|
||||||
super(OneLineListItem, self).__init__(**kwargs)
|
super(OneLineListItem, self).__init__(**kwargs)
|
||||||
self.height = dp(16)
|
self.height = dp(16)
|
||||||
|
|
||||||
|
|
|
@ -371,7 +371,7 @@ class Main(object):
|
||||||
|
|
||||||
elif state.kivy:
|
elif state.kivy:
|
||||||
config.remove_option('bitmessagesettings', 'dontconnect')
|
config.remove_option('bitmessagesettings', 'dontconnect')
|
||||||
# pylint: disable=no-member, import-error
|
# pylint: disable=no-member,import-error,no-name-in-module,relative-import
|
||||||
from bitmessagekivy.mpybit import NavigateApp
|
from bitmessagekivy.mpybit import NavigateApp
|
||||||
state.kivyapp = NavigateApp()
|
state.kivyapp = NavigateApp()
|
||||||
state.kivyapp.run()
|
state.kivyapp.run()
|
||||||
|
|
|
@ -117,6 +117,7 @@ class BMConfigParser(configparser.ConfigParser):
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def items(self, section, raw=False, variables=None):
|
def items(self, section, raw=False, variables=None):
|
||||||
|
# pylint: disable=signature-differs
|
||||||
"""Return section variables as parent,
|
"""Return section variables as parent,
|
||||||
but override the "raw" argument to always True"""
|
but override the "raw" argument to always True"""
|
||||||
return configparser.ConfigParser.items(self, section, True, variables)
|
return configparser.ConfigParser.items(self, section, True, variables)
|
||||||
|
|
|
@ -22,7 +22,7 @@ class MultiQueue(Queue.Queue):
|
||||||
Queue.Queue.__init__(self, maxsize)
|
Queue.Queue.__init__(self, maxsize)
|
||||||
|
|
||||||
# Initialize the queue representation
|
# Initialize the queue representation
|
||||||
def _init(self, maxsize):
|
def _init(self, _):
|
||||||
self.iter = 0
|
self.iter = 0
|
||||||
self.queues = []
|
self.queues = []
|
||||||
for _ in range(self.queueCount):
|
for _ in range(self.queueCount):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Bitmessage Protocol
|
Bitmessage Protocol
|
||||||
"""
|
"""
|
||||||
# pylint: disable=attribute-defined-outside-init, too-few-public-methods
|
# pylint: disable=attribute-defined-outside-init, too-few-public-methods, logging-format-interpolation
|
||||||
import base64
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import logging
|
import logging
|
||||||
|
@ -123,7 +123,8 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
||||||
length=protocol.Header.size, expectBytes=self.payloadLength)
|
length=protocol.Header.size, expectBytes=self.payloadLength)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def state_bm_command(self): # pylint: disable=too-many-branches, too-many-statements
|
def state_bm_command(self):
|
||||||
|
# pylint: disable=too-many-branches, too-many-statements
|
||||||
"""Process incoming command"""
|
"""Process incoming command"""
|
||||||
self.payload = self.read_buf[:self.payloadLength]
|
self.payload = self.read_buf[:self.payloadLength]
|
||||||
if self.checksum != hashlib.sha512(self.payload).digest()[0:4]:
|
if self.checksum != hashlib.sha512(self.payload).digest()[0:4]:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Select which node to connect to
|
Select which node to connect to
|
||||||
"""
|
"""
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches, logging-format-interpolation, unidiomatic-typecheck
|
||||||
import logging
|
import logging
|
||||||
import random # nosec
|
import random # nosec
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ class BMConnectionPool(object):
|
||||||
def startListening(self, bind=None):
|
def startListening(self, bind=None):
|
||||||
"""Open a listening socket and start accepting connections on it"""
|
"""Open a listening socket and start accepting connections on it"""
|
||||||
if bind is None:
|
if bind is None:
|
||||||
"this return blank host"
|
"""this return blank host"""
|
||||||
bind = self.getListeningIP()
|
bind = self.getListeningIP()
|
||||||
port = BMConfigParser().safeGetInt("bitmessagesettings", "port")
|
port = BMConfigParser().safeGetInt("bitmessagesettings", "port")
|
||||||
# correct port even if it changed
|
# correct port even if it changed
|
||||||
|
|
|
@ -30,7 +30,7 @@ from network.socks5 import Socks5Connection
|
||||||
from network.tls import TLSDispatcher
|
from network.tls import TLSDispatcher
|
||||||
from .node import Peer
|
from .node import Peer
|
||||||
from queues import UISignalQueue, invQueue, receiveDataQueue
|
from queues import UISignalQueue, invQueue, receiveDataQueue
|
||||||
|
# pylint: disable=logging-format-interpolation
|
||||||
|
|
||||||
logger = logging.getLogger('default')
|
logger = logging.getLogger('default')
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import state
|
||||||
from queues import receiveDataQueue
|
from queues import receiveDataQueue
|
||||||
|
|
||||||
logger = logging.getLogger('default')
|
logger = logging.getLogger('default')
|
||||||
|
# pylint: disable=logging-format-interpolation
|
||||||
|
|
||||||
|
|
||||||
class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes
|
class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes
|
||||||
|
@ -91,8 +92,8 @@ class UDPSocket(BMProto): # pylint: disable=too-many-instance-attributes
|
||||||
if remoteport is False:
|
if remoteport is False:
|
||||||
return True
|
return True
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"received peer discovery from {}:{} (port {}):",
|
"received peer discovery from {}:{} (port {}):".format(
|
||||||
self.destination.host, self.destination.port, remoteport)
|
self.destination.host, self.destination.port, remoteport))
|
||||||
if self.local:
|
if self.local:
|
||||||
state.discoveredPeers[Peer(self.destination.host, remoteport)] = \
|
state.discoveredPeers[Peer(self.destination.host, remoteport)] = \
|
||||||
time.time()
|
time.time()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Low-level protocol-related functions.
|
Low-level protocol-related functions.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=too-many-boolean-expressions,too-many-return-statements
|
# pylint: disable=too-many-boolean-expressions,too-many-return-statements
|
||||||
# pylint: disable=too-many-locals,too-many-statements
|
# pylint: disable=too-many-locals,too-many-statements,logging-format-interpolation
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
|
@ -65,6 +65,7 @@ Header = Struct('!L12sL4s')
|
||||||
VersionPacket = Struct('>LqQ20s4s36sH')
|
VersionPacket = Struct('>LqQ20s4s36sH')
|
||||||
|
|
||||||
# Bitfield
|
# Bitfield
|
||||||
|
# pylint: disable=unidiomatic-typecheck
|
||||||
|
|
||||||
|
|
||||||
def getBitfield(address):
|
def getBitfield(address):
|
||||||
|
|
|
@ -24,7 +24,7 @@ from addresses import decodeAddress, encodeVarint
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from debug import logger
|
from debug import logger
|
||||||
from helper_sql import sqlQuery
|
from helper_sql import sqlQuery
|
||||||
|
# pylint: disable=logging-format-interpolation
|
||||||
|
|
||||||
verbose = 1
|
verbose = 1
|
||||||
# This is obsolete with the change to protocol v3
|
# This is obsolete with the change to protocol v3
|
||||||
|
|
|
@ -10,6 +10,7 @@ class TestNetworkGroup(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
def test_network_group(self):
|
def test_network_group(self):
|
||||||
"""Test various types of network groups"""
|
"""Test various types of network groups"""
|
||||||
|
# pylint: disable=import-error
|
||||||
from pybitmessage.protocol import network_group
|
from pybitmessage.protocol import network_group
|
||||||
|
|
||||||
test_ip = '1.2.3.4'
|
test_ip = '1.2.3.4'
|
||||||
|
|
Reference in New Issue
Block a user