[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [fallback-scripts/master] update: py3: Fix module imports for py3
commit 0f4b9ec4b1bef0effe21da30bb698abc7494d86a
Author: teor <teor@xxxxxxxxxxxxxx>
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
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits