Back to index

moin  1.9.0~rc2
chartypes_create.py
Go to the documentation of this file.
00001 """
00002     Build MoinMoin/util/chartypes.py with
00003     UCS-2 character types (upper/lower/digits/spaces).
00004 
00005     @copyright: 2004 MoinMoin:ThomasWaldmann
00006     @license: GNU GPL, see COPYING for details
00007 """
00008 
00009 uppercase = []
00010 lowercase = []
00011 digits = []
00012 space = []
00013 for code in range(1, 65535):
00014     c = unichr(code)
00015     str = "\\u%04x" % code
00016     if c.isupper():
00017         uppercase.append(str)
00018     elif c.islower():
00019         lowercase.append(str)
00020     elif c.isdigit():
00021         digits.append(str)
00022     elif c.isspace():
00023         space.append(str)
00024 
00025 chars_upper = u''.join(uppercase)
00026 chars_lower = u''.join(lowercase+digits)
00027 chars_digits = u''.join(digits)
00028 chars_spaces = u''.join(space)
00029 
00030 print """
00031 chars_upper = u"%(chars_upper)s"
00032 
00033 chars_lower = u"%(chars_lower)s"
00034 
00035 chars_digits = u"%(chars_digits)s"
00036 
00037 chars_spaces = u"%(chars_spaces)s"
00038 
00039 
00040 """ % globals()
00041