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
Showing only changes of commit 0a30eb0225 - Show all commits

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
import multiprocessing
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""" ```
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""" ```
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""" ```
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_HTML = 1
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""" ```
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""" ```
super(MessageView, self).__init__(parent)
self.mode = MessageView.MODE_PLAIN
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()
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)
self.setWrappingWidth(event.size().width())
def mousePressEvent(self, event):
#text = textCursor.block().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""" ```
if event.button() == QtCore.Qt.LeftButton and self.html and self.html.has_html and self.cursorForPosition(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""" ```
"""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""" ```
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""" ```
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:
self.showHTML()
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)
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(MessageView, self).wheelEvent(event)
if (QtGui.QApplication.queryKeyboardModifiers() & 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""" ```
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""" ```
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
QtGui.QApplication.activeWindow().statusBar().showMessage(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""" ```
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""" ```
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):
"""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)
if width is None:
width = self.width()
self.setLineWrapColumnOrWidth(width)
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":
window = QtGui.QApplication.activeWindow()
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()
return
reply = QtGui.QMessageBox.warning(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""" ```
QtGui.QApplication.translate("MessageView", "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("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())),
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)
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""" ```
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""" ```
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""" ```
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""" ```
"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:
QtGui.QDesktopServices.openUrl(link)
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""" ```
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""" ```
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""" ```
# 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 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""" ```
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
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):
"""
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:
return
self.rendering = True
position = self.verticalScrollBar().value()
cursor = QtGui.QTextCursor(self.document())
while self.outpos < len(self.out) and self.verticalScrollBar().value() >= 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""" ```
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""" ```
) >= 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
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
@ -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
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
out = self.html.raw
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
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""" ```
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""" ```
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.outpos = 0
self.setHtml("")
self.lazyRender()
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
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
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""" ```
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""" ```
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.outpos = 0
self.setHtml("")
self.lazyRender()
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.reset()
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""" ```
import time
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""" ```
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""" ```
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 l10n
import network.stats
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 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 shared
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
import widgets
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""" ```
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):
"""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):
super(NetworkStatus, self).__init__(parent)
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)))
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(
"updateNumberOfMessagesProcessed()"), self.updateNumberOfMessagesProcessed)
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()
QtCore.QObject.connect(
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)
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.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""" ```
# 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""" ```
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
self.runEveryTwoSeconds()
self.timer.start(2000) # milliseconds
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()
def formatBytes(self, num):
for x in [_translate("networkstatus", "byte(s)", None, QtCore.QCoreApplication.CodecForTr, num), "kB", "MB", "GB"]:
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"""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""" ```
# 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:
return "%3.0f %s" % (num, x)
num /= 1000.0
return "%3.0f %s" % (num, 'TB')
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
return "%4.0f kB" % num
def updateNumberOfObjectsToBeSynced(self):
self.labelSyncStatus.setText(_translate("networkstatus", "Object(s) to be synced: %n", None, QtCore.QCoreApplication.CodecForTr, network.stats.pendingDownload() + 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""" ```
"""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""" ```
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):
"""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.labelMessageCount.setText(_translate(
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))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
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""" ```
_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""" ```
"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):
"""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.labelBroadcastCount.setText(_translate(
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))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
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""" ```
_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""" ```
"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):
"""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.labelPubkeyCount.setText(_translate(
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))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
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""" ```
_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""" ```
"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):
"""
This function is run every two seconds, so we divide the rate of bytes
sent and received by 2.
"""
self.labelBytesRecvCount.setText(_translate(
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())))
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(
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())))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
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""" ```
_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""" ```
"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""" ```
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):
"""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:
try:
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.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:
self.tableWidgetConnectionCount.insertRow(0)
self.tableWidgetConnectionCount.setItem(0, 0,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
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""" ```
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))
)
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.tableWidgetConnectionCount.setItem(0, 2,
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.setItem(
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))
)
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.tableWidgetConnectionCount.setItem(0, 3,
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.setItem(
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))
)
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
self.tableWidgetConnectionCount.setItem(0, 4,
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""" ```
)
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.setItem(
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
0, 4,
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""" ```
)
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
try:
# 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""" ```
# .. 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""" ```
rating = "%.1f" % (knownnodes.knownNodes[1][destination]['rating'])
except KeyError:
rating = "-"
self.tableWidgetConnectionCount.setItem(0, 1,
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
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""" ```
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))
)
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 outbound:
brush = QtGui.QBrush(QtGui.QColor("yellow"), QtCore.Qt.SolidPattern)
else:
brush = QtGui.QBrush(QtGui.QColor("green"), QtCore.Qt.SolidPattern)
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""" ```
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""" ```
self.tableWidgetConnectionCount.item(0, j).setBackground(brush)
self.tableWidgetConnectionCount.item(0, 0).setData(QtCore.Qt.UserRole, destination)
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:
self.tableWidgetConnectionCount.removeRow(i)
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.setSortingEnabled(True)
self.labelTotalConnections.setText(_translate(
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())))
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.
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
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""" ```
_translate(
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(
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':
self.window().setStatusIcon('yellow')
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
def runEveryTwoSeconds(self):
self.labelLookupsPerSecond.setText(_translate(
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)))
PeterSurda commented 2018-10-18 18:07:07 +02:00 (Migrated from github.com)
Review
    """Network status tab"""
```suggestion """Network status tab""" ```
"""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""" ```
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""" ```
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
self.updateNumberOfBytes()
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
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
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)""" ```
# used when the API must execute an outside program
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 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 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)""" ```
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
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 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)""" ```
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 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 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 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)""" ```
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 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 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)""" ```
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 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)""" ```
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)""" ```
from bmconfigparser import BMConfigParser
from debug import logger
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)""" ```
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_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)""" ```
from helper_threading import StoppableThread
from helper_sql import sqlQuery, sqlExecute
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 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)""" ```
# 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'):
"""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']:
if abs(num) < 1000.0:
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):
"""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):
# 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")
self.initStop()
proofofwork.init()
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:
queues.workerQueue.put(("stopThread", "data"))
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()
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:
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' ''')
for row in queryreturn:
ackdata, = row
logger.info('Watching for ackdata ' + 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)""" ```
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)""" ```
shared.ackdataForWhichImWatching[ackdata] = 0
# Fix legacy (headerless) watched ackdata to include header
for oldack in shared.ackdataForWhichImWatching.keys():
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):
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 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)""" ```
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)""" ```
# attach legacy header, always constant (msg/1/1)
newack = '\x00\x00\x00\x02\x01\x01' + oldack
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)
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
# 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):
""" 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
"""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]
# status
_, 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.
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):
"""
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:
myAddress = shared.myAddressesByHash[adressHash]
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] = (
objectType, streamNumber, payload, embeddedTime, '')
logger.info('broadcasting inv with hash: ' + 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)""" ```
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)""" ```
queues.invQueue.put((streamNumber, inventoryHash))
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.
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):
"""
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):
# The address has been deleted.
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:]
)
logger.info('broadcasting inv with hash: ' + 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)""" ```
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)""" ```
queues.invQueue.put((streamNumber, inventoryHash))
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):
"""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
sqlExecute(
'''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):
"""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
sqlExecute(
'''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.
if toAddressVersionNumber >= 4:
doubleHashOfToAddressData = hashlib.sha512(
hashlib.sha512(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)""" ```
toAddressVersionNumber) +
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)""" ```
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)""" ```
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)""" ```
).digest()
).digest()
# 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(
'SELECT transmitdata FROM pubkeys WHERE address=?',
toaddress)
for row in 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)""" ```
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)""" ```
pubkeyPayload, = row
# 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,
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)""" ```
'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)""" ```
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)""" ```
tr._translate(
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)""" ```
"MainWindow",
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)""" ```
"Doing work necessary to send message.\n"
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)""" ```
"Receiver\'s required difficulty: %1"
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 %2"
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(
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) /
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
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(
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) /
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)""" ```
)))))
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.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',
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,
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)""" ```
tr._translate(
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)""" ```
"MainWindow",
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)""" ```
"Doing work necessary to send message.\n"
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)""" ```
"Receiver\'s required difficulty: %1"
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 %2"
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(
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(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
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(
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
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 (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)""" ```
> 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)""" ```
'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)""" ```
) 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)""" ```
'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)""" ```
) != 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)""" ```
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)""" ```
> 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)""" ```
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)""" ```
'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)""" ```
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)""" ```
'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)""" ```
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)""" ```
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)""" ```
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)""" ```
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)""" ```
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)""" ```
# The demanded difficulty is more than
# we are willing to do.
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"
" more difficult than you are"
" willing to do. %3"
).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)""" ```
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
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(
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)
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)""" ```
).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)""" ```
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)""" ```
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)""" ```
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)""" ```
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)""" ```
continue
else: # if we are sending a message to ourselves or a chan..
logger.info('Sending a message.')
logger.debug(
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)""" ```
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)""" ```
behaviorBitfield = protocol.getBitfield(fromaddress)
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] = (
objectType, toStreamNumber, encryptedPayload, embeddedTime, '')
if BMConfigParser().has_section(toaddress) or \
not protocol.checkBitfield(
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)""" ```
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)""" ```
queues.UISignalQueue.put((
'updateSentItemStatusByAckdata', (
ackdata,
tr._translate(
"MainWindow",
"Message sent. Sent at %1"
).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)""" ```
).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)""" ```
else:
# not sending to a chan or one of my addresses
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
# necessary information.
if BMConfigParser().has_section(toaddress) or \
not protocol.checkBitfield(
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)""" ```
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)""" ```
newStatus = 'msgsentnoackexpected'
else:
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"])
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(
toAddress)
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''',
toAddress
)
if len(queryReturn) == 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)""" ```
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)""" ```
logger.critical(
'BUG: Why are we requesting the pubkey for %s'
' 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()))
))
def generateFullAckMessage(self, ackdata, toStreamNumber, 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)""" ```
# 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)""" ```
# the ackdata that we use for the message. But I would rather
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
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
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
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
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)""" ```
# 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)""" ```
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 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)""" ```
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)""" ```
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)""" ```
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)""" ```
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)""" ```
if TTL < 24 * 60 * 60: # 1 day
TTL = 24 * 60 * 60 # 1 day
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)""" ```