Skip to content

Commit

Permalink
Use ruff.lint.isort
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Mar 21, 2024
1 parent ec21a20 commit 5854528
Show file tree
Hide file tree
Showing 77 changed files with 79 additions and 90 deletions.
8 changes: 0 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ repos:
- "--exit-non-zero-on-fix"
- id: ruff-format

- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
args:
- "--application-directories=.:src"
- "--py311-plus"

- repo: https://github.com/adamchainz/django-upgrade
rev: "1.16.0"
hooks:
Expand Down
1 change: 1 addition & 0 deletions a3m/api/transferservice/v1beta1/request_response_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions a3m/api/transferservice/v1beta1/service_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions a3m/api/transferservice/v1beta1/service_pb2_grpc.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions a3m/appconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
where a specific parsing process can be defined. Those callbacks must accept the
current appconfig Config object and the section.
"""

import configparser
import functools
import os
Expand Down
2 changes: 1 addition & 1 deletion a3m/archivematicaFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""archivematicaFunctions provides various helper functions across the
different Archivematica modules.
"""

import collections
import hashlib
import os
Expand All @@ -26,7 +27,6 @@

from a3m.namespaces import NSMAP


REQUIRED_DIRECTORIES = (
"logs",
"logs/fileMeta",
Expand Down
1 change: 0 additions & 1 deletion a3m/cli/server/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from a3m.cli.common import init_django
from a3m.cli.common import suppress_warnings


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion a3m/client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import pathlib


THIS_DIR = os.path.dirname(__file__)

ASSETS_DIR = os.path.join(THIS_DIR, "assets", "")
Expand Down
2 changes: 1 addition & 1 deletion a3m/client/clientScripts/a3m_download_transfer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Download transfer object from storage."""

import shutil
import sys
from contextlib import contextmanager
Expand All @@ -14,7 +15,6 @@
from a3m.client import metrics
from a3m.executeOrRunSubProcess import executeOrRun


HTTP_SCHEMES = ("http", "https")
FILE_SCHEMES = "file"

Expand Down
1 change: 0 additions & 1 deletion a3m/client/clientScripts/a3m_store_aip.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from a3m.client import metrics


logger = logging.getLogger(__name__)


Expand Down
1 change: 1 addition & 0 deletions a3m/client/clientScripts/assign_file_uuids.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
path to the SIP directory, and the subdirectory being targeted if any.
"""

import argparse
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions a3m/client/clientScripts/assign_uuids_to_directories.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
without doing anything.
"""

import argparse
import logging
import os
Expand Down
1 change: 0 additions & 1 deletion a3m/client/clientScripts/change_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

from a3m.archivematicaFunctions import strToUnicode


VERSION = "1.10." + "$Id$".split(" ")[1]

# Letters, digits and a few punctuation characters
Expand Down
5 changes: 3 additions & 2 deletions a3m/client/clientScripts/change_object_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@

from django.db import transaction

from . import change_names
from a3m.main.models import SIP
from a3m.main.models import Directory
from a3m.main.models import Event
from a3m.main.models import File
from a3m.main.models import SIP
from a3m.main.models import Transfer

from . import change_names

logger = logging.getLogger(__name__)


Expand Down
2 changes: 1 addition & 1 deletion a3m/client/clientScripts/characterize_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from django.db import transaction
from lxml import etree

from a3m.dicts import replace_string_values
from a3m.dicts import ReplacementDict
from a3m.dicts import replace_string_values
from a3m.dicts import setup_dicts
from a3m.executeOrRunSubProcess import executeOrRun
from a3m.fpr.registry import FPR
Expand Down
9 changes: 5 additions & 4 deletions a3m/client/clientScripts/create_mets_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,22 @@
from bagit import BagError
from django.utils import timezone

from .archivematicaCreateMETSMetadataCSV import parseMetadata
from .archivematicaCreateMETSRights import archivematicaGetRights
from .change_names import change_name
from a3m import namespaces as ns
from a3m.archivematicaFunctions import escape
from a3m.archivematicaFunctions import normalizeNonDcElementName
from a3m.archivematicaFunctions import strToUnicode
from a3m.main.models import SIP
from a3m.main.models import Agent
from a3m.main.models import Derivation
from a3m.main.models import Directory
from a3m.main.models import DublinCore
from a3m.main.models import Event
from a3m.main.models import File
from a3m.main.models import FileID
from a3m.main.models import SIP

from .archivematicaCreateMETSMetadataCSV import parseMetadata
from .archivematicaCreateMETSRights import archivematicaGetRights
from .change_names import change_name


class ErrorAccumulator:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from django.db import transaction

from a3m import archivematicaFunctions
from a3m.main.models import SIP
from a3m.main.models import Directory
from a3m.main.models import File
from a3m.main.models import SIP


def main(job, transfer_id, sip_id):
Expand Down
5 changes: 3 additions & 2 deletions a3m/client/clientScripts/extract_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@

from django.db import transaction

from .has_packages import already_extracted
from a3m.archivematicaFunctions import format_subdir_path
from a3m.archivematicaFunctions import get_dir_uuids
from a3m.databaseFunctions import fileWasRemoved
from a3m.executeOrRunSubProcess import executeOrRun
from a3m.fileOperations import addFileToTransfer
from a3m.fileOperations import updateSizeAndChecksum
from a3m.fpr.registry import CommandScriptType
from a3m.fpr.registry import FPR
from a3m.fpr.registry import CommandScriptType
from a3m.fpr.registry import RulePurpose
from a3m.main.models import Directory
from a3m.main.models import File
from a3m.main.models import Transfer

from .has_packages import already_extracted

logger = logging.getLogger(__name__)

TRANSFER_DIRECTORY = "%transferDirectory%"
Expand Down
1 change: 0 additions & 1 deletion a3m/client/clientScripts/failed_sip_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from a3m.client import metrics


REJECTED = "reject"
FAILED = "fail"

Expand Down
1 change: 0 additions & 1 deletion a3m/client/clientScripts/failed_transfer_cleanup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from a3m.client import metrics


FAILED = "fail"


Expand Down
3 changes: 1 addition & 2 deletions a3m/client/clientScripts/identify_file_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@

from a3m.databaseFunctions import getUTCDate
from a3m.databaseFunctions import insertIntoEvents
from a3m.fpr.registry import FormatVersion
from a3m.fpr.registry import FPR
from a3m.fpr.registry import FormatVersion
from a3m.main.models import File
from a3m.main.models import FileID


logger = logging.getLogger(__name__)

TOOL_DESCRIPTION = "pygfried/siegfried"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
:param fileUUID: UUID of the preservation file.
:param filePath: Path on disk of the preservation file.
"""

import os
import uuid

Expand Down
3 changes: 1 addition & 2 deletions a3m/client/clientScripts/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
from a3m.dicts import ReplacementDict
from a3m.dicts import setup_dicts
from a3m.executeOrRunSubProcess import executeOrRun
from a3m.fpr.registry import FPR
from a3m.fpr.registry import Command
from a3m.fpr.registry import CommandScriptType
from a3m.fpr.registry import FPR
from a3m.fpr.registry import RulePurpose
from a3m.main.models import File
from a3m.main.models import FileFormatVersion
from a3m.main.models import FileID


# Return codes
SUCCESS = 0
RULE_FAILED = 1
Expand Down
5 changes: 3 additions & 2 deletions a3m/client/clientScripts/policy_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[FILE_PATH] [FILE_UUID] [SIP_UUID] [SHARED_PATH] [FILE_TYPE]
"""

import json
import logging
import os
Expand All @@ -19,12 +20,12 @@
from a3m.dicts import replace_string_values
from a3m.dicts import setup_dicts
from a3m.executeOrRunSubProcess import executeOrRun
from a3m.fpr.registry import CommandScriptType
from a3m.fpr.registry import FPR
from a3m.fpr.registry import CommandScriptType
from a3m.fpr.registry import Rule
from a3m.main.models import SIP
from a3m.main.models import Derivation
from a3m.main.models import File
from a3m.main.models import SIP
from a3m.main.models import Transfer

# Note that linkTaskManagerFiles.py will take the highest exit code it has seen
Expand Down
1 change: 1 addition & 0 deletions a3m/client/clientScripts/remove_unneeded_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
the file and its UUID. There is a default list of file names that are deleted;
however, this can be overridden in MCPClient/clientConfig.conf s
"""

import os
import shutil

Expand Down
3 changes: 1 addition & 2 deletions a3m/client/clientScripts/restructure_for_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@

from django.db import transaction

from a3m.archivematicaFunctions import create_structured_directory
from a3m.archivematicaFunctions import OPTIONAL_FILES
from a3m.archivematicaFunctions import REQUIRED_DIRECTORIES

from a3m.archivematicaFunctions import create_structured_directory

logger = logging.getLogger(__name__)

Expand Down
1 change: 0 additions & 1 deletion a3m/client/clientScripts/store_file_modification_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

from a3m.main import models


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion a3m/client/clientScripts/update_size_and_checksum.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from a3m.fileOperations import updateSizeAndChecksum
from a3m.main.models import File


logger = logging.getLogger(__name__)

SIP_REPLACEMENT_PATH_STRING = r"%SIPDirectory%"
Expand Down
6 changes: 3 additions & 3 deletions a3m/client/clientScripts/validate_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[FILE_PATH] [FILE_UUID] [SIP_UUID] [SHARED_PATH] [FILE_TYPE]
"""

import ast
import logging
import os
Expand All @@ -21,14 +22,13 @@
from a3m.dicts import replace_string_values
from a3m.dicts import setup_dicts
from a3m.executeOrRunSubProcess import executeOrRun
from a3m.fpr.registry import CommandScriptType
from a3m.fpr.registry import FPR
from a3m.fpr.registry import CommandScriptType
from a3m.fpr.registry import Rule
from a3m.fpr.registry import RulePurpose
from a3m.main.models import SIP
from a3m.main.models import Derivation
from a3m.main.models import File
from a3m.main.models import SIP


SUCCESS_CODE = 0
FAIL_CODE = 1
Expand Down
2 changes: 1 addition & 1 deletion a3m/client/clientScripts/verify_checksum.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* SHA256
* SHA512
"""

import datetime
import logging
import os
Expand All @@ -41,7 +42,6 @@
from a3m.main.models import File
from a3m.main.models import Transfer


logger = logging.getLogger(__name__)


Expand Down
1 change: 1 addition & 0 deletions a3m/client/clientScripts/verify_mets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
far is to verify the validity of custom structmaps included with transfers and
supplied on ingest after appraisal.
"""

import os

from lxml import etree
Expand Down
1 change: 0 additions & 1 deletion a3m/client/clientScripts/verify_sip_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from a3m.client import metrics


REQUIRED_DIRECTORIES = (
"objects",
"logs",
Expand Down
Loading

0 comments on commit 5854528

Please sign in to comment.