Debian Codegraph @

rpython/rlib/unicodedata/__init__.py

raw symbols SCIP
1 # This is the default unicodedb used in various places:
2 # - the unicode type
3 # - the regular expression engine
4 from rpython.rlib.unicodedata import unicodedb_5_2_0 as unicodedb
5
6 # to get information about individual unicode chars look at:
7 # http://www.fileformat.info/info/unicode/char/search.htm
8
9 # the following externally usable functions are defined in each of the
10 # unicodedb files.
11
12 # all code arguments are integers
13
14
15 """
16 lookup(name, with_named_sequence=False, with_alias=False)
17 Look up character by name.
18
19 If a character with the given name is found, return the
20 corresponding character. If not found, KeyError is raised.
21
22 If with_named_sequence is True, named sequences are also searched. They are
23 returned into the form of a code point in a private use area and must be
24 converted with lookup_named_sequence and lookup_named_sequence_length
25
26 with_alias should not be set to True, use lookup_with_alias instead.
27
28 lookup_with_alias(name, with_named_sequence=False)
29 Like lookup, but will also search the name aliases.
30
31 lookup_named_sequence(code)
32 Turns a code point that is the result of lookup or lookup_with_alias with
33 argument with_named_sequence=True and returns a utf-8 encoded unicode
34 string, if the code point is in the right range of the private use area
35 that lookup uses for named sequences. Otherwise None is returned.
36
37 lookup_named_sequence_length(code)
38 Like lookup_named_sequence, but returns the number of code points of the
39 named sequence that code represents.
40
41 name(code)
42 Returns the name assigned to the character code as a string.
43 If no name is defined, KeyError is raised.
44
45 composition(current, next)
46 Composes two code points current and next into a new one. Raises KeyError
47 if that's not possible.
48
49 decomposition(code)
50 Returns the character decomposition mapping assigned to the character code
51 as string.
52 An empty string is returned in case no such mapping is defined.
53
54 canon_decomposition(code)
55 Returns the canonical decomposition of code as a list of integers.
56 Returns an empty list if the code point is not decomposable.
57
58 compat_decomposition(code)
59 Returns the compatibility decomposition of code as a list of integers.
60 Returns an empty list if the code point is not decomposable.
61
62 combining(code)
63 Returns the canonical combining class assigned to the character code as integer.
64 Returns 0 if no combining class is defined.
65
66 category(code)
67 Returns the general category assigned to the character code as string.
68
69 bidirectional(code)
70 Returns the bidirectional class assigned to the character code as string.
71 If no such value is defined, an empty string is returned.
72
73 east_asian_width(code)
74 Returns the east asian width assigned to the character code as string.
75
76
77 The following functions all check various properties of characters:
78
79 isspace(code)
80 isalpha(code)
81 islinebreak(code)
82 isnumeric(code)
83 isdigit(code)
84 isdecimal(code)
85 isalnum(code)
86 isupper(code)
87 istitle(code)
88 islower(code)
89 iscased(code)
90 isxidstart(code)
91 isxidcontinue(code)
92 isprintable(code)
93 iscaseignorable(code)
94
95 mirrored(code)
96 Returns the mirrored property assigned to the character code as integer.
97
98 decimal(code)
99 Converts a Unicode character into its equivalent decimal value.
100
101 Returns the decimal value assigned to the character code as integer.
102 Otherwise a KeyError is raised.
103
104 digit(code)
105 Converts a Unicode character into its equivalent digit value.
106
107 Returns the digit value assigned to the character code as integer.
108 Otherwise a KeyError is raised.
109
110 numeric(code)
111 Converts a Unicode character into its equivalent numeric value.
112
113 Returns the numeric value assigned to the character code as float.
114 Otherwise a KeyError is raised.
115
116 toupper(code)
117 Return the upper case version of the code point, or just the argument
118 itself, if it is not cased. This uses the "simple" case folding rules,
119 where every code point maps to one code point only.
120
121 tolower(code)
122 Return the lower case version of the code point, or just the argument
123 itself, if it is not cased. This uses the "simple" case folding rules,
124 where every code point maps to one code point only.
125
126 totitle(code)
127 Return the title case version of the code point, or just the argument
128 itself, if it is not cased. This uses the "simple" case folding rules,
129 where every code point maps to one code point only.
130
131 toupper_full(code)
132 Return the upper case version of the code point, or just the argument
133 itself, if it is not cased. This uses the "full" case folding rules,
134 thus it returns a list of code points.
135
136 tolower_full(code)
137 Return the lower case version of the code point, or just the argument
138 itself, if it is not cased. This uses the "full" case folding rules,
139 thus it returns a list of code points.
140
141 totitle_full(code)
142 Return the title case version of the code point, or just the argument
143 itself, if it is not cased. This uses the "full" case folding rules,
144 thus it returns a list of code points.
145
146 casefold_lookup(code)
147 Return a version of the code point suitable for caseless
148 comparisons. Returns a list of code points.
149
150 """