IncrementalEncoder and IncrementalDecoder, These have to provide the interface defined by the base classes Incremental encoder and decoder classes or factory functions. incrementalencoder ¶ incrementaldecoder ¶ The functions or methods are expected to work in a stateless mode. The encode() and decode() methods of Codec These must beįunctions or methods which have the same interface as The stateless encoding and decoding functions. The constructorĪrguments are stored in attributes of the same name: name ¶ CodecInfo ( encode, decode, streamreader = None, streamwriter = None, incrementalencoder = None, incrementaldecoder = None, name = None ) ¶Ĭodec details when looking up the codec registry. Is stored in the cache and returned to the caller. If no CodecInfo object isįound, a LookupError is raised. Looks up the codec info in the Python codec registry and returns aĮncodings are first looked up in the registry’s cache. The full details for each codec can also be looked up directly: codecs. decode ( obj, encoding = 'utf-8', errors = 'strict' ) ¶ĭecodes obj using the codec registered for encoding.ĭefault error handler is 'strict' meaning that decoding errors raise ValueError (or a more codec specific subclass, such as Theĭefault error handler is 'strict' meaning that encoding errors raise encode ( obj, encoding = 'utf-8', errors = 'strict' ) ¶Įncodes obj using the codec registered for encoding.Įrrors may be given to set the desired error handling scheme. The module defines the following functions for encoding and decoding withĪny codec: codecs. Text encodings or with codecs that encode to Types, but some module features are restricted to be used specifically with Custom codecs may encode and decode between arbitrary Most standard codecsĪre text encodings, which encode text to bytes (andĭecode bytes to text), but there are also codecs provided that encode text to Manages the codec and error handling lookup process. This module defines base classes for standard Python codecs (encoders andĭecoders) and provides access to the internal Python codec registry, which Codecs - Codec registry and base classes ¶
0 Comments
Leave a Reply. |