Changes based on style and lint checks. (final_code_quality_4) #1362
No reviewers
Labels
No Label
bug
build
dependencies
developers
documentation
duplicate
enhancement
formatting
invalid
legal
mobile
obsolete
packaging
performance
protocol
question
refactoring
regression
security
test
translation
usability
wontfix
No Milestone
No project
No Assignees
1 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Bitmessage/PyBitmessage-2024-12-18#1362
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "final_code_quality_4"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Changes based on style and lint checks. (final_code_quality_4)
Looks like pycodestyle check fails if the file doesn't exist. Not sure where the check is defined but I'm guessing a quick shell check before might work (if the shell is bash:
if [ -e $filename ] ; then pycodestyle $filename; fi
)@coffeedogs Ok, will check. It's all written in python BTW, no shell. The algorithm for calculating new annotations did have a bug triggerd by removing a file, I thought I fixed it or maybe there's something that I missed.
Updated pylint checks to ignore E902 (IOError), requeued check.
Improved handling of removed files.
@ -22,0 +32,4 @@
anywhere. Current versions do have support for threading and multiprocessing. I don't see an urgent reason to
refactor this, but it should be noted in the comment that the problem is mostly not valid. Sadly, last time I
checked, there is no reliable way to check whether the library is or isn't thread-safe.
"""
This actually only applies for certain deployments, and/or really old version of sqlite. I haven't actually seen it anywhere. Current versions do have support for threading and multiprocessing. I don't see an urgent reason to refactor this, but it should be noted in the comment that the problem is mostly not valid. Sadly, last time I checked, there is no reliable way to check whether the library is or isn't thread-safe.
@ -371,1 +409,4 @@
buffer(self.payload[objectOffset:]), self.object.expiresTime,
buffer(self.object.tag)
)
self.handleReceivedObject(self.object.streamNumber, self.object.inventoryHash)
PS. the wire protocol works very similarly to Bitcoin, so even if the command isn't documented in Bitmessage Wiki, just look at how it works in Bitcoin.
I don' think this is a todo. It's just an explanation of what the
if
is doing.@ -522,2 +581,4 @@
logger.debug("Closed connection to %s because I'm connected to myself.",
str(self.destination))
return False
This however IS a todo. This loop may take a while, during which time a lot of other stuff is locked. Should be refactored in the future.
@ -429,6 +480,8 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
return True
def bm_command_version(self):
I think this isn't necessary. Returning here will prevent verack from being sent. Without that the handshake is considered incomplete, other commands are ignored and the connection will timeout after 20 seconds. The error message in the write buffer has this time to make it through. Probably a leftover from early stages, please remove this "todo".
@ -453,1 +505,4 @@
network.connectionpool.BMConnectionPool().streams,
True,
nodeid=self.nodeid))
if ((self.services & protocol.NODE_SSL == protocol.NODE_SSL) and
@ -453,1 +505,4 @@
network.connectionpool.BMConnectionPool().streams,
True,
nodeid=self.nodeid))
if ((self.services & protocol.NODE_SSL == protocol.NODE_SSL) and
Typo?
@ -1,4 +1,9 @@
"""SocksiPy - Python SOCKS module.
# pylint: disable=too-many-arguments,global-statement,too-many-branches
"""
This file will be removed once asyncore Socks resolver is finished, so I don't care about it. For P2P connections over Socks we're already using my port of this to asyncore. The only thing missing is a callback mechansim and tests, the actual resolving over wire protocol is implemented, but I never tested it (or maybe I tested it very shortly).
Change the docstrings according to comments, check the typos. Otherwise OK.
@ -522,2 +581,4 @@
logger.debug("Closed connection to %s because I'm connected to myself.",
str(self.destination))
return False
BTW, the rST syntax so that the sphinx documentation can both format and collect a list of all todo items.
It doesn't indicate a header presence, it expects it, according to the protocol specification.
@ -176,4 +209,4 @@
if char == "v":
return self.decode_payload_varint()
if char == "i":
return self.decode_payload_node()
Again, doesn't indicate, but expects, the presence of a command.
Minor docstring updates.
%s
causesstr()
itself - no need to convert args.use
%r
instead of str(repr(parameters))