Installation
Install the distribution from source:
$ python setup.py install
Or install with easy_install:
$ easy_install fnord.easycodec
Usage
This package can be used to easily create and register codecs.
Use the decorator encoder to create an encode-function:
>>> from fnord.easycodec import encoder
>>> @encoder("my_codec")
... def my_encode(message):
... ...
(my_codec is the name of the codec.)
Use the decorator decoder to create a decode-function:
>>> from fnord.easycodec import decoder
>>> @decoder("my_codec")
... def my_decode(message):
... ...
Use the factory CodecRegistration to create an object that can be returned by a codec’s search-function:
>>> from fnord.easycodec import CodecRegistration, AUTO >>> registration = CodecRegistration( ... "my_codec", my_encode, my_decode, ... streamwriter=AUTO, streamreader=AUTO)
This factory takes the following parameters:
- name:
The name of the codec. Required.
- encode:
The encode-function. Required.
- decode:
The decode-function. Required.
- incrementalencoder:
The incremental encoder. Optional.
- incrementaldecoder:
The incremental decoder. Optional.
- streamwriter:
The stream-writer. Optional.
- streamreader:
The stream-reader. Optional.
If one of the optional parameters has the value AUTO assigned, an appropriate object will be generated and used.
Use the factory CodecSearch to create a search-function for a codec. The parameters are the same as for CodecRegistration:
>>> from fnord.easycodec import CodecSearch >>> search = CodecSearch( ... "my_codec", my_encode, my_decode, ... streamwriter=AUTO, streamreader=AUTO)
This function can then be used to register the codec:
>>> import codecs >>> codecs.register(search)
Contributors
Bert Vanderbauwhede <batlock666@gmail.com>, Author
Changelog
0.2 (2013-08-17)
Fixed parameters to constructor for exception UnicodeDecodeError [Bert Vanderbauwhede]
0.1 (2013-08-11)
Package created using templer [Bert Vanderbauwhede]
First implementation [Bert Vanderbauwhede]
Metadata
Release files for fnord.easycodec 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fnord.easycodec-0.2.tar.gz | 6.8 kB | Without provenance | Details for fnord.easycodec-0.2.tar.gz |
Release files / fnord.easycodec-0.2.tar.gz
| Download URL | fnord.easycodec-0.2.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2c6dfa48b621c3fb779ab78adc68b170d90b6aceece05e92f605d52dfee6fdc
|
|
BLAKE2b-256 checksum How to use checksums |
5ac98df1c0f4d3ca7db965156585001544c04dabecb89875abcdee8bed930f62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for fnord.easycodec 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.