Skip to content

Commit 9a43344

Browse files
author
MarcoFalke
committed
Merge #14947: scripts: Remove Python 2 import workarounds
4de11a3 Remove Python 2 import workarounds (practicalswift) Pull request description: Remove Python 2 import workarounds. As noted by @jnewbery in bitcoin/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
2 parents d88d1f8 + 4de11a3 commit 9a43344

File tree

4 files changed

+4
-18
lines changed

4 files changed

+4
-18
lines changed

contrib/devtools/github-merge.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
# In case of a clean merge that is accepted by the user, the local branch with
1616
# name $BRANCH is overwritten with the merged result, and optionally pushed.
17-
from __future__ import division,print_function,unicode_literals
1817
import os
1918
from sys import stdin,stdout,stderr
2019
import argparse
@@ -23,10 +22,7 @@
2322
import sys
2423
import json
2524
import codecs
26-
try:
27-
from urllib.request import Request,urlopen
28-
except ImportError:
29-
from urllib2 import Request,urlopen
25+
from urllib.request import Request, urlopen
3026

3127
# External tools (can be overridden using environment)
3228
GIT = os.getenv('GIT','git')

contrib/linearize/linearize-data.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
88
#
99

10-
from __future__ import print_function, division
1110
import struct
1211
import re
1312
import os

contrib/linearize/linearize-hashes.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
88
#
99

10-
from __future__ import print_function
11-
try: # Python 3
12-
import http.client as httplib
13-
except ImportError: # Python 2
14-
import httplib
10+
from http.client import HttpConnection
1511
import json
1612
import re
1713
import base64
@@ -31,7 +27,7 @@ def __init__(self, host, port, username, password):
3127
authpair = "%s:%s" % (username, password)
3228
authpair = authpair.encode('utf-8')
3329
self.authhdr = b"Basic " + base64.b64encode(authpair)
34-
self.conn = httplib.HTTPConnection(host, port=port, timeout=30)
30+
self.conn = HttpConnection(host, port=port, timeout=30)
3531

3632
def execute(self, obj):
3733
try:

test/util/bitcoin-util-test.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,9 @@
99
1010
Can also be run manually."""
1111

12-
from __future__ import division,print_function,unicode_literals
13-
1412
import argparse
1513
import binascii
16-
try:
17-
import configparser
18-
except ImportError:
19-
import ConfigParser as configparser
14+
import configparser
2015
import difflib
2116
import json
2217
import logging

0 commit comments

Comments
 (0)