Browse Source

Merge #853: Fix remaining flake8 errors and add linter script

ab439617f3 Add flake8 linter script (Kristaps Kaupe)
512fab735a Fix remaining flake8 errors (Kristaps Kaupe)

Pull request description:

Top commit has no ACKs.

Tree-SHA512: 73cd6e308dbe8f387eaf4203a35778aa22fc229231cb6624f66c1412a4041a20ecc4b842b0ad411fcd018002486b9c6016a4f2ae0c95c9480478ca6f5d8b878d
master
Kristaps Kaupe 5 years ago
parent
commit
13c28ecfc2
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  1. 2
      conftest.py
  2. 2
      jmbase/jmbase/twisted_utils.py
  3. 4
      jmdaemon/jmdaemon/daemon_protocol.py
  4. 1
      scripts/snicker/snicker-finder.py
  5. 1
      scripts/snicker/snicker-recovery.py
  6. 16
      test/lint/lint-python.sh

2
conftest.py

@ -17,7 +17,7 @@ def get_bitcoind_version(version_string):
# this utility function returns the version number
# as a tuple in the form (major, minor, patch)
version_tuple = re.match(
b'.*v(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)',
br'.*v(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)',
version_string).groups()
return tuple(map(lambda x: int(x), version_tuple))

2
jmbase/jmbase/twisted_utils.py

@ -2,7 +2,7 @@
from zope.interface import implementer
from twisted.internet.error import ReactorNotRunning
from twisted.internet import reactor, defer
from twisted.internet.endpoints import TCP4ClientEndpoint
from twisted.internet.endpoints import TCP4ClientEndpoint, UNIXClientEndpoint
from twisted.web.client import Agent, BrowserLikePolicyForHTTPS
import txtorcon
from txtorcon.web import tor_agent

4
jmdaemon/jmdaemon/daemon_protocol.py

@ -415,8 +415,8 @@ class SNICKERDaemonServerProtocol(HTTPPassThrough):
@SNICKERReceiverGetProposals.responder
def on_SNICKER_RECEIVER_GET_PROPOSALS(self):
for server in self.servers:
self.getRequest(server, self.receive_proposals_from_server)
for srv in self.servers:
self.getRequest(srv, self.receive_proposals_from_server)
return {'accepted': True}
def receive_proposals_from_server(self, response, server):

1
scripts/snicker/snicker-finder.py

@ -24,6 +24,7 @@ in Bitcoin Core in order to get full transactions, since it
parses the raw blocks.
"""
import sys
from optparse import OptionParser
from jmbase import bintohex, EXIT_ARGERROR, jmprint
import jmbitcoin as btc

1
scripts/snicker/snicker-recovery.py

@ -24,6 +24,7 @@ keys, so as a reminder, *always* back up either jmdat wallet files,
or at least, the imported keys themselves.)
"""
import sys
from optparse import OptionParser
from jmbase import bintohex, EXIT_ARGERROR, jmprint
import jmbitcoin as btc

16
test/lint/lint-python.sh

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Based on Bitcoin Core's test/lint/lint-python.sh
if ! command -v flake8 > /dev/null; then
echo "Skipping Python linting since flake8 is not installed."
exit 0
elif flake8 --version | grep -q "Python 2"; then
echo "Skipping Python linting since flake8 is running under Python 2. Install the Python 3 version of flake8."
exit 0
fi
if [[ $# == 0 ]]; then
flake8 $(git ls-files "*.py")
else
flake8 "$@"
fi
Loading…
Cancel
Save