Changes based on style and lint checks. (final_code_quality_7) #1365

Merged
coffeedogs merged 1 commits from final_code_quality_7 into v0.6 2018-11-12 15:48:22 +01:00
3 changed files with 273 additions and 186 deletions

View File

@ -1,15 +1,20 @@
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
src/bitmessageqt/messageview.py
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
===============================
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
import multiprocessing from safehtmlparser import SafeHTMLParser
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
import Queue
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
from urlparse import urlparse
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
from safehtmlparser import *
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
class MessageView(QtGui.QTextBrowser): class MessageView(QtGui.QTextBrowser):
"""Message content viewer class, can switch between plaintext and HTML"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
MODE_PLAIN = 0 MODE_PLAIN = 0
MODE_HTML = 1 MODE_HTML = 1
def __init__(self, parent = 0): def __init__(self, parent=0):
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
super(MessageView, self).__init__(parent) super(MessageView, self).__init__(parent)
self.mode = MessageView.MODE_PLAIN self.mode = MessageView.MODE_PLAIN
self.html = None self.html = None
@ -25,12 +30,14 @@ class MessageView(QtGui.QTextBrowser):
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
self.setWrappingWidth() self.setWrappingWidth()
def resizeEvent(self, event): def resizeEvent(self, event):
"""View resize event handler"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
super(MessageView, self).resizeEvent(event) super(MessageView, self).resizeEvent(event)
self.setWrappingWidth(event.size().width()) self.setWrappingWidth(event.size().width())
def mousePressEvent(self, event): def mousePressEvent(self, event):
#text = textCursor.block().text() """Mouse press button event handler"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
if event.button() == QtCore.Qt.LeftButton and self.html and self.html.has_html and self.cursorForPosition(event.pos()).block().blockNumber() == 0: if event.button() == QtCore.Qt.LeftButton and self.html and self.html.has_html and self.cursorForPosition(
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
event.pos()).block().blockNumber() == 0:
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
if self.mode == MessageView.MODE_PLAIN: if self.mode == MessageView.MODE_PLAIN:
self.showHTML() self.showHTML()
else: else:
@ -39,19 +46,24 @@ class MessageView(QtGui.QTextBrowser):
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
super(MessageView, self).mousePressEvent(event) super(MessageView, self).mousePressEvent(event)
def wheelEvent(self, event): def wheelEvent(self, event):
"""Mouse wheel scroll event handler"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
# super will actually automatically take care of zooming # super will actually automatically take care of zooming
super(MessageView, self).wheelEvent(event) super(MessageView, self).wheelEvent(event)
if (QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical: if (QtGui.QApplication.queryKeyboardModifiers() &
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
QtGui.QApplication.activeWindow().statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Zoom level %1%").arg(str(zoom))) QtGui.QApplication.activeWindow().statusBar().showMessage(
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
QtGui.QApplication.translate("MainWindow", "Zoom level %1%").arg(str(zoom)))
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
def setWrappingWidth(self, width=None): def setWrappingWidth(self, width=None):
"""Set word-wrapping width"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
self.setLineWrapMode(QtGui.QTextEdit.FixedPixelWidth) self.setLineWrapMode(QtGui.QTextEdit.FixedPixelWidth)
if width is None: if width is None:
width = self.width() width = self.width()
self.setLineWrapColumnOrWidth(width) self.setLineWrapColumnOrWidth(width)
def confirmURL(self, link): def confirmURL(self, link):
"""Show a dialog requesting URL opening confirmation"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
if link.scheme() == "mailto": if link.scheme() == "mailto":
window = QtGui.QApplication.activeWindow() window = QtGui.QApplication.activeWindow()
window.ui.lineEditTo.setText(link.path()) window.ui.lineEditTo.setText(link.path())
@ -68,35 +80,39 @@ class MessageView(QtGui.QTextBrowser):
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
) )
window.ui.textEditMessage.setFocus() window.ui.textEditMessage.setFocus()
return return
reply = QtGui.QMessageBox.warning(self, reply = QtGui.QMessageBox.warning(
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
QtGui.QApplication.translate("MessageView", "Follow external link"), self,
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
QtGui.QApplication.translate("MessageView", "The link \"%1\" will open in a browser. It may be a security risk, it could de-anonymise you or download malicious data. Are you sure?").arg(unicode(link.toString())), QtGui.QApplication.translate(
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) "MessageView",
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
"Follow external link"),
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
QtGui.QApplication.translate(
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
"MessageView",
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
"The link \"%1\" will open in a browser. It may be a security risk, it could de-anonymise you"
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
" or download malicious data. Are you sure?").arg(unicode(link.toString())),
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
QtGui.QMessageBox.Yes,
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
QtGui.QMessageBox.No)
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
if reply == QtGui.QMessageBox.Yes: if reply == QtGui.QMessageBox.Yes:
QtGui.QDesktopServices.openUrl(link) QtGui.QDesktopServices.openUrl(link)
def loadResource (self, restype, name): def loadResource(self, restype, name):
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
if restype == QtGui.QTextDocument.ImageResource and name.scheme() == "bmmsg": """
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
Callback for loading referenced objects, such as an image. For security reasons at the moment doesn't do
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
anything)
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
pass pass
# QImage correctImage;
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
# lookup the correct QImage from a cache
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
# return QVariant::fromValue(correctImage);
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
# elif restype == QtGui.QTextDocument.HtmlResource:
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
# elif restype == QtGui.QTextDocument.ImageResource:
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
# elif restype == QtGui.QTextDocument.StyleSheetResource:
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
# elif restype == QtGui.QTextDocument.UserResource:
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
else:
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
pass
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
# by default, this will interpret it as a local file
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
# QtGui.QTextBrowser.loadResource(restype, name)
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
def lazyRender(self): def lazyRender(self):
"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
Partially render a message. This is to avoid UI freezing when loading huge messages. It continues loading as
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
you scroll down.
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
if self.rendering: if self.rendering:
return return
self.rendering = True self.rendering = True
position = self.verticalScrollBar().value() position = self.verticalScrollBar().value()
cursor = QtGui.QTextCursor(self.document()) cursor = QtGui.QTextCursor(self.document())
while self.outpos < len(self.out) and self.verticalScrollBar().value() >= self.document().size().height() - 2 * self.size().height(): while self.outpos < len(self.out) and self.verticalScrollBar().value(
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
) >= self.document().size().height() - 2 * self.size().height():
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
startpos = self.outpos startpos = self.outpos
self.outpos += 10240 self.outpos += 10240
PeterSurda commented 2018-10-18 18:04:37 +02:00 (Migrated from github.com)
Review
        """Render message as plain text."""
```suggestion """Render message as plain text.""" ```
PeterSurda commented 2018-10-18 18:05:12 +02:00 (Migrated from github.com)
Review
        """Render message as HTML"""
```suggestion """Render message as HTML""" ```
PeterSurda commented 2018-10-18 18:05:43 +02:00 (Migrated from github.com)
Review
        """Set message content from argument"""
```suggestion """Set message content from argument""" ```
# find next end of tag # find next end of tag
@ -110,25 +126,31 @@ class MessageView(QtGui.QTextBrowser):
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
self.rendering = False self.rendering = False
def showPlain(self): def showPlain(self):
"""Render message as plain text."""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
self.mode = MessageView.MODE_PLAIN self.mode = MessageView.MODE_PLAIN
out = self.html.raw out = self.html.raw
if self.html.has_html: if self.html.has_html:
out = "<div align=\"center\" style=\"text-decoration: underline;\"><b>" + unicode(QtGui.QApplication.translate("MessageView", "HTML detected, click here to display")) + "</b></div><br/>" + out out = "<div align=\"center\" style=\"text-decoration: underline;\"><b>" + unicode(
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
QtGui.QApplication.translate(
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
"MessageView", "HTML detected, click here to display")) + "</b></div><br/>" + out
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
self.out = out self.out = out
self.outpos = 0 self.outpos = 0
self.setHtml("") self.setHtml("")
self.lazyRender() self.lazyRender()
def showHTML(self): def showHTML(self):
"""Render message as HTML"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
self.mode = MessageView.MODE_HTML self.mode = MessageView.MODE_HTML
out = self.html.sanitised out = self.html.sanitised
out = "<div align=\"center\" style=\"text-decoration: underline;\"><b>" + unicode(QtGui.QApplication.translate("MessageView", "Click here to disable HTML")) + "</b></div><br/>" + out out = "<div align=\"center\" style=\"text-decoration: underline;\"><b>" + unicode(
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
QtGui.QApplication.translate("MessageView", "Click here to disable HTML")) + "</b></div><br/>" + out
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
self.out = out self.out = out
self.outpos = 0 self.outpos = 0
self.setHtml("") self.setHtml("")
self.lazyRender() self.lazyRender()
def setContent(self, data): def setContent(self, data):
"""Set message content from argument"""
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
self.html = SafeHTMLParser() self.html = SafeHTMLParser()
self.html.reset() self.html.reset()
self.html.reset_safe() self.html.reset_safe()

PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda commented 2018-10-18 17:51:00 +02:00 (Migrated from github.com)
Review
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```

View File

@ -1,20 +1,27 @@
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
from PyQt4 import QtCore, QtGui """
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
import time src/bitmessageqt/networkstatus.py
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
import shared =================================
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"""
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
import time
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
from PyQt4 import QtCore, QtGui
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
from tr import _translate
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
from inventory import Inventory
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
import knownnodes import knownnodes
import l10n import l10n
import network.stats import network.stats
from retranslateui import RetranslateMixin import shared
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
from uisignaler import UISignaler
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
import widgets import widgets
from inventory import Inventory
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
from network.connectionpool import BMConnectionPool from network.connectionpool import BMConnectionPool
from retranslateui import RetranslateMixin
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
from tr import _translate
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
from uisignaler import UISignaler
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
class NetworkStatus(QtGui.QWidget, RetranslateMixin): class NetworkStatus(QtGui.QWidget, RetranslateMixin):
"""Network status tab"""
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
def __init__(self, parent=None): def __init__(self, parent=None):
super(NetworkStatus, self).__init__(parent) super(NetworkStatus, self).__init__(parent)
widgets.load('networkstatus.ui', self) widgets.load('networkstatus.ui', self)
@ -31,6 +38,7 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
l10n.formatTimestamp(self.startup))) l10n.formatTimestamp(self.startup)))
self.UISignalThread = UISignaler.get() self.UISignalThread = UISignaler.get()
# pylint: disable=no-member
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"updateNumberOfMessagesProcessed()"), self.updateNumberOfMessagesProcessed) "updateNumberOfMessagesProcessed()"), self.updateNumberOfMessagesProcessed)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
@ -42,57 +50,108 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.timer = QtCore.QTimer() self.timer = QtCore.QTimer()
QtCore.QObject.connect( QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds) # pylint: enable=no-member
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
def startUpdate(self): def startUpdate(self):
"""Start a timer to update counters every 2 seconds"""
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
Inventory().numberOfInventoryLookupsPerformed = 0 Inventory().numberOfInventoryLookupsPerformed = 0
self.runEveryTwoSeconds() self.runEveryTwoSeconds()
self.timer.start(2000) # milliseconds self.timer.start(2000) # milliseconds
def stopUpdate(self): def stopUpdate(self):
"""Stop counter update timer"""
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.timer.stop() self.timer.stop()
def formatBytes(self, num): def formatBytes(self, num):
for x in [_translate("networkstatus", "byte(s)", None, QtCore.QCoreApplication.CodecForTr, num), "kB", "MB", "GB"]: """Format bytes nicely (SI prefixes)"""
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
# pylint: disable=no-self-use
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
for x in [
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
_translate(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"byte(s)",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
None,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
QtCore.QCoreApplication.CodecForTr,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
num),
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"kB",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"MB",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"GB",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
]:
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
if num < 1000.0: if num < 1000.0:
return "%3.0f %s" % (num, x) return "%3.0f %s" % (num, x)
num /= 1000.0 num /= 1000.0
return "%3.0f %s" % (num, 'TB') return "%3.0f %s" % (num, 'TB')
def formatByteRate(self, num): def formatByteRate(self, num):
"""Format transfer speed in kB/s"""
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
# pylint: disable=no-self-use
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
num /= 1000 num /= 1000
return "%4.0f kB" % num return "%4.0f kB" % num
def updateNumberOfObjectsToBeSynced(self): def updateNumberOfObjectsToBeSynced(self):
self.labelSyncStatus.setText(_translate("networkstatus", "Object(s) to be synced: %n", None, QtCore.QCoreApplication.CodecForTr, network.stats.pendingDownload() + network.stats.pendingUpload())) """Update the counter for number of objects to be synced"""
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.labelSyncStatus.setText(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
_translate(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"Object(s) to be synced: %n",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
None,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
QtCore.QCoreApplication.CodecForTr,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
network.stats.pendingDownload() +
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
network.stats.pendingUpload()))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
def updateNumberOfMessagesProcessed(self): def updateNumberOfMessagesProcessed(self):
"""Update the counter for number of processed messages"""
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.updateNumberOfObjectsToBeSynced() self.updateNumberOfObjectsToBeSynced()
self.labelMessageCount.setText(_translate( self.labelMessageCount.setText(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus", "Processed %n person-to-person message(s).", None, QtCore.QCoreApplication.CodecForTr, shared.numberOfMessagesProcessed)) _translate(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"Processed %n person-to-person message(s).",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
None,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
QtCore.QCoreApplication.CodecForTr,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
shared.numberOfMessagesProcessed))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
def updateNumberOfBroadcastsProcessed(self): def updateNumberOfBroadcastsProcessed(self):
"""Update the counter for the number of processed broadcasts"""
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.updateNumberOfObjectsToBeSynced() self.updateNumberOfObjectsToBeSynced()
self.labelBroadcastCount.setText(_translate( self.labelBroadcastCount.setText(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus", "Processed %n broadcast message(s).", None, QtCore.QCoreApplication.CodecForTr, shared.numberOfBroadcastsProcessed)) _translate(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"Processed %n broadcast message(s).",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
None,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
QtCore.QCoreApplication.CodecForTr,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
shared.numberOfBroadcastsProcessed))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
def updateNumberOfPubkeysProcessed(self): def updateNumberOfPubkeysProcessed(self):
"""Update the counter for the number of processed pubkeys"""
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.updateNumberOfObjectsToBeSynced() self.updateNumberOfObjectsToBeSynced()
self.labelPubkeyCount.setText(_translate( self.labelPubkeyCount.setText(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus", "Processed %n public key(s).", None, QtCore.QCoreApplication.CodecForTr, shared.numberOfPubkeysProcessed)) _translate(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"Processed %n public key(s).",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
None,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
QtCore.QCoreApplication.CodecForTr,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
shared.numberOfPubkeysProcessed))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
def updateNumberOfBytes(self): def updateNumberOfBytes(self):
""" """
This function is run every two seconds, so we divide the rate of bytes This function is run every two seconds, so we divide the rate of bytes
sent and received by 2. sent and received by 2.
""" """
self.labelBytesRecvCount.setText(_translate( self.labelBytesRecvCount.setText(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus", "Down: %1/s Total: %2").arg(self.formatByteRate(network.stats.downloadSpeed()), self.formatBytes(network.stats.receivedBytes()))) _translate(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.labelBytesSentCount.setText(_translate( "networkstatus",
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus", "Up: %1/s Total: %2").arg(self.formatByteRate(network.stats.uploadSpeed()), self.formatBytes(network.stats.sentBytes()))) "Down: %1/s Total: %2").arg(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.formatByteRate(network.stats.downloadSpeed()),
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.formatBytes(network.stats.receivedBytes())))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.labelBytesSentCount.setText(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
_translate(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus", "Up: %1/s Total: %2").arg(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.formatByteRate(network.stats.uploadSpeed()),
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.formatBytes(network.stats.sentBytes())))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
def updateNetworkStatusTab(self, outbound, add, destination): def updateNetworkStatusTab(self, outbound, add, destination):
"""Add or remove an entry to the list of connected peers"""
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
# pylint: disable=too-many-branches,undefined-variable
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
if outbound: if outbound:
try: try:
c = BMConnectionPool().outboundConnections[destination] c = BMConnectionPool().outboundConnections[destination]
@ -111,33 +170,39 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.tableWidgetConnectionCount.setUpdatesEnabled(False) self.tableWidgetConnectionCount.setUpdatesEnabled(False)
self.tableWidgetConnectionCount.setSortingEnabled(False) self.tableWidgetConnectionCount.setSortingEnabled(False)
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
if add: if add:
self.tableWidgetConnectionCount.insertRow(0) self.tableWidgetConnectionCount.insertRow(0)
self.tableWidgetConnectionCount.setItem(0, 0, self.tableWidgetConnectionCount.setItem(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
0, 0,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:15:07 +02:00 (Migrated from github.com)
Review
        """Updates counters, runs every 2 seconds if the timer is running"""
```suggestion """Updates counters, runs every 2 seconds if the timer is running""" ```
QtGui.QTableWidgetItem("%s:%i" % (destination.host, destination.port)) QtGui.QTableWidgetItem("%s:%i" % (destination.host, destination.port))
) )
self.tableWidgetConnectionCount.setItem(0, 2, self.tableWidgetConnectionCount.setItem(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
0, 2,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
QtGui.QTableWidgetItem("%s" % (c.userAgent)) QtGui.QTableWidgetItem("%s" % (c.userAgent))
) )
self.tableWidgetConnectionCount.setItem(0, 3, self.tableWidgetConnectionCount.setItem(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
0, 3,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
QtGui.QTableWidgetItem("%s" % (c.tlsVersion)) QtGui.QTableWidgetItem("%s" % (c.tlsVersion))
) )
self.tableWidgetConnectionCount.setItem(0, 4, self.tableWidgetConnectionCount.setItem(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
QtGui.QTableWidgetItem("%s" % (",".join(map(str,c.streams)))) 0, 4,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
QtGui.QTableWidgetItem("%s" % (",".join(map(str, c.streams))))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
) )
try: try:
# FIXME hard coded stream no # .. todo:: FIXME: hard coded stream no
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
rating = "%.1f" % (knownnodes.knownNodes[1][destination]['rating']) rating = "%.1f" % (knownnodes.knownNodes[1][destination]['rating'])
except KeyError: except KeyError:
rating = "-" rating = "-"
self.tableWidgetConnectionCount.setItem(0, 1, self.tableWidgetConnectionCount.setItem(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
0, 1,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
QtGui.QTableWidgetItem("%s" % (rating)) QtGui.QTableWidgetItem("%s" % (rating))
) )
if outbound: if outbound:
brush = QtGui.QBrush(QtGui.QColor("yellow"), QtCore.Qt.SolidPattern) brush = QtGui.QBrush(QtGui.QColor("yellow"), QtCore.Qt.SolidPattern)
else: else:
brush = QtGui.QBrush(QtGui.QColor("green"), QtCore.Qt.SolidPattern) brush = QtGui.QBrush(QtGui.QColor("green"), QtCore.Qt.SolidPattern)
for j in (range(1)): for j in range(1):
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.tableWidgetConnectionCount.item(0, j).setBackground(brush) self.tableWidgetConnectionCount.item(0, j).setBackground(brush)
self.tableWidgetConnectionCount.item(0, 0).setData(QtCore.Qt.UserRole, destination) self.tableWidgetConnectionCount.item(0, 0).setData(QtCore.Qt.UserRole, destination)
self.tableWidgetConnectionCount.item(0, 1).setData(QtCore.Qt.UserRole, outbound) self.tableWidgetConnectionCount.item(0, 1).setData(QtCore.Qt.UserRole, outbound)
@ -148,11 +213,16 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
if self.tableWidgetConnectionCount.item(i, 1).data(QtCore.Qt.UserRole).toPyObject() == outbound: if self.tableWidgetConnectionCount.item(i, 1).data(QtCore.Qt.UserRole).toPyObject() == outbound:
self.tableWidgetConnectionCount.removeRow(i) self.tableWidgetConnectionCount.removeRow(i)
break break
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.tableWidgetConnectionCount.setUpdatesEnabled(True) self.tableWidgetConnectionCount.setUpdatesEnabled(True)
self.tableWidgetConnectionCount.setSortingEnabled(True) self.tableWidgetConnectionCount.setSortingEnabled(True)
self.labelTotalConnections.setText(_translate( self.labelTotalConnections.setText(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus", "Total Connections: %1").arg(str(self.tableWidgetConnectionCount.rowCount()))) _translate(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
# FYI: The 'singlelistener' thread sets the icon color to green when it receives an incoming connection, meaning that the user's firewall is configured correctly. "networkstatus", "Total Connections: %1").arg(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
str(self.tableWidgetConnectionCount.rowCount())))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
# FYI: The 'singlelistener' thread sets the icon color to green when it
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
# receives an incoming connection, meaning that the user's firewall is
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
# configured correctly.
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
if self.tableWidgetConnectionCount.rowCount() and shared.statusIconColor == 'red': if self.tableWidgetConnectionCount.rowCount() and shared.statusIconColor == 'red':
self.window().setStatusIcon('yellow') self.window().setStatusIcon('yellow')
elif self.tableWidgetConnectionCount.rowCount() == 0 and shared.statusIconColor != "red": elif self.tableWidgetConnectionCount.rowCount() == 0 and shared.statusIconColor != "red":
@ -160,8 +230,9 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
# timer driven # timer driven
def runEveryTwoSeconds(self): def runEveryTwoSeconds(self):
self.labelLookupsPerSecond.setText(_translate( """Updates counters, runs every 2 seconds if the timer is running"""
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"networkstatus", "Inventory lookups per second: %1").arg(str(Inventory().numberOfInventoryLookupsPerformed/2))) self.labelLookupsPerSecond.setText(_translate("networkstatus", "Inventory lookups per second: %1").arg(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
str(Inventory().numberOfInventoryLookupsPerformed / 2)))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
Inventory().numberOfInventoryLookupsPerformed = 0 Inventory().numberOfInventoryLookupsPerformed = 0
self.updateNumberOfBytes() self.updateNumberOfBytes()
self.updateNumberOfObjectsToBeSynced() self.updateNumberOfObjectsToBeSynced()

PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```

View File

@ -1,40 +1,41 @@
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
src/class_singleWorker.py
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
=========================
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# pylint: disable=protected-access,too-many-branches,too-many-statements,no-self-use,too-many-lines,too-many-locals
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
from __future__ import division from __future__ import division
import time
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import threading
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import hashlib import hashlib
from struct import pack import threading
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# used when the API must execute an outside program import time
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
from subprocess import call # nosec
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
from binascii import hexlify, unhexlify from binascii import hexlify, unhexlify
from struct import pack
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
from subprocess import call # nosec
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import tr import defaults
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import helper_inbox
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import helper_msgcoding
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import helper_random
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import highlevelcrypto
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import l10n import l10n
import proofofwork
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import protocol import protocol
import queues import queues
import state
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import shared import shared
import defaults import state
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import highlevelcrypto import tr
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import proofofwork from addresses import calculateInventoryHash, decodeAddress, decodeVarint, encodeVarint
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import helper_inbox
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import helper_random
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
import helper_msgcoding
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
from debug import logger from debug import logger
from inventory import Inventory from helper_sql import sqlExecute, sqlQuery
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
from addresses import (
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
decodeAddress, encodeVarint, decodeVarint, calculateInventoryHash
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
)
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# from helper_generic import addDataPadding
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
from helper_threading import StoppableThread from helper_threading import StoppableThread
from helper_sql import sqlQuery, sqlExecute from inventory import Inventory
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# This thread, of which there is only one, does the heavy lifting:
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# calculating POWs.
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
def sizeof_fmt(num, suffix='h/s'): def sizeof_fmt(num, suffix='h/s'):
"""Format hashes per seconds nicely (SI prefix)"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
for unit in ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z']: for unit in ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z']:
if abs(num) < 1000.0: if abs(num) < 1000.0:
return "%3.1f%s%s" % (num, unit, suffix) return "%3.1f%s%s" % (num, unit, suffix)
@ -43,14 +44,16 @@ def sizeof_fmt(num, suffix='h/s'):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
class singleWorker(threading.Thread, StoppableThread): class singleWorker(threading.Thread, StoppableThread):
"""Thread for performing PoW"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
def __init__(self): def __init__(self):
# QThread.__init__(self, parent)
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
threading.Thread.__init__(self, name="singleWorker") threading.Thread.__init__(self, name="singleWorker")
self.initStop() self.initStop()
proofofwork.init() proofofwork.init()
def stopThread(self): def stopThread(self):
"""Signal through the queue that the thread should be stopped"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
try: try:
queues.workerQueue.put(("stopThread", "data")) queues.workerQueue.put(("stopThread", "data"))
except: except:
@ -58,6 +61,7 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
super(singleWorker, self).stopThread() super(singleWorker, self).stopThread()
def run(self): def run(self):
# pylint: disable=attribute-defined-outside-init
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
while not state.sqlReady and state.shutdown == 0: while not state.sqlReady and state.shutdown == 0:
self.stop.wait(2) self.stop.wait(2)
@ -96,12 +100,12 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
'''SELECT ackdata FROM sent WHERE status = 'msgsent' ''') '''SELECT ackdata FROM sent WHERE status = 'msgsent' ''')
for row in queryreturn: for row in queryreturn:
ackdata, = row ackdata, = row
logger.info('Watching for ackdata ' + hexlify(ackdata)) logger.info('Watching for ackdata %s', hexlify(ackdata))
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
shared.ackdataForWhichImWatching[ackdata] = 0 shared.ackdataForWhichImWatching[ackdata] = 0
# Fix legacy (headerless) watched ackdata to include header # Fix legacy (headerless) watched ackdata to include header
for oldack in shared.ackdataForWhichImWatching.keys(): for oldack in shared.ackdataForWhichImWatching:
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
if (len(oldack) == 32): if len(oldack) == 32:
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# attach legacy header, always constant (msg/1/1) # attach legacy header, always constant (msg/1/1)
newack = '\x00\x00\x00\x02\x01\x01' + oldack newack = '\x00\x00\x00\x02\x01\x01' + oldack
shared.ackdataForWhichImWatching[newack] = 0 shared.ackdataForWhichImWatching[newack] = 0
@ -226,19 +230,9 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# inventoryHash = calculateInventoryHash(payload) # inventoryHash = calculateInventoryHash(payload)
PeterSurda commented 2018-10-18 18:18:28 +02:00 (Migrated from github.com)
Review

The docstring is above the method in a comment.

The docstring is above the method in a comment.
return payload return payload
# This function also broadcasts out the pubkey message
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# once it is done with the POW
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
def doPOWForMyV2Pubkey(self, adressHash): def doPOWForMyV2Pubkey(self, adressHash):
""" This function also broadcasts out the pubkey message once it is done with the POW"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# Look up my stream number based on my address hash # Look up my stream number based on my address hash
"""configSections = shared.config.addresses()
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
for addressInKeysFile in configSections:
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
if addressInKeysFile != 'bitmessagesettings':
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
status, addressVersionNumber, streamNumber, \
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
hashFromThisParticularAddress = \
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
decodeAddress(addressInKeysFile)
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
if hash == hashFromThisParticularAddress:
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
myAddress = addressInKeysFile
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
break"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
myAddress = shared.myAddressesByHash[adressHash] myAddress = shared.myAddressesByHash[adressHash]
# status # status
_, addressVersionNumber, streamNumber, adressHash = decodeAddress(myAddress) _, addressVersionNumber, streamNumber, adressHash = decodeAddress(myAddress)
@ -289,11 +283,12 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# before this finished. # before this finished.
pass pass
# If this isn't a chan address, this function assembles the pubkey data,
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# does the necessary POW and sends it out. If it *is* a chan then it
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# assembles the pubkey and stores is in the pubkey table so that we can
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# send messages to "ourselves".
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
def sendOutOrStoreMyV3Pubkey(self, adressHash): def sendOutOrStoreMyV3Pubkey(self, adressHash):
"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:21:18 +02:00 (Migrated from github.com)
Review

The docstring is before the method as a comment.

The docstring is before the method as a comment.
If this isn't a chan address, this function assembles the pubkey data, does the necessary POW and sends it out.
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
If it *is* a chan then it assembles the pubkey and stores is in the pubkey table so that we can send messages
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
to "ourselves".
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
try: try:
myAddress = shared.myAddressesByHash[adressHash] myAddress = shared.myAddressesByHash[adressHash]
except: except:
@ -357,7 +352,7 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
Inventory()[inventoryHash] = ( Inventory()[inventoryHash] = (
objectType, streamNumber, payload, embeddedTime, '') objectType, streamNumber, payload, embeddedTime, '')
logger.info('broadcasting inv with hash: ' + hexlify(inventoryHash)) logger.info('broadcasting inv with hash: %s', hexlify(inventoryHash))
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
queues.invQueue.put((streamNumber, inventoryHash)) queues.invQueue.put((streamNumber, inventoryHash))
queues.UISignalQueue.put(('updateStatusBar', '')) queues.UISignalQueue.put(('updateStatusBar', ''))
@ -370,9 +365,12 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# before this finished. # before this finished.
pass pass
# If this isn't a chan address, this function assembles
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# the pubkey data, does the necessary POW and sends it out.
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
def sendOutOrStoreMyV4Pubkey(self, myAddress): def sendOutOrStoreMyV4Pubkey(self, myAddress):
"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
It doesn't send directly anymore. It put is to a queue for another thread to send at an appropriate time,
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
whereas in the past it directly appended it to the outgoing buffer, I think. Same with all the other methods in
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
this class.
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
if not BMConfigParser().has_section(myAddress): if not BMConfigParser().has_section(myAddress):
# The address has been deleted. # The address has been deleted.
return return
@ -444,7 +442,7 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
doubleHashOfAddressData[32:] doubleHashOfAddressData[32:]
) )
logger.info('broadcasting inv with hash: ' + hexlify(inventoryHash)) logger.info('broadcasting inv with hash: %s', hexlify(inventoryHash))
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
queues.invQueue.put((streamNumber, inventoryHash)) queues.invQueue.put((streamNumber, inventoryHash))
queues.UISignalQueue.put(('updateStatusBar', '')) queues.UISignalQueue.put(('updateStatusBar', ''))
@ -459,6 +457,7 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
) )
def sendBroadcast(self): def sendBroadcast(self):
"""Send a broadcast-type object (assemble the object, perform PoW and put it to the inv announcement queue)"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# Reset just in case # Reset just in case
sqlExecute( sqlExecute(
'''UPDATE sent SET status='broadcastqueued' ''' '''UPDATE sent SET status='broadcastqueued' '''
@ -627,6 +626,8 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
) )
def sendMsg(self): def sendMsg(self):
"""Send a message-type object (assemble the object, perform PoW and put it to the inv announcement queue)"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# pylint: disable=too-many-nested-blocks
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# Reset just in case # Reset just in case
sqlExecute( sqlExecute(
'''UPDATE sent SET status='msgqueued' ''' '''UPDATE sent SET status='msgqueued' '''
@ -740,10 +741,8 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# object associated with the tag for this toAddress. # object associated with the tag for this toAddress.
if toAddressVersionNumber >= 4: if toAddressVersionNumber >= 4:
doubleHashOfToAddressData = hashlib.sha512( doubleHashOfToAddressData = hashlib.sha512(
hashlib.sha512(encodeVarint( hashlib.sha512(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
toAddressVersionNumber) + encodeVarint(toAddressVersionNumber) + encodeVarint(toStreamNumber) + toRipe
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
encodeVarint(toStreamNumber) +
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
toRipe
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
).digest() ).digest()
).digest() ).digest()
# The first half of the sha512 hash. # The first half of the sha512 hash.
@ -834,7 +833,7 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
queryreturn = sqlQuery( queryreturn = sqlQuery(
'SELECT transmitdata FROM pubkeys WHERE address=?', 'SELECT transmitdata FROM pubkeys WHERE address=?',
toaddress) toaddress)
for row in queryreturn: for row in queryreturn: # pylint: disable=redefined-outer-name
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
pubkeyPayload, = row pubkeyPayload, = row
# The pubkey message is stored with the following items # The pubkey message is stored with the following items
@ -939,40 +938,43 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
requiredAverageProofOfWorkNonceTrialsPerByte, requiredAverageProofOfWorkNonceTrialsPerByte,
requiredPayloadLengthExtraBytes requiredPayloadLengthExtraBytes
) )
queues.UISignalQueue.put((
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
'updateSentItemStatusByAckdata', ( queues.UISignalQueue.put(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
'updateSentItemStatusByAckdata',
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
ackdata, ackdata,
tr._translate( tr._translate(
"MainWindow", "MainWindow",
"Doing work necessary to send message.\n" "Doing work necessary to send message.\n"
"Receiver\'s required difficulty: %1" "Receiver\'s required difficulty: %1"
" and %2" " and %2"
).arg(str(float( ).arg(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
requiredAverageProofOfWorkNonceTrialsPerByte) / str(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
float(requiredAverageProofOfWorkNonceTrialsPerByte) /
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
defaults.networkDefaultProofOfWorkNonceTrialsPerByte defaults.networkDefaultProofOfWorkNonceTrialsPerByte
)).arg(str(float( )
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
requiredPayloadLengthExtraBytes) / ).arg(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
str(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
float(requiredPayloadLengthExtraBytes) /
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
defaults.networkDefaultPayloadLengthExtraBytes defaults.networkDefaultPayloadLengthExtraBytes
))))) )
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
)
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
)
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
)
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
)
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
if status != 'forcepow': if status != 'forcepow':
if (requiredAverageProofOfWorkNonceTrialsPerByte maxacceptablenoncetrialsperbyte = BMConfigParser().getint(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
> BMConfigParser().getint( 'bitmessagesettings', 'maxacceptablenoncetrialsperbyte')
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
'bitmessagesettings', maxacceptablepayloadlengthextrabytes = BMConfigParser().getint(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
'maxacceptablenoncetrialsperbyte' 'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes')
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
) and cond1 = maxacceptablenoncetrialsperbyte and \
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
BMConfigParser().getint( requiredAverageProofOfWorkNonceTrialsPerByte > maxacceptablenoncetrialsperbyte
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
'bitmessagesettings', cond2 = maxacceptablepayloadlengthextrabytes and \
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
'maxacceptablenoncetrialsperbyte' requiredPayloadLengthExtraBytes > maxacceptablepayloadlengthextrabytes
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
) != 0) or (
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
requiredPayloadLengthExtraBytes if cond1 or cond2:
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
> BMConfigParser().getint(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
'bitmessagesettings',
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
'maxacceptablepayloadlengthextrabytes'
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
) and
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
BMConfigParser().getint(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
'bitmessagesettings',
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
'maxacceptablepayloadlengthextrabytes'
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
) != 0):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# The demanded difficulty is more than # The demanded difficulty is more than
# we are willing to do. # we are willing to do.
sqlExecute( sqlExecute(
@ -988,19 +990,15 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
" the recipient (%1 and %2) is" " the recipient (%1 and %2) is"
" more difficult than you are" " more difficult than you are"
" willing to do. %3" " willing to do. %3"
).arg(str(float( ).arg(str(float(requiredAverageProofOfWorkNonceTrialsPerByte) /
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
requiredAverageProofOfWorkNonceTrialsPerByte) defaults.networkDefaultProofOfWorkNonceTrialsPerByte)).arg(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
/ defaults.networkDefaultProofOfWorkNonceTrialsPerByte str(float(requiredPayloadLengthExtraBytes) /
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
)).arg(str(float( defaults.networkDefaultPayloadLengthExtraBytes)).arg(
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
requiredPayloadLengthExtraBytes) l10n.formatTimestamp()))))
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
/ defaults.networkDefaultPayloadLengthExtraBytes
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
)).arg(l10n.formatTimestamp()))
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
))
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
continue continue
else: # if we are sending a message to ourselves or a chan.. else: # if we are sending a message to ourselves or a chan..
logger.info('Sending a message.') logger.info('Sending a message.')
logger.debug( logger.debug('First 150 characters of message: %r', message[:150])
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
'First 150 characters of message: %r', message[:150])
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
behaviorBitfield = protocol.getBitfield(fromaddress) behaviorBitfield = protocol.getBitfield(fromaddress)
try: try:
@ -1199,16 +1197,14 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
Inventory()[inventoryHash] = ( Inventory()[inventoryHash] = (
objectType, toStreamNumber, encryptedPayload, embeddedTime, '') objectType, toStreamNumber, encryptedPayload, embeddedTime, '')
if BMConfigParser().has_section(toaddress) or \ if BMConfigParser().has_section(toaddress) or \
not protocol.checkBitfield( not protocol.checkBitfield(behaviorBitfield, protocol.BITFIELD_DOESACK):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
behaviorBitfield, protocol.BITFIELD_DOESACK):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
queues.UISignalQueue.put(( queues.UISignalQueue.put((
'updateSentItemStatusByAckdata', ( 'updateSentItemStatusByAckdata', (
ackdata, ackdata,
tr._translate( tr._translate(
"MainWindow", "MainWindow",
"Message sent. Sent at %1" "Message sent. Sent at %1"
).arg(l10n.formatTimestamp())) ).arg(l10n.formatTimestamp()))))
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
))
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
else: else:
# not sending to a chan or one of my addresses # not sending to a chan or one of my addresses
queues.UISignalQueue.put(( queues.UISignalQueue.put((
@ -1229,8 +1225,7 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# Update the sent message in the sent table with the # Update the sent message in the sent table with the
# necessary information. # necessary information.
if BMConfigParser().has_section(toaddress) or \ if BMConfigParser().has_section(toaddress) or \
not protocol.checkBitfield( not protocol.checkBitfield(behaviorBitfield, protocol.BITFIELD_DOESACK):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
behaviorBitfield, protocol.BITFIELD_DOESACK):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
newStatus = 'msgsentnoackexpected' newStatus = 'msgsentnoackexpected'
else: else:
newStatus = 'msgsent' newStatus = 'msgsent'
@ -1270,6 +1265,7 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
call([apiNotifyPath, "newMessage"]) call([apiNotifyPath, "newMessage"])
def requestPubKey(self, toAddress): def requestPubKey(self, toAddress):
"""Send a getpubkey object"""
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
toStatus, addressVersionNumber, streamNumber, ripe = decodeAddress( toStatus, addressVersionNumber, streamNumber, ripe = decodeAddress(
toAddress) toAddress)
if toStatus != 'success': if toStatus != 'success':
@ -1286,7 +1282,7 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
''' LIMIT 1''', ''' LIMIT 1''',
toAddress toAddress
) )
if len(queryReturn) == 0: if not queryReturn:
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
logger.critical( logger.critical(
'BUG: Why are we requesting the pubkey for %s' 'BUG: Why are we requesting the pubkey for %s'
' if there are no messages in the sent folder' ' if there are no messages in the sent folder'
@ -1389,16 +1385,14 @@ class singleWorker(threading.Thread, StoppableThread):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
).arg(l10n.formatTimestamp())) ).arg(l10n.formatTimestamp()))
)) ))
def generateFullAckMessage(self, ackdata, toStreamNumber, TTL): def generateFullAckMessage(self, ackdata, _, TTL):
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# It might be perfectly fine to just use the same TTL for """
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# the ackdata that we use for the message. But I would rather It might be perfectly fine to just use the same TTL for the ackdata that we use for the message. But I would
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# it be more difficult for attackers to associate ackData with rather it be more difficult for attackers to associate ackData with the associated msg object. However, users
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# the associated msg object. However, users would want the TTL would want the TTL of the acknowledgement to be about the same as they set for the message itself. So let's set
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# of the acknowledgement to be about the same as they set the TTL of the acknowledgement to be in one of three 'buckets': 1 hour, 7 days, or 28 days, whichever is
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# for the message itself. So let's set the TTL of the relatively close to what the user specified.
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# acknowledgement to be in one of three 'buckets': 1 hour, 7 """
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# days, or 28 days, whichever is relatively close to what the
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
# user specified.
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
if TTL < 24 * 60 * 60: # 1 day if TTL < 24 * 60 * 60: # 1 day
TTL = 24 * 60 * 60 # 1 day TTL = 24 * 60 * 60 # 1 day
elif TTL < 7 * 24 * 60 * 60: # 1 week elif TTL < 7 * 24 * 60 * 60: # 1 week

PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda commented 2018-10-18 18:15:37 +02:00 (Migrated from github.com)
Review
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```