diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index b6f00657ec914..4c4a2bd1e9d5a 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -7,10 +7,7 @@ import re import os -try: - from urllib.request import urlopen -except ImportError: - from urllib2 import urlopen +from urllib.request import urlopen CLASS_INDEX_PAGE_URL = "https://clang.llvm.org/doxygen/classes.html" try: diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view index d01aebb4029a7..b63f494adfbe7 100755 --- a/clang/tools/scan-view/bin/scan-view +++ b/clang/tools/scan-view/bin/scan-view @@ -10,10 +10,7 @@ import os import posixpath import threading import time -try: - from urllib.request import urlopen -except ImportError: - from urllib2 import urlopen +from urllib.request import urlopen import webbrowser # How long to wait for server to start. @@ -39,7 +36,6 @@ def url_is_up(url): def start_browser(port, options): - import webbrowser url = 'http://%s:%d' % (options.host, port) @@ -83,10 +79,7 @@ def run(port, options, root): def port_is_open(port): - try: - import socketserver - except ImportError: - import SocketServer as socketserver + import socketserver try: t = socketserver.TCPServer((kDefaultHost, port), None) except: diff --git a/lld/utils/benchmark.py b/lld/utils/benchmark.py index 7202e07ec438d..4257f6bb16056 100755 --- a/lld/utils/benchmark.py +++ b/lld/utils/benchmark.py @@ -14,12 +14,8 @@ import datetime import argparse -try: - from urllib.parse import urlencode - from urllib.request import urlopen, Request -except ImportError: - from urllib import urlencode - from urllib2 import urlopen, Request +from urllib.parse import urlencode +from urllib.request import urlopen, Request parser = argparse.ArgumentParser() diff --git a/llvm/utils/unicode-case-fold.py b/llvm/utils/unicode-case-fold.py index 9639aa0dc44b4..3ef12a0ef881a 100755 --- a/llvm/utils/unicode-case-fold.py +++ b/llvm/utils/unicode-case-fold.py @@ -22,10 +22,7 @@ import sys import re -try: - from urllib.request import urlopen -except ImportError: - from urllib2 import urlopen +from urllib.request import urlopen # This variable will body of the mappings function