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
# git-archive tarball (such as those provided by githubs download-from-tag
# 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
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
from .wordlist import (byte_to_even_word, byte_to_odd_word,
even_words_lowercase, odd_words_lowercase)

View File

@ -1,3 +1,4 @@
from __future__ import unicode_literals
import functools
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
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
from twisted.python import usage
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
from collections import defaultdict
from .database import get_db

View File

@ -1,3 +1,4 @@
from __future__ import unicode_literals
from twisted.python import log
from twisted.internet import defer
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
from collections import namedtuple
from twisted.python import log

View File

@ -1,3 +1,4 @@
from __future__ import unicode_literals
import time
from twisted.internet import reactor
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
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.internet import reactor, endpoints
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
from twisted.python import log
from twisted.internet import protocol

View File

@ -14,6 +14,8 @@ class ServerBase:
self.sp.startService()
relayport = 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,
"tcp:%s:interface=127.0.0.1" % transitport,
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
# ARGS" does the same thing as running "trial ARGS" (unfortunately
# 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
from binascii import unhexlify #, hexlify
from hkdf import Hkdf
@ -42,4 +42,3 @@ class TestKAT(unittest.TestCase):
#if __name__ == '__main__':
# 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 mock
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
from binascii import hexlify
import mock
@ -375,9 +375,9 @@ class Prune(unittest.TestCase):
for messages in [None, OLD, NEW]:
self.one(nameplate, mailbox, has_listeners, messages)
#def test_one(self):
# def test_one(self):
# # 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):
desc = ("nameplate=%s, mailbox=%s, has_listeners=%s,"
@ -427,8 +427,8 @@ class Prune(unittest.TestCase):
messages = None
messages_survive = False
if (nameplate is NEW or mailbox is NEW
or has_listeners or messages is NEW):
if (nameplate == NEW or mailbox == NEW
or has_listeners or messages == NEW):
if nameplate is not None:
nameplate_survives = True
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
from binascii import hexlify, unhexlify
from twisted.trial import unittest

View File

@ -1,3 +1,4 @@
from __future__ import unicode_literals
import unicodedata
from twisted.trial import unittest
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
from binascii import hexlify, unhexlify
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
class Event:

View File

@ -1,4 +1,4 @@
from __future__ import print_function
from __future__ import print_function, unicode_literals
import time
from twisted.internet.defer import inlineCallbacks, returnValue
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
import re, sys, time, socket
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
# are two lists, even and odd, and encodings should alternate between then to
# 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
from six.moves.urllib_parse import urlparse
from twisted.internet import defer, endpoints, error