added unicode_literals import to all apropriate modules

bug in twisted serverFromString prevents test.common and transit
from using unicode properly should revisit if twisted gets patched
This commit is contained in:
laharah 2016-06-03 23:07:50 -07:00
parent 33758abd18
commit 6a73d50fdd
26 changed files with 31 additions and 25 deletions

View File

@ -1,4 +1,4 @@
from __future__ import unicode_literals
# This file helps to compute a version number in source trees obtained from # This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag # git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build # feature). Distribution tarballs (built by setup.py sdist) and build

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import sys import sys
from weakref import ref from weakref import ref

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import os, six import os, six
from .wordlist import (byte_to_even_word, byte_to_odd_word, from .wordlist import (byte_to_even_word, byte_to_odd_word,
even_words_lowercase, odd_words_lowercase) even_words_lowercase, odd_words_lowercase)

View File

@ -1,3 +1,4 @@
from __future__ import unicode_literals
import functools import functools
class ServerError(Exception): class ServerError(Exception):

View File

@ -1,4 +1,4 @@
# no unicode_literals
# Find all of our ip addresses. From tahoe's src/allmydata/util/iputil.py # Find all of our ip addresses. From tahoe's src/allmydata/util/iputil.py
import os, re, subprocess, errno import os, re, subprocess, errno

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import os, time import os, time
from twisted.python import usage from twisted.python import usage
from twisted.scripts import twistd from twisted.scripts import twistd

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import os, time, json import os, time, json
from collections import defaultdict from collections import defaultdict
from .database import get_db from .database import get_db

View File

@ -1,3 +1,4 @@
from __future__ import unicode_literals
from twisted.python import log from twisted.python import log
from twisted.internet import defer from twisted.internet import defer
from twisted.application import service from twisted.application import service

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import os, time, random, base64 import os, time, random, base64
from collections import namedtuple from collections import namedtuple
from twisted.python import log from twisted.python import log

View File

@ -1,3 +1,4 @@
from __future__ import unicode_literals
import time import time
from twisted.internet import reactor from twisted.internet import reactor
from twisted.python import log from twisted.python import log

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import os, sys import os, sys
from .cli_args import parser from .cli_args import parser

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
from twisted.python import log from twisted.python import log
from twisted.internet import reactor, endpoints from twisted.internet import reactor, endpoints
from twisted.application import service from twisted.application import service

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import re, time import re, time
from twisted.python import log from twisted.python import log
from twisted.internet import protocol from twisted.internet import protocol

View File

@ -14,6 +14,8 @@ class ServerBase:
self.sp.startService() self.sp.startService()
relayport = allocate_tcp_port() relayport = allocate_tcp_port()
transitport = allocate_tcp_port() transitport = allocate_tcp_port()
# need to talk to twisted team about only using unicode in
# endpoints.serverFromString
s = RelayServer("tcp:%d:interface=127.0.0.1" % relayport, s = RelayServer("tcp:%d:interface=127.0.0.1" % relayport,
"tcp:%s:interface=127.0.0.1" % transitport, "tcp:%s:interface=127.0.0.1" % transitport,
advertise_version=__version__, advertise_version=__version__,

View File

@ -1,4 +1,4 @@
from __future__ import unicode_literals
# This is a tiny helper module, to let "python -m wormhole.test.run_trial # This is a tiny helper module, to let "python -m wormhole.test.run_trial
# ARGS" does the same thing as running "trial ARGS" (unfortunately # ARGS" does the same thing as running "trial ARGS" (unfortunately
# twisted/scripts/trial.py does not have a '__name__=="__main__"' clause). # twisted/scripts/trial.py does not have a '__name__=="__main__"' clause).

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import unittest import unittest
from binascii import unhexlify #, hexlify from binascii import unhexlify #, hexlify
from hkdf import Hkdf from hkdf import Hkdf
@ -42,4 +42,3 @@ class TestKAT(unittest.TestCase):
#if __name__ == '__main__': #if __name__ == '__main__':
# generate_KAT() # generate_KAT()

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import os, sys, re, io, zipfile, six, stat import os, sys, re, io, zipfile, six, stat
import mock import mock
from twisted.trial import unittest from twisted.trial import unittest

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import json, itertools import json, itertools
from binascii import hexlify from binascii import hexlify
import mock import mock
@ -375,9 +375,9 @@ class Prune(unittest.TestCase):
for messages in [None, OLD, NEW]: for messages in [None, OLD, NEW]:
self.one(nameplate, mailbox, has_listeners, messages) self.one(nameplate, mailbox, has_listeners, messages)
#def test_one(self): # def test_one(self):
# # to debug specific problems found by test_lots # # to debug specific problems found by test_lots
# self.one(None, "old", True, None) # self.one(None, "old", False, 'new')
def one(self, nameplate, mailbox, has_listeners, messages): def one(self, nameplate, mailbox, has_listeners, messages):
desc = ("nameplate=%s, mailbox=%s, has_listeners=%s," desc = ("nameplate=%s, mailbox=%s, has_listeners=%s,"
@ -427,8 +427,8 @@ class Prune(unittest.TestCase):
messages = None messages = None
messages_survive = False messages_survive = False
if (nameplate is NEW or mailbox is NEW if (nameplate == NEW or mailbox == NEW
or has_listeners or messages is NEW): or has_listeners or messages == NEW):
if nameplate is not None: if nameplate is not None:
nameplate_survives = True nameplate_survives = True
if mailbox is not None: if mailbox is not None:

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import io import io
from binascii import hexlify, unhexlify from binascii import hexlify, unhexlify
from twisted.trial import unittest from twisted.trial import unittest

View File

@ -1,3 +1,4 @@
from __future__ import unicode_literals
import unicodedata import unicodedata
from twisted.trial import unittest from twisted.trial import unittest
from .. import util from .. import util

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import os, json, re, gc import os, json, re, gc
from binascii import hexlify, unhexlify from binascii import hexlify, unhexlify
import mock import mock

View File

@ -1,4 +1,4 @@
from __future__ import print_function, absolute_import from __future__ import print_function, absolute_import, unicode_literals
import json, time import json, time
class Event: class Event:

View File

@ -1,4 +1,4 @@
from __future__ import print_function from __future__ import print_function, unicode_literals
import time import time
from twisted.internet.defer import inlineCallbacks, returnValue from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet.error import ConnectError from twisted.internet.error import ConnectError

View File

@ -1,3 +1,4 @@
# no unicode_literals, revisit after twisted patch
from __future__ import print_function, absolute_import from __future__ import print_function, absolute_import
import re, sys, time, socket import re, sys, time, socket
from collections import namedtuple, deque from collections import namedtuple, deque

View File

@ -1,4 +1,4 @@
from __future__ import unicode_literals
# The PGP Word List, which maps bytes to phonetically-distinct words. There # The PGP Word List, which maps bytes to phonetically-distinct words. There
# are two lists, even and odd, and encodings should alternate between then to # are two lists, even and odd, and encodings should alternate between then to
# detect dropped words. https://en.wikipedia.org/wiki/PGP_Words # detect dropped words. https://en.wikipedia.org/wiki/PGP_Words

View File

@ -1,4 +1,4 @@
from __future__ import print_function, absolute_import from __future__ import print_function, absolute_import, unicode_literals
import os, sys, re import os, sys, re
from six.moves.urllib_parse import urlparse from six.moves.urllib_parse import urlparse
from twisted.internet import defer, endpoints, error from twisted.internet import defer, endpoints, error