mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-15 11:36:00 -05:00
Merge #14947: scripts: Remove Python 2 import workarounds
4de11a3682
Remove Python 2 import workarounds (practicalswift)
Pull request description:
Remove Python 2 import workarounds.
As noted by @jnewbery in https://github.com/bitcoin/bitcoin/pull/14903#discussion_r241396925:
> 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
This commit is contained in:
commit
9a43344430
4 changed files with 4 additions and 18 deletions
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
# In case of a clean merge that is accepted by the user, the local branch with
|
# 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.
|
# name $BRANCH is overwritten with the merged result, and optionally pushed.
|
||||||
from __future__ import division,print_function,unicode_literals
|
|
||||||
import os
|
import os
|
||||||
from sys import stdin,stdout,stderr
|
from sys import stdin,stdout,stderr
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -23,10 +22,7 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import codecs
|
import codecs
|
||||||
try:
|
from urllib.request import Request, urlopen
|
||||||
from urllib.request import Request,urlopen
|
|
||||||
except ImportError:
|
|
||||||
from urllib2 import Request,urlopen
|
|
||||||
|
|
||||||
# External tools (can be overridden using environment)
|
# External tools (can be overridden using environment)
|
||||||
GIT = os.getenv('GIT','git')
|
GIT = os.getenv('GIT','git')
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
#
|
#
|
||||||
|
|
||||||
from __future__ import print_function, division
|
|
||||||
import struct
|
import struct
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -7,11 +7,7 @@
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
#
|
#
|
||||||
|
|
||||||
from __future__ import print_function
|
from http.client import HttpConnection
|
||||||
try: # Python 3
|
|
||||||
import http.client as httplib
|
|
||||||
except ImportError: # Python 2
|
|
||||||
import httplib
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import base64
|
import base64
|
||||||
|
@ -31,7 +27,7 @@ class BitcoinRPC:
|
||||||
authpair = "%s:%s" % (username, password)
|
authpair = "%s:%s" % (username, password)
|
||||||
authpair = authpair.encode('utf-8')
|
authpair = authpair.encode('utf-8')
|
||||||
self.authhdr = b"Basic " + base64.b64encode(authpair)
|
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):
|
def execute(self, obj):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -9,14 +9,9 @@ Runs automatically during `make check`.
|
||||||
|
|
||||||
Can also be run manually."""
|
Can also be run manually."""
|
||||||
|
|
||||||
from __future__ import division,print_function,unicode_literals
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import binascii
|
import binascii
|
||||||
try:
|
import configparser
|
||||||
import configparser
|
|
||||||
except ImportError:
|
|
||||||
import ConfigParser as configparser
|
|
||||||
import difflib
|
import difflib
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
Loading…
Add table
Reference in a new issue