Staging
v0.5.1
https://github.com/python/cpython
Revision a3d6d23a923d62a713b9e4536d5f7ce7313d99c7 authored by Miss Islington (bot) on 11 June 2020, 19:32:37 UTC, committed by GitHub on 11 June 2020, 19:32:37 UTC

Add hdf5 with .h5 file extension

See 'Recommendations' section for mime types from the HDF group:  https://www.hdfgroup.org/2018/06/citations-for-hdf-data-and-software/

Patch by Mark Schwab.
(cherry picked from commit 60c2a810e37994fc640c58d0ef45b6843354b770)

Co-authored-by: MARK SCHWAB <32745414+schwabm@users.noreply.github.com>
1 parent 3e499cd
Raw File
Tip revision: a3d6d23a923d62a713b9e4536d5f7ce7313d99c7 authored by Miss Islington (bot) on 11 June 2020, 19:32:37 UTC
bpo-40626: Support HDF5 in mimetypes (GH-20042)
Tip revision: a3d6d23
gb2312.py
#
# gb2312.py: Python Unicode Codec for GB2312
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
#

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,
    )
back to top