[tor-commits] [chutney/master] python: Add __future__ imports for python 3 compatibility
teor at torproject.org
teor at torproject.org
Sun Dec 15 22:24:13 UTC 2019
commit f9d27ae30ca72db6f77a454e0b1b5274d49a66a9
Author: teor <teor at torproject.org>
Date: Thu Dec 12 15:44:02 2019 +1000
python: Add __future__ imports for python 3 compatibility
Closes ticket 32731.
---
lib/chutney/Debug.py | 3 +++
lib/chutney/Host.py | 4 ++++
lib/chutney/Templating.py | 4 +++-
lib/chutney/TorNet.py | 4 +++-
lib/chutney/Traffic.py | 3 +++
lib/chutney/Util.py | 5 ++++-
lib/chutney/__init__.py | 4 ++++
scripts/chutney_tests/__init__.py | 4 ++++
scripts/chutney_tests/verify.py | 6 +++++-
9 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/lib/chutney/Debug.py b/lib/chutney/Debug.py
index 85c9eee..9d06521 100755
--- a/lib/chutney/Debug.py
+++ b/lib/chutney/Debug.py
@@ -7,7 +7,10 @@
# restrict, so long as you retain the above notice(s) and this license
# in all redistributed copies and derived works. There is no warranty.
+# Future imports for Python 2.7, mandatory in 3.0
+from __future__ import division
from __future__ import print_function
+from __future__ import unicode_literals
import cgitb
import os
diff --git a/lib/chutney/Host.py b/lib/chutney/Host.py
index 75573d6..274e843 100644
--- a/lib/chutney/Host.py
+++ b/lib/chutney/Host.py
@@ -1,3 +1,7 @@
+# Future imports for Python 2.7, mandatory in 3.0
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
import socket
import chutney.Util
diff --git a/lib/chutney/Templating.py b/lib/chutney/Templating.py
index 6560e25..2a658ab 100755
--- a/lib/chutney/Templating.py
+++ b/lib/chutney/Templating.py
@@ -76,8 +76,10 @@
"""
+# Future imports for Python 2.7, mandatory in 3.0
+from __future__ import division
from __future__ import print_function
-from __future__ import with_statement
+from __future__ import unicode_literals
import string
import os
diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index e9cf8f4..e47907c 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -7,8 +7,10 @@
# restrict, so long as you retain the above notice(s) and this license
# in all redistributed copies and derived works. There is no warranty.
+# Future imports for Python 2.7, mandatory in 3.0
+from __future__ import division
from __future__ import print_function
-from __future__ import with_statement
+from __future__ import unicode_literals
import cgitb
import os
diff --git a/lib/chutney/Traffic.py b/lib/chutney/Traffic.py
index 02cca91..9990dcd 100755
--- a/lib/chutney/Traffic.py
+++ b/lib/chutney/Traffic.py
@@ -20,7 +20,10 @@
#
# For example code, see main() below.
+# Future imports for Python 2.7, mandatory in 3.0
+from __future__ import division
from __future__ import print_function
+from __future__ import unicode_literals
import sys
import socket
diff --git a/lib/chutney/Util.py b/lib/chutney/Util.py
index f8b838e..761636b 100644
--- a/lib/chutney/Util.py
+++ b/lib/chutney/Util.py
@@ -1,4 +1,7 @@
-
+# Future imports for Python 2.7, mandatory in 3.0
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
def memoized(fn):
"""Decorator: memoize a function."""
diff --git a/lib/chutney/__init__.py b/lib/chutney/__init__.py
index e69de29..cd47ba0 100644
--- a/lib/chutney/__init__.py
+++ b/lib/chutney/__init__.py
@@ -0,0 +1,4 @@
+# Future imports for Python 2.7, mandatory in 3.0
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
diff --git a/scripts/chutney_tests/__init__.py b/scripts/chutney_tests/__init__.py
index e69de29..cd47ba0 100644
--- a/scripts/chutney_tests/__init__.py
+++ b/scripts/chutney_tests/__init__.py
@@ -0,0 +1,4 @@
+# Future imports for Python 2.7, mandatory in 3.0
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
diff --git a/scripts/chutney_tests/verify.py b/scripts/chutney_tests/verify.py
index e97ff52..a0f0c3e 100644
--- a/scripts/chutney_tests/verify.py
+++ b/scripts/chutney_tests/verify.py
@@ -1,7 +1,11 @@
+# Future imports for Python 2.7, mandatory in 3.0
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
import time
import chutney
-
def run_test(network):
wait_time = network._dfltEnv['bootstrap_time']
start_time = time.time()
More information about the tor-commits
mailing list