PATH:
usr
/
lib
/
python3.9
/
site-packages
/
dns
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license import collections.abc from typing import Any, Callable from dns._immutable_ctx import immutable @immutable class Dict(collections.abc.Mapping): # lgtm[py/missing-equals] def __init__( self, dictionary: Any, no_copy: bool = False, map_factory: Callable[[], collections.abc.MutableMapping] = dict, ): """Make an immutable dictionary from the specified dictionary. If *no_copy* is `True`, then *dictionary* will be wrapped instead of copied. Only set this if you are sure there will be no external references to the dictionary. """ if no_copy and isinstance(dictionary, collections.abc.MutableMapping): self._odict = dictionary else: self._odict = map_factory() self._odict.update(dictionary) self._hash = None def __getitem__(self, key): return self._odict.__getitem__(key) def __hash__(self): # pylint: disable=invalid-hash-returned if self._hash is None: h = 0 for key in sorted(self._odict.keys()): h ^= hash(key) object.__setattr__(self, "_hash", h) # this does return an int, but pylint doesn't figure that out return self._hash def __len__(self): return len(self._odict) def __iter__(self): return iter(self._odict) def constify(o: Any) -> Any: """ Convert mutable types to immutable types. """ if isinstance(o, bytearray): return bytes(o) if isinstance(o, tuple): try: hash(o) return o except Exception: return tuple(constify(elt) for elt in o) if isinstance(o, list): return tuple(constify(elt) for elt in o) if isinstance(o, dict): cdict = dict() for k, v in o.items(): cdict[k] = constify(v) return Dict(cdict, True) return o
[-] enum.py
[edit]
[-] rdata.py
[edit]
[-] resolver.py
[edit]
[-] _asyncbackend.py
[edit]
[-] message.py
[edit]
[-] e164.py
[edit]
[+]
rdtypes
[-] win32util.py
[edit]
[-] zone.py
[edit]
[-] versioned.py
[edit]
[-] tokenizer.py
[edit]
[-] tsig.py
[edit]
[-] xfr.py
[edit]
[-] tsigkeyring.py
[edit]
[-] set.py
[edit]
[-] rdataset.py
[edit]
[-] dnssec.py
[edit]
[-] namedict.py
[edit]
[-] nameserver.py
[edit]
[-] wire.py
[edit]
[-] _immutable_ctx.py
[edit]
[-] immutable.py
[edit]
[-] opcode.py
[edit]
[-] ttl.py
[edit]
[-] asyncresolver.py
[edit]
[-] __init__.py
[edit]
[-] name.py
[edit]
[-] _ddr.py
[edit]
[-] rdatatype.py
[edit]
[-] rcode.py
[edit]
[-] rrset.py
[edit]
[-] zonefile.py
[edit]
[-] edns.py
[edit]
[-] renderer.py
[edit]
[+]
..
[-] _features.py
[edit]
[-] zonetypes.py
[edit]
[-] asyncquery.py
[edit]
[-] dnssectypes.py
[edit]
[-] grange.py
[edit]
[-] transaction.py
[edit]
[-] asyncbackend.py
[edit]
[-] reversename.py
[edit]
[+]
dnssecalgs
[-] entropy.py
[edit]
[-] ipv4.py
[edit]
[-] inet.py
[edit]
[-] version.py
[edit]
[-] _asyncio_backend.py
[edit]
[+]
__pycache__
[-] update.py
[edit]
[-] exception.py
[edit]
[-] ipv6.py
[edit]
[+]
quic
[-] serial.py
[edit]
[-] node.py
[edit]
[-] flags.py
[edit]
[-] rdataclass.py
[edit]
[-] query.py
[edit]