mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-23 02:23: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
|
from __future__ import print_function
|
||||||
|
import six
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ class TaskWikiException(VimPrettyException):
|
||||||
# Handle error without traceback, if they're descendants of VimPrettyException
|
# Handle error without traceback, if they're descendants of VimPrettyException
|
||||||
def output_exception(exception_type, value, traceback):
|
def output_exception(exception_type, value, traceback):
|
||||||
if any(['VimPretty' in t.__name__ for t in exception_type.mro()]):
|
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:
|
else:
|
||||||
sys.__excepthook__(exception_type, value, traceback)
|
sys.__excepthook__(exception_type, value, traceback)
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ from __future__ import print_function
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
|
import six
|
||||||
import sys
|
import sys
|
||||||
import vim # pylint: disable=F0401
|
import vim # pylint: disable=F0401
|
||||||
|
|
||||||
|
@ -255,8 +256,8 @@ class Meta(object):
|
||||||
port.sort,
|
port.sort,
|
||||||
len(port.matching_tasks),
|
len(port.matching_tasks),
|
||||||
len(port.tasks),
|
len(port.tasks),
|
||||||
', '.join(map(unicode, to_add)),
|
', '.join(map(six.text_type, to_add)),
|
||||||
', '.join(map(unicode, to_del)),
|
', '.join(map(six.text_type, to_del)),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Show in the split
|
# Show in the split
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
import six
|
||||||
|
|
||||||
class ShortUUID(object):
|
class ShortUUID(object):
|
||||||
def __init__(self, value, tw):
|
def __init__(self, value, tw):
|
||||||
# Extract the UUID from the given object. Support both
|
# Extract the UUID from the given object. Support both
|
||||||
# strings and ShortUUID instances.
|
# 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
|
# Use str reprentation of the value, first 8 chars
|
||||||
self.value = str(value)[:8]
|
self.value = str(value)[:8]
|
||||||
elif type(value) is ShortUUID:
|
elif type(value) is ShortUUID:
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import re
|
import re
|
||||||
|
import six
|
||||||
import itertools
|
import itertools
|
||||||
import vim # pylint: disable=F0401
|
import vim # pylint: disable=F0401
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import six
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import vimrunner
|
import vimrunner
|
||||||
|
@ -29,8 +30,8 @@ class IntegrationTest(object):
|
||||||
|
|
||||||
def read_buffer(self, start=0, end=1000):
|
def read_buffer(self, start=0, end=1000):
|
||||||
return self.client.read_buffer(
|
return self.client.read_buffer(
|
||||||
unicode(start+1),
|
six.text_type(start+1),
|
||||||
unicode(end+1)
|
six.text_type(end+1)
|
||||||
).splitlines()
|
).splitlines()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue