py3: More unicode porting

This commit is contained in:
Kovid Goyal 2019-05-27 20:43:20 +05:30
parent 6e0ec5b65c
commit 4ed839f595
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 6 additions and 8 deletions

View File

@ -1,4 +1,4 @@
from __future__ import print_function
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
@ -166,11 +166,11 @@ class OptionParser(optparse.OptionParser):
def options_iter(self):
for opt in self.option_list:
if str(opt).strip():
if native_string_type(opt).strip():
yield opt
for gr in self.option_groups:
for opt in gr.option_list:
if str(opt).strip():
if native_string_type(opt).strip():
yield opt
def option_by_dest(self, dest):

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import absolute_import, division, print_function, unicode_literals
from __future__ import print_function
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
@ -49,4 +49,3 @@ def diff_hists(h1, h2):
if h1[k] != h2[k]:
print("%s: %d -> %d (%s%d)" % (
k, h1[k], h2[k], h2[k] > h1[k] and "+" or "", h2[k] - h1[k]))

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
from __future__ import print_function
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
@ -85,7 +84,7 @@ def get_image_path(path, data=False, allow_user_override=True):
def js_name_to_path(name, ext='.coffee'):
path = (u'/'.join(name.split('.'))) + ext
path = ('/'.join(name.split('.'))) + ext
d = os.path.dirname
base = d(d(os.path.abspath(__file__)))
return os.path.join(base, path)