Fix typo in Python equivalent for bit_length.
[python.git] / Lib / encodings / cp424.py
blobd3ade2277687900698f62b2e087f59c064cb9955
1 """ Python Character Mapping Codec cp424 generated from 'MAPPINGS/VENDORS/MISC/CP424.TXT' with gencodec.py.
3 """#"
5 import codecs
7 ### Codec APIs
9 class Codec(codecs.Codec):
11 def encode(self,input,errors='strict'):
12 return codecs.charmap_encode(input,errors,encoding_table)
14 def decode(self,input,errors='strict'):
15 return codecs.charmap_decode(input,errors,decoding_table)
17 class IncrementalEncoder(codecs.IncrementalEncoder):
18 def encode(self, input, final=False):
19 return codecs.charmap_encode(input,self.errors,encoding_table)[0]
21 class IncrementalDecoder(codecs.IncrementalDecoder):
22 def decode(self, input, final=False):
23 return codecs.charmap_decode(input,self.errors,decoding_table)[0]
25 class StreamWriter(Codec,codecs.StreamWriter):
26 pass
28 class StreamReader(Codec,codecs.StreamReader):
29 pass
31 ### encodings module API
33 def getregentry():
34 return codecs.CodecInfo(
35 name='cp424',
36 encode=Codec().encode,
37 decode=Codec().decode,
38 incrementalencoder=IncrementalEncoder,
39 incrementaldecoder=IncrementalDecoder,
40 streamreader=StreamReader,
41 streamwriter=StreamWriter,
45 ### Decoding Table
47 decoding_table = (
48 u'\x00' # 0x00 -> NULL
49 u'\x01' # 0x01 -> START OF HEADING
50 u'\x02' # 0x02 -> START OF TEXT
51 u'\x03' # 0x03 -> END OF TEXT
52 u'\x9c' # 0x04 -> SELECT
53 u'\t' # 0x05 -> HORIZONTAL TABULATION
54 u'\x86' # 0x06 -> REQUIRED NEW LINE
55 u'\x7f' # 0x07 -> DELETE
56 u'\x97' # 0x08 -> GRAPHIC ESCAPE
57 u'\x8d' # 0x09 -> SUPERSCRIPT
58 u'\x8e' # 0x0A -> REPEAT
59 u'\x0b' # 0x0B -> VERTICAL TABULATION
60 u'\x0c' # 0x0C -> FORM FEED
61 u'\r' # 0x0D -> CARRIAGE RETURN
62 u'\x0e' # 0x0E -> SHIFT OUT
63 u'\x0f' # 0x0F -> SHIFT IN
64 u'\x10' # 0x10 -> DATA LINK ESCAPE
65 u'\x11' # 0x11 -> DEVICE CONTROL ONE
66 u'\x12' # 0x12 -> DEVICE CONTROL TWO
67 u'\x13' # 0x13 -> DEVICE CONTROL THREE
68 u'\x9d' # 0x14 -> RESTORE/ENABLE PRESENTATION
69 u'\x85' # 0x15 -> NEW LINE
70 u'\x08' # 0x16 -> BACKSPACE
71 u'\x87' # 0x17 -> PROGRAM OPERATOR COMMUNICATION
72 u'\x18' # 0x18 -> CANCEL
73 u'\x19' # 0x19 -> END OF MEDIUM
74 u'\x92' # 0x1A -> UNIT BACK SPACE
75 u'\x8f' # 0x1B -> CUSTOMER USE ONE
76 u'\x1c' # 0x1C -> FILE SEPARATOR
77 u'\x1d' # 0x1D -> GROUP SEPARATOR
78 u'\x1e' # 0x1E -> RECORD SEPARATOR
79 u'\x1f' # 0x1F -> UNIT SEPARATOR
80 u'\x80' # 0x20 -> DIGIT SELECT
81 u'\x81' # 0x21 -> START OF SIGNIFICANCE
82 u'\x82' # 0x22 -> FIELD SEPARATOR
83 u'\x83' # 0x23 -> WORD UNDERSCORE
84 u'\x84' # 0x24 -> BYPASS OR INHIBIT PRESENTATION
85 u'\n' # 0x25 -> LINE FEED
86 u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK
87 u'\x1b' # 0x27 -> ESCAPE
88 u'\x88' # 0x28 -> SET ATTRIBUTE
89 u'\x89' # 0x29 -> START FIELD EXTENDED
90 u'\x8a' # 0x2A -> SET MODE OR SWITCH
91 u'\x8b' # 0x2B -> CONTROL SEQUENCE PREFIX
92 u'\x8c' # 0x2C -> MODIFY FIELD ATTRIBUTE
93 u'\x05' # 0x2D -> ENQUIRY
94 u'\x06' # 0x2E -> ACKNOWLEDGE
95 u'\x07' # 0x2F -> BELL
96 u'\x90' # 0x30 -> <reserved>
97 u'\x91' # 0x31 -> <reserved>
98 u'\x16' # 0x32 -> SYNCHRONOUS IDLE
99 u'\x93' # 0x33 -> INDEX RETURN
100 u'\x94' # 0x34 -> PRESENTATION POSITION
101 u'\x95' # 0x35 -> TRANSPARENT
102 u'\x96' # 0x36 -> NUMERIC BACKSPACE
103 u'\x04' # 0x37 -> END OF TRANSMISSION
104 u'\x98' # 0x38 -> SUBSCRIPT
105 u'\x99' # 0x39 -> INDENT TABULATION
106 u'\x9a' # 0x3A -> REVERSE FORM FEED
107 u'\x9b' # 0x3B -> CUSTOMER USE THREE
108 u'\x14' # 0x3C -> DEVICE CONTROL FOUR
109 u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE
110 u'\x9e' # 0x3E -> <reserved>
111 u'\x1a' # 0x3F -> SUBSTITUTE
112 u' ' # 0x40 -> SPACE
113 u'\u05d0' # 0x41 -> HEBREW LETTER ALEF
114 u'\u05d1' # 0x42 -> HEBREW LETTER BET
115 u'\u05d2' # 0x43 -> HEBREW LETTER GIMEL
116 u'\u05d3' # 0x44 -> HEBREW LETTER DALET
117 u'\u05d4' # 0x45 -> HEBREW LETTER HE
118 u'\u05d5' # 0x46 -> HEBREW LETTER VAV
119 u'\u05d6' # 0x47 -> HEBREW LETTER ZAYIN
120 u'\u05d7' # 0x48 -> HEBREW LETTER HET
121 u'\u05d8' # 0x49 -> HEBREW LETTER TET
122 u'\xa2' # 0x4A -> CENT SIGN
123 u'.' # 0x4B -> FULL STOP
124 u'<' # 0x4C -> LESS-THAN SIGN
125 u'(' # 0x4D -> LEFT PARENTHESIS
126 u'+' # 0x4E -> PLUS SIGN
127 u'|' # 0x4F -> VERTICAL LINE
128 u'&' # 0x50 -> AMPERSAND
129 u'\u05d9' # 0x51 -> HEBREW LETTER YOD
130 u'\u05da' # 0x52 -> HEBREW LETTER FINAL KAF
131 u'\u05db' # 0x53 -> HEBREW LETTER KAF
132 u'\u05dc' # 0x54 -> HEBREW LETTER LAMED
133 u'\u05dd' # 0x55 -> HEBREW LETTER FINAL MEM
134 u'\u05de' # 0x56 -> HEBREW LETTER MEM
135 u'\u05df' # 0x57 -> HEBREW LETTER FINAL NUN
136 u'\u05e0' # 0x58 -> HEBREW LETTER NUN
137 u'\u05e1' # 0x59 -> HEBREW LETTER SAMEKH
138 u'!' # 0x5A -> EXCLAMATION MARK
139 u'$' # 0x5B -> DOLLAR SIGN
140 u'*' # 0x5C -> ASTERISK
141 u')' # 0x5D -> RIGHT PARENTHESIS
142 u';' # 0x5E -> SEMICOLON
143 u'\xac' # 0x5F -> NOT SIGN
144 u'-' # 0x60 -> HYPHEN-MINUS
145 u'/' # 0x61 -> SOLIDUS
146 u'\u05e2' # 0x62 -> HEBREW LETTER AYIN
147 u'\u05e3' # 0x63 -> HEBREW LETTER FINAL PE
148 u'\u05e4' # 0x64 -> HEBREW LETTER PE
149 u'\u05e5' # 0x65 -> HEBREW LETTER FINAL TSADI
150 u'\u05e6' # 0x66 -> HEBREW LETTER TSADI
151 u'\u05e7' # 0x67 -> HEBREW LETTER QOF
152 u'\u05e8' # 0x68 -> HEBREW LETTER RESH
153 u'\u05e9' # 0x69 -> HEBREW LETTER SHIN
154 u'\xa6' # 0x6A -> BROKEN BAR
155 u',' # 0x6B -> COMMA
156 u'%' # 0x6C -> PERCENT SIGN
157 u'_' # 0x6D -> LOW LINE
158 u'>' # 0x6E -> GREATER-THAN SIGN
159 u'?' # 0x6F -> QUESTION MARK
160 u'\ufffe' # 0x70 -> UNDEFINED
161 u'\u05ea' # 0x71 -> HEBREW LETTER TAV
162 u'\ufffe' # 0x72 -> UNDEFINED
163 u'\ufffe' # 0x73 -> UNDEFINED
164 u'\xa0' # 0x74 -> NO-BREAK SPACE
165 u'\ufffe' # 0x75 -> UNDEFINED
166 u'\ufffe' # 0x76 -> UNDEFINED
167 u'\ufffe' # 0x77 -> UNDEFINED
168 u'\u2017' # 0x78 -> DOUBLE LOW LINE
169 u'`' # 0x79 -> GRAVE ACCENT
170 u':' # 0x7A -> COLON
171 u'#' # 0x7B -> NUMBER SIGN
172 u'@' # 0x7C -> COMMERCIAL AT
173 u"'" # 0x7D -> APOSTROPHE
174 u'=' # 0x7E -> EQUALS SIGN
175 u'"' # 0x7F -> QUOTATION MARK
176 u'\ufffe' # 0x80 -> UNDEFINED
177 u'a' # 0x81 -> LATIN SMALL LETTER A
178 u'b' # 0x82 -> LATIN SMALL LETTER B
179 u'c' # 0x83 -> LATIN SMALL LETTER C
180 u'd' # 0x84 -> LATIN SMALL LETTER D
181 u'e' # 0x85 -> LATIN SMALL LETTER E
182 u'f' # 0x86 -> LATIN SMALL LETTER F
183 u'g' # 0x87 -> LATIN SMALL LETTER G
184 u'h' # 0x88 -> LATIN SMALL LETTER H
185 u'i' # 0x89 -> LATIN SMALL LETTER I
186 u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
187 u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
188 u'\ufffe' # 0x8C -> UNDEFINED
189 u'\ufffe' # 0x8D -> UNDEFINED
190 u'\ufffe' # 0x8E -> UNDEFINED
191 u'\xb1' # 0x8F -> PLUS-MINUS SIGN
192 u'\xb0' # 0x90 -> DEGREE SIGN
193 u'j' # 0x91 -> LATIN SMALL LETTER J
194 u'k' # 0x92 -> LATIN SMALL LETTER K
195 u'l' # 0x93 -> LATIN SMALL LETTER L
196 u'm' # 0x94 -> LATIN SMALL LETTER M
197 u'n' # 0x95 -> LATIN SMALL LETTER N
198 u'o' # 0x96 -> LATIN SMALL LETTER O
199 u'p' # 0x97 -> LATIN SMALL LETTER P
200 u'q' # 0x98 -> LATIN SMALL LETTER Q
201 u'r' # 0x99 -> LATIN SMALL LETTER R
202 u'\ufffe' # 0x9A -> UNDEFINED
203 u'\ufffe' # 0x9B -> UNDEFINED
204 u'\ufffe' # 0x9C -> UNDEFINED
205 u'\xb8' # 0x9D -> CEDILLA
206 u'\ufffe' # 0x9E -> UNDEFINED
207 u'\xa4' # 0x9F -> CURRENCY SIGN
208 u'\xb5' # 0xA0 -> MICRO SIGN
209 u'~' # 0xA1 -> TILDE
210 u's' # 0xA2 -> LATIN SMALL LETTER S
211 u't' # 0xA3 -> LATIN SMALL LETTER T
212 u'u' # 0xA4 -> LATIN SMALL LETTER U
213 u'v' # 0xA5 -> LATIN SMALL LETTER V
214 u'w' # 0xA6 -> LATIN SMALL LETTER W
215 u'x' # 0xA7 -> LATIN SMALL LETTER X
216 u'y' # 0xA8 -> LATIN SMALL LETTER Y
217 u'z' # 0xA9 -> LATIN SMALL LETTER Z
218 u'\ufffe' # 0xAA -> UNDEFINED
219 u'\ufffe' # 0xAB -> UNDEFINED
220 u'\ufffe' # 0xAC -> UNDEFINED
221 u'\ufffe' # 0xAD -> UNDEFINED
222 u'\ufffe' # 0xAE -> UNDEFINED
223 u'\xae' # 0xAF -> REGISTERED SIGN
224 u'^' # 0xB0 -> CIRCUMFLEX ACCENT
225 u'\xa3' # 0xB1 -> POUND SIGN
226 u'\xa5' # 0xB2 -> YEN SIGN
227 u'\xb7' # 0xB3 -> MIDDLE DOT
228 u'\xa9' # 0xB4 -> COPYRIGHT SIGN
229 u'\xa7' # 0xB5 -> SECTION SIGN
230 u'\xb6' # 0xB6 -> PILCROW SIGN
231 u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER
232 u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF
233 u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS
234 u'[' # 0xBA -> LEFT SQUARE BRACKET
235 u']' # 0xBB -> RIGHT SQUARE BRACKET
236 u'\xaf' # 0xBC -> MACRON
237 u'\xa8' # 0xBD -> DIAERESIS
238 u'\xb4' # 0xBE -> ACUTE ACCENT
239 u'\xd7' # 0xBF -> MULTIPLICATION SIGN
240 u'{' # 0xC0 -> LEFT CURLY BRACKET
241 u'A' # 0xC1 -> LATIN CAPITAL LETTER A
242 u'B' # 0xC2 -> LATIN CAPITAL LETTER B
243 u'C' # 0xC3 -> LATIN CAPITAL LETTER C
244 u'D' # 0xC4 -> LATIN CAPITAL LETTER D
245 u'E' # 0xC5 -> LATIN CAPITAL LETTER E
246 u'F' # 0xC6 -> LATIN CAPITAL LETTER F
247 u'G' # 0xC7 -> LATIN CAPITAL LETTER G
248 u'H' # 0xC8 -> LATIN CAPITAL LETTER H
249 u'I' # 0xC9 -> LATIN CAPITAL LETTER I
250 u'\xad' # 0xCA -> SOFT HYPHEN
251 u'\ufffe' # 0xCB -> UNDEFINED
252 u'\ufffe' # 0xCC -> UNDEFINED
253 u'\ufffe' # 0xCD -> UNDEFINED
254 u'\ufffe' # 0xCE -> UNDEFINED
255 u'\ufffe' # 0xCF -> UNDEFINED
256 u'}' # 0xD0 -> RIGHT CURLY BRACKET
257 u'J' # 0xD1 -> LATIN CAPITAL LETTER J
258 u'K' # 0xD2 -> LATIN CAPITAL LETTER K
259 u'L' # 0xD3 -> LATIN CAPITAL LETTER L
260 u'M' # 0xD4 -> LATIN CAPITAL LETTER M
261 u'N' # 0xD5 -> LATIN CAPITAL LETTER N
262 u'O' # 0xD6 -> LATIN CAPITAL LETTER O
263 u'P' # 0xD7 -> LATIN CAPITAL LETTER P
264 u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q
265 u'R' # 0xD9 -> LATIN CAPITAL LETTER R
266 u'\xb9' # 0xDA -> SUPERSCRIPT ONE
267 u'\ufffe' # 0xDB -> UNDEFINED
268 u'\ufffe' # 0xDC -> UNDEFINED
269 u'\ufffe' # 0xDD -> UNDEFINED
270 u'\ufffe' # 0xDE -> UNDEFINED
271 u'\ufffe' # 0xDF -> UNDEFINED
272 u'\\' # 0xE0 -> REVERSE SOLIDUS
273 u'\xf7' # 0xE1 -> DIVISION SIGN
274 u'S' # 0xE2 -> LATIN CAPITAL LETTER S
275 u'T' # 0xE3 -> LATIN CAPITAL LETTER T
276 u'U' # 0xE4 -> LATIN CAPITAL LETTER U
277 u'V' # 0xE5 -> LATIN CAPITAL LETTER V
278 u'W' # 0xE6 -> LATIN CAPITAL LETTER W
279 u'X' # 0xE7 -> LATIN CAPITAL LETTER X
280 u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y
281 u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z
282 u'\xb2' # 0xEA -> SUPERSCRIPT TWO
283 u'\ufffe' # 0xEB -> UNDEFINED
284 u'\ufffe' # 0xEC -> UNDEFINED
285 u'\ufffe' # 0xED -> UNDEFINED
286 u'\ufffe' # 0xEE -> UNDEFINED
287 u'\ufffe' # 0xEF -> UNDEFINED
288 u'0' # 0xF0 -> DIGIT ZERO
289 u'1' # 0xF1 -> DIGIT ONE
290 u'2' # 0xF2 -> DIGIT TWO
291 u'3' # 0xF3 -> DIGIT THREE
292 u'4' # 0xF4 -> DIGIT FOUR
293 u'5' # 0xF5 -> DIGIT FIVE
294 u'6' # 0xF6 -> DIGIT SIX
295 u'7' # 0xF7 -> DIGIT SEVEN
296 u'8' # 0xF8 -> DIGIT EIGHT
297 u'9' # 0xF9 -> DIGIT NINE
298 u'\xb3' # 0xFA -> SUPERSCRIPT THREE
299 u'\ufffe' # 0xFB -> UNDEFINED
300 u'\ufffe' # 0xFC -> UNDEFINED
301 u'\ufffe' # 0xFD -> UNDEFINED
302 u'\ufffe' # 0xFE -> UNDEFINED
303 u'\x9f' # 0xFF -> EIGHT ONES
306 ### Encoding table
307 encoding_table=codecs.charmap_build(decoding_table)