diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 141d048..370bd7a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ default_language_version: repos: # Run fast code improvement/checks before running PR specific helpers. - repo: https://github.com/pre-commit/pre-commit-hooks.git - rev: v4.5.0 + rev: v6.0.0 hooks: - id: trailing-whitespace args: [--markdown-linebreak-ext=md] @@ -19,13 +19,13 @@ repos: - id: check-yaml - id: end-of-file-fixer - repo: https://github.com/rstcheck/rstcheck - rev: v6.2.0 + rev: v6.2.5 hooks: - id: rstcheck additional_dependencies: [sphinx] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.9 + rev: v0.14.10 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/postprocessing/Configuration.py b/postprocessing/Configuration.py index 86cdf75..aae963e 100644 --- a/postprocessing/Configuration.py +++ b/postprocessing/Configuration.py @@ -1,11 +1,12 @@ # pylint: disable=line-too-long, too-many-statements, too-few-public-methods, too-many-instance-attributes, invalid-name """ - Post-processing, ActiveMQ, and logging configuration +Post-processing, ActiveMQ, and logging configuration - The original code for this class was take from https://github.com/mantidproject/autoreduce +The original code for this class was take from https://github.com/mantidproject/autoreduce - @copyright: 2014 Oak Ridge National Laboratory +@copyright: 2014 Oak Ridge National Laboratory """ + import sys import os import json diff --git a/postprocessing/Consumer.py b/postprocessing/Consumer.py index 1dc8ab7..ab51c0c 100644 --- a/postprocessing/Consumer.py +++ b/postprocessing/Consumer.py @@ -5,6 +5,7 @@ @copyright: 2014 Oak Ridge National Laboratory """ + import json import logging import time diff --git a/postprocessing/PostProcessAdmin.py b/postprocessing/PostProcessAdmin.py index 40266a4..af886d3 100644 --- a/postprocessing/PostProcessAdmin.py +++ b/postprocessing/PostProcessAdmin.py @@ -14,6 +14,7 @@ @copyright: 2014 Oak Ridge National Laboratory """ + import logging import json import socket diff --git a/postprocessing/processors/base_processor.py b/postprocessing/processors/base_processor.py index 1a94c93..be25dad 100644 --- a/postprocessing/processors/base_processor.py +++ b/postprocessing/processors/base_processor.py @@ -1,9 +1,9 @@ """ - The base processor defines a base class to be used to process jobs. - An input AMQ queue is defined. The post-processing client will - automatically register with that queue upon starting. +The base processor defines a base class to be used to process jobs. +An input AMQ queue is defined. The post-processing client will +automatically register with that queue upon starting. - @copyright: 2014-2015 Oak Ridge National Laboratory +@copyright: 2014-2015 Oak Ridge National Laboratory """ import os diff --git a/postprocessing/processors/calvera_processor.py b/postprocessing/processors/calvera_processor.py index d7c59f7..085ac08 100644 --- a/postprocessing/processors/calvera_processor.py +++ b/postprocessing/processors/calvera_processor.py @@ -1,7 +1,7 @@ """ - ` Processor for Calvera cataloging +` Processor for Calvera cataloging - @copyright: 2023 Oak Ridge National Laboratory + @copyright: 2023 Oak Ridge National Laboratory """ import copy @@ -74,7 +74,7 @@ def _read_reduced_data(self, filepath): contents = json.load(f) if "input_files" not in contents or "output_files" not in contents: logging.info( - "%s does not appear to be a JSON reduction file so will not " "send to Calvera", + "%s does not appear to be a JSON reduction file so will not send to Calvera", filepath, ) return None diff --git a/postprocessing/processors/job_handling.py b/postprocessing/processors/job_handling.py index ec8e9f1..961af50 100644 --- a/postprocessing/processors/job_handling.py +++ b/postprocessing/processors/job_handling.py @@ -1,8 +1,9 @@ """ - Handling of job execution. +Handling of job execution. - @copyright: 2014 Oak Ridge National Laboratory +@copyright: 2014 Oak Ridge National Laboratory """ + import logging import subprocess import os diff --git a/postprocessing/processors/oncat_processor.py b/postprocessing/processors/oncat_processor.py index 215a5be..735d79f 100644 --- a/postprocessing/processors/oncat_processor.py +++ b/postprocessing/processors/oncat_processor.py @@ -1,8 +1,9 @@ """ - Processor for ONCat cataloging +Processor for ONCat cataloging - @copyright: 2017 Oak Ridge National Laboratory +@copyright: 2017 Oak Ridge National Laboratory """ + import os import logging import json diff --git a/postprocessing/processors/oncat_reduced_processor.py b/postprocessing/processors/oncat_reduced_processor.py index 600489e..abda62e 100644 --- a/postprocessing/processors/oncat_reduced_processor.py +++ b/postprocessing/processors/oncat_reduced_processor.py @@ -1,8 +1,9 @@ """ - Processor for ONCat cataloging +Processor for ONCat cataloging - @copyright: 2017 Oak Ridge National Laboratory +@copyright: 2017 Oak Ridge National Laboratory """ + import os import logging import json @@ -57,7 +58,7 @@ def ingest(self, location): contents = json.load(f) if "input_files" not in contents or "output_files" not in contents: logging.info( - "%s does not appear to be a JSON reduction file so will not " "call ONCat", + "%s does not appear to be a JSON reduction file so will not call ONCat", location, ) return diff --git a/postprocessing/processors/test_processor.py b/postprocessing/processors/test_processor.py index cda9953..bf8b0f0 100644 --- a/postprocessing/processors/test_processor.py +++ b/postprocessing/processors/test_processor.py @@ -1,8 +1,9 @@ """ - Test Processor +Test Processor - @copyright: 2014 Oak Ridge National Laboratory +@copyright: 2014 Oak Ridge National Laboratory """ + from .base_processor import BaseProcessor import json diff --git a/postprocessing/queueProcessor.py b/postprocessing/queueProcessor.py index 178c2c8..7bc238c 100755 --- a/postprocessing/queueProcessor.py +++ b/postprocessing/queueProcessor.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 """ - Post-processing agent start script +Post-processing agent start script - @copyright: 2014 Oak Ridge National Laboratory +@copyright: 2014 Oak Ridge National Laboratory """ + import importlib.metadata import logging diff --git a/scripts/ar_report.py b/scripts/ar_report.py index 5412386..a2407a9 100755 --- a/scripts/ar_report.py +++ b/scripts/ar_report.py @@ -350,7 +350,7 @@ def report(self): f"{self.loadDurationTotal:.1f}", f"{self.loadEventNexusDuration:.1f}", f"{reduxTime:.1f}", - f"{self.eventfile.duration-reduxTime:.1f}", + f"{self.eventfile.duration - reduxTime:.1f}", ) diff --git a/tests/reduce_REF_L.py b/tests/reduce_REF_L.py index 535a2a0..df7445d 100644 --- a/tests/reduce_REF_L.py +++ b/tests/reduce_REF_L.py @@ -1,11 +1,12 @@ """ - Auto-reduction script for the Liquids Reflectometer - For reference: - Type 0: Normal sample data - Type 1: Direct beams for scaling factors - Type 2: Zero-attenuator direct beams - Type 3: Data that we don't need to treat +Auto-reduction script for the Liquids Reflectometer +For reference: + Type 0: Normal sample data + Type 1: Direct beams for scaling factors + Type 2: Zero-attenuator direct beams + Type 3: Data that we don't need to treat """ + import sys import os import warnings diff --git a/tests/test_mantidpython.py b/tests/test_mantidpython.py index 8ae83f5..0f0c74d 100644 --- a/tests/test_mantidpython.py +++ b/tests/test_mantidpython.py @@ -163,9 +163,7 @@ def verify_subprocess_command(reduce_script, nexus_file, output_dir, expected_ou # generate command sub_process_command = generate_subprocess_command(reduce_script, [nexus_file, output_dir], False) - assert sub_process_command == expected_output, "Expected: {}. But: {}" "".format( - expected_output, sub_process_command - ) + assert sub_process_command == expected_output, "Expected: {}. But: {}".format(expected_output, sub_process_command) if __name__ == "__main__":