mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Bump dnspython from 2.6.1 to 2.7.0 (#2440)
* Bump dnspython from 2.6.1 to 2.7.0 Bumps [dnspython](https://github.com/rthalley/dnspython) from 2.6.1 to 2.7.0. - [Release notes](https://github.com/rthalley/dnspython/releases) - [Changelog](https://github.com/rthalley/dnspython/blob/main/doc/whatsnew.rst) - [Commits](https://github.com/rthalley/dnspython/compare/v2.6.1...v2.7.0) --- updated-dependencies: - dependency-name: dnspython dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update dnspython==2.7.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
0836fb902c
commit
feca713b76
56 changed files with 1382 additions and 665 deletions
|
@ -214,7 +214,7 @@ class Rdata:
|
|||
compress: Optional[dns.name.CompressType] = None,
|
||||
origin: Optional[dns.name.Name] = None,
|
||||
canonicalize: bool = False,
|
||||
) -> bytes:
|
||||
) -> None:
|
||||
raise NotImplementedError # pragma: no cover
|
||||
|
||||
def to_wire(
|
||||
|
@ -223,14 +223,19 @@ class Rdata:
|
|||
compress: Optional[dns.name.CompressType] = None,
|
||||
origin: Optional[dns.name.Name] = None,
|
||||
canonicalize: bool = False,
|
||||
) -> bytes:
|
||||
) -> Optional[bytes]:
|
||||
"""Convert an rdata to wire format.
|
||||
|
||||
Returns a ``bytes`` or ``None``.
|
||||
Returns a ``bytes`` if no output file was specified, or ``None`` otherwise.
|
||||
"""
|
||||
|
||||
if file:
|
||||
return self._to_wire(file, compress, origin, canonicalize)
|
||||
# We call _to_wire() and then return None explicitly instead of
|
||||
# of just returning the None from _to_wire() as mypy's func-returns-value
|
||||
# unhelpfully errors out with "error: "_to_wire" of "Rdata" does not return
|
||||
# a value (it only ever returns None)"
|
||||
self._to_wire(file, compress, origin, canonicalize)
|
||||
return None
|
||||
else:
|
||||
f = io.BytesIO()
|
||||
self._to_wire(f, compress, origin, canonicalize)
|
||||
|
@ -253,8 +258,9 @@ class Rdata:
|
|||
|
||||
Returns a ``bytes``.
|
||||
"""
|
||||
|
||||
return self.to_wire(origin=origin, canonicalize=True)
|
||||
wire = self.to_wire(origin=origin, canonicalize=True)
|
||||
assert wire is not None # for mypy
|
||||
return wire
|
||||
|
||||
def __repr__(self):
|
||||
covers = self.covers()
|
||||
|
@ -434,15 +440,11 @@ class Rdata:
|
|||
continue
|
||||
if key not in parameters:
|
||||
raise AttributeError(
|
||||
"'{}' object has no attribute '{}'".format(
|
||||
self.__class__.__name__, key
|
||||
)
|
||||
f"'{self.__class__.__name__}' object has no attribute '{key}'"
|
||||
)
|
||||
if key in ("rdclass", "rdtype"):
|
||||
raise AttributeError(
|
||||
"Cannot overwrite '{}' attribute '{}'".format(
|
||||
self.__class__.__name__, key
|
||||
)
|
||||
f"Cannot overwrite '{self.__class__.__name__}' attribute '{key}'"
|
||||
)
|
||||
|
||||
# Construct the parameter list. For each field, use the value in
|
||||
|
@ -646,13 +648,14 @@ _rdata_classes: Dict[Tuple[dns.rdataclass.RdataClass, dns.rdatatype.RdataType],
|
|||
{}
|
||||
)
|
||||
_module_prefix = "dns.rdtypes"
|
||||
_dynamic_load_allowed = True
|
||||
|
||||
|
||||
def get_rdata_class(rdclass, rdtype):
|
||||
def get_rdata_class(rdclass, rdtype, use_generic=True):
|
||||
cls = _rdata_classes.get((rdclass, rdtype))
|
||||
if not cls:
|
||||
cls = _rdata_classes.get((dns.rdatatype.ANY, rdtype))
|
||||
if not cls:
|
||||
if not cls and _dynamic_load_allowed:
|
||||
rdclass_text = dns.rdataclass.to_text(rdclass)
|
||||
rdtype_text = dns.rdatatype.to_text(rdtype)
|
||||
rdtype_text = rdtype_text.replace("-", "_")
|
||||
|
@ -670,12 +673,36 @@ def get_rdata_class(rdclass, rdtype):
|
|||
_rdata_classes[(rdclass, rdtype)] = cls
|
||||
except ImportError:
|
||||
pass
|
||||
if not cls:
|
||||
if not cls and use_generic:
|
||||
cls = GenericRdata
|
||||
_rdata_classes[(rdclass, rdtype)] = cls
|
||||
return cls
|
||||
|
||||
|
||||
def load_all_types(disable_dynamic_load=True):
|
||||
"""Load all rdata types for which dnspython has a non-generic implementation.
|
||||
|
||||
Normally dnspython loads DNS rdatatype implementations on demand, but in some
|
||||
specialized cases loading all types at an application-controlled time is preferred.
|
||||
|
||||
If *disable_dynamic_load*, a ``bool``, is ``True`` then dnspython will not attempt
|
||||
to use its dynamic loading mechanism if an unknown type is subsequently encountered,
|
||||
and will simply use the ``GenericRdata`` class.
|
||||
"""
|
||||
# Load class IN and ANY types.
|
||||
for rdtype in dns.rdatatype.RdataType:
|
||||
get_rdata_class(dns.rdataclass.IN, rdtype, False)
|
||||
# Load the one non-ANY implementation we have in CH. Everything
|
||||
# else in CH is an ANY type, and we'll discover those on demand but won't
|
||||
# have to import anything.
|
||||
get_rdata_class(dns.rdataclass.CH, dns.rdatatype.A, False)
|
||||
if disable_dynamic_load:
|
||||
# Now disable dynamic loading so any subsequent unknown type immediately becomes
|
||||
# GenericRdata without a load attempt.
|
||||
global _dynamic_load_allowed
|
||||
_dynamic_load_allowed = False
|
||||
|
||||
|
||||
def from_text(
|
||||
rdclass: Union[dns.rdataclass.RdataClass, str],
|
||||
rdtype: Union[dns.rdatatype.RdataType, str],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue