Bump dnspython from 2.2.1 to 2.3.0 (#1975)

* Bump dnspython from 2.2.1 to 2.3.0

Bumps [dnspython](https://github.com/rthalley/dnspython) from 2.2.1 to 2.3.0.
- [Release notes](https://github.com/rthalley/dnspython/releases)
- [Changelog](https://github.com/rthalley/dnspython/blob/master/doc/whatsnew.rst)
- [Commits](https://github.com/rthalley/dnspython/compare/v2.2.1...v2.3.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.3.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:
dependabot[bot] 2023-03-02 20:54:32 -08:00 committed by GitHub
parent 6910079330
commit 32c06a8b72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
137 changed files with 7699 additions and 4277 deletions

View file

@ -17,6 +17,7 @@
"""DNS RRsets (an RRset is a named rdataset)"""
from typing import Any, cast, Collection, Dict, Optional, Union
import dns.name
import dns.rdataset
@ -35,10 +36,16 @@ class RRset(dns.rdataset.Rdataset):
name.
"""
__slots__ = ['name', 'deleting']
__slots__ = ["name", "deleting"]
def __init__(self, name, rdclass, rdtype, covers=dns.rdatatype.NONE,
deleting=None):
def __init__(
self,
name: dns.name.Name,
rdclass: dns.rdataclass.RdataClass,
rdtype: dns.rdatatype.RdataType,
covers: dns.rdatatype.RdataType = dns.rdatatype.NONE,
deleting: Optional[dns.rdataclass.RdataClass] = None,
):
"""Create a new RRset."""
super().__init__(rdclass, rdtype, covers)
@ -53,17 +60,26 @@ class RRset(dns.rdataset.Rdataset):
def __repr__(self):
if self.covers == 0:
ctext = ''
ctext = ""
else:
ctext = '(' + dns.rdatatype.to_text(self.covers) + ')'
ctext = "(" + dns.rdatatype.to_text(self.covers) + ")"
if self.deleting is not None:
dtext = ' delete=' + dns.rdataclass.to_text(self.deleting)
dtext = " delete=" + dns.rdataclass.to_text(self.deleting)
else:
dtext = ''
return '<DNS ' + str(self.name) + ' ' + \
dns.rdataclass.to_text(self.rdclass) + ' ' + \
dns.rdatatype.to_text(self.rdtype) + ctext + dtext + \
' RRset: ' + self._rdata_repr() + '>'
dtext = ""
return (
"<DNS "
+ str(self.name)
+ " "
+ dns.rdataclass.to_text(self.rdclass)
+ " "
+ dns.rdatatype.to_text(self.rdtype)
+ ctext
+ dtext
+ " RRset: "
+ self._rdata_repr()
+ ">"
)
def __str__(self):
return self.to_text()
@ -76,7 +92,7 @@ class RRset(dns.rdataset.Rdataset):
return False
return super().__eq__(other)
def match(self, *args, **kwargs):
def match(self, *args: Any, **kwargs: Any) -> bool: # type: ignore[override]
"""Does this rrset match the specified attributes?
Behaves as :py:func:`full_match()` if the first argument is a
@ -89,12 +105,18 @@ class RRset(dns.rdataset.Rdataset):
compatibility.)
"""
if isinstance(args[0], dns.name.Name):
return self.full_match(*args, **kwargs)
return self.full_match(*args, **kwargs) # type: ignore[arg-type]
else:
return super().match(*args, **kwargs)
return super().match(*args, **kwargs) # type: ignore[arg-type]
def full_match(self, name, rdclass, rdtype, covers,
deleting=None):
def full_match(
self,
name: dns.name.Name,
rdclass: dns.rdataclass.RdataClass,
rdtype: dns.rdatatype.RdataType,
covers: dns.rdatatype.RdataType,
deleting: Optional[dns.rdataclass.RdataClass] = None,
) -> bool:
"""Returns ``True`` if this rrset matches the specified name, class,
type, covers, and deletion state.
"""
@ -106,7 +128,12 @@ class RRset(dns.rdataset.Rdataset):
# pylint: disable=arguments-differ
def to_text(self, origin=None, relativize=True, **kw):
def to_text( # type: ignore[override]
self,
origin: Optional[dns.name.Name] = None,
relativize: bool = True,
**kw: Dict[str, Any]
) -> str:
"""Convert the RRset into DNS zone file format.
See ``dns.name.Name.choose_relativity`` for more information
@ -123,11 +150,17 @@ class RRset(dns.rdataset.Rdataset):
to *origin*.
"""
return super().to_text(self.name, origin, relativize,
self.deleting, **kw)
return super().to_text(
self.name, origin, relativize, self.deleting, **kw # type: ignore
)
def to_wire(self, file, compress=None, origin=None,
**kw):
def to_wire( # type: ignore[override]
self,
file: Any,
compress: Optional[dns.name.CompressType] = None, # type: ignore
origin: Optional[dns.name.Name] = None,
**kw: Dict[str, Any]
) -> int:
"""Convert the RRset to wire format.
All keyword arguments are passed to ``dns.rdataset.to_wire()``; see
@ -136,12 +169,13 @@ class RRset(dns.rdataset.Rdataset):
Returns an ``int``, the number of records emitted.
"""
return super().to_wire(self.name, file, compress, origin,
self.deleting, **kw)
return super().to_wire(
self.name, file, compress, origin, self.deleting, **kw # type:ignore
)
# pylint: enable=arguments-differ
def to_rdataset(self):
def to_rdataset(self) -> dns.rdataset.Rdataset:
"""Convert an RRset into an Rdataset.
Returns a ``dns.rdataset.Rdataset``.
@ -149,9 +183,17 @@ class RRset(dns.rdataset.Rdataset):
return dns.rdataset.from_rdata_list(self.ttl, list(self))
def from_text_list(name, ttl, rdclass, rdtype, text_rdatas,
idna_codec=None, origin=None, relativize=True,
relativize_to=None):
def from_text_list(
name: Union[dns.name.Name, str],
ttl: int,
rdclass: Union[dns.rdataclass.RdataClass, str],
rdtype: Union[dns.rdatatype.RdataType, str],
text_rdatas: Collection[str],
idna_codec: Optional[dns.name.IDNACodec] = None,
origin: Optional[dns.name.Name] = None,
relativize: bool = True,
relativize_to: Optional[dns.name.Name] = None,
) -> RRset:
"""Create an RRset with the specified name, TTL, class, and type, and with
the specified list of rdatas in text format.
@ -172,28 +214,42 @@ def from_text_list(name, ttl, rdclass, rdtype, text_rdatas,
if isinstance(name, str):
name = dns.name.from_text(name, None, idna_codec=idna_codec)
rdclass = dns.rdataclass.RdataClass.make(rdclass)
rdtype = dns.rdatatype.RdataType.make(rdtype)
r = RRset(name, rdclass, rdtype)
the_rdclass = dns.rdataclass.RdataClass.make(rdclass)
the_rdtype = dns.rdatatype.RdataType.make(rdtype)
r = RRset(name, the_rdclass, the_rdtype)
r.update_ttl(ttl)
for t in text_rdatas:
rd = dns.rdata.from_text(r.rdclass, r.rdtype, t, origin, relativize,
relativize_to, idna_codec)
rd = dns.rdata.from_text(
r.rdclass, r.rdtype, t, origin, relativize, relativize_to, idna_codec
)
r.add(rd)
return r
def from_text(name, ttl, rdclass, rdtype, *text_rdatas):
def from_text(
name: Union[dns.name.Name, str],
ttl: int,
rdclass: Union[dns.rdataclass.RdataClass, str],
rdtype: Union[dns.rdatatype.RdataType, str],
*text_rdatas: Any
) -> RRset:
"""Create an RRset with the specified name, TTL, class, and type and with
the specified rdatas in text format.
Returns a ``dns.rrset.RRset`` object.
"""
return from_text_list(name, ttl, rdclass, rdtype, text_rdatas)
return from_text_list(
name, ttl, rdclass, rdtype, cast(Collection[str], text_rdatas)
)
def from_rdata_list(name, ttl, rdatas, idna_codec=None):
def from_rdata_list(
name: Union[dns.name.Name, str],
ttl: int,
rdatas: Collection[dns.rdata.Rdata],
idna_codec: Optional[dns.name.IDNACodec] = None,
) -> RRset:
"""Create an RRset with the specified name and TTL, and with
the specified list of rdata objects.
@ -216,14 +272,15 @@ def from_rdata_list(name, ttl, rdatas, idna_codec=None):
r = RRset(name, rd.rdclass, rd.rdtype)
r.update_ttl(ttl)
r.add(rd)
assert r is not None
return r
def from_rdata(name, ttl, *rdatas):
def from_rdata(name: Union[dns.name.Name, str], ttl: int, *rdatas: Any) -> RRset:
"""Create an RRset with the specified name and TTL, and with
the specified rdata objects.
Returns a ``dns.rrset.RRset`` object.
"""
return from_rdata_list(name, ttl, rdatas)
return from_rdata_list(name, ttl, cast(Collection[dns.rdata.Rdata], rdatas))