From bfa397c9b97487e4f9d54f3d41323ccda1fc4b1d Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Sun, 2 Oct 2022 10:04:05 -0700 Subject: [PATCH] more lint --- dns/asyncquery.py | 2 +- dns/enum.py | 4 ++-- dns/message.py | 2 +- dns/rdataset.py | 4 ++-- dns/win32util.py | 12 +++++++++--- dns/zone.py | 2 -- dns/zonefile.py | 6 ++++++ 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/dns/asyncquery.py b/dns/asyncquery.py index dd1fba4a..107f7667 100644 --- a/dns/asyncquery.py +++ b/dns/asyncquery.py @@ -482,7 +482,7 @@ async def https( timeout: Optional[float] = None, port: int = 443, source: Optional[str] = None, - source_port: int = 0, + source_port: int = 0, # pylint: disable=W0613 one_rr_per_rrset: bool = False, ignore_trailing: bool = False, client: Optional["httpx.AsyncClient"] = None, diff --git a/dns/enum.py b/dns/enum.py index 0eeafd4b..b5a4aed8 100644 --- a/dns/enum.py +++ b/dns/enum.py @@ -94,11 +94,11 @@ class IntEnum(enum.IntEnum): return "" @classmethod - def _extra_from_text(cls, text): + def _extra_from_text(cls, text): # pylint: disable=W0613 return None @classmethod - def _extra_to_text(cls, value, current_text): + def _extra_to_text(cls, value, current_text): # pylint: disable=W0613 return current_text @classmethod diff --git a/dns/message.py b/dns/message.py index 507a5b08..8250db3b 100644 --- a/dns/message.py +++ b/dns/message.py @@ -1096,8 +1096,8 @@ class _WireReader: (rdclass, rdtype, deleting, empty) = self.message._parse_rr_header( section_number, name, rdclass, rdtype ) + rdata_start = self.parser.current try: - rdata_start = self.parser.current if empty: if rdlen > 0: raise dns.exception.FormError diff --git a/dns/rdataset.py b/dns/rdataset.py index 072e7f72..c0ede425 100644 --- a/dns/rdataset.py +++ b/dns/rdataset.py @@ -98,9 +98,9 @@ class Rdataset(dns.set.Set): elif ttl < self.ttl: self.ttl = ttl - def add( + def add( # pylint: disable=arguments-differ,arguments-renamed self, rd: dns.rdata.Rdata, ttl: Optional[int] = None - ) -> None: # pylint: disable=arguments-differ + ) -> None: """Add the specified rdata to the rdataset. If the optional *ttl* parameter is supplied, then diff --git a/dns/win32util.py b/dns/win32util.py index deebc818..b9db2912 100644 --- a/dns/win32util.py +++ b/dns/win32util.py @@ -8,12 +8,18 @@ if sys.platform == "win32": _prefer_wmi = True - import winreg + import winreg # pylint: disable=import-error + + # Keep pylint quiet on non-windows. + try: + WindowsError is None # pylint: disable=used-before-assignment + except KeyError: + WindowsError = Exception try: import threading - import pythoncom - import wmi + import pythoncom # pylint: disable=import-error + import wmi # pylint: disable=import-error _have_wmi = True except Exception: diff --git a/dns/zone.py b/dns/zone.py index d3bdb3b5..cc8268da 100644 --- a/dns/zone.py +++ b/dns/zone.py @@ -904,8 +904,6 @@ class VersionedNode(dns.node.Node): # lgtm[py/missing-equals] @dns.immutable.immutable class ImmutableVersionedNode(VersionedNode): - __slots__ = ["id"] - def __init__(self, node): super().__init__() self.id = node.id diff --git a/dns/zonefile.py b/dns/zonefile.py index a04ccf39..1a53f5bc 100644 --- a/dns/zonefile.py +++ b/dns/zonefile.py @@ -603,6 +603,9 @@ class RRsetsReaderTransaction(dns.transaction.Transaction): def _set_origin(self, origin): pass + def _iterate_rdatasets(self): + raise NotImplementedError # pragma: no cover + class RRSetsReaderManager(dns.transaction.TransactionManager): def __init__( @@ -613,6 +616,9 @@ class RRSetsReaderManager(dns.transaction.TransactionManager): self.rdclass = rdclass self.rrsets = [] + def reader(self): # pragma: no cover + raise NotImplementedError + def writer(self, replacement=False): assert replacement is True return RRsetsReaderTransaction(self, True, False) -- 2.47.3