From 6bfd1e5140eab643c0e9461fc552c2c504fec473 Mon Sep 17 00:00:00 2001 From: Teal Dulcet Date: Fri, 22 Dec 2023 07:12:50 -0800 Subject: [PATCH] Fixed W293 (blank-line-with-whitespace): Blank line contains whitespace --- management/backup.py | 6 +++--- management/dns_update.py | 2 +- management/mail_log.py | 2 +- management/utils.py | 2 +- tools/editconf.py | 12 ++++++------ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/management/backup.py b/management/backup.py index bd8e9f00..c8b33d2f 100755 --- a/management/backup.py +++ b/management/backup.py @@ -226,7 +226,7 @@ def get_duplicity_additional_args(env): port = 22 if port is None: port = 22 - + return [ f"--ssh-options='-i /root/.ssh/id_rsa_miab -p {port}'", f"--rsync-options='-e \"/usr/bin/ssh -oStrictHostKeyChecking=no -oBatchMode=yes -p {port} -i /root/.ssh/id_rsa_miab\"'", @@ -497,7 +497,7 @@ def list_target_files(config): elif target.scheme == "s3": import boto3.s3 from botocore.exceptions import ClientError - + # separate bucket from path in target bucket = target.path[1:].split('/')[0] path = '/'.join(target.path[1:].split('/')[1:]) + '/' @@ -526,7 +526,7 @@ def list_target_files(config): from b2sdk.v1.exception import NonExistentBucket info = InMemoryAccountInfo() b2_api = B2Api(info) - + # Extract information from target b2_application_keyid = target.netloc[:target.netloc.index(':')] b2_application_key = urllib.parse.unquote(target.netloc[target.netloc.index(':')+1:target.netloc.index('@')]) diff --git a/management/dns_update.py b/management/dns_update.py index 8afbd376..74ea8a34 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -1044,7 +1044,7 @@ def set_secondary_dns(hostnames, env): resolver = dns.resolver.get_default_resolver() resolver.timeout = 5 resolver.lifetime = 5 - + for item in hostnames: if not item.startswith("xfr:"): # Resolve hostname. diff --git a/management/mail_log.py b/management/mail_log.py index 38ae1ec6..c54c2cb5 100755 --- a/management/mail_log.py +++ b/management/mail_log.py @@ -344,7 +344,7 @@ def scan_mail_log_line(line, collector): # Replaced the dateutil parser for a less clever way of parser that is roughly 4 times faster. # date = dateutil.parser.parse(date) - + # strptime fails on Feb 29 with ValueError: day is out of range for month if correct year is not provided. # See https://bugs.python.org/issue26460 date = datetime.datetime.strptime(str(NOW.year) + ' ' + date, '%Y %b %d %H:%M:%S') diff --git a/management/utils.py b/management/utils.py index baf99143..0c475d5c 100644 --- a/management/utils.py +++ b/management/utils.py @@ -95,7 +95,7 @@ def sort_domains(domain_names, env): # Then in right-to-left lexicographic order of the .-separated parts of the name. list(reversed(d.split("."))), )) - + return domain_names def sort_email_addresses(email_addresses, env): diff --git a/tools/editconf.py b/tools/editconf.py index 9e397846..898e49b6 100755 --- a/tools/editconf.py +++ b/tools/editconf.py @@ -110,30 +110,30 @@ while len(input_lines) > 0: buf += line found.add(i) break - + # comment-out the existing line (also comment any folded lines) if is_comment is None: buf += comment_char + line.rstrip().replace("\n", "\n" + comment_char) + "\n" else: # the line is already commented, pass it through buf += line - + # if this option already is set don't add the setting again, # or if we're clearing the setting with -e, don't add it if (i in found) or (not val and erase_setting): break - + # add the new setting buf += indent + name + delimiter + val + "\n" - + # note that we've applied this option found.add(i) - + break else: # If did not match any setting names, pass this line through. buf += line - + # Put any settings we didn't see at the end of the file, # except settings being cleared. for i in range(len(settings)):