Skip to content

Commit 2b763dc

Browse files
committed
linting
1 parent 36dafb2 commit 2b763dc

File tree

14 files changed

+27
-11
lines changed

14 files changed

+27
-11
lines changed

dns/asyncquery.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ async def https(
562562

563563
extensions = {}
564564
if bootstrap_address is None:
565+
# pylint: disable=possibly-used-before-assignment
565566
parsed = urllib.parse.urlparse(url)
566567
if parsed.hostname is None:
567568
raise ValueError("no hostname in URL")
@@ -595,8 +596,10 @@ async def https(
595596

596597
if not have_doh:
597598
raise NoDOH # pragma: no cover
599+
# pylint: disable=possibly-used-before-assignment
598600
if client and not isinstance(client, httpx.AsyncClient):
599601
raise ValueError("session parameter must be an httpx.AsyncClient")
602+
# pylint: enable=possibly-used-before-assignment
600603

601604
wire = q.to_wire()
602605
headers = {"accept": "application/dns-message"}
@@ -899,7 +902,6 @@ async def inbound_xfr(
899902
except dns.xfr.UseTCP:
900903
if udp_mode == UDPMode.ONLY:
901904
raise
902-
pass
903905

904906
s = await backend.make_socket(
905907
af, socket.SOCK_STREAM, 0, stuple, dtuple, _timeout(expiration)

dns/dnssec.py

+4
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ def _get_rrname_rdataset(
325325

326326

327327
def _validate_signature(sig: bytes, data: bytes, key: DNSKEY) -> None:
328+
# pylint: disable=possibly-used-before-assignment
328329
public_cls = get_algorithm_cls_from_dnskey(key).public_cls
329330
try:
330331
public_key = public_cls.from_dnskey(key)
@@ -389,6 +390,7 @@ def _validate_rrsig(
389390

390391
data = _make_rrsig_signature_data(rrset, rrsig, origin)
391392

393+
# pylint: disable=possibly-used-before-assignment
392394
for candidate_key in candidate_keys:
393395
if not policy.ok_to_validate(candidate_key):
394396
continue
@@ -587,6 +589,7 @@ def _sign(
587589

588590
data = dns.dnssec._make_rrsig_signature_data(rrset, rrsig_template, origin)
589591

592+
# pylint: disable=possibly-used-before-assignment
590593
if isinstance(private_key, GenericPrivateKey):
591594
signing_key = private_key
592595
else:
@@ -695,6 +698,7 @@ def _make_dnskey(
695698

696699
algorithm = Algorithm.make(algorithm)
697700

701+
# pylint: disable=possibly-used-before-assignment
698702
if isinstance(public_key, GenericPublicKey):
699703
return public_key.to_dnskey(flags=flags, protocol=protocol)
700704
else:

dns/dnssecalgs/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
algorithms: Dict[Tuple[Algorithm, AlgorithmPrefix], Type[GenericPrivateKey]] = {}
2828
if _have_cryptography:
29+
# pylint: disable=possibly-used-before-assignment
2930
algorithms.update(
3031
{
3132
(Algorithm.RSAMD5, None): PrivateRSAMD5,

dns/dnssecalgs/dsa.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import struct
2-
from typing import Optional
32

43
from cryptography.hazmat.backends import default_backend
54
from cryptography.hazmat.primitives import hashes

dns/dnssecalgs/ecdsa.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Optional
2-
31
from cryptography.hazmat.backends import default_backend
42
from cryptography.hazmat.primitives import hashes
53
from cryptography.hazmat.primitives.asymmetric import ec, utils

dns/dnssecalgs/eddsa.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Optional, Type
1+
from typing import Type
22

33
from cryptography.hazmat.primitives import serialization
44
from cryptography.hazmat.primitives.asymmetric import ed448, ed25519

dns/dnssecalgs/rsa.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import math
22
import struct
3-
from typing import Optional
43

54
from cryptography.hazmat.backends import default_backend
65
from cryptography.hazmat.primitives import hashes

dns/name.py

+1
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ def encode(self, label: str) -> bytes:
277277
raise NoIDNA2008
278278
try:
279279
if self.uts_46:
280+
# pylint: disable=possibly-used-before-assignment
280281
label = idna.uts46_remap(label, False, self.transitional)
281282
return idna.alabel(label)
282283
except idna.IDNAError as e:

dns/query.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ def https(
451451

452452
extensions = {}
453453
if bootstrap_address is None:
454+
# pylint: disable=possibly-used-before-assignment
454455
parsed = urllib.parse.urlparse(url)
455456
if parsed.hostname is None:
456457
raise ValueError("no hostname in URL")
@@ -1158,6 +1159,7 @@ def tcp(
11581159
cm = _make_socket(af, socket.SOCK_STREAM, source)
11591160
with cm as s:
11601161
if not sock:
1162+
# pylint: disable=possibly-used-before-assignment
11611163
_connect(s, destination, expiration)
11621164
send_tcp(s, wire, expiration)
11631165
(r, received_time) = receive_tcp(
@@ -1654,7 +1656,6 @@ def inbound_xfr(
16541656
except dns.xfr.UseTCP:
16551657
if udp_mode == UDPMode.ONLY:
16561658
raise
1657-
pass
16581659

16591660
with _make_socket(af, socket.SOCK_STREAM, source) as s:
16601661
_connect(s, destination, expiration)

dns/rdataset.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ def to_text(
248248
# (which is meaningless anyway).
249249
#
250250
s.write(
251-
f"{ntext}{pad}{dns.rdataclass.to_text(rdclass)} {dns.rdatatype.to_text(self.rdtype)}\n"
251+
f"{ntext}{pad}{dns.rdataclass.to_text(rdclass)} "
252+
f"{dns.rdatatype.to_text(self.rdtype)}\n"
252253
)
253254
else:
254255
for rd in self:

dns/rdtypes/ANY/GPOS.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ def __init__(self, rdclass, rdtype, latitude, longitude, altitude):
7575
raise dns.exception.FormError("bad longitude")
7676

7777
def to_text(self, origin=None, relativize=True, **kw):
78-
return f"{self.latitude.decode()} {self.longitude.decode()} {self.altitude.decode()}"
78+
return (
79+
f"{self.latitude.decode()} {self.longitude.decode()} "
80+
f"{self.altitude.decode()}"
81+
)
7982

8083
@classmethod
8184
def from_text(

dns/rdtypes/ANY/ISDN.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ def __init__(self, rdclass, rdtype, address, subaddress):
3838

3939
def to_text(self, origin=None, relativize=True, **kw):
4040
if self.subaddress:
41-
return f'"{dns.rdata._escapify(self.address)}" "{dns.rdata._escapify(self.subaddress)}"'
41+
return (
42+
f'"{dns.rdata._escapify(self.address)}" '
43+
f'"{dns.rdata._escapify(self.subaddress)}"'
44+
)
4245
else:
4346
return f'"{dns.rdata._escapify(self.address)}"'
4447

dns/rdtypes/ANY/LOC.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ def to_text(self, origin=None, relativize=True, **kw):
184184
or self.horizontal_precision != _default_hprec
185185
or self.vertical_precision != _default_vprec
186186
):
187-
text += f" {self.size / 100.0:0.2f}m {self.horizontal_precision / 100.0:0.2f}m {self.vertical_precision / 100.0:0.2f}m"
187+
text += (
188+
f" {self.size / 100.0:0.2f}m {self.horizontal_precision / 100.0:0.2f}m"
189+
f" {self.vertical_precision / 100.0:0.2f}m"
190+
)
188191
return text
189192

190193
@classmethod

dns/win32util.py

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(self):
4444
if _have_wmi:
4545

4646
class _WMIGetter(threading.Thread):
47+
# pylint: disable=possibly-used-before-assignment
4748
def __init__(self):
4849
super().__init__()
4950
self.info = DnsInfo()

0 commit comments

Comments
 (0)