nntp.headerdict¶
Case-insensitive ordered mapping for headers. Copyright (C) 2013-2024 Byron Platt
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Classes¶
Mapping of header names to values, with case-insensitive names. |
Module Contents¶
- class nntp.headerdict.HeaderDict(other: collections.abc.Mapping[str, str] | collections.abc.Iterable[tuple[str, str]] = (), **kwargs: str)¶
Bases:
collections.abc.MutableMapping[str,str]Mapping of header names to values, with case-insensitive names.
Names keep the case they were first set with and iterate in insertion order. Equality with another mapping ignores name case and order.
- __hash__ = None¶
- _items: dict[str, tuple[str, str]]¶
- classmethod _from_fields(keys: tuple[str, ...], names: tuple[str, ...], values: collections.abc.Iterable[str]) HeaderDict¶
Build from casefolded keys and names computed once by the caller.
Used for XOVER, where every line has the same unique field names; this skips the per-item work of __setitem__.
- __getitem__(key: str) str¶
- __setitem__(key: str, value: str) None¶
- __delitem__(key: str) None¶
- __contains__(key: object) bool¶
- __iter__() collections.abc.Iterator[str]¶
- __len__() int¶
- _folded() dict[str, str]¶
- __eq__(other: object) bool¶
- __repr__() str¶