src/extras/pyrepl/dumbunicodedata.py
author Vijayan <ts.vijayan@nokia.com>
Tue, 16 Feb 2010 10:07:05 +0530
changeset 0 ca70ae20a155
permissions -rw-r--r--
Base Python2.0 code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
     1
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
     2
# Stub unicodedata module. Covers only the Latin-1 range.
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
     3
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
     4
# Copyright (c) 2005 Nokia Corporation
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
     5
#
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
     6
# Licensed under the Apache License, Version 2.0 (the "License");
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
     7
# you may not use this file except in compliance with the License.
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
     8
# You may obtain a copy of the License at
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
     9
#
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    10
#     http://www.apache.org/licenses/LICENSE-2.0
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    11
#
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    12
# Unless required by applicable law or agreed to in writing, software
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    13
# distributed under the License is distributed on an "AS IS" BASIS,
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    15
# See the License for the specific language governing permissions and
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    16
# limitations under the License.
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    17
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    18
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    19
_latin1_categories={u'\x00': 'Cc', u'\x83': 'Cc', u'\x04': 'Cc', u'\x87': 'Cc', u'\x08':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    20
'Cc', u'\x8b': 'Cc', u'\x0c': 'Cc', u'\x8f': 'Cc', u'\x10': 'Cc',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    21
u'\x93': 'Cc', u'\x14': 'Cc', u'\x97': 'Cc', u'\x18': 'Cc', u'\x9b':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    22
'Cc', u'\x1c': 'Cc', u'\x9f': 'Cc', u' ': 'Zs', u'\xa3': 'Sc', u'$':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    23
'Sc', u'\xa7': 'So', u'(': 'Ps', u'\xab': 'Pi', u',': 'Po', u'\xaf':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    24
'Sk', u'0': 'Nd', u'\xb3': 'No', u'4': 'Nd', u'\xb7': 'Po', u'8':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    25
'Nd', u'\xbb': 'Pf', u'<': 'Sm', u'\xbf': 'Po', u'@': 'Po', u'\xc3':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    26
'Lu', u'D': 'Lu', u'\xc7': 'Lu', u'H': 'Lu', u'\xcb': 'Lu', u'L':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    27
'Lu', u'\xcf': 'Lu', u'P': 'Lu', u'\xd3': 'Lu', u'T': 'Lu', u'\xd7':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    28
'Sm', u'X': 'Lu', u'\xdb': 'Lu', u'\\': 'Po', u'\xdf': 'Ll', u'`':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    29
'Sk', u'\xe3': 'Ll', u'd': 'Ll', u'\xe7': 'Ll', u'h': 'Ll', u'\xeb':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    30
'Ll', u'l': 'Ll', u'\xef': 'Ll', u'p': 'Ll', u'\xf3': 'Ll', u't':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    31
'Ll', u'\xf7': 'Sm', u'x': 'Ll', u'\xfb': 'Ll', u'|': 'Sm', u'\xff':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    32
'Ll', u'\x80': 'Cc', u'\x03': 'Cc', u'\x84': 'Cc', u'\x07': 'Cc',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    33
u'\x88': 'Cc', u'\x0b': 'Cc', u'\x8c': 'Cc', u'\x0f': 'Cc', u'\x90':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    34
'Cc', u'\x13': 'Cc', u'\x94': 'Cc', u'\x17': 'Cc', u'\x98': 'Cc',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    35
u'\x1b': 'Cc', u'\x9c': 'Cc', u'\x1f': 'Cc', u'\xa0': 'Zs', u'#':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    36
'Po', u'\xa4': 'Sc', u"'": 'Po', u'\xa8': 'Sk', u'+': 'Sm', u'\xac':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    37
'Sm', u'/': 'Po', u'\xb0': 'So', u'3': 'Nd', u'\xb4': 'Sk', u'7':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    38
'Nd', u'\xb8': 'Sk', u';': 'Po', u'\xbc': 'No', u'?': 'Po', u'\xc0':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    39
'Lu', u'C': 'Lu', u'\xc4': 'Lu', u'G': 'Lu', u'\xc8': 'Lu', u'K':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    40
'Lu', u'\xcc': 'Lu', u'O': 'Lu', u'\xd0': 'Lu', u'S': 'Lu', u'\xd4':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    41
'Lu', u'W': 'Lu', u'\xd8': 'Lu', u'[': 'Ps', u'\xdc': 'Lu', u'_':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    42
'Pc', u'\xe0': 'Ll', u'c': 'Ll', u'\xe4': 'Ll', u'g': 'Ll', u'\xe8':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    43
'Ll', u'k': 'Ll', u'\xec': 'Ll', u'o': 'Ll', u'\xf0': 'Ll', u's':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    44
'Ll', u'\xf4': 'Ll', u'w': 'Ll', u'\xf8': 'Ll', u'{': 'Ps', u'\xfc':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    45
'Ll', u'\x7f': 'Cc', u'\x81': 'Cc', u'\x02': 'Cc', u'\x85': 'Cc',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    46
u'\x06': 'Cc', u'\x89': 'Cc', u'\n': 'Cc', u'\x8d': 'Cc', u'\x0e':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    47
'Cc', u'\x91': 'Cc', u'\x12': 'Cc', u'\x95': 'Cc', u'\x16': 'Cc',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    48
u'\x99': 'Cc', u'\x1a': 'Cc', u'\x9d': 'Cc', u'\x1e': 'Cc', u'\xa1':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    49
'Po', u'"': 'Po', u'\xa5': 'Sc', u'&': 'Po', u'\xa9': 'So', u'*':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    50
'Po', u'\xad': 'Pd', u'.': 'Po', u'\xb1': 'Sm', u'2': 'Nd', u'\xb5':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    51
'Ll', u'6': 'Nd', u'\xb9': 'No', u':': 'Po', u'\xbd': 'No', u'>':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    52
'Sm', u'\xc1': 'Lu', u'B': 'Lu', u'\xc5': 'Lu', u'F': 'Lu', u'\xc9':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    53
'Lu', u'J': 'Lu', u'\xcd': 'Lu', u'N': 'Lu', u'\xd1': 'Lu', u'R':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    54
'Lu', u'\xd5': 'Lu', u'V': 'Lu', u'\xd9': 'Lu', u'Z': 'Lu', u'\xdd':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    55
'Lu', u'^': 'Sk', u'\xe1': 'Ll', u'b': 'Ll', u'\xe5': 'Ll', u'f':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    56
'Ll', u'\xe9': 'Ll', u'j': 'Ll', u'\xed': 'Ll', u'n': 'Ll', u'\xf1':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    57
'Ll', u'r': 'Ll', u'\xf5': 'Ll', u'v': 'Ll', u'\xf9': 'Ll', u'z':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    58
'Ll', u'\xfd': 'Ll', u'~': 'Sm', u'\x01': 'Cc', u'\x82': 'Cc',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    59
u'\x05': 'Cc', u'\x86': 'Cc', u'\t': 'Cc', u'\x8a': 'Cc', u'\r': 'Cc',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    60
u'\x8e': 'Cc', u'\x11': 'Cc', u'\x92': 'Cc', u'\x15': 'Cc', u'\x96':
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    61
'Cc', u'\x19': 'Cc', u'\x9a': 'Cc', u'\x1d': 'Cc', u'\x9e': 'Cc',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    62
u'!': 'Po', u'\xa2': 'Sc', u'%': 'Po', u'\xa6': 'So', u')': 'Pe',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    63
u'\xaa': 'Ll', u'-': 'Pd', u'\xae': 'So', u'1': 'Nd', u'\xb2': 'No',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    64
u'5': 'Nd', u'\xb6': 'So', u'9': 'Nd', u'\xba': 'Ll', u'=': 'Sm',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    65
u'\xbe': 'No', u'A': 'Lu', u'\xc2': 'Lu', u'E': 'Lu', u'\xc6': 'Lu',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    66
u'I': 'Lu', u'\xca': 'Lu', u'M': 'Lu', u'\xce': 'Lu', u'Q': 'Lu',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    67
u'\xd2': 'Lu', u'U': 'Lu', u'\xd6': 'Lu', u'Y': 'Lu', u'\xda': 'Lu',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    68
u']': 'Pe', u'\xde': 'Lu', u'a': 'Ll', u'\xe2': 'Ll', u'e': 'Ll',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    69
u'\xe6': 'Ll', u'i': 'Ll', u'\xea': 'Ll', u'm': 'Ll', u'\xee': 'Ll',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    70
u'q': 'Ll', u'\xf2': 'Ll', u'u': 'Ll', u'\xf6': 'Ll', u'y': 'Ll',
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    71
u'\xfa': 'Ll', u'}': 'Pe', u'\xfe': 'Ll'}
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    72
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    73
def category(c):
ca70ae20a155 Base Python2.0 code
Vijayan <ts.vijayan@nokia.com>
parents:
diff changeset
    74
    return _latin1_categories.get(c)