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
coffeedogs commented 2018-10-10 12:50:46 +02:00 (Migrated from github.com)

Changes based on style and lint checks. (final_code_quality_7)

Changes based on style and lint checks. (final_code_quality_7)
PeterSurda (Migrated from github.com) reviewed 2018-10-18 17:51:00 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 17:51:00 +02:00
    """Message content viewer class, can switch between plaintext and HTML"""
```suggestion """Message content viewer class, can switch between plaintext and HTML""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 17:51:45 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 17:51:45 +02:00
        """View resize event handler"""
```suggestion """View resize event handler""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 17:52:03 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 17:52:03 +02:00
        """Mouse press button event handler"""
```suggestion """Mouse press button event handler""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 17:52:36 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 17:52:36 +02:00
        """Mouse wheel scroll event handler"""
```suggestion """Mouse wheel scroll event handler""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 17:57:08 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 17:57:08 +02:00
        """Set word-wrapping width"""
```suggestion """Set word-wrapping width""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 17:57:52 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 17:57:52 +02:00
        """Show a dialog requesting URL opening confirmation"""
```suggestion """Show a dialog requesting URL opening confirmation""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:02:15 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:02:15 +02:00
        """Callback for loading referenced objects, such as an image. For security reasons at the moment doesn't do anything)"""
```suggestion """Callback for loading referenced objects, such as an image. For security reasons at the moment doesn't do anything)""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:03:54 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:03:54 +02:00
        """Partially render a message. This is to avoid UI freezing when loading huge messages. It continues loading as you scroll down."""
```suggestion """Partially render a message. This is to avoid UI freezing when loading huge messages. It continues loading as you scroll down.""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:04:37 +02:00
@ -100,2 +114,4 @@
while self.outpos < len(self.out) and self.verticalScrollBar().value(
) >= self.document().size().height() - 2 * self.size().height():
startpos = self.outpos
self.outpos += 10240
PeterSurda (Migrated from github.com) commented 2018-10-18 18:04:37 +02:00
        """Render message as plain text."""
```suggestion """Render message as plain text.""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:05:12 +02:00
@ -100,2 +114,4 @@
while self.outpos < len(self.out) and self.verticalScrollBar().value(
) >= self.document().size().height() - 2 * self.size().height():
startpos = self.outpos
self.outpos += 10240
PeterSurda (Migrated from github.com) commented 2018-10-18 18:05:12 +02:00
        """Render message as HTML"""
```suggestion """Render message as HTML""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:05:44 +02:00
@ -100,2 +114,4 @@
while self.outpos < len(self.out) and self.verticalScrollBar().value(
) >= self.document().size().height() - 2 * self.size().height():
startpos = self.outpos
self.outpos += 10240
PeterSurda (Migrated from github.com) commented 2018-10-18 18:05:43 +02:00
        """Set message content from argument"""
```suggestion """Set message content from argument""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:07:07 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:07:07 +02:00
    """Network status tab"""
```suggestion """Network status tab""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:07:46 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:07:46 +02:00
        """Start a timer to update counters every 2 seconds"""
```suggestion """Start a timer to update counters every 2 seconds""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:08:08 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:08:08 +02:00
        """Stop counter update timer"""
```suggestion """Stop counter update timer""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:08:42 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:08:42 +02:00
        """Format bytes nicely (SI prefixes)"""
```suggestion """Format bytes nicely (SI prefixes)""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:09:24 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:09:24 +02:00
        """Format transfer speed in kB/s"""
```suggestion """Format transfer speed in kB/s""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:09:58 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:09:58 +02:00
        """Update the counter for number of objects to be synced"""
```suggestion """Update the counter for number of objects to be synced""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:10:22 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:10:22 +02:00
        """Update the counter for number of processed messages"""
```suggestion """Update the counter for number of processed messages""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:10:44 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:10:44 +02:00
        """Update the counter for the number of processed broadcasts"""
```suggestion """Update the counter for the number of processed broadcasts""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:11:06 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:11:06 +02:00
        """Update the counter for the number of processed pubkeys"""
```suggestion """Update the counter for the number of processed pubkeys""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:12:54 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:12:54 +02:00
        """Add or remove an entry to the list of connected peers"""
```suggestion """Add or remove an entry to the list of connected peers""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:14:26 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:14:26 +02:00

Where did this whole section go?

Where did this whole section go?
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:15:07 +02:00
@ -115,2 +175,3 @@
self.tableWidgetConnectionCount.insertRow(0)
self.tableWidgetConnectionCount.setItem(0, 0,
self.tableWidgetConnectionCount.setItem(
0, 0,
PeterSurda (Migrated from github.com) commented 2018-10-18 18:15:07 +02:00
        """Updates counters, runs every 2 seconds if the timer is running"""
```suggestion """Updates counters, runs every 2 seconds if the timer is running""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:15:37 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:15:37 +02:00
    """Format hashes per seconds nicely (SI prefix)"""
```suggestion """Format hashes per seconds nicely (SI prefix)""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:16:39 +02:00
@ -38,3 +38,4 @@
for unit in ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z']:
if abs(num) < 1000.0:
return "%3.1f%s%s" % (num, unit, suffix)
PeterSurda (Migrated from github.com) commented 2018-10-18 18:16:38 +02:00
    """Thread for performing PoW"""
```suggestion """Thread for performing PoW""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:17:18 +02:00
@ -38,3 +38,4 @@
for unit in ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z']:
if abs(num) < 1000.0:
return "%3.1f%s%s" % (num, unit, suffix)
PeterSurda (Migrated from github.com) commented 2018-10-18 18:17:18 +02:00
        """Signal through the queue that the thread should be stopped"""
```suggestion """Signal through the queue that the thread should be stopped""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:18:28 +02:00
@ -226,19 +230,9 @@ class singleWorker(threading.Thread, StoppableThread):
# inventoryHash = calculateInventoryHash(payload)
PeterSurda (Migrated from github.com) commented 2018-10-18 18:18:28 +02:00

The docstring is above the method in a comment.

The docstring is above the method in a comment.
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:21:18 +02:00
@ -294,3 +286,2 @@
# assembles the pubkey and stores is in the pubkey table so that we can
# send messages to "ourselves".
def sendOutOrStoreMyV3Pubkey(self, adressHash):
"""
PeterSurda (Migrated from github.com) commented 2018-10-18 18:21:18 +02:00

The docstring is before the method as a comment.

The docstring is before the method as a comment.
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:23:02 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:23:02 +02:00

It doesn't send directly anymore. It put is to a queue for another thread to send at an appropriate time, whereas in the past it directly appended it to the outgoing buffer, I think. Same with all the other methods in this class.

It doesn't send directly anymore. It put is to a queue for another thread to send at an appropriate time, whereas in the past it directly appended it to the outgoing buffer, I think. Same with all the other methods in this class.
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:24:06 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:24:06 +02:00
        """Send a broadcast-type object (assemble the object, perform PoW and put it to the inv announcement queue)"""
```suggestion """Send a broadcast-type object (assemble the object, perform PoW and put it to the inv announcement queue)""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:24:30 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:24:30 +02:00
        """Send a message-type object (assemble the object, perform PoW and put it to the inv announcement queue)"""
```suggestion """Send a message-type object (assemble the object, perform PoW and put it to the inv announcement queue)""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:25:38 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:25:37 +02:00

Docstring below in comment.

Docstring below in comment.
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:26:09 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:26:09 +02:00
        """Send a getpubkey object"""
```suggestion """Send a getpubkey object""" ```
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:45:41 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-18 18:45:41 +02:00

👍 nice

:+1: nice
PeterSurda (Migrated from github.com) reviewed 2018-10-18 18:46:47 +02:00
PeterSurda (Migrated from github.com) left a comment

Update docstrings and find out what happened to the missing section.

Update docstrings and find out what happened to the missing section.
coffeedogs (Migrated from github.com) reviewed 2018-10-18 21:38:53 +02:00
coffeedogs (Migrated from github.com) commented 2018-10-18 21:38:53 +02:00

If this section was ever hit, c would not be in scope. Since we're not seeing associated NameError's, I assume this code is never hit.

If this section was ever hit, `c` would not be in scope. Since we're not seeing associated `NameError`'s, I assume this code is never hit.
PeterSurda (Migrated from github.com) reviewed 2018-10-19 08:08:34 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-19 08:08:34 +02:00

Your assumptions are incorrect. The KeyError handlers are there to prevent adding invalid connections. Without this section the list of connected peers will remain empty forever.

Your assumptions are incorrect. The `KeyError` handlers are there to prevent adding invalid connections. Without this section the list of connected peers will remain empty forever.
coffeedogs (Migrated from github.com) reviewed 2018-10-20 15:43:58 +02:00
coffeedogs (Migrated from github.com) commented 2018-10-20 15:43:58 +02:00

I have reverted this section and added an undefined-variable pylint marker on the method and inline noqa markers for flake8. If you can explain to me where c gets defined such that the setItem() calls don't fail I'd be keen to learn something here.

I have reverted this section and added an `undefined-variable` pylint marker on the method and inline `noqa` markers for flake8. If you can explain to me where `c` gets defined such that the `setItem()` calls don't fail I'd be keen to learn something here.
PeterSurda (Migrated from github.com) reviewed 2018-10-20 16:35:23 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-20 16:35:23 +02:00

You removed the assignments for c

You removed the assignments for `c`
PeterSurda (Migrated from github.com) reviewed 2018-10-20 16:35:41 +02:00
PeterSurda (Migrated from github.com) left a comment

Please put the c = assignment back.

Please put the `c =` assignment back.
coffeedogs (Migrated from github.com) reviewed 2018-10-24 16:03:24 +02:00
coffeedogs (Migrated from github.com) commented 2018-10-24 16:03:24 +02:00

Well that would explain it. Not sure how that happened, sorry. I've reverted the removal of the assignments.

Well that would explain it. Not sure how that happened, sorry. I've reverted the removal of the assignments.
PeterSurda (Migrated from github.com) approved these changes 2018-11-02 06:15:40 +01:00
This repo is archived. You cannot comment on pull requests.
No description provided.