Changes based on style and lint checks. (final_code_quality_3) #1356

Merged
coffeedogs merged 1 commits from final_code_quality_3 into v0.6 2018-10-31 14:21:20 +01:00
coffeedogs commented 2018-10-04 16:25:32 +02:00 (Migrated from github.com)

Changes based on style and lint checks. (final_code_quality_3)

Changes based on style and lint checks. (final_code_quality_3)
PeterSurda (Migrated from github.com) requested changes 2018-10-04 17:43:31 +02:00
PeterSurda (Migrated from github.com) left a comment

Please amend the docstrings based on my feedback. About two are left, which I'm unsure about and will have to check.

Please amend the docstrings based on my feedback. About two are left, which I'm unsure about and will have to check.
@ -9,3 +16,4 @@
class ProcessingError(Exception):
"""General class for protocol parser exception, use as a base for others."""
pass
PeterSurda (Migrated from github.com) commented 2018-10-04 17:26:43 +02:00

General class for protocol parser exception, use as a base for others.

General class for protocol parser exception, use as a base for others.
@ -13,2 +21,4 @@
class UnknownStateError(ProcessingError):
"""Parser points to an unknown (unimplemented) state."""
pass
PeterSurda (Migrated from github.com) commented 2018-10-04 17:28:05 +02:00

Parser points to an unknown (unimplemented) state.

Parser points to an unknown (unimplemented) state.
@ -16,2 +27,3 @@
class AdvancedDispatcher(asyncore.dispatcher):
_buf_len = 131072 # 128kB
"""Improved version of asyncore dispatcher, with buffers and protocol state."""
# pylint: disable=too-many-instance-attributes
PeterSurda (Migrated from github.com) commented 2018-10-04 17:29:02 +02:00

Improved version of asyncore dispatcher, with buffers and protocol state.

Improved version of asyncore dispatcher, with buffers and protocol state.
PeterSurda (Migrated from github.com) commented 2018-10-04 17:29:27 +02:00

Append binary data to the end of stream write buffer.

Append binary data to the end of stream write buffer.
@ -82,2 +99,4 @@
self.state = state_str
def writable(self):
"""Is data from the write buffer ready to be sent to the network?"""
PeterSurda (Migrated from github.com) commented 2018-10-04 17:30:09 +02:00

Cut the beginning of the stream write buffer.

Cut the beginning of the stream write buffer.
PeterSurda (Migrated from github.com) commented 2018-10-04 17:30:33 +02:00

Cut the beginning of the stream read buffer.

Cut the beginning of the stream read buffer.
@ -112,3 +133,4 @@
def handle_write(self):
"""Send outgoing data from write buffer."""
self.lastTx = time.time()
PeterSurda (Migrated from github.com) commented 2018-10-04 17:31:40 +02:00

Process (parse) data that's in the buffer, as long as there is enough data and the connection is open.

Process (parse) data that's in the buffer, as long as there is enough data and the connection is open.
PeterSurda (Migrated from github.com) commented 2018-10-04 17:32:04 +02:00

Set the next processing state.

Set the next processing state.
PeterSurda (Migrated from github.com) commented 2018-10-04 17:33:00 +02:00

Is data from the write buffer ready to be sent to the network?

Is data from the write buffer ready to be sent to the network?
PeterSurda (Migrated from github.com) commented 2018-10-04 17:33:17 +02:00

Is the read buffer ready to accept data from the network?

Is the read buffer ready to accept data from the network?
PeterSurda (Migrated from github.com) commented 2018-10-04 17:33:38 +02:00

Append incoming data to the read buffer.

Append incoming data to the read buffer.
PeterSurda (Migrated from github.com) commented 2018-10-04 17:34:01 +02:00

Send outgoing data from write buffer.

Send outgoing data from write buffer.
PeterSurda (Migrated from github.com) commented 2018-10-04 17:34:47 +02:00

Callback for connection established event.

Callback for connection established event.
PeterSurda (Migrated from github.com) commented 2018-10-04 17:35:58 +02:00

Signal to the processing loop to end.

Signal to the processing loop to end.
@ -11,3 +17,4 @@
class BMObjectInsufficientPOWError(Exception):
"""Exception indicating the object doesn't have sufficient proof of work."""
errorCodes = ("Insufficient proof of work")
PeterSurda (Migrated from github.com) commented 2018-10-04 17:36:40 +02:00

Exception indicating the object doesn't have sufficient proof of work.

Exception indicating the object doesn't have sufficient proof of work.
@ -15,3 +22,4 @@
class BMObjectInvalidDataError(Exception):
"""Exception indicating the data being parsed does not match the specification."""
errorCodes = ("Data invalid")
PeterSurda (Migrated from github.com) commented 2018-10-04 17:37:26 +02:00

Exception indicating the data being parsed does not match the specification.

Exception indicating the data being parsed does not match the specification.
@ -19,3 +27,4 @@
class BMObjectExpiredError(Exception):
"""Exception indicating the object's lifetime has expired."""
errorCodes = ("Object expired")
PeterSurda (Migrated from github.com) commented 2018-10-04 17:37:55 +02:00

Exception indicating the object's lifetime has expired.

Exception indicating the object's lifetime has expired.
@ -23,3 +32,4 @@
class BMObjectUnwantedStreamError(Exception):
"""Exception indicating the object is in a stream we didn't advertise as being interested in."""
errorCodes = ("Object in unwanted stream")
PeterSurda (Migrated from github.com) commented 2018-10-04 17:38:17 +02:00

Exception indicating the object is in a stream we didn't advertise as being interested in.

Exception indicating the object is in a stream we didn't advertise as being interested in.
@ -27,3 +37,4 @@
class BMObjectInvalidError(Exception):
"""The object's data does not match object specification."""
errorCodes = ("Invalid object")
PeterSurda (Migrated from github.com) commented 2018-10-04 17:38:47 +02:00

The object's data does not match object specification.

The object's data does not match object specification.
@ -31,3 +42,4 @@
class BMObjectAlreadyHaveError(Exception):
"""We received a duplicate object (one we already have)"""
errorCodes = ("Already have this object")
PeterSurda (Migrated from github.com) commented 2018-10-04 17:39:07 +02:00

We received a duplicate object (one we already have)

We received a duplicate object (one we already have)
@ -35,1 +47,4 @@
class BMObject(object):
"""Bitmessage Object as a class."""
# pylint: disable=too-many-instance-attributes
PeterSurda (Migrated from github.com) commented 2018-10-04 17:39:33 +02:00

Bitmessage Object as a class.

Bitmessage Object as a class.
@ -108,1 +148,3 @@
logger.debug('The payload length of this broadcast packet is unreasonably low. Someone is probably trying funny business. Ignoring message.')
logger.debug(
'The payload length of this broadcast packet is unreasonably low.'
' Someone is probably trying funny business. Ignoring message.')
PeterSurda (Migrated from github.com) commented 2018-10-04 17:39:56 +02:00

Perform a proof of work check for sufficiency.

Perform a proof of work check for sufficiency.
PeterSurda (Migrated from github.com) commented 2018-10-04 17:40:28 +02:00

Check if object's lifetime isn't ridiculously far in the past or future.

Check if object's lifetime isn't ridiculously far in the past or future.
PeterSurda (Migrated from github.com) commented 2018-10-04 17:40:51 +02:00

Check if object's stream matches streams we are interested in

Check if object's stream matches streams we are interested in
PeterSurda (Migrated from github.com) commented 2018-10-04 17:41:16 +02:00

Check if we already have the object (so that we don't duplicate it in inventory or advertise it unnecessarily)

Check if we already have the object (so that we don't duplicate it in inventory or advertise it unnecessarily)
PeterSurda (Migrated from github.com) commented 2018-10-04 17:41:57 +02:00

Call a object type specific check (objects can have additional checks based on their types)

Call a object type specific check (objects can have additional checks based on their types)
PeterSurda (Migrated from github.com) commented 2018-10-04 17:42:11 +02:00

"Message" object type checks.

"Message" object type checks.
PeterSurda (Migrated from github.com) commented 2018-10-04 17:42:27 +02:00

"Getpubkey" object type checks.

"Getpubkey" object type checks.
PeterSurda (Migrated from github.com) commented 2018-10-04 17:42:38 +02:00

"Pubkey" object type checks.

"Pubkey" object type checks.
PeterSurda (Migrated from github.com) commented 2018-10-04 17:42:52 +02:00

"Broadcast" object type checks.

"Broadcast" object type checks.
coffeedogs commented 2018-10-04 19:28:29 +02:00 (Migrated from github.com)

All supplied docstrings added. One relative import made less relative.

All supplied docstrings added. One relative import made less relative.
PeterSurda (Migrated from github.com) reviewed 2018-10-10 13:12:18 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-10 13:12:17 +02:00

Base class for handling connection established implementations.

Base class for handling connection established implementations.
PeterSurda (Migrated from github.com) reviewed 2018-10-10 13:14:16 +02:00
PeterSurda (Migrated from github.com) commented 2018-10-10 13:14:16 +02:00

Callback for connection being closed, but can also be called directly when you want connection to close.

Callback for connection being closed, but can also be called directly when you want connection to close.
PeterSurda (Migrated from github.com) reviewed 2018-10-10 13:19:33 +02:00
PeterSurda (Migrated from github.com) left a comment

I updated the last 2 missing docstrings, just add those and rebase and it's ready to go.

I updated the last 2 missing docstrings, just add those and rebase and it's ready to go.
coffeedogs (Migrated from github.com) reviewed 2018-10-15 12:22:24 +02:00
coffeedogs (Migrated from github.com) commented 2018-10-15 12:22:23 +02:00

Guessing you meant 'method' instead of 'base class' there.

Guessing you meant 'method' instead of 'base class' there.
PeterSurda (Migrated from github.com) approved these changes 2018-10-27 13:09:18 +02:00
This repo is archived. You cannot comment on pull requests.
No description provided.