Skip to content

Commit

Permalink
Merge bitcoin#14947: scripts: Remove Python 2 import workarounds
Browse files Browse the repository at this point in the history
4de11a3 Remove Python 2 import workarounds (practicalswift)

Pull request description:

  Remove Python 2 import workarounds.

  As noted by @jnewbery in bitcoin#14903 (comment):

  > This exception handling is a vestige from when github-merge.py supported Python 2 and Python 3. We only support Python 3 now so we should be able to remove it entirely and just import from urllib.request.

Tree-SHA512: e0d21e6299dd62fb669ad95cbd3d19f7c803195fd336621aac72fd10ddc7431d90443831072a2e1eb2fc880d1d88eb7c3e2ead3da59f545f6db07d349af98fb3
  • Loading branch information
MarcoFalke authored and pravblockc committed Aug 3, 2021
1 parent a753b89 commit a41ca89
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 20 deletions.
6 changes: 1 addition & 5 deletions contrib/devtools/github-merge.py
Expand Up @@ -14,7 +14,6 @@

# In case of a clean merge that is accepted by the user, the local branch with
# name $BRANCH is overwritten with the merged result, and optionally pushed.
from __future__ import division,print_function,unicode_literals
import os
from sys import stdin,stdout,stderr
import argparse
Expand All @@ -23,10 +22,7 @@
import sys
import json
import codecs
try:
from urllib.request import Request,urlopen
except:
from urllib2 import Request,urlopen
from urllib.request import Request, urlopen

# External tools (can be overridden using environment)
GIT = os.getenv('GIT','git')
Expand Down
1 change: 0 additions & 1 deletion contrib/linearize/linearize-data.py
Expand Up @@ -7,7 +7,6 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#

from __future__ import print_function, division
import struct
import re
import os
Expand Down
8 changes: 2 additions & 6 deletions contrib/linearize/linearize-hashes.py
Expand Up @@ -7,11 +7,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#

from __future__ import print_function
try: # Python 3
import http.client as httplib
except ImportError: # Python 2
import httplib
from http.client import HttpConnection
import json
import re
import base64
Expand All @@ -31,7 +27,7 @@ def __init__(self, host, port, username, password):
authpair = "%s:%s" % (username, password)
authpair = authpair.encode('utf-8')
self.authhdr = b"Basic " + base64.b64encode(authpair)
self.conn = httplib.HTTPConnection(host, port=port, timeout=30)
self.conn = HttpConnection(host, port=port, timeout=30)

def execute(self, obj):
try:
Expand Down
2 changes: 1 addition & 1 deletion src/test/denialofservice_tests.cpp
Expand Up @@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE(outbound_slow_chain_eviction)
static void AddRandomOutboundPeer(std::vector<CNode *> &vNodes, PeerLogicValidation &peerLogic, CConnmanTest* connman)
{
CAddress addr(ip(g_insecure_rand_ctx.randbits(32)), NODE_NONE);
vNodes.emplace_back(new CNode(id++, ServiceFlags(NODE_NETWORK|NODE_WITNESS), 0, INVALID_SOCKET, addr, 0, 0, CAddress(), "", /*fInboundIn=*/ false));
vNodes.emplace_back(new CNode(id++, ServiceFlags(NODE_NETWORK), 0, INVALID_SOCKET, addr, 0, 0, CAddress(), "", /*fInboundIn=*/ false));
CNode &node = *vNodes.back();
node.SetSendVersion(PROTOCOL_VERSION);

Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_framework/test_framework.py
Expand Up @@ -321,7 +321,7 @@ def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, binary=None):
assert_equal(len(binary), num_nodes)
for i in range(num_nodes):
numnode = len(self.nodes)
self.nodes.append(TestNode(numnode, get_datadir_path(self.options.tmpdir, numnode), rpchost=rpchost, timewait=self.rpc_timewait, bitcoind=binary[i], bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli))
self.nodes.append(TestNode(numnode, get_datadir_path(self.options.tmpdir, numnode), self.extra_args_from_options, chain=self.chain, rpchost=rpchost, timewait=self.rpc_timewait, bitcoind=binary[i], bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli))

def start_node(self, i, *args, **kwargs):
"""Start a dashd"""
Expand Down
7 changes: 1 addition & 6 deletions test/util/bitcoin-util-test.py
Expand Up @@ -9,14 +9,9 @@
Can also be run manually."""

from __future__ import division,print_function,unicode_literals

import argparse
import binascii
try:
import configparser
except ImportError:
import ConfigParser as configparser
import configparser
import difflib
import json
import logging
Expand Down

0 comments on commit a41ca89

Please sign in to comment.