From acb7e61409e3751d74d8b0f7d81d1f0f6ce51484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Thu, 16 Sep 2021 08:22:01 +0200 Subject: [PATCH 1/3] Remove redundant zone_keyid() function The zone_keyid() helper function defined in bin/tests/system/statschannel/helper.py is not used anywhere. Remove it. --- bin/tests/system/statschannel/helper.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/bin/tests/system/statschannel/helper.py b/bin/tests/system/statschannel/helper.py index c43bea93b8..fb9a2eb12b 100644 --- a/bin/tests/system/statschannel/helper.py +++ b/bin/tests/system/statschannel/helper.py @@ -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) From 6a4b8b145620a6532d334e26fd12427e9b9c7b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Thu, 16 Sep 2021 08:22:01 +0200 Subject: [PATCH 2/3] Explicitly specify encoding for open() calls Address the following warnings reported by PyLint 2.10.2: ************* Module tests-checkds bin/tests/system/checkds/tests-checkds.py:70:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) bin/tests/system/checkds/tests-checkds.py:120:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) bin/tests/system/checkds/tests-checkds.py:206:17: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) ************* Module yamlget bin/tests/system/digdelv/yamlget.py:22:5: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) ************* Module stress_http_quota bin/tests/system/doth/stress_http_quota.py:131:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) ************* Module tests-rpz-passthru-logging bin/tests/system/rpzextra/tests-rpz-passthru-logging.py:40:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) bin/tests/system/rpzextra/tests-rpz-passthru-logging.py:44:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) --- bin/tests/system/checkds/tests-checkds.py | 6 +++--- bin/tests/system/digdelv/yamlget.py | 2 +- bin/tests/system/doth/stress_http_quota.py | 2 +- bin/tests/system/rpzextra/tests-rpz-passthru-logging.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/tests/system/checkds/tests-checkds.py b/bin/tests/system/checkds/tests-checkds.py index 1c60c93309..2561a17024 100755 --- a/bin/tests/system/checkds/tests-checkds.py +++ b/bin/tests/system/checkds/tests-checkds.py @@ -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 diff --git a/bin/tests/system/digdelv/yamlget.py b/bin/tests/system/digdelv/yamlget.py index 60b14cb2d4..9d702036e5 100644 --- a/bin/tests/system/digdelv/yamlget.py +++ b/bin/tests/system/digdelv/yamlget.py @@ -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: diff --git a/bin/tests/system/doth/stress_http_quota.py b/bin/tests/system/doth/stress_http_quota.py index 1e56538aa9..e2ddae1819 100755 --- a/bin/tests/system/doth/stress_http_quota.py +++ b/bin/tests/system/doth/stress_http_quota.py @@ -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) diff --git a/bin/tests/system/rpzextra/tests-rpz-passthru-logging.py b/bin/tests/system/rpzextra/tests-rpz-passthru-logging.py index c4afa43ae9..efc0ac053b 100755 --- a/bin/tests/system/rpzextra/tests-rpz-passthru-logging.py +++ b/bin/tests/system/rpzextra/tests-rpz-passthru-logging.py @@ -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 From e5944bc610fa45902e89c4173d0b7b124876c82b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Thu, 16 Sep 2021 08:22:01 +0200 Subject: [PATCH 3/3] Remove redundant prefix from Python 3 strings Address the following warnings reported by PyLint 2.10.2: ************* Module conf doc/arm/conf.py:90:10: W1406: The u prefix for strings is no longer necessary in Python >=3.0 (redundant-u-string-prefix) doc/arm/conf.py:92:12: W1406: The u prefix for strings is no longer necessary in Python >=3.0 (redundant-u-string-prefix) doc/arm/conf.py:93:9: W1406: The u prefix for strings is no longer necessary in Python >=3.0 (redundant-u-string-prefix) doc/arm/conf.py:143:31: W1406: The u prefix for strings is no longer necessary in Python >=3.0 (redundant-u-string-prefix) doc/man/conf.py:33:10: W1406: The u prefix for strings is no longer necessary in Python >=3.0 (redundant-u-string-prefix) doc/man/conf.py:38:12: W1406: The u prefix for strings is no longer necessary in Python >=3.0 (redundant-u-string-prefix) doc/man/conf.py:39:9: W1406: The u prefix for strings is no longer necessary in Python >=3.0 (redundant-u-string-prefix) --- doc/arm/conf.py | 8 ++++---- doc/man/conf.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/arm/conf.py b/doc/arm/conf.py index 1458fe9f47..b8aca9b33c 100644 --- a/doc/arm/conf.py +++ b/doc/arm/conf.py @@ -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" diff --git a/doc/man/conf.py b/doc/man/conf.py index 8b4e37c777..6395cf0974 100644 --- a/doc/man/conf.py +++ b/doc/man/conf.py @@ -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 ---------------------------------------------------