Merge branch '2907-address-pylint-2.10.2-warnings' into 'main'

Address PyLint 2.10.2 warnings

Closes #2907

See merge request isc-projects/bind9!5412
This commit is contained in:
Michał Kępień 2021-09-16 06:51:05 +00:00
commit b3542aec55
7 changed files with 14 additions and 21 deletions

View file

@ -67,7 +67,7 @@ def verify_zone(zone, transfer):
assert verify is not None
filename = "{}out".format(zone)
with open(filename, 'w') as file:
with open(filename, 'w', encoding='utf-8') as file:
for rr in transfer.answer:
file.write(rr.to_text())
file.write('\n')
@ -117,7 +117,7 @@ def read_statefile(server, zone):
print("read state file {}".format(filename))
try:
with open(filename, 'r') as file:
with open(filename, 'r', encoding='utf-8') as file:
for line in file:
if line.startswith(';'):
continue
@ -203,7 +203,7 @@ def wait_for_log(filename, log):
print("read log file {}".format(filename))
try:
with open(filename, 'r') as file:
with open(filename, 'r', encoding='utf-8') as file:
s = mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ)
if s.find(bytes(log, "ascii")) != -1:
found = True

View file

@ -19,7 +19,7 @@ except:
print("No python yaml module, skipping")
sys.exit(1)
with open(sys.argv[1], "r") as f:
with open(sys.argv[1], "r", encoding="utf-8") as f:
for item in yaml.safe_load_all(f):
for key in sys.argv[2:]:
try:

View file

@ -128,7 +128,7 @@ class SubDIG:
def run(self):
# pylint: disable=consider-using-with
with open(os.devnull, 'w') as devnull:
with open(os.devnull, 'w', encoding='utf-8') as devnull:
self.sub_process = subprocess.Popen(self.get_command(), shell=True,
stdout=devnull)

View file

@ -37,11 +37,11 @@ def test_rpz_passthru_logging(named_port):
assert os.path.isfile(rpz_passthru_logfile)
assert os.path.isfile(rpz_logfile)
with open(rpz_passthru_logfile) as log_file:
with open(rpz_passthru_logfile, encoding='utf-8') as log_file:
line = log_file.read()
assert "rpz QNAME PASSTHRU rewrite allowed/A/IN" in line
with open(rpz_logfile) as log_file:
with open(rpz_logfile, encoding='utf-8') as log_file:
line = log_file.read()
assert "rpz QNAME PASSTHRU rewrite allowed/A/IN" not in line
assert "rpz QNAME NXDOMAIN rewrite baddomain/A/IN" in line

View file

@ -78,13 +78,6 @@ def zone_mtime(zonedir, name):
return mtime
def zone_keyid(nameserver, zone, key):
with open('{}/{}.{}.id'.format(nameserver, zone, key)) as f:
keyid = f.read().strip()
print('{}-{} ID: {}'.format(zone, key, keyid))
return keyid
def create_msg(qname, qtype):
msg = dns.message.make_query(qname, qtype, want_dnssec=True,
use_edns=0, payload=4096)

View file

@ -87,10 +87,10 @@ def setup(_):
# -- Project information -----------------------------------------------------
project = u'BIND 9'
project = 'BIND 9'
# pylint: disable=redefined-builtin
copyright = u'2021, Internet Systems Consortium'
author = u'Internet Systems Consortium'
copyright = '2021, Internet Systems Consortium'
author = 'Internet Systems Consortium'
# -- General configuration ---------------------------------------------------
@ -140,7 +140,7 @@ latex_engine = 'xelatex'
# pylint disable=line-too-long
latex_documents = [
(master_doc, 'Bv9ARM.tex', u'BIND 9 Administrator Reference Manual', author, 'manual'),
(master_doc, 'Bv9ARM.tex', 'BIND 9 Administrator Reference Manual', author, 'manual'),
]
latex_logo = "isc-logo.pdf"

View file

@ -30,13 +30,13 @@
# -- Project information -----------------------------------------------------
project = u'BIND 9'
project = 'BIND 9'
# pylint: disable=wrong-import-position
import datetime
year = datetime.datetime.now().year
# pylint: disable=redefined-builtin
copyright = u"%d, Internet Systems Consortium" % year
author = u'Internet Systems Consortium'
copyright = "%d, Internet Systems Consortium" % year
author = 'Internet Systems Consortium'
# -- General configuration ---------------------------------------------------