samuelcolvin / multidict

multidict implementation

Home Page:https://multidict.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

multidict

image

image

image

image

image

Coverage metrics

Chat on Gitter

Multidict is dict-like collection of key-value pairs where key might be occurred more than once in the container.

Introduction

HTTP Headers and URL query string require specific data structure: multidict. It behaves mostly like a regular dict but it may have several values for the same key and preserves insertion ordering.

The key is str (or istr for case-insensitive dictionaries).

multidict has four multidict classes: MultiDict, MultiDictProxy, CIMultiDict and CIMultiDictProxy.

Immutable proxies (MultiDictProxy and CIMultiDictProxy) provide a dynamic view for the proxied multidict, the view reflects underlying collection changes. They implement the collections.abc.Mapping interface.

Regular mutable (MultiDict and CIMultiDict) classes implement collections.abc.MutableMapping and allows to change their own content.

Case insensitive (CIMultiDict and CIMultiDictProxy) ones assume the keys are case insensitive, e.g.:

>>> dct = CIMultiDict(key='val')
>>> 'Key' in dct
True
>>> dct['Key']
'val'

Keys should be str or istr instances.

The library has optional Cython optimization for sake of speed.

License

Apache 2

Changelog

See RTD page.

About

multidict implementation

https://multidict.readthedocs.io

License:Apache License 2.0


Languages

Language:Python 57.1%Language:C 39.3%Language:Shell 1.7%Language:Makefile 1.1%Language:Batchfile 0.5%Language:C++ 0.4%