| 215 | |
| 216 | |
| 217 | class EUCJPDistributionAnalysis(CharDistributionAnalysis): |
| 218 | def __init__(self): |
| 219 | super(EUCJPDistributionAnalysis, self).__init__() |
| 220 | self._char_to_freq_order = JIS_CHAR_TO_FREQ_ORDER |
| 221 | self._table_size = JIS_TABLE_SIZE |
| 222 | self.typical_distribution_ratio = JIS_TYPICAL_DISTRIBUTION_RATIO |
| 223 | |
| 224 | def get_order(self, byte_str): |
| 225 | # for euc-JP encoding, we are interested |
| 226 | # first byte range: 0xa0 -- 0xfe |
| 227 | # second byte range: 0xa1 -- 0xfe |
| 228 | # no validation needed here. State machine has done that |
| 229 | char = byte_str[0] |
| 230 | if char >= 0xA0: |
| 231 | return 94 * (char - 0xA1) + byte_str[1] - 0xa1 |
| 232 | else: |
| 233 | return -1 |
no outgoing calls
no test coverage detected
searching dependent graphs…