diff --git a/src/MCPClient/lib/clientScripts/archivematicaCreateMETSMetadataCSV.py b/src/MCPClient/lib/clientScripts/archivematicaCreateMETSMetadataCSV.py
index 57fb1130e0..d5bbaa1687 100755
--- a/src/MCPClient/lib/clientScripts/archivematicaCreateMETSMetadataCSV.py
+++ b/src/MCPClient/lib/clientScripts/archivematicaCreateMETSMetadataCSV.py
@@ -16,7 +16,6 @@
#
# You should have received a copy of the GNU General Public License
# along with Archivematica. If not, see .
-# /src/dashboard/src/main/models.py
import collections
import csv
import sys
@@ -24,8 +23,6 @@
import archivematicaFunctions
-# archivematicaCommon
-
def parseMetadata(job, SIPPath, state):
"""
diff --git a/src/MCPClient/lib/clientScripts/archivematicaCreateMETSReingest.py b/src/MCPClient/lib/clientScripts/archivematicaCreateMETSReingest.py
index 1f6d8b58d5..faefb82414 100755
--- a/src/MCPClient/lib/clientScripts/archivematicaCreateMETSReingest.py
+++ b/src/MCPClient/lib/clientScripts/archivematicaCreateMETSReingest.py
@@ -11,8 +11,6 @@
from lxml import etree
from main import models
-# dashboard
-
def _create_premis_object(premis_object_type):
"""Return new PREMIS element container (``lxml._Element`` instance).
diff --git a/src/MCPClient/lib/clientScripts/archivematicaCreateMETSRights.py b/src/MCPClient/lib/clientScripts/archivematicaCreateMETSRights.py
index 5f00d381a8..37754c963a 100755
--- a/src/MCPClient/lib/clientScripts/archivematicaCreateMETSRights.py
+++ b/src/MCPClient/lib/clientScripts/archivematicaCreateMETSRights.py
@@ -16,7 +16,6 @@
#
# You should have received a copy of the GNU General Public License
# along with Archivematica. If not, see .
-# /src/dashboard/src/main/models.py
import sys
import uuid
@@ -25,9 +24,6 @@
from countryCodes import getCodeForCountry
from main.models import RightsStatement
-# dashboard
-# archivematicaCommon
-
RIGHTS_BASIS_OTHER = ["Policy", "Donor"]
diff --git a/src/MCPClient/lib/clientScripts/archivematicaCreateMETSTrim.py b/src/MCPClient/lib/clientScripts/archivematicaCreateMETSTrim.py
index 0f6f0436bd..c3f5ed7e65 100755
--- a/src/MCPClient/lib/clientScripts/archivematicaCreateMETSTrim.py
+++ b/src/MCPClient/lib/clientScripts/archivematicaCreateMETSTrim.py
@@ -25,8 +25,6 @@
from django.core.exceptions import ValidationError
from main.models import File
-# dashboard
-
def getTrimDmdSec(job, baseDirectoryPath, sipUUID):
# containerMetadata
diff --git a/src/MCPClient/lib/clientScripts/assign_file_uuids.py b/src/MCPClient/lib/clientScripts/assign_file_uuids.py
index 0ec7997bc4..8514cf56a0 100755
--- a/src/MCPClient/lib/clientScripts/assign_file_uuids.py
+++ b/src/MCPClient/lib/clientScripts/assign_file_uuids.py
@@ -36,11 +36,9 @@
from django.db import transaction
django.setup()
-# dashboard
+
import metsrw
import namespaces as ns
-
-# archivematicaCommon
from archivematicaFunctions import chunk_iterable
from archivematicaFunctions import find_mets_file
from custom_handlers import get_script_logger
diff --git a/src/MCPClient/lib/clientScripts/assign_uuids_to_directories.py b/src/MCPClient/lib/clientScripts/assign_uuids_to_directories.py
index c1a2b049e9..777a426dba 100755
--- a/src/MCPClient/lib/clientScripts/assign_uuids_to_directories.py
+++ b/src/MCPClient/lib/clientScripts/assign_uuids_to_directories.py
@@ -34,12 +34,10 @@
import django
django.setup()
-# dashboard
+
from archivematicaFunctions import format_subdir_path
from archivematicaFunctions import get_dir_uuids
from archivematicaFunctions import str2bool
-
-# archivematicaCommon
from custom_handlers import get_script_logger
from django.core.exceptions import ValidationError
from django.db import transaction
diff --git a/src/MCPClient/lib/clientScripts/bag_with_empty_directories.py b/src/MCPClient/lib/clientScripts/bag_with_empty_directories.py
index 483d1b5b53..5022a18c7c 100755
--- a/src/MCPClient/lib/clientScripts/bag_with_empty_directories.py
+++ b/src/MCPClient/lib/clientScripts/bag_with_empty_directories.py
@@ -23,7 +23,7 @@
import django
django.setup()
-# archivematicaCommon
+
from archivematicaFunctions import get_setting
from bagit import make_bag
from django.conf import settings as mcpclient_settings
diff --git a/src/MCPClient/lib/clientScripts/bind_pid.py b/src/MCPClient/lib/clientScripts/bind_pid.py
index da7ee6eb31..15fff4194d 100755
--- a/src/MCPClient/lib/clientScripts/bind_pid.py
+++ b/src/MCPClient/lib/clientScripts/bind_pid.py
@@ -46,8 +46,8 @@
from django.db import transaction
django.setup()
-# dashboard
-# archivematicaCommon
+
+
import bindpid
from archivematicaFunctions import str2bool
from custom_handlers import get_script_logger
diff --git a/src/MCPClient/lib/clientScripts/bind_pids.py b/src/MCPClient/lib/clientScripts/bind_pids.py
index a8ebf9cf58..e0973d0287 100755
--- a/src/MCPClient/lib/clientScripts/bind_pids.py
+++ b/src/MCPClient/lib/clientScripts/bind_pids.py
@@ -48,8 +48,6 @@
django.setup()
import namespaces as ns
-
-# archivematicaCommon
from archivematicaFunctions import str2bool
from bindpid import BindPIDException
from bindpid import _validate_entity_type_required_params
@@ -60,8 +58,6 @@
from django.db import transaction
from lxml import etree
from main.models import SIP
-
-# dashboard
from main.models import DashboardSetting
from main.models import Directory
diff --git a/src/MCPClient/lib/clientScripts/change_object_names.py b/src/MCPClient/lib/clientScripts/change_object_names.py
index 17a77e37f5..6146fcee83 100755
--- a/src/MCPClient/lib/clientScripts/change_object_names.py
+++ b/src/MCPClient/lib/clientScripts/change_object_names.py
@@ -23,14 +23,10 @@
django.setup()
import change_names
-
-# archivematicaCommon
from custom_handlers import get_script_logger
from django.db import transaction
from main.models import SIP
from main.models import Directory
-
-# dashboard
from main.models import Event
from main.models import File
from main.models import Transfer
diff --git a/src/MCPClient/lib/clientScripts/change_sip_name.py b/src/MCPClient/lib/clientScripts/change_sip_name.py
index 17373abea4..0ce261290d 100755
--- a/src/MCPClient/lib/clientScripts/change_sip_name.py
+++ b/src/MCPClient/lib/clientScripts/change_sip_name.py
@@ -23,8 +23,6 @@
django.setup()
from change_names import change_path
from django.db import transaction
-
-# dashboard
from main.models import SIP
from main.models import Transfer
diff --git a/src/MCPClient/lib/clientScripts/check_for_access_directory.py b/src/MCPClient/lib/clientScripts/check_for_access_directory.py
index 8571db1596..d70bcb1feb 100755
--- a/src/MCPClient/lib/clientScripts/check_for_access_directory.py
+++ b/src/MCPClient/lib/clientScripts/check_for_access_directory.py
@@ -23,10 +23,8 @@
from django.db import transaction
django.setup()
-# dashboard
-from fileOperations import rename
-# archivematicaCommon
+from fileOperations import rename
from fileOperations import updateFileLocation
from main.models import File
diff --git a/src/MCPClient/lib/clientScripts/check_for_service_directory.py b/src/MCPClient/lib/clientScripts/check_for_service_directory.py
index a88dfe712d..4ec5ceb0f5 100755
--- a/src/MCPClient/lib/clientScripts/check_for_service_directory.py
+++ b/src/MCPClient/lib/clientScripts/check_for_service_directory.py
@@ -23,7 +23,7 @@
from django.db import transaction
django.setup()
-# dashboard
+
from main.models import File
diff --git a/src/MCPClient/lib/clientScripts/compress_aip.py b/src/MCPClient/lib/clientScripts/compress_aip.py
index 10100c7c2b..0e1123f10e 100755
--- a/src/MCPClient/lib/clientScripts/compress_aip.py
+++ b/src/MCPClient/lib/clientScripts/compress_aip.py
@@ -7,8 +7,8 @@
from django.db import transaction
django.setup()
-# dashboard
-# archivematicaCommon
+
+
import databaseFunctions
from executeOrRunSubProcess import executeOrRun
from main.models import SIP
diff --git a/src/MCPClient/lib/clientScripts/convert_dataverse_structure.py b/src/MCPClient/lib/clientScripts/convert_dataverse_structure.py
index c9ae12de44..0d2b533060 100644
--- a/src/MCPClient/lib/clientScripts/convert_dataverse_structure.py
+++ b/src/MCPClient/lib/clientScripts/convert_dataverse_structure.py
@@ -30,8 +30,6 @@
import django
from lxml import etree
-# Database functions requires Django to be set up.
-
django.setup()
import metsrw
diff --git a/src/MCPClient/lib/clientScripts/create_aic_mets.py b/src/MCPClient/lib/clientScripts/create_aic_mets.py
index ce54c67bc4..7bd393510e 100755
--- a/src/MCPClient/lib/clientScripts/create_aic_mets.py
+++ b/src/MCPClient/lib/clientScripts/create_aic_mets.py
@@ -11,10 +11,8 @@
from lxml.builder import ElementMaker
django.setup()
-# dashboard
-import create_mets_v2
-# archivematicaCommon
+import create_mets_v2
import databaseFunctions
import fileOperations
import namespaces as ns
diff --git a/src/MCPClient/lib/clientScripts/create_event.py b/src/MCPClient/lib/clientScripts/create_event.py
index b026757a05..742de8fcda 100755
--- a/src/MCPClient/lib/clientScripts/create_event.py
+++ b/src/MCPClient/lib/clientScripts/create_event.py
@@ -20,10 +20,8 @@
import django
-# databaseFunctions requires Django to be set up
-
django.setup()
-# archivematicaCommon
+
from databaseFunctions import insertIntoEvents
from django.db import transaction
diff --git a/src/MCPClient/lib/clientScripts/create_mets_dataverse_v2.py b/src/MCPClient/lib/clientScripts/create_mets_dataverse_v2.py
index 741f4f3604..34c8c5c9cb 100644
--- a/src/MCPClient/lib/clientScripts/create_mets_dataverse_v2.py
+++ b/src/MCPClient/lib/clientScripts/create_mets_dataverse_v2.py
@@ -24,7 +24,6 @@
import metsrw
from custom_handlers import get_script_logger
-# Create a module level logger.
logger = get_script_logger("archivematica.mcp.client.createMETSDataverse")
diff --git a/src/MCPClient/lib/clientScripts/create_mets_v2.py b/src/MCPClient/lib/clientScripts/create_mets_v2.py
index d6460e2022..c61a9a3a9c 100755
--- a/src/MCPClient/lib/clientScripts/create_mets_v2.py
+++ b/src/MCPClient/lib/clientScripts/create_mets_v2.py
@@ -34,7 +34,7 @@
import metsrw
django.setup()
-# dashboard
+
import archivematicaCreateMETSMetadataXML
import archivematicaCreateMETSReingest
import namespaces as ns
@@ -47,8 +47,6 @@
from archivematicaCreateMETSTrim import getTrimDmdSec
from archivematicaCreateMETSTrim import getTrimFileAmdSec
from archivematicaCreateMETSTrim import getTrimFileDmdSec
-
-# archivematicaCommon
from archivematicaFunctions import normalizeNonDcElementName
from bagit import Bag
from bagit import BagError
diff --git a/src/MCPClient/lib/clientScripts/create_sip_from_transfer_objects.py b/src/MCPClient/lib/clientScripts/create_sip_from_transfer_objects.py
index 0bf46612a2..f68d09d3cf 100755
--- a/src/MCPClient/lib/clientScripts/create_sip_from_transfer_objects.py
+++ b/src/MCPClient/lib/clientScripts/create_sip_from_transfer_objects.py
@@ -23,15 +23,13 @@
import django
django.setup()
-# archivematicaCommon
+
import archivematicaFunctions
from django.core.exceptions import ValidationError
from django.db import transaction
from main.models import SIP
from main.models import Agent
from main.models import Directory
-
-# dashboard
from main.models import File
from main.models import Transfer
from main.models import UnitVariable
diff --git a/src/MCPClient/lib/clientScripts/create_sips_from_trim_transfer_containers.py b/src/MCPClient/lib/clientScripts/create_sips_from_trim_transfer_containers.py
index 95c6d51800..ab056933cc 100755
--- a/src/MCPClient/lib/clientScripts/create_sips_from_trim_transfer_containers.py
+++ b/src/MCPClient/lib/clientScripts/create_sips_from_trim_transfer_containers.py
@@ -24,8 +24,8 @@
from django.db import transaction
django.setup()
-# dashboard
-# archivematicaCommon
+
+
import archivematicaFunctions
import databaseFunctions
from main.models import File
diff --git a/src/MCPClient/lib/clientScripts/create_transfer_metadata.py b/src/MCPClient/lib/clientScripts/create_transfer_metadata.py
index 801867ebc4..322db136f6 100755
--- a/src/MCPClient/lib/clientScripts/create_transfer_metadata.py
+++ b/src/MCPClient/lib/clientScripts/create_transfer_metadata.py
@@ -5,7 +5,7 @@
from lxml import etree
django.setup()
-# dashboard
+
from client import metrics
from main.models import Transfer
diff --git a/src/MCPClient/lib/clientScripts/create_transfer_mets.py b/src/MCPClient/lib/clientScripts/create_transfer_mets.py
index 9eb3c1ddcf..070024dd8c 100755
--- a/src/MCPClient/lib/clientScripts/create_transfer_mets.py
+++ b/src/MCPClient/lib/clientScripts/create_transfer_mets.py
@@ -28,12 +28,8 @@
django.setup()
import metsrw
-
-# archivematicaCommon
from archivematicaFunctions import get_dashboard_uuid
from countryCodes import getCodeForCountry
-
-# dashboard
from main.models import Agent
from main.models import Derivation
from main.models import Directory
diff --git a/src/MCPClient/lib/clientScripts/extract_contents.py b/src/MCPClient/lib/clientScripts/extract_contents.py
index 96db8a544d..719b52d2ee 100755
--- a/src/MCPClient/lib/clientScripts/extract_contents.py
+++ b/src/MCPClient/lib/clientScripts/extract_contents.py
@@ -7,19 +7,15 @@
from django.db import transaction
django.setup()
-# dashboard
+
from archivematicaFunctions import format_subdir_path
from archivematicaFunctions import get_dir_uuids
-
-# archivematicaCommon
from custom_handlers import get_script_logger
from databaseFunctions import fileWasRemoved
from executeOrRunSubProcess import executeOrRun
from fileOperations import addFileToTransfer
from fileOperations import updateSizeAndChecksum
from fpr.models import FPCommand
-
-# clientScripts
from has_packages import already_extracted
from main.models import Directory
from main.models import File
diff --git a/src/MCPClient/lib/clientScripts/extract_maildir_attachments.py b/src/MCPClient/lib/clientScripts/extract_maildir_attachments.py
index 3d9d9bf9df..292d42e0f5 100755
--- a/src/MCPClient/lib/clientScripts/extract_maildir_attachments.py
+++ b/src/MCPClient/lib/clientScripts/extract_maildir_attachments.py
@@ -27,13 +27,9 @@
django.setup()
from django.core.exceptions import ValidationError
from django.db import transaction
-
-# archivematicaCommon
from externals.extractMaildirAttachments import parse
from fileOperations import addFileToTransfer
from fileOperations import updateSizeAndChecksum
-
-# dashboard
from main.models import File
diff --git a/src/MCPClient/lib/clientScripts/extract_zipped_transfer.py b/src/MCPClient/lib/clientScripts/extract_zipped_transfer.py
index 9e8b057512..dc6c0406be 100755
--- a/src/MCPClient/lib/clientScripts/extract_zipped_transfer.py
+++ b/src/MCPClient/lib/clientScripts/extract_zipped_transfer.py
@@ -24,12 +24,8 @@
django.setup()
from django.db import transaction
-
-# archivematicaCommon
from executeOrRunSubProcess import executeOrRun
from fileOperations import get_extract_dir_name
-
-# dashboard
from main.models import Transfer
diff --git a/src/MCPClient/lib/clientScripts/failed_sip_cleanup.py b/src/MCPClient/lib/clientScripts/failed_sip_cleanup.py
index 61da95459e..3caa74a2e7 100755
--- a/src/MCPClient/lib/clientScripts/failed_sip_cleanup.py
+++ b/src/MCPClient/lib/clientScripts/failed_sip_cleanup.py
@@ -5,8 +5,8 @@
from django.db import transaction
django.setup()
-# dashboard
-# archivematicaCommon
+
+
import storageService as storage_service
from client import metrics
from main import models
diff --git a/src/MCPClient/lib/clientScripts/failed_transfer_cleanup.py b/src/MCPClient/lib/clientScripts/failed_transfer_cleanup.py
index a3e58afd3b..b3289090e4 100755
--- a/src/MCPClient/lib/clientScripts/failed_transfer_cleanup.py
+++ b/src/MCPClient/lib/clientScripts/failed_transfer_cleanup.py
@@ -5,7 +5,7 @@
import django
django.setup()
-# archivematicaCommon
+
import storageService as storage_service
from client import metrics
from django.db import transaction
diff --git a/src/MCPClient/lib/clientScripts/file_to_folder.py b/src/MCPClient/lib/clientScripts/file_to_folder.py
index c7d8672eb9..a65204b246 100755
--- a/src/MCPClient/lib/clientScripts/file_to_folder.py
+++ b/src/MCPClient/lib/clientScripts/file_to_folder.py
@@ -6,8 +6,6 @@
django.setup()
from django.db import transaction
-
-# dashboard
from main.models import Transfer
diff --git a/src/MCPClient/lib/clientScripts/get_aip_storage_locations.py b/src/MCPClient/lib/clientScripts/get_aip_storage_locations.py
index ced0a10dd2..9b6e4f44cd 100755
--- a/src/MCPClient/lib/clientScripts/get_aip_storage_locations.py
+++ b/src/MCPClient/lib/clientScripts/get_aip_storage_locations.py
@@ -3,11 +3,9 @@
import django
-# storageService requires Django to be set up
-
django.setup()
-# archivematicaCommon
+
import storageService as storage_service
from custom_handlers import get_script_logger
diff --git a/src/MCPClient/lib/clientScripts/identify_dspace_files.py b/src/MCPClient/lib/clientScripts/identify_dspace_files.py
index 17e18dda28..bbdf188038 100755
--- a/src/MCPClient/lib/clientScripts/identify_dspace_files.py
+++ b/src/MCPClient/lib/clientScripts/identify_dspace_files.py
@@ -23,7 +23,7 @@
from lxml import etree
django.setup()
-# dashboard
+
from main.models import File
diff --git a/src/MCPClient/lib/clientScripts/identify_dspace_mets_files.py b/src/MCPClient/lib/clientScripts/identify_dspace_mets_files.py
index 96b198be92..dbc4aaf50e 100755
--- a/src/MCPClient/lib/clientScripts/identify_dspace_mets_files.py
+++ b/src/MCPClient/lib/clientScripts/identify_dspace_mets_files.py
@@ -18,7 +18,7 @@
import django
django.setup()
-# dashboard
+
from django.db import transaction
from main.models import File
diff --git a/src/MCPClient/lib/clientScripts/index_aip.py b/src/MCPClient/lib/clientScripts/index_aip.py
index 2e7d8a99f8..ebd9c15c37 100755
--- a/src/MCPClient/lib/clientScripts/index_aip.py
+++ b/src/MCPClient/lib/clientScripts/index_aip.py
@@ -12,9 +12,6 @@
from django.core.exceptions import ValidationError
from main.models import UnitVariable
-# dashboard
-# archivematicaCommon
-
django.setup()
from django.conf import settings as mcpclient_settings
diff --git a/src/MCPClient/lib/clientScripts/load_dublin_core.py b/src/MCPClient/lib/clientScripts/load_dublin_core.py
index 6cd52c8bdd..4f70e5004f 100755
--- a/src/MCPClient/lib/clientScripts/load_dublin_core.py
+++ b/src/MCPClient/lib/clientScripts/load_dublin_core.py
@@ -7,8 +7,6 @@
django.setup()
from django.db import transaction
-
-# dashboard
from main import models
# This is the UUID of SIP from the `MetadataAppliesToTypes` table
diff --git a/src/MCPClient/lib/clientScripts/load_labels_from_csv.py b/src/MCPClient/lib/clientScripts/load_labels_from_csv.py
index aaea6e7b83..472ec2f74f 100755
--- a/src/MCPClient/lib/clientScripts/load_labels_from_csv.py
+++ b/src/MCPClient/lib/clientScripts/load_labels_from_csv.py
@@ -22,8 +22,6 @@
django.setup()
from django.db import transaction
-
-# dashboard
from main.models import File
diff --git a/src/MCPClient/lib/clientScripts/manual_normalization_create_metadata_and_restructure.py b/src/MCPClient/lib/clientScripts/manual_normalization_create_metadata_and_restructure.py
index c0d711820a..bbd13ce02e 100755
--- a/src/MCPClient/lib/clientScripts/manual_normalization_create_metadata_and_restructure.py
+++ b/src/MCPClient/lib/clientScripts/manual_normalization_create_metadata_and_restructure.py
@@ -18,13 +18,11 @@
from django.db import transaction
django.setup()
-# archivematicaCommon
+
import databaseFunctions
import fileOperations
from django.core.exceptions import ValidationError
from django.db.models import Q
-
-# dashboard
from main.models import Event
from main.models import File
diff --git a/src/MCPClient/lib/clientScripts/manual_normalization_identify_files_included.py b/src/MCPClient/lib/clientScripts/manual_normalization_identify_files_included.py
index 2e75037372..f88d8af5a4 100755
--- a/src/MCPClient/lib/clientScripts/manual_normalization_identify_files_included.py
+++ b/src/MCPClient/lib/clientScripts/manual_normalization_identify_files_included.py
@@ -20,7 +20,7 @@
from django.db import transaction
django.setup()
-# archivematicaCommon
+
from fileOperations import updateFileGrpUse
diff --git a/src/MCPClient/lib/clientScripts/manual_normalization_move_access_files_to_dip.py b/src/MCPClient/lib/clientScripts/manual_normalization_move_access_files_to_dip.py
index 2b0345b889..58cd8d9734 100755
--- a/src/MCPClient/lib/clientScripts/manual_normalization_move_access_files_to_dip.py
+++ b/src/MCPClient/lib/clientScripts/manual_normalization_move_access_files_to_dip.py
@@ -21,11 +21,9 @@
from django.db import transaction
django.setup()
-# dashboard
-# --sipUUID "%SIPUUID%" --sipDirectory "%SIPDirectory%" --filePath "%relativeLocation%"
+
from optparse import OptionParser
-# archivematicaCommon
import fileOperations
from django.core.exceptions import ValidationError
from main.models import File
diff --git a/src/MCPClient/lib/clientScripts/manual_normalization_remove_mn_directories.py b/src/MCPClient/lib/clientScripts/manual_normalization_remove_mn_directories.py
index 27a6f39a40..7978e8587a 100755
--- a/src/MCPClient/lib/clientScripts/manual_normalization_remove_mn_directories.py
+++ b/src/MCPClient/lib/clientScripts/manual_normalization_remove_mn_directories.py
@@ -21,11 +21,9 @@
import django
django.setup()
-# archivematicaCommon
+
import databaseFunctions
from django.db import transaction
-
-# dashboard
from main.models import File
diff --git a/src/MCPClient/lib/clientScripts/move_sip.py b/src/MCPClient/lib/clientScripts/move_sip.py
index 2229716c50..37f20a8bf1 100755
--- a/src/MCPClient/lib/clientScripts/move_sip.py
+++ b/src/MCPClient/lib/clientScripts/move_sip.py
@@ -23,11 +23,7 @@
django.setup()
from django.db import transaction
-
-# archivematicaCommon
from fileOperations import rename
-
-# dashboard
from main.models import SIP
diff --git a/src/MCPClient/lib/clientScripts/move_transfer.py b/src/MCPClient/lib/clientScripts/move_transfer.py
index 709800313c..6271499da8 100755
--- a/src/MCPClient/lib/clientScripts/move_transfer.py
+++ b/src/MCPClient/lib/clientScripts/move_transfer.py
@@ -21,11 +21,7 @@
django.setup()
from django.db import transaction
-
-# archivematicaCommon
from fileOperations import rename
-
-# dashboard
from main.models import Transfer
diff --git a/src/MCPClient/lib/clientScripts/parse_dataverse_mets.py b/src/MCPClient/lib/clientScripts/parse_dataverse_mets.py
index e2c5b0e9e3..79142b6260 100644
--- a/src/MCPClient/lib/clientScripts/parse_dataverse_mets.py
+++ b/src/MCPClient/lib/clientScripts/parse_dataverse_mets.py
@@ -10,13 +10,9 @@
import django
-# databaseFunctions requires Django to be set up
-
django.setup()
import databaseFunctions
import metsrw
-
-# archivematicaCommon
from archivematicaFunctions import get_file_checksum
from custom_handlers import get_script_logger
from django.core.exceptions import ValidationError
diff --git a/src/MCPClient/lib/clientScripts/parse_external_mets.py b/src/MCPClient/lib/clientScripts/parse_external_mets.py
index 010b0b59bb..63d2fce5a4 100755
--- a/src/MCPClient/lib/clientScripts/parse_external_mets.py
+++ b/src/MCPClient/lib/clientScripts/parse_external_mets.py
@@ -7,8 +7,6 @@
from custom_handlers import get_script_logger
from lxml import etree
-# archivematicaCommon
-
logger = get_script_logger("archivematica.mcp.client.parse_external_mets")
diff --git a/src/MCPClient/lib/clientScripts/parse_mets_to_db.py b/src/MCPClient/lib/clientScripts/parse_mets_to_db.py
index 162d391946..8f4b7ddcc2 100755
--- a/src/MCPClient/lib/clientScripts/parse_mets_to_db.py
+++ b/src/MCPClient/lib/clientScripts/parse_mets_to_db.py
@@ -9,11 +9,9 @@
from lxml import etree
django.setup()
-# dashboard
+
import databaseFunctions
import fileOperations
-
-# archivematicaCommon
import namespaces as ns
from fpr import models as fpr_models
from main import models
diff --git a/src/MCPClient/lib/clientScripts/post_store_aip_hook.py b/src/MCPClient/lib/clientScripts/post_store_aip_hook.py
index d5a10c1572..20c032f32c 100755
--- a/src/MCPClient/lib/clientScripts/post_store_aip_hook.py
+++ b/src/MCPClient/lib/clientScripts/post_store_aip_hook.py
@@ -11,14 +11,10 @@
import elasticSearchFunctions
import storageService as storage_service
from archivematicaFunctions import find_transfer_path_from_ingest
-
-# archivematicaCommon
from custom_handlers import get_script_logger
from django.conf import settings as mcpclient_settings
from django.core.exceptions import ValidationError
from django.db import transaction
-
-# dashboard
from main import models
logger = get_script_logger("archivematica.mcp.client.post_store_aip_hook")
diff --git a/src/MCPClient/lib/clientScripts/remove_unneeded_files.py b/src/MCPClient/lib/clientScripts/remove_unneeded_files.py
index b554a1f25f..93e6df09a5 100755
--- a/src/MCPClient/lib/clientScripts/remove_unneeded_files.py
+++ b/src/MCPClient/lib/clientScripts/remove_unneeded_files.py
@@ -13,10 +13,8 @@
import django
from django.db import transaction
-# databaseFunctions requires Django to be set up
-
django.setup()
-# archivematicaCommon
+
from databaseFunctions import fileWasRemoved
from django.conf import settings as mcpclient_settings
diff --git a/src/MCPClient/lib/clientScripts/restructure_bag_aip_to_sip.py b/src/MCPClient/lib/clientScripts/restructure_bag_aip_to_sip.py
index 3caba7ef17..4be52e82fb 100755
--- a/src/MCPClient/lib/clientScripts/restructure_bag_aip_to_sip.py
+++ b/src/MCPClient/lib/clientScripts/restructure_bag_aip_to_sip.py
@@ -21,9 +21,6 @@
import archivematicaFunctions
from custom_handlers import get_script_logger
-# archivematicaCommon
-
-
logger = get_script_logger("archivematica.mcp.client.restructureBagAIPToSIP")
diff --git a/src/MCPClient/lib/clientScripts/restructure_dip_for_content_dm_upload.py b/src/MCPClient/lib/clientScripts/restructure_dip_for_content_dm_upload.py
index 70cbac9263..0f38d64149 100755
--- a/src/MCPClient/lib/clientScripts/restructure_dip_for_content_dm_upload.py
+++ b/src/MCPClient/lib/clientScripts/restructure_dip_for_content_dm_upload.py
@@ -26,8 +26,6 @@
import namespaces as ns
from lxml import etree
-# archivematicaCommon
-
def parseDmdSec(dmdSec, label="[Placeholder title]"):
"""
diff --git a/src/MCPClient/lib/clientScripts/restructure_for_compliance.py b/src/MCPClient/lib/clientScripts/restructure_for_compliance.py
index 502393ce1a..b02a42c3c3 100755
--- a/src/MCPClient/lib/clientScripts/restructure_for_compliance.py
+++ b/src/MCPClient/lib/clientScripts/restructure_for_compliance.py
@@ -25,8 +25,6 @@
import bag
from archivematicaFunctions import OPTIONAL_FILES
from archivematicaFunctions import REQUIRED_DIRECTORIES
-
-# archivematicaCommon
from archivematicaFunctions import create_structured_directory
from archivematicaFunctions import reconstruct_empty_directories
from custom_handlers import get_script_logger
diff --git a/src/MCPClient/lib/clientScripts/restructure_for_compliance_sip.py b/src/MCPClient/lib/clientScripts/restructure_for_compliance_sip.py
index 913a7da75e..0236a3d81e 100755
--- a/src/MCPClient/lib/clientScripts/restructure_for_compliance_sip.py
+++ b/src/MCPClient/lib/clientScripts/restructure_for_compliance_sip.py
@@ -5,10 +5,8 @@
import django
-# fileOperations requires Django to be set up
-
django.setup()
-# archivematicaCommon
+
import archivematicaFunctions
import fileOperations
from archivematicaFunctions import OPTIONAL_FILES
diff --git a/src/MCPClient/lib/clientScripts/retry_normalize_remove_normalized.py b/src/MCPClient/lib/clientScripts/retry_normalize_remove_normalized.py
index 9519c8b069..3ba38b1f27 100755
--- a/src/MCPClient/lib/clientScripts/retry_normalize_remove_normalized.py
+++ b/src/MCPClient/lib/clientScripts/retry_normalize_remove_normalized.py
@@ -24,7 +24,7 @@
import django
django.setup()
-# dashboard
+
from django.db import transaction
from django.utils import timezone
from main.models import Derivation
diff --git a/src/MCPClient/lib/clientScripts/rights_from_csv.py b/src/MCPClient/lib/clientScripts/rights_from_csv.py
index 074f17ce80..cfc9587f50 100755
--- a/src/MCPClient/lib/clientScripts/rights_from_csv.py
+++ b/src/MCPClient/lib/clientScripts/rights_from_csv.py
@@ -22,8 +22,6 @@
django.setup()
from django.db import transaction
-
-# dashboard
from main import models
diff --git a/src/MCPClient/lib/clientScripts/save_dublin_core.py b/src/MCPClient/lib/clientScripts/save_dublin_core.py
index 450ca8b081..7915b1512e 100755
--- a/src/MCPClient/lib/clientScripts/save_dublin_core.py
+++ b/src/MCPClient/lib/clientScripts/save_dublin_core.py
@@ -6,8 +6,6 @@
django.setup()
from django.db import transaction
-
-# dashboard
from main import models
FIELDS = (
diff --git a/src/MCPClient/lib/clientScripts/set_maildir_file_grp_use_and_file_ids.py b/src/MCPClient/lib/clientScripts/set_maildir_file_grp_use_and_file_ids.py
index 118a4e948a..2a19364ace 100755
--- a/src/MCPClient/lib/clientScripts/set_maildir_file_grp_use_and_file_ids.py
+++ b/src/MCPClient/lib/clientScripts/set_maildir_file_grp_use_and_file_ids.py
@@ -20,13 +20,9 @@
import django
from custom_handlers import get_script_logger
-# archivematicaCommon
-
django.setup()
from django.db import connection
from django.db import transaction
-
-# dashboard
from main.models import File
from main.models import FileFormatVersion
from main.models import FileID
diff --git a/src/MCPClient/lib/clientScripts/set_transfer_type.py b/src/MCPClient/lib/clientScripts/set_transfer_type.py
index 162425497d..036f6c8c52 100755
--- a/src/MCPClient/lib/clientScripts/set_transfer_type.py
+++ b/src/MCPClient/lib/clientScripts/set_transfer_type.py
@@ -18,10 +18,8 @@
import django
django.setup()
-# dashboard
-from client import metrics
-# archivematicaCommon
+from client import metrics
from custom_handlers import get_script_logger
from django.db import transaction
from main.models import Transfer
diff --git a/src/MCPClient/lib/clientScripts/store_aip.py b/src/MCPClient/lib/clientScripts/store_aip.py
index a0ba4d9d60..5ff1413f13 100755
--- a/src/MCPClient/lib/clientScripts/store_aip.py
+++ b/src/MCPClient/lib/clientScripts/store_aip.py
@@ -22,14 +22,10 @@
import django
-# storageService requires Django to be set up
-
django.setup()
import storageService as storage_service
from archivematicaFunctions import escape
from client import metrics
-
-# archivematicaCommon
from custom_handlers import get_script_logger
from django.core.exceptions import ValidationError
from django.db import transaction
diff --git a/src/MCPClient/lib/clientScripts/trim_create_rights_entries.py b/src/MCPClient/lib/clientScripts/trim_create_rights_entries.py
index 7083e916ab..a62cd9894c 100755
--- a/src/MCPClient/lib/clientScripts/trim_create_rights_entries.py
+++ b/src/MCPClient/lib/clientScripts/trim_create_rights_entries.py
@@ -29,11 +29,7 @@
django.setup()
from django.db import transaction
-
-# archivematicaCommon
from fileOperations import getFileUUIDLike
-
-# dashboard
from main.models import RightsStatement
from main.models import RightsStatementOtherRightsDocumentationIdentifier
from main.models import RightsStatementOtherRightsInformation
diff --git a/src/MCPClient/lib/clientScripts/trim_restructure_for_compliance.py b/src/MCPClient/lib/clientScripts/trim_restructure_for_compliance.py
index 0a0ee000c9..124ed60057 100755
--- a/src/MCPClient/lib/clientScripts/trim_restructure_for_compliance.py
+++ b/src/MCPClient/lib/clientScripts/trim_restructure_for_compliance.py
@@ -19,10 +19,8 @@
import django
-# fileOperations requires Django to be set up
-
django.setup()
-# archivematicaCommon
+
import archivematicaFunctions
import fileOperations
from archivematicaFunctions import REQUIRED_DIRECTORIES
diff --git a/src/MCPClient/lib/clientScripts/trim_verify_checksums.py b/src/MCPClient/lib/clientScripts/trim_verify_checksums.py
index 02f27a3053..c48c6b046c 100755
--- a/src/MCPClient/lib/clientScripts/trim_verify_checksums.py
+++ b/src/MCPClient/lib/clientScripts/trim_verify_checksums.py
@@ -22,12 +22,8 @@
import django
from lxml import etree as etree
-# fileOperations, databaseFunctions requires Django to be set up
-
django.setup()
import databaseFunctions
-
-# archivematicaCommon
from archivematicaFunctions import get_file_checksum
from django.db import transaction
from fileOperations import getFileUUIDLike
diff --git a/src/MCPClient/lib/clientScripts/trim_verify_manifest.py b/src/MCPClient/lib/clientScripts/trim_verify_manifest.py
index 09bbebdde6..3a57cfddaa 100755
--- a/src/MCPClient/lib/clientScripts/trim_verify_manifest.py
+++ b/src/MCPClient/lib/clientScripts/trim_verify_manifest.py
@@ -22,13 +22,9 @@
import django
-# fileOperations, databaseFunctions requires Django to be set up
-
django.setup()
import databaseFunctions
from django.db import transaction
-
-# archivematicaCommon
from fileOperations import getFileUUIDLike
diff --git a/src/MCPClient/lib/clientScripts/update_size_and_checksum.py b/src/MCPClient/lib/clientScripts/update_size_and_checksum.py
index a8edfcef96..3f06991e56 100755
--- a/src/MCPClient/lib/clientScripts/update_size_and_checksum.py
+++ b/src/MCPClient/lib/clientScripts/update_size_and_checksum.py
@@ -22,8 +22,6 @@
import django
from django.db import transaction
-# fileOperations requires Django to be set up
-
django.setup()
import metsrw
diff --git a/src/MCPClient/lib/clientScripts/upload_archivesspace.py b/src/MCPClient/lib/clientScripts/upload_archivesspace.py
index d6328f69fe..97fd7361d0 100755
--- a/src/MCPClient/lib/clientScripts/upload_archivesspace.py
+++ b/src/MCPClient/lib/clientScripts/upload_archivesspace.py
@@ -11,10 +11,6 @@
from main.models import File
from xml2obj import mets_file
-# archivematicaCommon
-# Third party dependencies, alphabetical by import source
-# initialize Django (required for Django 1.7)
-
django.setup()
from django.core.exceptions import ValidationError
from django.db import transaction
diff --git a/src/MCPClient/lib/clientScripts/upload_qubit.py b/src/MCPClient/lib/clientScripts/upload_qubit.py
index 84bc84fb2e..5568fc6a0e 100755
--- a/src/MCPClient/lib/clientScripts/upload_qubit.py
+++ b/src/MCPClient/lib/clientScripts/upload_qubit.py
@@ -28,17 +28,13 @@
import requests
from custom_handlers import get_script_logger
-# archivematicaCommon
-# externals
-
django.setup()
-# dashboard
+
import main.models as models
from django.conf import settings as mcpclient_settings
from django.core.exceptions import ValidationError
from django.db import transaction
-# moved after django.setup()
logger = get_script_logger("archivematica.upload.qubit")
PREFIX = "[uploadDIP]"
diff --git a/src/MCPClient/lib/clientScripts/verify_aip.py b/src/MCPClient/lib/clientScripts/verify_aip.py
index 594aa383ab..32feae86a6 100755
--- a/src/MCPClient/lib/clientScripts/verify_aip.py
+++ b/src/MCPClient/lib/clientScripts/verify_aip.py
@@ -8,8 +8,6 @@
django.setup()
import databaseFunctions
-
-# archivematicaCommon
from archivematicaFunctions import get_setting
from bagit import Bag
from bagit import BagError
diff --git a/src/MCPClient/lib/clientScripts/verify_and_restructure_transfer_bag.py b/src/MCPClient/lib/clientScripts/verify_and_restructure_transfer_bag.py
index 8e37cda6fa..865cba3395 100755
--- a/src/MCPClient/lib/clientScripts/verify_and_restructure_transfer_bag.py
+++ b/src/MCPClient/lib/clientScripts/verify_and_restructure_transfer_bag.py
@@ -22,12 +22,10 @@
from django.db import transaction
django.setup()
-# dashboard
+
import bag
import fileOperations
from archivematicaFunctions import OPTIONAL_FILES
-
-# archivematicaCommon
from archivematicaFunctions import REQUIRED_DIRECTORIES
from databaseFunctions import insertIntoEvents
from main.models import File
diff --git a/src/archivematicaCommon/lib/countryCodes.py b/src/archivematicaCommon/lib/countryCodes.py
index 8c2223fcad..cdaff18c2b 100644
--- a/src/archivematicaCommon/lib/countryCodes.py
+++ b/src/archivematicaCommon/lib/countryCodes.py
@@ -14,11 +14,11 @@
#
# You should have received a copy of the GNU General Public License
# along with Archivematica. If not, see .
+
# http://www.iso.org/iso/country_codes.htm
# Country Codes - ISO 3166
# Country Name;ISO 3166-1-alpha-2 code
-
countryCodes = {
"AFGHANISTAN": "AF",
"Ă…LAND ISLANDS": "AX",
diff --git a/src/archivematicaCommon/lib/elasticSearchFunctions.py b/src/archivematicaCommon/lib/elasticSearchFunctions.py
index e1191d39ef..76acbc83a2 100644
--- a/src/archivematicaCommon/lib/elasticSearchFunctions.py
+++ b/src/archivematicaCommon/lib/elasticSearchFunctions.py
@@ -37,9 +37,6 @@
from main.models import Identifier
from main.models import Transfer
-# archivematicaCommon
-
-
logger = logging.getLogger("archivematica.common")
STATUS_DELETE_REQUESTED = "DEL_REQ"
diff --git a/src/archivematicaCommon/lib/storageService.py b/src/archivematicaCommon/lib/storageService.py
index c50d3a0946..dfc038a4f0 100644
--- a/src/archivematicaCommon/lib/storageService.py
+++ b/src/archivematicaCommon/lib/storageService.py
@@ -9,9 +9,6 @@
from django.conf import settings as django_settings
from requests.auth import AuthBase
-# archivematicaCommon
-
-
LOGGER = logging.getLogger("archivematica.common")