[tor-commits] [fallback-scripts/master] update: py3: Fix module imports for py3
teor at torproject.org
teor at torproject.org
Mon Jan 20 05:32:02 UTC 2020
commit 0f4b9ec4b1bef0effe21da30bb698abc7494d86a
Author: teor <teor at torproject.org>
Date: Mon Dec 2 15:29:20 2019 +1000
update: py3: Fix module imports for py3
Part of 28863.
---
updateFallbackDirs.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/updateFallbackDirs.py b/updateFallbackDirs.py
index eb7dd62..9a8e400 100755
--- a/updateFallbackDirs.py
+++ b/updateFallbackDirs.py
@@ -35,28 +35,36 @@
# https://trac.torproject.org/projects/tor/attachment/ticket/8374/dir_list.2.py
# Modifications by teor, 2015
+## Imports: version-independent
+
import copy
import datetime
import dateutil.parser
import gzip
import hashlib
import json
+import logging
import math
import os
import os.path
import re
import string
-import StringIO
import sys
-import urllib
-import urllib2
from stem.descriptor import DocumentHandler
from stem.descriptor.remote import get_consensus, get_server_descriptors, MAX_FINGERPRINTS
-import logging
+## Imports: python 2/3 compatibility
+
+import six
+from six.moves import urllib
+
+## Logging Configuration
+
logging.root.name = ''
+## Imports: optional
+
HAVE_IPADDRESS = False
try:
# python 3 builtin, or install package py2-ipaddress
More information about the tor-commits
mailing list