Exemple #1
0
 def test_decode_hz_replace(self):
     import _codecs_cn
     codec = _codecs_cn.getcodec("hz")
     r = codec.decode("def~{}abc", errors='replace')
     assert r == (u'def\ufffd\u5fcf', 9)
     r = codec.decode("def~{}abc", 'replace')
     assert r == (u'def\ufffd\u5fcf', 9)
Exemple #2
0
 def test_decode_hz_ignore(self):
     import _codecs_cn
     codec = _codecs_cn.getcodec("hz")
     r = codec.decode("def~{}abc", errors='ignore')
     assert r == (u'def\u5fcf', 9)
     r = codec.decode("def~{}abc", 'ignore')
     assert r == (u'def\u5fcf', 9)
Exemple #3
0
 def test_encode_hz_error(self):
     import _codecs_cn
     codec = _codecs_cn.getcodec("hz")
     u = u'abc\u1234def'
     e = raises(UnicodeEncodeError, codec.encode, u).value
     assert e.args == ('hz', u, 3, 4, 'illegal multibyte sequence')
     assert e.encoding == 'hz'
     assert e.object == u and type(e.object) is unicode
     assert e.start == 3
     assert e.end == 4
     assert e.reason == 'illegal multibyte sequence'
Exemple #4
0
 def test_decode_hz_error(self):
     import _codecs_cn
     codec = _codecs_cn.getcodec("hz")
     e = raises(UnicodeDecodeError, codec.decode, "~{}").value
     assert e.args == ('hz', '~{}', 2, 3, 'incomplete multibyte sequence')
     assert e.encoding == 'hz'
     assert e.object == '~{}' and type(e.object) is str
     assert e.start == 2
     assert e.end == 3
     assert e.reason == "incomplete multibyte sequence"
     #
     e = raises(UnicodeDecodeError, codec.decode, "~{xyz}").value
     assert e.args == ('hz', '~{xyz}', 2, 4, 'illegal multibyte sequence')
Exemple #5
0
 def test_strict_error(self):
     import _codecs_cn
     codec = _codecs_cn.getcodec("hz")
     r = codec.decode("~{abc}", "strict")
     assert r == (u'\u5f95\u6cef', 6)
     assert type(r[0]) is unicode
Exemple #6
0
# 2015.11.10 21:35:49 Støední Evropa (bìžný èas)
# Embedded file name: scripts/common/Lib/encodings/hz.py
import _codecs_cn, codecs
import _multibytecodec as mbc

codec = _codecs_cn.getcodec("hz")


class Codec(codecs.Codec):
    encode = codec.encode
    decode = codec.decode


class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder):
    codec = codec


class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder):
    codec = codec


class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
    codec = codec


class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
    codec = codec


def getregentry():
    return codecs.CodecInfo(
Exemple #7
0
# 2015.11.10 21:35:48 Støední Evropa (bìžný èas)
# Embedded file name: scripts/common/Lib/encodings/gb18030.py
import _codecs_cn, codecs
import _multibytecodec as mbc
codec = _codecs_cn.getcodec('gb18030')

class Codec(codecs.Codec):
    encode = codec.encode
    decode = codec.decode


class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder):
    codec = codec


class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder):
    codec = codec


class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
    codec = codec


class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
    codec = codec


def getregentry():
    return codecs.CodecInfo(name='gb18030', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter)
# okay decompyling c:\Users\PC\wotsources\files\originals\res_bw\scripts\common\lib\encodings\gb18030.pyc 
# decompiled 1 files: 1 okay, 0 failed, 0 verify failed
Exemple #8
0
 def test_encode_hz_replace(self):
     import _codecs_cn
     codec = _codecs_cn.getcodec("hz")
     r = codec.encode(u'abc\u1234def', 'replace')
     assert r == ('abc?def', 7)
     assert type(r[0]) is str
Exemple #9
0
#Embedded file name: c:\depot\games\branches\release\EVE-TRANQUILITY\carbon\common\stdlib\encodings\gbk.py
import _codecs_cn, codecs
import _multibytecodec as mbc
codec = _codecs_cn.getcodec('gbk')


class Codec(codecs.Codec):
    encode = codec.encode
    decode = codec.decode


class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
                         codecs.IncrementalEncoder):
    codec = codec


class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
                         codecs.IncrementalDecoder):
    codec = codec


class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
    codec = codec


class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
    codec = codec


def getregentry():
    return codecs.CodecInfo(name='gbk',
# uncompyle6 version 2.14.1
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.12 (default, Nov 19 2016, 06:48:10)
# [GCC 5.4.0 20160609]
# Embedded file name: encodings\gb18030.pyc
# Compiled at: 2016-06-25 21:46:06
import _codecs_cn, codecs, _multibytecodec as mbc
codec = _codecs_cn.getcodec('gb18030')


class Codec(codecs.Codec):
    encode = codec.encode
    decode = codec.decode


class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
                         codecs.IncrementalEncoder):
    codec = codec


class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
                         codecs.IncrementalDecoder):
    codec = codec


class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
    codec = codec


class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
    codec = codec
Exemple #11
0
#
# hz.py: Python Unicode Codec for HZ
#
# Written by Hye-Shik Chang <*****@*****.**>
#

import _codecs_cn
import _multibytecodec as mbc
import codecs

codec = _codecs_cn.getcodec('hz')


class Codec(codecs.Codec):
    encode = codec.encode
    decode = codec.decode


class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
                         codecs.IncrementalEncoder):
    codec = codec


class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
                         codecs.IncrementalDecoder):
    codec = codec


class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
    codec = codec
Exemple #12
0
#
# gb2312.py: Python Unicode Codec for GB2312
#
# Written by Hye-Shik Chang <*****@*****.**>
#

import _codecs_cn, codecs
import _multibytecodec as mbc

codec = _codecs_cn.getcodec('gb2312')

class Codec(codecs.Codec):
    encode = codec.encode
    decode = codec.decode

class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
                         codecs.IncrementalEncoder):
    codec = codec

class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
                         codecs.IncrementalDecoder):
    codec = codec

class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
    codec = codec

class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
    codec = codec

def getregentry():
    return codecs.CodecInfo(
Exemple #13
0
#
# gbk.py: Python Unicode Codec for GBK
#
# Written by Hye-Shik Chang <*****@*****.**>
#

import _codecs_cn, codecs
import _multibytecodec as mbc

codec = _codecs_cn.getcodec("gbk")


class Codec(codecs.Codec):
    encode = codec.encode
    decode = codec.decode


class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
                         codecs.IncrementalEncoder):
    codec = codec


class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
                         codecs.IncrementalDecoder):
    codec = codec


class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
    codec = codec

Exemple #14
0
 def test_encode_hz_replace(self):
     import _codecs_cn
     codec = _codecs_cn.getcodec("hz")
     r = codec.encode(u'abc\u1234def', 'replace')
     assert r == ('abc?def', 7)
     assert type(r[0]) is str
Exemple #15
0
 def test_encode_hz(self):
     import _codecs_cn
     codec = _codecs_cn.getcodec("hz")
     r = codec.encode(u'\u5f95\u6cef')
     assert r == ('~{abc}~}', 2)
     assert type(r[0]) is str
Exemple #16
0
 def test_encode_hz(self):
     import _codecs_cn
     codec = _codecs_cn.getcodec("hz")
     r = codec.encode(u'\u5f95\u6cef')
     assert r == ('~{abc}~}', 2)
     assert type(r[0]) is str
Exemple #17
0
#
# gb18030.py: Python Unicode Codec for GB18030
#
# Written by Hye-Shik Chang <*****@*****.**>
# $CJKCodecs: gb18030.py,v 1.8 2004/06/28 18:16:03 perky Exp $
#

import _codecs_cn, codecs

codec = _codecs_cn.getcodec("gb18030")


class Codec(codecs.Codec):
    encode = codec.encode
    decode = codec.decode


class StreamReader(Codec, codecs.StreamReader):
    def __init__(self, stream, errors="strict"):
        codecs.StreamReader.__init__(self, stream, errors)
        __codec = codec.StreamReader(stream, errors)
        self.read = __codec.read
        self.readline = __codec.readline
        self.readlines = __codec.readlines
        self.reset = __codec.reset


class StreamWriter(Codec, codecs.StreamWriter):
    def __init__(self, stream, errors="strict"):
        codecs.StreamWriter.__init__(self, stream, errors)
        __codec = codec.StreamWriter(stream, errors)
Exemple #18
0
# 2015.11.18 12:03:40 Støední Evropa (bìžný èas)
# Embedded file name: scripts/common/Lib/encodings/gb2312.py
import _codecs_cn, codecs
import _multibytecodec as mbc

codec = _codecs_cn.getcodec("gb2312")


class Codec(codecs.Codec):
    encode = codec.encode
    decode = codec.decode


class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder):
    codec = codec


class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder):
    codec = codec


class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
    codec = codec


class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
    codec = codec


def getregentry():
    return codecs.CodecInfo(
Exemple #19
0
#Embedded file name: e:\jenkins\workspace\client_SERENITY\branches\release\SERENITY\carbon\common\stdlib\encodings\gb2312.py
import _codecs_cn, codecs
import _multibytecodec as mbc
codec = _codecs_cn.getcodec('gb2312')

class Codec(codecs.Codec):
    encode = codec.encode
    decode = codec.decode


class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder):
    codec = codec


class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder):
    codec = codec


class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
    codec = codec


class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
    codec = codec


def getregentry():
    return codecs.CodecInfo(name='gb2312', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter)
Exemple #20
0
 def test_decode_hz(self):
     import _codecs_cn
     codec = _codecs_cn.getcodec("hz")
     r = codec.decode("~{abc}")
     assert r == (u'\u5f95\u6cef', 6)
Exemple #21
0
#
# gbk.py: Python Unicode Codec for GBK
#
# Written by Hye-Shik Chang <*****@*****.**>
#

import _codecs_cn, codecs
import _multibytecodec as mbc

codec = _codecs_cn.getcodec('gbk')

class Codec(codecs.Codec):
    encode = codec.encode
    decode = codec.decode

class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
                         codecs.IncrementalEncoder):
    codec = codec

class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
                         codecs.IncrementalDecoder):
    codec = codec

class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
    codec = codec

class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
    codec = codec

def getregentry():
    return codecs.CodecInfo(
Exemple #22
0
 def test_strict_error(self):
     import _codecs_cn
     codec = _codecs_cn.getcodec("hz")
     r = codec.decode("~{abc}", "strict")
     assert r == (u'\u5f95\u6cef', 6)
     assert type(r[0]) is unicode
Exemple #23
0
import _codecs_cn
import codecs
import _multibytecodec as mbc
codec = _codecs_cn.getcodec('hz')

class Codec(codecs.Codec):
    __qualname__ = 'Codec'
    encode = codec.encode
    decode = codec.decode

class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEncoder):
    __qualname__ = 'IncrementalEncoder'
    codec = codec

class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder):
    __qualname__ = 'IncrementalDecoder'
    codec = codec

class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
    __qualname__ = 'StreamReader'
    codec = codec

class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
    __qualname__ = 'StreamWriter'
    codec = codec

def getregentry():
    return codecs.CodecInfo(name='hz', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter)

Exemple #24
0
 def test_decode_hz(self):
     import _codecs_cn
     codec = _codecs_cn.getcodec("hz")
     r = codec.decode("~{abc}")
     assert r == (u'\u5f95\u6cef', 6)