Changes based on style and lint checks. (final_code_quality_19) #1401

Closed
coffeedogs wants to merge 1 commits from final_code_quality_19 into v0.6
coffeedogs commented 2018-11-26 16:54:00 +01:00 (Migrated from github.com)

Changes based on style and lint checks. (final_code_quality_19)

Changes based on style and lint checks. (final_code_quality_19)
PeterSurda (Migrated from github.com) reviewed 2018-12-04 12:52:54 +01:00
@ -43,2 +53,4 @@
return start + expovariate(1.0 / average) + FLUFF_TRIGGER_FIXED_DELAY
def addHash(self, hashId, source=None, stream=1):
""""""
PeterSurda (Migrated from github.com) commented 2018-12-04 12:52:54 +01:00
    """Dandelion class for tracking stem/fluff stages."""
```suggestion """Dandelion class for tracking stem/fluff stages.""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 12:54:15 +01:00
@ -67,12 +81,15 @@ class Dandelion():
pass
def hasHash(self, hashId):
""""""
PeterSurda (Migrated from github.com) commented 2018-12-04 12:54:15 +01:00
        """Generate deadline using Poisson distribution"""
```suggestion """Generate deadline using Poisson distribution""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 12:56:01 +01:00
@ -75,3 +91,4 @@
def maybeAddStem(self, connection):
""""""
# fewer than MAX_STEMS outbound connections at last reshuffle?
with self.lock:
PeterSurda (Migrated from github.com) commented 2018-12-04 12:56:00 +01:00
        """Add inventory vector to dandelion stem"""
```suggestion """Add inventory vector to dandelion stem""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 12:57:11 +01:00
@ -88,3 +104,4 @@
""""""
# is the stem active?
with self.lock:
if connection in self.stem:
PeterSurda (Migrated from github.com) commented 2018-12-04 12:57:10 +01:00
        """Update stream for inventory vector (as inv/dinv commands don't include streams, we only learn this after receiving the object)"""
```suggestion """Update stream for inventory vector (as inv/dinv commands don't include streams, we only learn this after receiving the object)""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 12:58:10 +01:00
@ -99,3 +116,4 @@
""""""
try:
# pick a random from available stems
stem = choice(range(len(self.stem)))
PeterSurda (Migrated from github.com) commented 2018-12-04 12:58:10 +01:00
        """Switch inventory vector from stem to fluff mode"""
```suggestion """Switch inventory vector from stem to fluff mode""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 12:58:54 +01:00
PeterSurda (Migrated from github.com) commented 2018-12-04 12:58:54 +01:00
        """Is inventory vector in stem mode?"""
```suggestion """Is inventory vector in stem mode?""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 12:59:54 +01:00
@ -112,6 +130,7 @@ class Dandelion():
return None
def getNodeStem(self, node=None):
""""""
PeterSurda (Migrated from github.com) commented 2018-12-04 12:59:54 +01:00
        """Child (i.e. next) node for an inventory vector during stem mode"""
```suggestion """Child (i.e. next) node for an inventory vector during stem mode""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:02:05 +01:00
@ -115,3 +133,4 @@
""""""
with self.lock:
try:
return self.nodeMap[node]
PeterSurda (Migrated from github.com) commented 2018-12-04 13:02:05 +01:00
        """If we had too few outbound connections, add the current one to the current stem list. Dandelion as designed by the authors should always have two active stem child connections."""
```suggestion """If we had too few outbound connections, add the current one to the current stem list. Dandelion as designed by the authors should always have two active stem child connections.""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:02:46 +01:00
PeterSurda (Migrated from github.com) commented 2018-12-04 13:02:46 +01:00
        """Remove current connection from the stem list (called e.g. when a connection is closed)."""
```suggestion """Remove current connection from the stem list (called e.g. when a connection is closed).""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:04:06 +01:00
PeterSurda (Migrated from github.com) commented 2018-12-04 13:04:06 +01:00
        """Pick a random active stem, but not the parent one (the one where an object came from)"""
```suggestion """Pick a random active stem, but not the parent one (the one where an object came from)""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:05:42 +01:00
PeterSurda (Migrated from github.com) commented 2018-12-04 13:05:42 +01:00
        """Return child stem node for a given parent stem node (the mapping is static for about 10 minutes, then it reshuffles)"""
```suggestion """Return child stem node for a given parent stem node (the mapping is static for about 10 minutes, then it reshuffles)""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:07:04 +01:00
PeterSurda (Migrated from github.com) commented 2018-12-04 13:07:04 +01:00
        """Switch expired objects from stem to fluff mode"""
```suggestion """Switch expired objects from stem to fluff mode""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:07:42 +01:00
PeterSurda (Migrated from github.com) commented 2018-12-04 13:07:42 +01:00
        """Re-shuffle stem mapping (parent <-> child pairs)"""
```suggestion """Re-shuffle stem mapping (parent <-> child pairs)""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:08:28 +01:00
@ -5,3 +12,4 @@
class Socks4aError(ProxyError):
""""""
errorCodes = ("Request granted",
PeterSurda (Migrated from github.com) commented 2018-12-04 13:08:28 +01:00
    """SOCKS4a error base class"""
```suggestion """SOCKS4a error base class""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:08:41 +01:00
@ -16,4 +25,4 @@
Proxy.__init__(self, address)
self.ipaddr = None
self.destport = address[1]
PeterSurda (Migrated from github.com) commented 2018-12-04 13:08:41 +01:00
    """SOCKS4a proxy class"""
```suggestion """SOCKS4a proxy class""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:09:00 +01:00
@ -22,3 +32,4 @@
return True
def state_pre_connect(self):
""""""
PeterSurda (Migrated from github.com) commented 2018-12-04 13:09:00 +01:00
        """Protocol initialisation (before connection is established)"""
```suggestion """Protocol initialisation (before connection is established)""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:09:45 +01:00
PeterSurda (Migrated from github.com) commented 2018-12-04 13:09:45 +01:00
        """Handle feedback from SOCKS4a while it is connecting on our behalf."""
```suggestion """Handle feedback from SOCKS4a while it is connecting on our behalf.""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:10:54 +01:00
@ -91,12 +106,14 @@ class Socks4aConnection(Socks4a):
PeterSurda (Migrated from github.com) commented 2018-12-04 13:10:54 +01:00
        """Handle return value when using SOCKS4a for DNS resolving instead of connecting."""
```suggestion """Handle return value when using SOCKS4a for DNS resolving instead of connecting.""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:12:32 +01:00
@ -93,3 +108,4 @@
class Socks4aResolver(Socks4a):
""""""
def __init__(self, host):
self.host = host
PeterSurda (Migrated from github.com) commented 2018-12-04 13:12:32 +01:00
    """Child SOCKS4a class used for making outbound connections."""
```suggestion """Child SOCKS4a class used for making outbound connections.""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:12:50 +01:00
@ -97,3 +113,4 @@
Socks4a.__init__(self, address=(self.host, self.port))
def state_auth_done(self):
""""""
PeterSurda (Migrated from github.com) commented 2018-12-04 13:12:50 +01:00
        """Request connection to be made"""
```suggestion """Request connection to be made""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:13:24 +01:00
PeterSurda (Migrated from github.com) commented 2018-12-04 13:13:24 +01:00
        """Tell SOCKS4a to initiate a connection"""
```suggestion """Tell SOCKS4a to initiate a connection""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:13:49 +01:00
PeterSurda (Migrated from github.com) commented 2018-12-04 13:13:49 +01:00
        """DNS resolver class using SOCKS4a"""
```suggestion """DNS resolver class using SOCKS4a""" ```
PeterSurda (Migrated from github.com) reviewed 2018-12-04 13:14:15 +01:00
PeterSurda (Migrated from github.com) commented 2018-12-04 13:14:15 +01:00
        """Resolving is done, process the return value. To use this within PyBitmessage, a callback needs to be
        implemented which hasn't been done yet."""
```suggestion """Resolving is done, process the return value. To use this within PyBitmessage, a callback needs to be implemented which hasn't been done yet.""" ```
PeterSurda (Migrated from github.com) requested changes 2018-12-04 13:14:31 +01:00
PeterSurda (Migrated from github.com) left a comment

Update docstrings, otherwise ok.

Update docstrings, otherwise ok.
This repo is archived. You cannot comment on pull requests.
No description provided.