From fce882ab67186fddd957404fe62f84d41380895c Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Fri, 25 Aug 2023 11:09:52 +1200 Subject: [PATCH] python: Remove unused imports Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- python/samba/__init__.py | 1 - python/samba/domain_update.py | 3 --- python/samba/forest_update.py | 2 -- python/samba/gp/gp_centrify_crontab_ext.py | 6 ++---- python/samba/gp/gp_centrify_sudoers_ext.py | 1 - python/samba/gp/gp_gnome_settings_ext.py | 2 +- python/samba/gp/gp_smb_conf_ext.py | 2 +- python/samba/gp/gpclass.py | 8 +++----- python/samba/gp/util/logging.py | 1 - python/samba/gp/vgp_access_ext.py | 1 - python/samba/gp/vgp_openssh_ext.py | 3 +-- python/samba/gp/vgp_startup_scripts_ext.py | 2 +- python/samba/gp/vgp_sudoers_ext.py | 1 - python/samba/gp/vgp_symlink_ext.py | 2 -- python/samba/join.py | 2 -- python/samba/mdb_util.py | 1 - python/samba/policies.py | 1 - python/samba/provision/__init__.py | 6 ------ python/samba/provision/sambadns.py | 4 ---- python/samba/safe_tarfile.py | 2 +- python/samba/subunit/__init__.py | 1 - python/samba/tests/common.py | 2 +- python/samba/tests/compression.py | 2 -- python/samba/tests/dcerpc/samr_change_password.py | 1 - python/samba/tests/dns_aging.py | 2 +- python/samba/tests/dns_forwarder.py | 2 +- python/samba/tests/domain_backup_offline.py | 3 --- python/samba/tests/dsdb_dns.py | 1 - python/samba/tests/dsdb_lock.py | 1 - python/samba/tests/getdcname.py | 1 - python/samba/tests/gpo.py | 2 +- python/samba/tests/gpo_member.py | 2 -- python/samba/tests/krb5_credentials.py | 2 +- python/samba/tests/ldap_upn_sam_account.py | 2 +- python/samba/tests/ldap_whoami.py | 2 +- python/samba/tests/netlogonsvc.py | 1 - python/samba/tests/password_hash_ldap.py | 1 - python/samba/tests/safe_tarfile.py | 1 - python/samba/tests/samba_startup_fl_change.py | 3 +-- python/samba/tests/samba_tool/gpo.py | 2 -- python/samba/tests/samdb_api.py | 1 - python/samba/tests/security_descriptors.py | 1 - python/samba/tests/smb-notify.py | 1 - python/samba/tests/smb1posix.py | 1 - python/samba/upgrade.py | 1 - python/samba/upgradehelpers.py | 2 +- 46 files changed, 19 insertions(+), 73 deletions(-) diff --git a/python/samba/__init__.py b/python/samba/__init__.py index 2f0570f19ad..6eb0d01d1cf 100644 --- a/python/samba/__init__.py +++ b/python/samba/__init__.py @@ -23,7 +23,6 @@ __docformat__ = "restructuredText" import os -import sys import time import ldb import samba.param diff --git a/python/samba/domain_update.py b/python/samba/domain_update.py index feb03de860c..e91bdf40dbb 100644 --- a/python/samba/domain_update.py +++ b/python/samba/domain_update.py @@ -17,12 +17,9 @@ # import ldb -import samba from base64 import b64encode from samba import sd_utils -from samba.ndr import ndr_unpack, ndr_pack from samba.dcerpc import security -from samba.dcerpc.security import SECINFO_DACL from samba.descriptor import ( get_managed_service_accounts_descriptor, ) diff --git a/python/samba/forest_update.py b/python/samba/forest_update.py index de94638a028..46de2137616 100644 --- a/python/samba/forest_update.py +++ b/python/samba/forest_update.py @@ -19,9 +19,7 @@ import ldb import samba from samba import sd_utils -from samba.ndr import ndr_unpack, ndr_pack from samba.dcerpc import security -from samba.dcerpc.security import SECINFO_DACL from samba.provision.common import setup_path from samba.dsdb import ( DS_DOMAIN_FUNCTION_2008, diff --git a/python/samba/gp/gp_centrify_crontab_ext.py b/python/samba/gp/gp_centrify_crontab_ext.py index e532416d224..b1055a19607 100644 --- a/python/samba/gp/gp_centrify_crontab_ext.py +++ b/python/samba/gp/gp_centrify_crontab_ext.py @@ -14,13 +14,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os, re -from subprocess import Popen, PIPE +import os from samba.gp.gpclass import gp_pol_ext, drop_privileges, gp_file_applier, \ gp_misc_applier from tempfile import NamedTemporaryFile -from samba.gp.gp_scripts_ext import fetch_crontab, install_crontab, \ - install_user_crontab +from samba.gp.gp_scripts_ext import fetch_crontab, install_user_crontab intro = ''' ### autogenerated by samba diff --git a/python/samba/gp/gp_centrify_sudoers_ext.py b/python/samba/gp/gp_centrify_sudoers_ext.py index 3de4fb871ea..4752f1e5a60 100644 --- a/python/samba/gp/gp_centrify_sudoers_ext.py +++ b/python/samba/gp/gp_centrify_sudoers_ext.py @@ -17,7 +17,6 @@ import os from samba.gp.gpclass import gp_pol_ext, gp_file_applier from samba.gp.gp_sudoers_ext import sudo_applier_func -from samba.gp.util.logging import log def ext_enabled(entries): section = 'Software\\Policies\\Centrify\\UnixSettings' diff --git a/python/samba/gp/gp_gnome_settings_ext.py b/python/samba/gp/gp_gnome_settings_ext.py index 0e9c407aa09..ee0e756e8e2 100644 --- a/python/samba/gp/gp_gnome_settings_ext.py +++ b/python/samba/gp/gp_gnome_settings_ext.py @@ -20,7 +20,7 @@ from tempfile import NamedTemporaryFile import shutil from configparser import ConfigParser from subprocess import Popen, PIPE -from samba.common import get_bytes, get_string +from samba.common import get_string from glob import glob import xml.etree.ElementTree as etree from samba.gp.util.logging import log diff --git a/python/samba/gp/gp_smb_conf_ext.py b/python/samba/gp/gp_smb_conf_ext.py index eafe9426e1a..3ef9cfdf2b4 100644 --- a/python/samba/gp/gp_smb_conf_ext.py +++ b/python/samba/gp/gp_smb_conf_ext.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os, re, numbers +import os, numbers from samba.gp.gpclass import gp_pol_ext, gp_misc_applier from tempfile import NamedTemporaryFile from samba.gp.util.logging import log diff --git a/python/samba/gp/gpclass.py b/python/samba/gp/gpclass.py index d70643421d0..fcb7c480203 100644 --- a/python/samba/gp/gpclass.py +++ b/python/samba/gp/gpclass.py @@ -21,7 +21,7 @@ import errno import tdb import pwd sys.path.insert(0, "bin/python") -from samba import NTSTATUSError, WERRORError +from samba import WERRORError from configparser import ConfigParser from io import StringIO import traceback @@ -33,12 +33,10 @@ from samba.net import Net from samba.dcerpc import nbt from samba.samba3 import libsmb_samba_internal as libsmb import samba.gpo as gpo -from samba.param import LoadParm from uuid import UUID from tempfile import NamedTemporaryFile from samba.dcerpc import preg -from samba.dcerpc import misc -from samba.ndr import ndr_pack, ndr_unpack +from samba.ndr import ndr_unpack from samba.credentials import SMB_SIGNING_REQUIRED from samba.gp.util.logging import log from hashlib import blake2b @@ -47,7 +45,7 @@ from samba.common import get_string from samba.samdb import SamDB from samba.auth import system_session import ldb -from samba.dsdb import UF_WORKSTATION_TRUST_ACCOUNT, UF_SERVER_TRUST_ACCOUNT, GPLINK_OPT_ENFORCE, GPLINK_OPT_DISABLE, GPO_INHERIT, GPO_BLOCK_INHERITANCE +from samba.dsdb import UF_WORKSTATION_TRUST_ACCOUNT, UF_SERVER_TRUST_ACCOUNT, GPLINK_OPT_ENFORCE, GPLINK_OPT_DISABLE, GPO_BLOCK_INHERITANCE from samba.auth import AUTH_SESSION_INFO_DEFAULT_GROUPS, AUTH_SESSION_INFO_AUTHENTICATED, AUTH_SESSION_INFO_SIMPLE_PRIVILEGES from samba.dcerpc import security import samba.security diff --git a/python/samba/gp/util/logging.py b/python/samba/gp/util/logging.py index a74a8707d50..f4dca35c3dd 100644 --- a/python/samba/gp/util/logging.py +++ b/python/samba/gp/util/logging.py @@ -17,7 +17,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import json import datetime import logging import gettext diff --git a/python/samba/gp/vgp_access_ext.py b/python/samba/gp/vgp_access_ext.py index 4748352d14a..7efb3bbc30b 100644 --- a/python/samba/gp/vgp_access_ext.py +++ b/python/samba/gp/vgp_access_ext.py @@ -17,7 +17,6 @@ import os, re from samba.gp.gpclass import gp_xml_ext, gp_file_applier from tempfile import NamedTemporaryFile -from samba.common import get_bytes from samba.gp.util.logging import log intro = ''' diff --git a/python/samba/gp/vgp_openssh_ext.py b/python/samba/gp/vgp_openssh_ext.py index bf865e78375..4448a54a8dc 100644 --- a/python/samba/gp/vgp_openssh_ext.py +++ b/python/samba/gp/vgp_openssh_ext.py @@ -17,8 +17,7 @@ import os from io import BytesIO from samba.gp.gpclass import gp_xml_ext, gp_file_applier -from tempfile import NamedTemporaryFile -from samba.common import get_bytes, get_string +from samba.common import get_bytes intro = b''' ### autogenerated by samba diff --git a/python/samba/gp/vgp_startup_scripts_ext.py b/python/samba/gp/vgp_startup_scripts_ext.py index 02f22bab78d..c0edb165d31 100644 --- a/python/samba/gp/vgp_startup_scripts_ext.py +++ b/python/samba/gp/vgp_startup_scripts_ext.py @@ -18,7 +18,7 @@ import os from samba.gp.gpclass import gp_xml_ext, check_safe_path, gp_file_applier from tempfile import NamedTemporaryFile from samba.common import get_bytes -from subprocess import Popen, PIPE +from subprocess import Popen intro = b''' ### autogenerated by samba diff --git a/python/samba/gp/vgp_sudoers_ext.py b/python/samba/gp/vgp_sudoers_ext.py index d11200869e7..4d2eea02434 100644 --- a/python/samba/gp/vgp_sudoers_ext.py +++ b/python/samba/gp/vgp_sudoers_ext.py @@ -17,7 +17,6 @@ import os from samba.gp.gpclass import gp_xml_ext, gp_file_applier from samba.gp.gp_sudoers_ext import sudo_applier_func -from samba.gp.util.logging import log class vgp_sudoers_ext(gp_xml_ext, gp_file_applier): def __str__(self): diff --git a/python/samba/gp/vgp_symlink_ext.py b/python/samba/gp/vgp_symlink_ext.py index c1637d58d4f..4f85264a66d 100644 --- a/python/samba/gp/vgp_symlink_ext.py +++ b/python/samba/gp/vgp_symlink_ext.py @@ -16,8 +16,6 @@ import os from samba.gp.gpclass import gp_xml_ext, gp_file_applier -from tempfile import NamedTemporaryFile -from subprocess import Popen, PIPE from samba.gp.util.logging import log class vgp_symlink_ext(gp_xml_ext, gp_file_applier): diff --git a/python/samba/join.py b/python/samba/join.py index 731d319badc..dc19a0fcfbc 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -26,7 +26,6 @@ import samba import uuid from samba.ndr import ndr_pack, ndr_unpack from samba.dcerpc import security, drsuapi, misc, nbt, lsa, drsblobs, dnsserver, dnsp -from samba.dsdb import DS_DOMAIN_FUNCTION_2003 from samba.credentials import Credentials, DONT_USE_KERBEROS from samba.provision import (secretsdb_self_join, provision, provision_fill, FILL_DRS, FILL_SUBDOMAIN, DEFAULTSITE) @@ -41,7 +40,6 @@ from base64 import b64encode from samba import WERRORError, NTSTATUSError from samba import sd_utils from samba.dnsserver import ARecord, AAAARecord, CNAMERecord -import logging import random import time import re diff --git a/python/samba/mdb_util.py b/python/samba/mdb_util.py index 1be16d5bb3d..688e0663364 100644 --- a/python/samba/mdb_util.py +++ b/python/samba/mdb_util.py @@ -16,7 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import samba import subprocess import os from samba.netcmd import CommandError diff --git a/python/samba/policies.py b/python/samba/policies.py index aed7547c79d..5adcb1c9f47 100644 --- a/python/samba/policies.py +++ b/python/samba/policies.py @@ -15,7 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import json from io import StringIO import ldb from samba.ndr import ndr_unpack, ndr_pack diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py index 2e418f1e654..461219d63aa 100644 --- a/python/samba/provision/__init__.py +++ b/python/samba/provision/__init__.py @@ -66,7 +66,6 @@ from samba.dcerpc.misc import ( ) from samba.dsdb import ( DS_DOMAIN_FUNCTION_2000, - DS_DOMAIN_FUNCTION_2003, DS_DOMAIN_FUNCTION_2008, DS_DOMAIN_FUNCTION_2008_R2, DS_DOMAIN_FUNCTION_2012, @@ -82,7 +81,6 @@ from samba.provision.backend import ( LDBBackend, ) from samba.descriptor import ( - get_empty_descriptor, get_config_descriptor, get_config_partitions_descriptor, get_config_sites_descriptor, @@ -98,9 +96,6 @@ from samba.descriptor import ( get_domain_controllers_descriptor, get_domain_delete_protected1_descriptor, get_domain_delete_protected2_descriptor, - get_dns_partition_descriptor, - get_dns_forest_microsoft_dns_descriptor, - get_dns_domain_microsoft_dns_descriptor, get_managed_service_accounts_descriptor, ) from samba.provision.common import ( @@ -109,7 +104,6 @@ from samba.provision.common import ( setup_modify_ldif, FILL_FULL, FILL_SUBDOMAIN, - FILL_NT4SYNC, FILL_DRS ) from samba.provision.sambadns import ( diff --git a/python/samba/provision/sambadns.py b/python/samba/provision/sambadns.py index 19c5919dac6..9c37876671f 100644 --- a/python/samba/provision/sambadns.py +++ b/python/samba/provision/sambadns.py @@ -36,8 +36,6 @@ from samba.dcerpc import dnsp, misc, security from samba.dsdb import ( DS_DOMAIN_FUNCTION_2000, DS_DOMAIN_FUNCTION_2003, - DS_DOMAIN_FUNCTION_2008_R2, - DS_DOMAIN_FUNCTION_2012_R2, DS_DOMAIN_FUNCTION_2016, DS_GUID_USERS_CONTAINER ) @@ -56,8 +54,6 @@ from samba.provision.common import ( setup_ldb, FILL_FULL, FILL_SUBDOMAIN, - FILL_NT4SYNC, - FILL_DRS, ) from samba.samdb import get_default_backend_store diff --git a/python/samba/safe_tarfile.py b/python/samba/safe_tarfile.py index 21366178475..1015fcf4a8c 100644 --- a/python/samba/safe_tarfile.py +++ b/python/samba/safe_tarfile.py @@ -18,7 +18,7 @@ import os import tarfile from pathlib import Path -from tarfile import ExtractError, TarInfo, TarFile as UnsafeTarFile +from tarfile import ExtractError, TarFile as UnsafeTarFile class TarFile(UnsafeTarFile): diff --git a/python/samba/subunit/__init__.py b/python/samba/subunit/__init__.py index 813e53bdafd..dab522e160b 100644 --- a/python/samba/subunit/__init__.py +++ b/python/samba/subunit/__init__.py @@ -17,7 +17,6 @@ """Subunit test protocol.""" -import samba import unittest diff --git a/python/samba/tests/common.py b/python/samba/tests/common.py index b7248b0826e..1a7d9ad9360 100644 --- a/python/samba/tests/common.py +++ b/python/samba/tests/common.py @@ -21,7 +21,7 @@ import samba import os import samba.tests from samba.common import normalise_int32 -from samba.samdb import SamDB, dsdb_Dn +from samba.samdb import dsdb_Dn class CommonTests(samba.tests.TestCaseInTempDir): diff --git a/python/samba/tests/compression.py b/python/samba/tests/compression.py index 45e6747b0dd..0b42100a7b7 100644 --- a/python/samba/tests/compression.py +++ b/python/samba/tests/compression.py @@ -14,9 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from unittest import TestSuite import os -import random from samba.tests import TestCase from samba import compression diff --git a/python/samba/tests/dcerpc/samr_change_password.py b/python/samba/tests/dcerpc/samr_change_password.py index 109eeea98cc..89cf8ca403e 100644 --- a/python/samba/tests/dcerpc/samr_change_password.py +++ b/python/samba/tests/dcerpc/samr_change_password.py @@ -18,7 +18,6 @@ """Tests for samba.dcerpc.samr.password""" -import os import ctypes import samba.tests diff --git a/python/samba/tests/dns_aging.py b/python/samba/tests/dns_aging.py index 99301c09d22..34ba37f7f6e 100644 --- a/python/samba/tests/dns_aging.py +++ b/python/samba/tests/dns_aging.py @@ -26,7 +26,7 @@ import ldb from samba import credentials from samba.dcerpc import dns, dnsp, dnsserver from samba.dnsserver import TXTRecord, ARecord -from samba.dnsserver import recbuf_from_string, ipv6_normalise +from samba.dnsserver import ipv6_normalise from samba.tests.subunitrun import SubunitOptions, TestProgram from samba import werror, WERRORError from samba.tests.dns_base import DNSTest diff --git a/python/samba/tests/dns_forwarder.py b/python/samba/tests/dns_forwarder.py index 42995d1f2aa..cd27790c0af 100644 --- a/python/samba/tests/dns_forwarder.py +++ b/python/samba/tests/dns_forwarder.py @@ -25,7 +25,7 @@ import errno import samba.ndr as ndr from samba import credentials from samba.tests import TestCase -from samba.dcerpc import dns, dnsp +from samba.dcerpc import dns from samba.tests.subunitrun import SubunitOptions, TestProgram import samba.getopt as options import optparse diff --git a/python/samba/tests/domain_backup_offline.py b/python/samba/tests/domain_backup_offline.py index 7c688c8560c..3b2f25283e5 100644 --- a/python/samba/tests/domain_backup_offline.py +++ b/python/samba/tests/domain_backup_offline.py @@ -21,9 +21,6 @@ import tempfile from samba.tests import BlackboxTestCase, BlackboxProcessError from samba.netcmd import CommandError from samba.param import LoadParm -from samba.join import join_DC -from samba.credentials import Credentials -from samba.logger import get_samba_logger from samba import safe_tarfile as tarfile diff --git a/python/samba/tests/dsdb_dns.py b/python/samba/tests/dsdb_dns.py index 8c7fc343278..c175adb691e 100644 --- a/python/samba/tests/dsdb_dns.py +++ b/python/samba/tests/dsdb_dns.py @@ -16,7 +16,6 @@ # from samba.tests import TestCase from samba import dsdb_dns -import time def unix2nttime(t): diff --git a/python/samba/tests/dsdb_lock.py b/python/samba/tests/dsdb_lock.py index 3f7cc9b5ae5..628be9c9726 100644 --- a/python/samba/tests/dsdb_lock.py +++ b/python/samba/tests/dsdb_lock.py @@ -21,7 +21,6 @@ from samba.tests.samdb import SamDBTestCase from samba.samdb import SamDB import ldb import os -import samba import gc import time diff --git a/python/samba/tests/getdcname.py b/python/samba/tests/getdcname.py index f5bf64b989c..daf668641a1 100644 --- a/python/samba/tests/getdcname.py +++ b/python/samba/tests/getdcname.py @@ -19,7 +19,6 @@ Tests GetDCNameEx calls in NETLOGON """ -from samba import auth from samba import WERRORError, werror import samba.tests import os diff --git a/python/samba/tests/gpo.py b/python/samba/tests/gpo.py index fc72ca8b7cc..4534f2734a8 100644 --- a/python/samba/tests/gpo.py +++ b/python/samba/tests/gpo.py @@ -27,7 +27,7 @@ from tempfile import NamedTemporaryFile, TemporaryDirectory from samba.gp import gpclass # Disable privilege dropping for testing gpclass.drop_privileges = lambda _, func, *args : func(*args) -from samba.gp.gp_sec_ext import gp_krb_ext, gp_access_ext +from samba.gp.gp_sec_ext import gp_krb_ext from samba.gp.gp_scripts_ext import gp_scripts_ext, gp_user_scripts_ext from samba.gp.gp_sudoers_ext import gp_sudoers_ext from samba.gp.vgp_sudoers_ext import vgp_sudoers_ext diff --git a/python/samba/tests/gpo_member.py b/python/samba/tests/gpo_member.py index 0fc09e81b03..1b8779b1ace 100644 --- a/python/samba/tests/gpo_member.py +++ b/python/samba/tests/gpo_member.py @@ -18,9 +18,7 @@ import os from samba import tests from samba.gp.gpclass import GPOStorage from samba.param import LoadParm -from samba.credentials import Credentials from samba.gp.gp_sec_ext import gp_access_ext -import logging class GPOTests(tests.TestCase): def setUp(self): diff --git a/python/samba/tests/krb5_credentials.py b/python/samba/tests/krb5_credentials.py index 0563e40286a..178cc48aa6c 100644 --- a/python/samba/tests/krb5_credentials.py +++ b/python/samba/tests/krb5_credentials.py @@ -26,7 +26,7 @@ from samba.credentials import ( from samba.dsdb import ( UF_WORKSTATION_TRUST_ACCOUNT, UF_PASSWD_NOTREQD, - UF_NORMAL_ACCOUNT) +) from samba.samdb import SamDB """KRB5 Integration tests for pycredentials. diff --git a/python/samba/tests/ldap_upn_sam_account.py b/python/samba/tests/ldap_upn_sam_account.py index ab0ca063225..4838f44260d 100644 --- a/python/samba/tests/ldap_upn_sam_account.py +++ b/python/samba/tests/ldap_upn_sam_account.py @@ -26,7 +26,7 @@ from samba.tests import TestCase, ldb_err from samba.tests import DynamicTestCase import samba.getopt as options import optparse -from samba.colour import c_RED, c_GREEN, c_DARK_YELLOW +from samba.colour import c_DARK_YELLOW import re import pprint from samba.dsdb import ( diff --git a/python/samba/tests/ldap_whoami.py b/python/samba/tests/ldap_whoami.py index 378928e6379..95c08cf76d6 100644 --- a/python/samba/tests/ldap_whoami.py +++ b/python/samba/tests/ldap_whoami.py @@ -16,7 +16,7 @@ from samba import Ldb,tests from samba.samba3 import param as s3param -from samba import (credentials,NTSTATUSError) +from samba import credentials import os class LdapWhoami(tests.TestCase): diff --git a/python/samba/tests/netlogonsvc.py b/python/samba/tests/netlogonsvc.py index 342e2efc849..86ac22de5a3 100644 --- a/python/samba/tests/netlogonsvc.py +++ b/python/samba/tests/netlogonsvc.py @@ -18,7 +18,6 @@ from samba.tests import TestCase import os -import samba from samba.credentials import Credentials from samba.dcerpc import netlogon from samba import NTSTATUSError, ntstatus diff --git a/python/samba/tests/password_hash_ldap.py b/python/samba/tests/password_hash_ldap.py index 6b6375d0fc1..7e685dd2c05 100644 --- a/python/samba/tests/password_hash_ldap.py +++ b/python/samba/tests/password_hash_ldap.py @@ -39,7 +39,6 @@ from samba.tests.password_hash import ( PassWordHashTests, get_package, USER_NAME, - USER_PASS ) from samba.samdb import SamDB from samba.ndr import ndr_unpack diff --git a/python/samba/tests/safe_tarfile.py b/python/samba/tests/safe_tarfile.py index 27ff8dae0bf..1f2cb03aeb4 100644 --- a/python/samba/tests/safe_tarfile.py +++ b/python/samba/tests/safe_tarfile.py @@ -15,7 +15,6 @@ # along with this program. If not, see . import tarfile from samba import safe_tarfile -import tempfile import os from samba.tests import TestCaseInTempDir diff --git a/python/samba/tests/samba_startup_fl_change.py b/python/samba/tests/samba_startup_fl_change.py index 1fb97d51e70..54fa9f820c6 100644 --- a/python/samba/tests/samba_startup_fl_change.py +++ b/python/samba/tests/samba_startup_fl_change.py @@ -20,10 +20,9 @@ from samba.credentials import Credentials from samba.samdb import SamDB from samba.auth import system_session -from samba.tests import TestCase from samba.param import LoadParm from samba import dsdb, functional_level -import ldb, samba +import ldb from samba.tests.samba_tool.base import SambaToolCmdTest diff --git a/python/samba/tests/samba_tool/gpo.py b/python/samba/tests/samba_tool/gpo.py index e49944c204d..483a4cc019d 100644 --- a/python/samba/tests/samba_tool/gpo.py +++ b/python/samba/tests/samba_tool/gpo.py @@ -30,10 +30,8 @@ from samba.dcerpc import preg from samba.ndr import ndr_pack, ndr_unpack from samba.common import get_string from configparser import ConfigParser -from io import StringIO import xml.etree.ElementTree as etree from tempfile import NamedTemporaryFile -from time import sleep import re from samba.gp.gpclass import check_guid from samba.gp_parse.gp_ini import GPTIniParser diff --git a/python/samba/tests/samdb_api.py b/python/samba/tests/samdb_api.py index 710d0bc310f..a653ca089a2 100644 --- a/python/samba/tests/samdb_api.py +++ b/python/samba/tests/samdb_api.py @@ -19,7 +19,6 @@ from samba.tests import TestCaseInTempDir from samba.samdb import SamDB from ldb import LdbError, ERR_OPERATIONS_ERROR -import os import errno diff --git a/python/samba/tests/security_descriptors.py b/python/samba/tests/security_descriptors.py index e6feafed016..83ff667b007 100644 --- a/python/samba/tests/security_descriptors.py +++ b/python/samba/tests/security_descriptors.py @@ -28,7 +28,6 @@ from samba.colour import colourdiff from hashlib import md5 import gzip -import os import json from pathlib import Path diff --git a/python/samba/tests/smb-notify.py b/python/samba/tests/smb-notify.py index 78b757e4e21..8c7dad0b762 100755 --- a/python/samba/tests/smb-notify.py +++ b/python/samba/tests/smb-notify.py @@ -24,7 +24,6 @@ os.environ["PYTHONUNBUFFERED"] = "1" import samba import random from samba.tests import TestCase -from samba import NTSTATUSError from samba import credentials from samba.ntstatus import NT_STATUS_NOTIFY_CLEANUP from samba.samba3 import libsmb_samba_internal as libsmb diff --git a/python/samba/tests/smb1posix.py b/python/samba/tests/smb1posix.py index d77c49d0664..22ca6a260f9 100644 --- a/python/samba/tests/smb1posix.py +++ b/python/samba/tests/smb1posix.py @@ -17,7 +17,6 @@ from samba.samba3 import libsmb_samba_internal as libsmb from samba import (ntstatus,NTSTATUSError) -from samba.dcerpc import security as sec import samba.tests.libsmb import stat diff --git a/python/samba/upgrade.py b/python/samba/upgrade.py index dff856a8d7c..bc21172a0d4 100644 --- a/python/samba/upgrade.py +++ b/python/samba/upgrade.py @@ -25,7 +25,6 @@ import time import pwd from samba import Ldb, registry -from samba.param import LoadParm from samba.provision import provision, ProvisioningError, setsysvolacl from samba.provision.common import FILL_FULL from samba.samba3 import passdb diff --git a/python/samba/upgradehelpers.py b/python/samba/upgradehelpers.py index 6920cea6583..f1250feef03 100644 --- a/python/samba/upgradehelpers.py +++ b/python/samba/upgradehelpers.py @@ -27,7 +27,7 @@ import shutil import samba from samba.common import cmp -from samba import Ldb, version, ntacls +from samba import Ldb, version from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE import ldb from samba.provision import (provision_paths_from_lp,