Assorted fixes
- landscape.io was complaining, this fixes most easily fixable errors
This commit is contained in:
parent
cdcdf11d59
commit
c738d93056
|
@ -19,6 +19,7 @@ try:
|
|||
except Exception as err:
|
||||
logmsg = 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download it from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\' (without quotes).'
|
||||
logger.critical(logmsg, exc_info=True)
|
||||
import sys
|
||||
sys.exit()
|
||||
|
||||
try:
|
||||
|
@ -1214,8 +1215,6 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
|
||||
# When an unread inbox row is selected on then clear the messaging menu
|
||||
def ubuntuMessagingMenuClear(self, inventoryHash):
|
||||
global withMessagingMenu
|
||||
|
||||
# if this isn't ubuntu then don't do anything
|
||||
if not self.isUbuntu():
|
||||
return
|
||||
|
@ -1315,8 +1314,6 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
|
||||
# update the Ubuntu messaging menu
|
||||
def ubuntuMessagingMenuUpdate(self, drawAttention, newItem, toLabel):
|
||||
global withMessagingMenu
|
||||
|
||||
# if this isn't ubuntu then don't do anything
|
||||
if not self.isUbuntu():
|
||||
return
|
||||
|
@ -1440,14 +1437,11 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
|
||||
# initialise the message notifier
|
||||
def notifierInit(self):
|
||||
global withMessagingMenu
|
||||
if withMessagingMenu:
|
||||
Notify.init('pybitmessage')
|
||||
|
||||
# shows a notification
|
||||
def notifierShow(self, title, subtitle, fromCategory, label):
|
||||
global withMessagingMenu
|
||||
|
||||
self.playSound(fromCategory, label)
|
||||
|
||||
if withMessagingMenu:
|
||||
|
@ -1642,7 +1636,6 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
connected = False
|
||||
|
||||
def setStatusIcon(self, color):
|
||||
global withMessagingMenu
|
||||
# print 'setting status icon color'
|
||||
if color == 'red':
|
||||
self.pushButtonStatusIcon.setIcon(
|
||||
|
@ -3057,7 +3050,7 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
self.statusBar().showMessage(_translate(
|
||||
"MainWindow", "Error: You cannot add the same address to your blacklist twice. Try renaming the existing one if you want."), 10000)
|
||||
|
||||
def deleteRowFromMessagelist(row = None, inventoryHash = None, ackData = None, messageLists = None):
|
||||
def deleteRowFromMessagelist(self, row = None, inventoryHash = None, ackData = None, messageLists = None):
|
||||
if messageLists is None:
|
||||
messageLists = (self.ui.tableWidgetInbox, self.ui.tableWidgetInboxChans, self.ui.tableWidgetInboxSubscriptions)
|
||||
elif type(messageLists) not in (list, tuple):
|
||||
|
@ -4447,7 +4440,6 @@ class MySingleApplication(QApplication):
|
|||
self.server.close()
|
||||
|
||||
def on_new_connection(self):
|
||||
global myapp
|
||||
if myapp:
|
||||
myapp.appIndicatorShow()
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ class GatewayAccount(BMAccount):
|
|||
ALL_OK = 0
|
||||
REGISTRATION_DENIED = 1
|
||||
def __init__(self, address):
|
||||
super(BMAccount, self).__init__(address)
|
||||
super(GatewayAccount, self).__init__(address)
|
||||
|
||||
def send(self):
|
||||
status, addressVersionNumber, streamNumber, ripe = decodeAddress(self.toAddress)
|
||||
|
@ -175,7 +175,7 @@ class GatewayAccount(BMAccount):
|
|||
shared.workerQueue.put(('sendmessage', self.toAddress))
|
||||
|
||||
def parseMessage(self, toAddress, fromAddress, subject, message):
|
||||
super(BMAccount, self).parseMessage(toAddress, fromAddress, subject, message)
|
||||
super(GatewayAccount, self).parseMessage(toAddress, fromAddress, subject, message)
|
||||
|
||||
class MailchuckAccount(GatewayAccount):
|
||||
# set "gateway" in keys.dat to this
|
||||
|
@ -186,7 +186,7 @@ class MailchuckAccount(GatewayAccount):
|
|||
regExpIncoming = re.compile("(.*)MAILCHUCK-FROM::(\S+) \| (.*)")
|
||||
regExpOutgoing = re.compile("(\S+) (.*)")
|
||||
def __init__(self, address):
|
||||
super(GatewayAccount, self).__init__(address)
|
||||
super(MailchuckAccount, self).__init__(address)
|
||||
self.feedback = self.ALL_OK
|
||||
|
||||
def createMessage(self, toAddress, fromAddress, subject, message):
|
||||
|
@ -262,7 +262,7 @@ class MailchuckAccount(GatewayAccount):
|
|||
self.fromAddress = self.address
|
||||
|
||||
def parseMessage(self, toAddress, fromAddress, subject, message):
|
||||
super(GatewayAccount, self).parseMessage(toAddress, fromAddress, subject, message)
|
||||
super(MailchuckAccount, self).parseMessage(toAddress, fromAddress, subject, message)
|
||||
if fromAddress == self.relayAddress:
|
||||
matches = self.regExpIncoming.search(subject)
|
||||
if not matches is None:
|
||||
|
|
|
@ -2,7 +2,6 @@ from PyQt4 import QtCore, QtGui
|
|||
import shared
|
||||
from tr import _translate
|
||||
import l10n
|
||||
from uisignaler import UISignaler
|
||||
import widgets
|
||||
from addresses import addBMIfNotPresent
|
||||
from configparser import BMConfigParser
|
||||
|
|
|
@ -316,19 +316,19 @@ class NewAddressThread(QtCore.QThread):
|
|||
def __del__(self):
|
||||
self.wait()
|
||||
|
||||
def createDeterministic():
|
||||
def createDeterministic(self):
|
||||
pass
|
||||
|
||||
def createPassphrase():
|
||||
def createPassphrase(self):
|
||||
pass
|
||||
|
||||
def broadcastAddress():
|
||||
def broadcastAddress(self):
|
||||
pass
|
||||
|
||||
def registerMailchuck():
|
||||
def registerMailchuck(self):
|
||||
pass
|
||||
|
||||
def waitRegistration():
|
||||
def waitRegistration(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
|
|
|
@ -41,7 +41,6 @@ class objectHashHolder(threading.Thread):
|
|||
|
||||
def hasHash(self, hash):
|
||||
if hash in (hashlist for hashlist in self.collectionOfHashLists):
|
||||
logger.debug("Hash in hashHolder")
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -270,9 +270,9 @@ class receiveDataThread(threading.Thread):
|
|||
self.processData()
|
||||
|
||||
|
||||
def sendpong(self):
|
||||
def sendpong(self, payload):
|
||||
logger.debug('Sending pong')
|
||||
self.sendDataThreadQueue.put((0, 'sendRawData', protocol.CreatePacket('pong')))
|
||||
self.sendDataThreadQueue.put((0, 'sendRawData', protocol.CreatePacket('pong', payload)))
|
||||
|
||||
|
||||
def recverack(self):
|
||||
|
|
|
@ -8,6 +8,7 @@ import urlparse
|
|||
from configparser import BMConfigParser
|
||||
from debug import logger
|
||||
from helper_threading import *
|
||||
from bitmessageqt.uisignaler import UISignaler
|
||||
import shared
|
||||
|
||||
SMTPDOMAIN = "bmaddr.lan"
|
||||
|
|
|
@ -6,6 +6,7 @@ from email.header import decode_header
|
|||
import re
|
||||
import signal
|
||||
import smtpd
|
||||
import socket
|
||||
import threading
|
||||
import time
|
||||
|
||||
|
@ -43,7 +44,7 @@ class smtpServerChannel(smtpd.SMTPChannel):
|
|||
self.auth = True
|
||||
self.push('235 2.7.0 Authentication successful')
|
||||
else:
|
||||
raise Error("Auth fail")
|
||||
raise Exception("Auth fail")
|
||||
except:
|
||||
self.push('501 Authentication fail')
|
||||
|
||||
|
|
|
@ -53,16 +53,12 @@ def initCL():
|
|||
enabledGpus = []
|
||||
|
||||
def openclAvailable():
|
||||
global gpus
|
||||
return (len(gpus) > 0)
|
||||
|
||||
def openclEnabled():
|
||||
global enabledGpus
|
||||
return (len(enabledGpus) > 0)
|
||||
|
||||
def do_opencl_pow(hash, target):
|
||||
global ctx, queue, program, enabledGpus, hash_dt
|
||||
|
||||
output = numpy.zeros(1, dtype=[('v', numpy.uint64, 1)])
|
||||
if (len(enabledGpus) == 0):
|
||||
return output[0][0]
|
||||
|
|
|
@ -19,8 +19,7 @@ bitmsglib = 'bitmsghash.so'
|
|||
|
||||
def _set_idle():
|
||||
if 'linux' in sys.platform:
|
||||
import os
|
||||
os.nice(20) # @UndefinedVariable
|
||||
os.nice(20)
|
||||
else:
|
||||
try:
|
||||
sys.getwindowsversion()
|
||||
|
|
|
@ -211,7 +211,7 @@ def reloadBroadcastSendersForWhichImWatching():
|
|||
MyECSubscriptionCryptorObjects[tag] = highlevelcrypto.makeCryptor(hexlify(privEncryptionKey))
|
||||
|
||||
def doCleanShutdown():
|
||||
global shutdown, thisapp
|
||||
global shutdown
|
||||
shutdown = 1 #Used to tell proof of work worker threads and the objectProcessorThread to exit.
|
||||
try:
|
||||
parserInputQueue.put(None, False)
|
||||
|
|
15
src/upnp.py
15
src/upnp.py
|
@ -11,7 +11,7 @@ from helper_threading import *
|
|||
import shared
|
||||
import tr
|
||||
|
||||
def createRequestXML(service, action, arguments=[]):
|
||||
def createRequestXML(service, action, arguments=None):
|
||||
from xml.dom.minidom import Document
|
||||
|
||||
doc = Document()
|
||||
|
@ -37,11 +37,12 @@ def createRequestXML(service, action, arguments=[]):
|
|||
# iterate over arguments, create nodes, create text nodes,
|
||||
# append text nodes to nodes, and finally add the ready product
|
||||
# to argument_list
|
||||
for k, v in arguments:
|
||||
tmp_node = doc.createElement(k)
|
||||
tmp_text_node = doc.createTextNode(v)
|
||||
tmp_node.appendChild(tmp_text_node)
|
||||
argument_list.append(tmp_node)
|
||||
if arguments is not None:
|
||||
for k, v in arguments:
|
||||
tmp_node = doc.createElement(k)
|
||||
tmp_text_node = doc.createTextNode(v)
|
||||
tmp_node.appendChild(tmp_text_node)
|
||||
argument_list.append(tmp_node)
|
||||
|
||||
# append the prepared argument nodes to the function element
|
||||
for arg in argument_list:
|
||||
|
@ -140,7 +141,7 @@ class Router:
|
|||
dom = parseString(resp)
|
||||
return dom.getElementsByTagName('NewExternalIPAddress')[0].childNodes[0].data
|
||||
|
||||
def soapRequest(self, service, action, arguments=[]):
|
||||
def soapRequest(self, service, action, arguments=None):
|
||||
from xml.dom.minidom import parseString
|
||||
from debug import logger
|
||||
conn = httplib.HTTPConnection(self.routerPath.hostname, self.routerPath.port)
|
||||
|
|
Loading…
Reference in New Issue
Block a user