From 0ee64f2fe865ad491c69a7afb5af3d5c2822a19e Mon Sep 17 00:00:00 2001 From: Teal Dulcet Date: Fri, 22 Dec 2023 07:08:30 -0800 Subject: [PATCH] Fixed F401 (unused-import) --- management/auth.py | 2 +- management/backup.py | 2 +- management/cli.py | 2 +- management/daemon.py | 4 ++-- management/dns_update.py | 2 +- management/mailconfig.py | 2 +- management/ssl_certificates.py | 1 - management/status_checks.py | 3 +-- management/wsgi.py | 2 +- tests/fail2ban.py | 3 +-- tests/test_dns.py | 2 +- 11 files changed, 11 insertions(+), 14 deletions(-) diff --git a/management/auth.py b/management/auth.py index c576d01c..d450720d 100644 --- a/management/auth.py +++ b/management/auth.py @@ -1,4 +1,4 @@ -import base64, os, os.path, hmac, json, secrets +import base64, hmac, json, secrets from datetime import timedelta from expiringdict import ExpiringDict diff --git a/management/backup.py b/management/backup.py index c2ef7676..0d2a0c07 100755 --- a/management/backup.py +++ b/management/backup.py @@ -7,7 +7,7 @@ # 4) The stopped services are restarted. # 5) STORAGE_ROOT/backup/after-backup is executed if it exists. -import os, os.path, shutil, glob, re, datetime, sys +import os, os.path, re, datetime, sys import dateutil.parser, dateutil.relativedelta, dateutil.tz import rtyaml from exclusiveprocess import Lock diff --git a/management/cli.py b/management/cli.py index b32089c6..cbf19fc0 100755 --- a/management/cli.py +++ b/management/cli.py @@ -6,7 +6,7 @@ # root API key. This file is readable only by root, so this # tool can only be used as root. -import sys, getpass, urllib.request, urllib.error, json, re, csv +import sys, getpass, urllib.request, urllib.error, json, csv def mgmt(cmd, data=None, is_json=False): # The base URL for the management daemon. (Listens on IPv4 only.) diff --git a/management/daemon.py b/management/daemon.py index 47548531..5081aea3 100755 --- a/management/daemon.py +++ b/management/daemon.py @@ -11,11 +11,11 @@ # service mailinabox start # when done debugging, start it up again import os, os.path, re, json, time -import multiprocessing.pool, subprocess +import multiprocessing.pool from functools import wraps -from flask import Flask, request, render_template, abort, Response, send_from_directory, make_response +from flask import Flask, request, render_template, Response, send_from_directory, make_response import auth, utils from mailconfig import get_mail_users, get_mail_users_ex, get_admins, add_mail_user, set_mail_password, remove_mail_user diff --git a/management/dns_update.py b/management/dns_update.py index 9a768ea8..64b55dec 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -4,7 +4,7 @@ # and mail aliases and restarts nsd. ######################################################################## -import sys, os, os.path, urllib.parse, datetime, re, hashlib, base64 +import sys, os, os.path, datetime, re, hashlib, base64 import ipaddress import rtyaml import dns.resolver diff --git a/management/mailconfig.py b/management/mailconfig.py index 2fcb9703..4068b393 100755 --- a/management/mailconfig.py +++ b/management/mailconfig.py @@ -9,7 +9,7 @@ # Python 3 in setup/questions.sh to validate the email # address entered by the user. -import subprocess, shutil, os, sqlite3, re +import os, sqlite3, re import utils from email_validator import validate_email as validate_email_, EmailNotValidError import idna diff --git a/management/ssl_certificates.py b/management/ssl_certificates.py index 19f0266a..f3e83a15 100755 --- a/management/ssl_certificates.py +++ b/management/ssl_certificates.py @@ -4,7 +4,6 @@ import os, os.path, re, shutil, subprocess, tempfile from utils import shell, safe_domain_name, sort_domains -import idna # SELECTING SSL CERTIFICATES FOR USE IN WEB diff --git a/management/status_checks.py b/management/status_checks.py index e8faf6fb..927e6102 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -4,11 +4,10 @@ # TLS certificates have been signed, etc., and if not tells the user # what to do next. -import sys, os, os.path, re, subprocess, datetime, multiprocessing.pool +import sys, os, os.path, re, datetime, multiprocessing.pool import asyncio import dns.reversename, dns.resolver -import dateutil.parser, dateutil.tz import idna import psutil import postfix_mta_sts_resolver.resolver diff --git a/management/wsgi.py b/management/wsgi.py index 86cf3af4..9cf21c4b 100644 --- a/management/wsgi.py +++ b/management/wsgi.py @@ -1,5 +1,5 @@ from daemon import app -import auth, utils +import utils app.logger.addHandler(utils.create_syslog_handler()) diff --git a/tests/fail2ban.py b/tests/fail2ban.py index cb55c51f..9979507f 100644 --- a/tests/fail2ban.py +++ b/tests/fail2ban.py @@ -6,7 +6,7 @@ # try to log in to. ###################################################################### -import sys, os, time, functools +import sys, os, time # parse command line @@ -163,7 +163,6 @@ def run_test(testfunc, args, count, within_seconds, parallel): # run testfunc sequentially and still get to count requests within # the required time. So we split the requests across threads. - import requests.exceptions from multiprocessing import Pool restart_fail2ban_service() diff --git a/tests/test_dns.py b/tests/test_dns.py index 25c64bf1..62cf5e78 100755 --- a/tests/test_dns.py +++ b/tests/test_dns.py @@ -7,7 +7,7 @@ # where ipaddr is the IP address of your Mail-in-a-Box # and hostname is the domain name to check the DNS for. -import sys, re, difflib +import sys, re import dns.reversename, dns.resolver if len(sys.argv) < 3: