File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515'Lu'
1616>>> unicode_util.Category.get(u2) == unicode_util.Category.LOWERCASE_LETTER
1717True
18- >>> beyond_bmp = u'\U00010100 '
18+ >>> beyond_bmp = u'\U00010100 ' # AEGEAN WORD SEPARATOR LINE
1919>>> if len(beyond_bmp) == 1: # We have a UCS4 build of Python
2020... unicode_util.Category.get(beyond_bmp)
21- ... else: # UCS2 build of Python; no unknown characters available
22- ... 'Po'
21+ ... else: # UCS2 build of Python; no non-BMP chars available
22+ ... unicode_util.Category.OTHER_PUNCTUATION
2323'Po'
2424>>> unicode_util.is_letter(u1)
2525False
6767
6868
6969class Category (object ):
70+ """General category of a Unicode character.
71+
72+ See http://www.unicode.org/reports/tr18/#Categories"""
7073 LETTER = "L"
7174 UPPERCASE_LETTER = "Lu"
7275 LOWERCASE_LETTER = "Ll"
@@ -107,6 +110,7 @@ class Category(object):
107110
108111 @classmethod
109112 def get (cls , unichr ):
113+ """Return the general category code for the given Unicode character"""
110114 unichr = unicode (unichr )
111115 return unicodedata .category (unichr )
112116
You can’t perform that action at this time.
0 commit comments