Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/multidict/__init__.py: 89%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2Multidict implementation.
4HTTP Headers and URL query string require specific data structure:
5multidict. It behaves mostly like a dict but it can have
6several values for the same key.
7"""
9from pathlib import Path
10from typing import TYPE_CHECKING
12from ._abc import MultiMapping, MutableMultiMapping
13from ._compat import USE_EXTENSIONS
15__all__ = (
16 "CIMultiDict",
17 "CIMultiDictProxy",
18 "MultiDict",
19 "MultiDictProxy",
20 "MultiMapping",
21 "MutableMultiMapping",
22 "get_include",
23 "getversion",
24 "istr",
25 "upstr",
26)
28__version__ = "7.0.0"
31if TYPE_CHECKING or not USE_EXTENSIONS:
32 from ._multidict_py import (
33 CIMultiDict,
34 CIMultiDictProxy,
35 MultiDict,
36 MultiDictProxy,
37 getversion,
38 istr,
39 )
40else:
41 from collections.abc import ItemsView, KeysView, ValuesView
43 from ._multidict import (
44 CIMultiDict,
45 CIMultiDictProxy,
46 MultiDict,
47 MultiDictProxy,
48 _ItemsView,
49 _KeysView,
50 _ValuesView,
51 getversion,
52 istr,
53 )
55 MultiMapping.register(MultiDictProxy)
56 MutableMultiMapping.register(MultiDict)
57 KeysView.register(_KeysView)
58 ItemsView.register(_ItemsView)
59 ValuesView.register(_ValuesView)
62upstr = istr
65def get_include() -> str:
66 """Return the directory containing multidict's C API headers.
68 Pass it as an ``-I`` include path when building a C extension
69 against ``multidict_capi.h``.
70 """
71 return str(Path(__file__).absolute().parent)