Browse files

Use Py2/3k u() rather than unicode()

  • Loading branch information...
daviddrysdale committed Nov 26, 2011
1 parent 2d0a745 commit 5e6f1e2447e4fabd786a9f236c39cc8abf197fd6
Showing with 5 additions and 5 deletions.
  1. +5 −5 python/phonenumbers/
@@ -66,7 +66,7 @@
import bisect
import unicodedata # Python 2.5 onward
from util import UnicodeMixin, u
from .util import UnicodeMixin, u
class Category(object):
@@ -114,13 +114,13 @@ class Category(object):
def get(cls, uni_char):
"""Return the general category code for the given Unicode character"""
uni_char = unicode(uni_char)
uni_char = u(uni_char)
return unicodedata.category(uni_char)
def is_letter(uni_char):
"""Determine whether the given Unicode character is a Unicode letter"""
uni_char = unicode(uni_char)
uni_char = u(uni_char)
category = unicodedata.category(uni_char)
return (category == Category.UPPERCASE_LETTER or
category == Category.LOWERCASE_LETTER or
@@ -371,7 +371,7 @@ class Block(object):
def get(cls, uni_char):
"""Return the Unicode block of the given Unicode character"""
uni_char = unicode(uni_char)
uni_char = u(uni_char)
code_point = ord(uni_char)
if Block._RANGE_KEYS is None:
Block._RANGE_KEYS = sorted(Block._RANGES.keys())
@@ -392,7 +392,7 @@ def digit(uni_char, default_value=None):
"""Returns the digit value assigned to the Unicode character uni_char as
integer. If no such value is defined, default is returned, or, if not
given, ValueError is raised."""
uni_char = unicode(uni_char)
uni_char = u(uni_char)
if default_value is not None:
return unicodedata.digit(uni_char, default_value)

0 comments on commit 5e6f1e2

Please sign in to comment.