Bump dnspython from 2.3.0 to 2.4.2 (#2123)

* Bump dnspython from 2.3.0 to 2.4.2

Bumps [dnspython](https://github.com/rthalley/dnspython) from 2.3.0 to 2.4.2.
- [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.3.0...v2.4.2)

---
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.4.2

---------

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-08-24 12:05:11 -07:00 committed by GitHub
commit c0aa4e4996
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
108 changed files with 2985 additions and 1136 deletions

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.mxbase
import dns.immutable
import dns.rdtypes.mxbase
@dns.immutable.immutable

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.txtbase
import dns.immutable
import dns.rdtypes.txtbase
@dns.immutable.immutable

View file

@ -15,15 +15,15 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.dnskeybase # lgtm[py/import-and-import-from]
import dns.immutable
import dns.rdtypes.dnskeybase # lgtm[py/import-and-import-from]
# pylint: disable=unused-import
from dns.rdtypes.dnskeybase import (
SEP,
from dns.rdtypes.dnskeybase import ( # noqa: F401 lgtm[py/unused-import]
REVOKE,
SEP,
ZONE,
) # noqa: F401 lgtm[py/unused-import]
)
# pylint: enable=unused-import

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.dsbase
import dns.immutable
import dns.rdtypes.dsbase
@dns.immutable.immutable

View file

@ -15,12 +15,12 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import struct
import base64
import struct
import dns.dnssectypes
import dns.exception
import dns.immutable
import dns.dnssectypes
import dns.rdata
import dns.tokenizer

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.nsbase
import dns.immutable
import dns.rdtypes.nsbase
@dns.immutable.immutable

View file

@ -19,9 +19,9 @@ import struct
import dns.exception
import dns.immutable
import dns.name
import dns.rdata
import dns.rdatatype
import dns.name
import dns.rdtypes.util

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.dsbase
import dns.immutable
import dns.rdtypes.dsbase
@dns.immutable.immutable

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.nsbase
import dns.immutable
import dns.rdtypes.nsbase
@dns.immutable.immutable

View file

@ -15,15 +15,15 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.dnskeybase # lgtm[py/import-and-import-from]
import dns.immutable
import dns.rdtypes.dnskeybase # lgtm[py/import-and-import-from]
# pylint: disable=unused-import
from dns.rdtypes.dnskeybase import (
SEP,
from dns.rdtypes.dnskeybase import ( # noqa: F401 lgtm[py/unused-import]
REVOKE,
SEP,
ZONE,
) # noqa: F401 lgtm[py/unused-import]
)
# pylint: enable=unused-import

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.dsbase
import dns.immutable
import dns.rdtypes.dsbase
@dns.immutable.immutable

View file

@ -16,8 +16,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.euibase
import dns.immutable
import dns.rdtypes.euibase
@dns.immutable.immutable

View file

@ -16,8 +16,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.euibase
import dns.immutable
import dns.rdtypes.euibase
@dns.immutable.immutable

View file

@ -15,9 +15,9 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import struct
import base64
import binascii
import struct
import dns.exception
import dns.immutable

View file

@ -21,7 +21,6 @@ import dns.exception
import dns.immutable
import dns.rdata
_pows = tuple(10**i for i in range(0, 11))
# default values are in centimeters
@ -40,7 +39,7 @@ def _exponent_of(what, desc):
if what == 0:
return 0
exp = None
for (i, pow) in enumerate(_pows):
for i, pow in enumerate(_pows):
if what < pow:
exp = i - 1
break

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.mxbase
import dns.immutable
import dns.rdtypes.mxbase
@dns.immutable.immutable

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.txtbase
import dns.immutable
import dns.rdtypes.txtbase
@dns.immutable.immutable

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.nsbase
import dns.immutable
import dns.rdtypes.nsbase
@dns.immutable.immutable

View file

@ -17,9 +17,9 @@
import dns.exception
import dns.immutable
import dns.name
import dns.rdata
import dns.rdatatype
import dns.name
import dns.rdtypes.util

View file

@ -25,7 +25,6 @@ import dns.rdata
import dns.rdatatype
import dns.rdtypes.util
b32_hex_to_normal = bytes.maketrans(
b"0123456789ABCDEFGHIJKLMNOPQRSTUV", b"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
)
@ -67,6 +66,7 @@ class NSEC3(dns.rdata.Rdata):
def to_text(self, origin=None, relativize=True, **kw):
next = base64.b32encode(self.next).translate(b32_normal_to_hex).lower().decode()
next = next.rstrip("=")
if self.salt == b"":
salt = "-"
else:
@ -94,6 +94,10 @@ class NSEC3(dns.rdata.Rdata):
else:
salt = binascii.unhexlify(salt.encode("ascii"))
next = tok.get_string().encode("ascii").upper().translate(b32_hex_to_normal)
if next.endswith(b"="):
raise binascii.Error("Incorrect padding")
if len(next) % 8 != 0:
next += b"=" * (8 - len(next) % 8)
next = base64.b32decode(next)
bitmap = Bitmap.from_text(tok)
return cls(rdclass, rdtype, algorithm, flags, iterations, salt, next, bitmap)

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import struct
import binascii
import struct
import dns.exception
import dns.immutable

View file

@ -18,11 +18,10 @@
import struct
import dns.edns
import dns.immutable
import dns.exception
import dns.immutable
import dns.rdata
# We don't implement from_text, and that's ok.
# pylint: disable=abstract-method

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.nsbase
import dns.immutable
import dns.rdtypes.nsbase
@dns.immutable.immutable

View file

@ -17,8 +17,8 @@
import dns.exception
import dns.immutable
import dns.rdata
import dns.name
import dns.rdata
@dns.immutable.immutable

View file

@ -21,8 +21,8 @@ import struct
import time
import dns.dnssectypes
import dns.immutable
import dns.exception
import dns.immutable
import dns.rdata
import dns.rdatatype

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.mxbase
import dns.immutable
import dns.rdtypes.mxbase
@dns.immutable.immutable

View file

@ -19,8 +19,8 @@ import struct
import dns.exception
import dns.immutable
import dns.rdata
import dns.name
import dns.rdata
@dns.immutable.immutable

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.txtbase
import dns.immutable
import dns.rdtypes.txtbase
@dns.immutable.immutable

View file

@ -15,11 +15,11 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import struct
import binascii
import struct
import dns.rdata
import dns.immutable
import dns.rdata
import dns.rdatatype

View file

@ -18,8 +18,8 @@
import base64
import struct
import dns.immutable
import dns.exception
import dns.immutable
import dns.rdata

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.txtbase
import dns.immutable
import dns.rdtypes.txtbase
@dns.immutable.immutable

View file

@ -20,9 +20,9 @@ import struct
import dns.exception
import dns.immutable
import dns.name
import dns.rdata
import dns.rdtypes.util
import dns.name
@dns.immutable.immutable

View file

@ -1,7 +1,7 @@
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
import struct
import binascii
import struct
import dns.immutable
import dns.rdata

View file

@ -17,8 +17,8 @@
import struct
import dns.rdtypes.mxbase
import dns.immutable
import dns.rdtypes.mxbase
@dns.immutable.immutable

View file

@ -124,7 +124,6 @@ class APL(dns.rdata.Rdata):
@classmethod
def from_wire_parser(cls, rdclass, rdtype, parser, origin=None):
items = []
while parser.remaining() > 0:
header = parser.get_struct("!HBB")

View file

@ -1,7 +1,7 @@
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
import dns.rdtypes.svcbbase
import dns.immutable
import dns.rdtypes.svcbbase
@dns.immutable.immutable

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import struct
import base64
import struct
import dns.exception
import dns.immutable

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.mxbase
import dns.immutable
import dns.rdtypes.mxbase
@dns.immutable.immutable

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import dns.rdtypes.nsbase
import dns.immutable
import dns.rdtypes.nsbase
@dns.immutable.immutable

View file

@ -19,9 +19,9 @@ import struct
import dns.exception
import dns.immutable
import dns.name
import dns.rdata
import dns.rdtypes.util
import dns.name
@dns.immutable.immutable

View file

@ -19,9 +19,9 @@ import struct
import dns.exception
import dns.immutable
import dns.name
import dns.rdata
import dns.rdtypes.util
import dns.name
@dns.immutable.immutable

View file

@ -1,7 +1,7 @@
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
import dns.rdtypes.svcbbase
import dns.immutable
import dns.rdtypes.svcbbase
@dns.immutable.immutable

View file

@ -18,8 +18,8 @@
import socket
import struct
import dns.ipv4
import dns.immutable
import dns.ipv4
import dns.rdata
try:

View file

@ -19,9 +19,9 @@ import base64
import enum
import struct
import dns.dnssectypes
import dns.exception
import dns.immutable
import dns.dnssectypes
import dns.rdata
# wildcard import
@ -43,7 +43,7 @@ class DNSKEYBase(dns.rdata.Rdata):
def __init__(self, rdclass, rdtype, flags, protocol, algorithm, key):
super().__init__(rdclass, rdtype)
self.flags = self._as_uint16(flags)
self.flags = Flag(self._as_uint16(flags))
self.protocol = self._as_uint8(protocol)
self.algorithm = dns.dnssectypes.Algorithm.make(algorithm)
self.key = self._as_bytes(key)

View file

@ -15,8 +15,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import struct
import binascii
import struct
import dns.dnssectypes
import dns.immutable
@ -44,7 +44,7 @@ class DSBase(dns.rdata.Rdata):
super().__init__(rdclass, rdtype)
self.key_tag = self._as_uint16(key_tag)
self.algorithm = dns.dnssectypes.Algorithm.make(algorithm)
self.digest_type = self._as_uint8(digest_type)
self.digest_type = dns.dnssectypes.DSDigest.make(self._as_uint8(digest_type))
self.digest = self._as_bytes(digest)
try:
if len(self.digest) != self._digest_length_by_type[self.digest_type]:

View file

@ -16,8 +16,8 @@
import binascii
import dns.rdata
import dns.immutable
import dns.rdata
@dns.immutable.immutable

View file

@ -21,8 +21,8 @@ import struct
import dns.exception
import dns.immutable
import dns.rdata
import dns.name
import dns.rdata
import dns.rdtypes.util

View file

@ -19,8 +19,8 @@
import dns.exception
import dns.immutable
import dns.rdata
import dns.name
import dns.rdata
@dns.immutable.immutable

View file

@ -34,6 +34,7 @@ class ParamKey(dns.enum.IntEnum):
IPV4HINT = 4
ECH = 5
IPV6HINT = 6
DOHPATH = 7
@classmethod
def _maximum(cls):

View file

@ -15,11 +15,11 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import struct
import binascii
import struct
import dns.rdata
import dns.immutable
import dns.rdata
import dns.rdatatype

View file

@ -17,9 +17,8 @@
"""TXT-like base class."""
from typing import Any, Dict, Iterable, Optional, Tuple, Union
import struct
from typing import Any, Dict, Iterable, Optional, Tuple, Union
import dns.exception
import dns.immutable

View file

@ -18,6 +18,7 @@
import collections
import random
import struct
from typing import Any, List
import dns.exception
import dns.ipv4
@ -119,7 +120,7 @@ class Bitmap:
def __init__(self, windows=None):
last_window = -1
self.windows = windows
for (window, bitmap) in self.windows:
for window, bitmap in self.windows:
if not isinstance(window, int):
raise ValueError(f"bad {self.type_name} window type")
if window <= last_window:
@ -132,11 +133,11 @@ class Bitmap:
if len(bitmap) == 0 or len(bitmap) > 32:
raise ValueError(f"bad {self.type_name} octets")
def to_text(self):
def to_text(self) -> str:
text = ""
for (window, bitmap) in self.windows:
for window, bitmap in self.windows:
bits = []
for (i, byte) in enumerate(bitmap):
for i, byte in enumerate(bitmap):
for j in range(0, 8):
if byte & (0x80 >> j):
rdtype = window * 256 + i * 8 + j
@ -145,14 +146,18 @@ class Bitmap:
return text
@classmethod
def from_text(cls, tok):
def from_text(cls, tok: "dns.tokenizer.Tokenizer") -> "Bitmap":
rdtypes = []
for token in tok.get_remaining():
rdtype = dns.rdatatype.from_text(token.unescape().value)
if rdtype == 0:
raise dns.exception.SyntaxError(f"{cls.type_name} with bit 0")
rdtypes.append(rdtype)
rdtypes.sort()
return cls.from_rdtypes(rdtypes)
@classmethod
def from_rdtypes(cls, rdtypes: List[dns.rdatatype.RdataType]) -> "Bitmap":
rdtypes = sorted(rdtypes)
window = 0
octets = 0
prior_rdtype = 0
@ -177,13 +182,13 @@ class Bitmap:
windows.append((window, bytes(bitmap[0:octets])))
return cls(windows)
def to_wire(self, file):
for (window, bitmap) in self.windows:
def to_wire(self, file: Any) -> None:
for window, bitmap in self.windows:
file.write(struct.pack("!BB", window, len(bitmap)))
file.write(bitmap)
@classmethod
def from_wire_parser(cls, parser):
def from_wire_parser(cls, parser: "dns.wire.Parser") -> "Bitmap":
windows = []
while parser.remaining() > 0:
window = parser.get_uint8()
@ -226,7 +231,7 @@ def weighted_processing_order(iterable):
total = sum(rdata._processing_weight() or _no_weight for rdata in rdatas)
while len(rdatas) > 1:
r = random.uniform(0, total)
for (n, rdata) in enumerate(rdatas):
for n, rdata in enumerate(rdatas):
weight = rdata._processing_weight() or _no_weight
if weight > r:
break