mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-09-20 04:56:21 +02:00
python: Add __future__ imports for python 3 compatibility
Except for src/ext, which we may not want to modify. Closes ticket 32732.
This commit is contained in:
parent
a38014e5c6
commit
1619f14a04
@ -1,5 +1,10 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
# 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 socket
|
||||||
import struct
|
import struct
|
||||||
import sys
|
import sys
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
# Future imports for Python 2.7, mandatory in 3.0
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
FUZZERS = """
|
FUZZERS = """
|
||||||
consensus
|
consensus
|
||||||
descriptor
|
descriptor
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
#
|
#
|
||||||
# Run it on all the files in your openssl include directory.
|
# Run it on all the files in your openssl include directory.
|
||||||
|
|
||||||
|
# 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 re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
# It takes two arguments: the location of a firefox source directory, and the
|
# It takes two arguments: the location of a firefox source directory, and the
|
||||||
# location of an openssl source directory.
|
# location of an openssl source directory.
|
||||||
|
|
||||||
|
# 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 os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
# I've used this to make inputs for unit tests. I wouldn't suggest
|
# I've used this to make inputs for unit tests. I wouldn't suggest
|
||||||
# using it for anything else.
|
# using it for anything else.
|
||||||
|
|
||||||
|
# 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 base64
|
import base64
|
||||||
import binascii
|
import binascii
|
||||||
import ctypes
|
import ctypes
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
% add_c_file.py ./src/feature/dirauth/ocelot.c
|
% add_c_file.py ./src/feature/dirauth/ocelot.c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# 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 os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
@ -57,6 +57,11 @@ Note that only #else and #endif lines are annotated. Existing comments
|
|||||||
on those lines are removed.
|
on those lines are removed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# 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 re
|
import re
|
||||||
|
|
||||||
# Any block with fewer than this many lines does not need annotations.
|
# Any block with fewer than this many lines does not need annotations.
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
# functionality. This is a stub file that exists so that older git
|
# functionality. This is a stub file that exists so that older git
|
||||||
# hooks will know where to look.
|
# hooks will know where to look.
|
||||||
|
|
||||||
|
# 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, os
|
import sys, os
|
||||||
|
|
||||||
dirname = os.path.split(sys.argv[0])[0]
|
dirname = os.path.split(sys.argv[0])[0]
|
||||||
|
@ -9,7 +9,11 @@
|
|||||||
# To run it, pipe a section of the changelog (starting with "Changes
|
# To run it, pipe a section of the changelog (starting with "Changes
|
||||||
# in Tor 0.x.y.z-alpha" through the script.)
|
# in Tor 0.x.y.z-alpha" through the script.)
|
||||||
|
|
||||||
|
# Future imports for Python 2.7, mandatory in 3.0
|
||||||
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
# Future imports for Python 2.7, mandatory in 3.0
|
||||||
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import with_statement
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
@ -7,6 +7,11 @@
|
|||||||
to highlight the undocumented stuff.
|
to highlight the undocumented stuff.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# 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 os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -19,8 +19,10 @@
|
|||||||
Advisory .may_include files only result in warnings, rather than errors.
|
Advisory .may_include files only result in warnings, rather than errors.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Future imports for Python 2.7, mandatory in 3.0
|
||||||
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import os
|
import os
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
# These are currently ad-hoc string operations and regexps.
|
# These are currently ad-hoc string operations and regexps.
|
||||||
# We might want to use a proper static analysis library in the future, if we want to get more advanced metrics.
|
# We might want to use a proper static analysis library in the future, if we want to get more advanced metrics.
|
||||||
|
|
||||||
|
# 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 re
|
import re
|
||||||
|
|
||||||
def get_file_len(f):
|
def get_file_len(f):
|
||||||
|
@ -19,7 +19,10 @@ problems in the Tor source, use the --regen flag:
|
|||||||
$ python3 --regen ./scripts/maint/practracker/practracker.py .
|
$ python3 --regen ./scripts/maint/practracker/practracker.py .
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Future imports for Python 2.7, mandatory in 3.0
|
||||||
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os, sys
|
import os, sys
|
||||||
|
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
"""Some simple tests for practracker metrics"""
|
"""Some simple tests for practracker metrics"""
|
||||||
|
|
||||||
|
# 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 unittest
|
import unittest
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -7,7 +7,10 @@ problem is worse than a registered exception so that it only warns when things
|
|||||||
get worse.
|
get worse.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Future imports for Python 2.7, mandatory in 3.0
|
||||||
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
# 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 os
|
import os
|
||||||
|
|
||||||
# We don't want to run metrics for unittests, automatically-generated C files,
|
# We don't want to run metrics for unittests, automatically-generated C files,
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
# 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 os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
|
@ -29,6 +29,14 @@
|
|||||||
# "mv fname.c.newdoc fname.c". Otherwise, you'll need to merge
|
# "mv fname.c.newdoc fname.c". Otherwise, you'll need to merge
|
||||||
# the parts you like by hand.
|
# the parts you like by hand.
|
||||||
|
|
||||||
|
# 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 re
|
||||||
|
import sys
|
||||||
|
|
||||||
# Which files should we ignore warning from? Mostly, these are external
|
# Which files should we ignore warning from? Mostly, these are external
|
||||||
# files that we've snarfed in from somebody else, whose C we do no intend
|
# files that we've snarfed in from somebody else, whose C we do no intend
|
||||||
# to document for them.
|
# to document for them.
|
||||||
@ -52,9 +60,6 @@ ADD_DOCDOCS_TO_TYPES += [ 'variable', ]
|
|||||||
# ====================
|
# ====================
|
||||||
# The rest of this should not need hacking.
|
# The rest of this should not need hacking.
|
||||||
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
KINDS = [ "type", "field", "typedef", "define", "function", "variable",
|
KINDS = [ "type", "field", "typedef", "define", "function", "variable",
|
||||||
"enumeration" ]
|
"enumeration" ]
|
||||||
|
|
||||||
|
@ -11,6 +11,11 @@ Helpful script to replace one or more C identifiers, and optionally
|
|||||||
generate a commit message explaining what happened.
|
generate a commit message explaining what happened.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# 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 argparse
|
import argparse
|
||||||
import fileinput
|
import fileinput
|
||||||
import os
|
import os
|
||||||
|
@ -7,7 +7,11 @@
|
|||||||
changelog.
|
changelog.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Future imports for Python 2.7, mandatory in 3.0
|
||||||
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# Future imports for Python 2.7, mandatory in 3.0
|
||||||
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
|
@ -75,8 +75,10 @@ in Appveyor's YAML:
|
|||||||
- "python scripts/test/appveyor-irc-notify.py irc.oftc.net:6697 tor-ci failure
|
- "python scripts/test/appveyor-irc-notify.py irc.oftc.net:6697 tor-ci failure
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Future imports for Python 2.7, mandatory in 3.0
|
||||||
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import absolute_import
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
@ -28,6 +28,11 @@
|
|||||||
pieces.
|
pieces.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# 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 struct
|
import struct
|
||||||
import bisect
|
import bisect
|
||||||
import socket
|
import socket
|
||||||
|
@ -15,7 +15,11 @@ OK
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Future imports for Python 2.7, mandatory in 3.0
|
||||||
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
Includes self-tester and test vector generator.
|
Includes self-tester and test vector generator.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# 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 slow_ed25519
|
import slow_ed25519
|
||||||
from slow_ed25519 import *
|
from slow_ed25519 import *
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
# 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 sys
|
||||||
import hashlib
|
import hashlib
|
||||||
import struct
|
import struct
|
||||||
|
@ -7,6 +7,11 @@
|
|||||||
# store/fetch the descriptor on the hashring. (hs_build_hs_index()).
|
# store/fetch the descriptor on the hashring. (hs_build_hs_index()).
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# 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 sys
|
||||||
import hashlib
|
import hashlib
|
||||||
import struct
|
import struct
|
||||||
|
@ -41,6 +41,11 @@ The whole logic and concept for this test suite was taken from ntor_ref.py.
|
|||||||
*** DO NOT USE THIS IN PRODUCTION. ***
|
*** DO NOT USE THIS IN PRODUCTION. ***
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# 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 struct
|
import struct
|
||||||
import os, sys
|
import os, sys
|
||||||
import binascii
|
import binascii
|
||||||
|
@ -27,6 +27,11 @@ commands:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# 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 binascii
|
import binascii
|
||||||
try:
|
try:
|
||||||
import curve25519
|
import curve25519
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
# Reference implementation for our rudimentary OPE code, used to
|
# Reference implementation for our rudimentary OPE code, used to
|
||||||
# generate test vectors. See crypto_ope.c for more details.
|
# generate test vectors. See crypto_ope.c for more details.
|
||||||
|
|
||||||
|
# Future imports for Python 2.7, mandatory in 3.0
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
||||||
from cryptography.hazmat.primitives.ciphers.algorithms import AES
|
from cryptography.hazmat.primitives.ciphers.algorithms import AES
|
||||||
from cryptography.hazmat.backends import default_backend
|
from cryptography.hazmat.backends import default_backend
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
#
|
#
|
||||||
# Don't edit this file. Mess with ed25519_ref.py
|
# Don't edit this file. Mess with ed25519_ref.py
|
||||||
|
|
||||||
|
# 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 hashlib
|
import hashlib
|
||||||
|
|
||||||
b = 256
|
b = 256
|
||||||
|
@ -6,10 +6,15 @@
|
|||||||
# Nick got the slownacl source from:
|
# Nick got the slownacl source from:
|
||||||
# https://github.com/mdempsky/dnscurve/tree/master/slownacl
|
# https://github.com/mdempsky/dnscurve/tree/master/slownacl
|
||||||
|
|
||||||
__all__ = ['smult_curve25519_base', 'smult_curve25519']
|
# 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 sys
|
||||||
|
|
||||||
|
__all__ = ['smult_curve25519_base', 'smult_curve25519']
|
||||||
|
|
||||||
P = 2 ** 255 - 19
|
P = 2 ** 255 - 19
|
||||||
A = 486662
|
A = 486662
|
||||||
|
|
||||||
|
@ -12,6 +12,11 @@
|
|||||||
# COMMIT = base64-encode( TIMESTAMP || H(REVEAL) )
|
# COMMIT = base64-encode( TIMESTAMP || H(REVEAL) )
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# 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 sys
|
||||||
import hashlib
|
import hashlib
|
||||||
import struct
|
import struct
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
# HASHED_REVEALS | previous_SRV)
|
# HASHED_REVEALS | previous_SRV)
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# 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 sys
|
||||||
import hashlib
|
import hashlib
|
||||||
import struct
|
import struct
|
||||||
|
@ -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 print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import errno
|
import errno
|
||||||
import logging
|
import logging
|
||||||
|
Loading…
Reference in New Issue
Block a user