mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-18 21:33:07 +02:00
python3: Use six.text_type instead direct unicode/str
This commit is contained in:
parent
91af39e17e
commit
29c6c1d29c
5 changed files with 12 additions and 6 deletions
|
@ -3,6 +3,7 @@ Contains TaskWiki-specific exceptions.
|
|||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import six
|
||||
import sys
|
||||
|
||||
|
||||
|
@ -18,7 +19,7 @@ class TaskWikiException(VimPrettyException):
|
|||
# Handle error without traceback, if they're descendants of VimPrettyException
|
||||
def output_exception(exception_type, value, traceback):
|
||||
if any(['VimPretty' in t.__name__ for t in exception_type.mro()]):
|
||||
print(unicode(value), file=sys.stderr)
|
||||
print(six.text_type(value), file=sys.stderr)
|
||||
else:
|
||||
sys.__excepthook__(exception_type, value, traceback)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ from __future__ import print_function
|
|||
import re
|
||||
import os
|
||||
import pickle
|
||||
import six
|
||||
import sys
|
||||
import vim # pylint: disable=F0401
|
||||
|
||||
|
@ -255,8 +256,8 @@ class Meta(object):
|
|||
port.sort,
|
||||
len(port.matching_tasks),
|
||||
len(port.tasks),
|
||||
', '.join(map(unicode, to_add)),
|
||||
', '.join(map(unicode, to_del)),
|
||||
', '.join(map(six.text_type, to_add)),
|
||||
', '.join(map(six.text_type, to_del)),
|
||||
)
|
||||
|
||||
# Show in the split
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import six
|
||||
|
||||
class ShortUUID(object):
|
||||
def __init__(self, value, tw):
|
||||
# Extract the UUID from the given object. Support both
|
||||
# strings and ShortUUID instances.
|
||||
if type(value) in (str, unicode):
|
||||
if isinstance(value, six.string_types):
|
||||
# Use str reprentation of the value, first 8 chars
|
||||
self.value = str(value)[:8]
|
||||
elif type(value) is ShortUUID:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import re
|
||||
import six
|
||||
import itertools
|
||||
import vim # pylint: disable=F0401
|
||||
from datetime import datetime
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
import re
|
||||
import six
|
||||
import subprocess
|
||||
import tempfile
|
||||
import vimrunner
|
||||
|
@ -29,8 +30,8 @@ class IntegrationTest(object):
|
|||
|
||||
def read_buffer(self, start=0, end=1000):
|
||||
return self.client.read_buffer(
|
||||
unicode(start+1),
|
||||
unicode(end+1)
|
||||
six.text_type(start+1),
|
||||
six.text_type(end+1)
|
||||
).splitlines()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue