From 08996aa68c2b27d528a78b7b48f50f96d42b9bf2 Mon Sep 17 00:00:00 2001 From: Nicholas Devenish Date: Wed, 28 Aug 2024 08:28:13 +0100 Subject: [PATCH] MNT: Update pre-commit and reprocess The version of flake8 didn't seem compatible with python 3.12 --- .pre-commit-config.yaml | 8 ++++---- src/ispyb/xmltools.py | 4 +++- tests/test_mxacquisition.py | 6 +++--- tests/test_xtalimaging.py | 1 + 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f0c16de6..760d20c5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # Syntax validation and some basic sanity checks - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.6.0 hooks: - id: check-merge-conflict - id: check-ast @@ -11,7 +11,7 @@ repos: # Automatically sort imports - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort args: [ @@ -28,14 +28,14 @@ repos: # Automatic source code formatting - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 24.8.0 hooks: - id: black args: [--safe, --quiet] # Linting - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + rev: 7.1.1 hooks: - id: flake8 additional_dependencies: ['flake8-comprehensions==3.8.0'] diff --git a/src/ispyb/xmltools.py b/src/ispyb/xmltools.py index 5e666b47..7f88a9f5 100644 --- a/src/ispyb/xmltools.py +++ b/src/ispyb/xmltools.py @@ -68,7 +68,9 @@ def __init__(self, parent_element): currentValue = self[element.tag] currentValue.append(aDict) self.update({element.tag: currentValue}) - except Exception: # the first of its kind, an empty list must be created + except ( + Exception + ): # the first of its kind, an empty list must be created self.update( {element.tag: [aDict]} ) # aDict is written in [], i.e. it will be a list diff --git a/tests/test_mxacquisition.py b/tests/test_mxacquisition.py index fcf4383f..78cb2080 100644 --- a/tests/test_mxacquisition.py +++ b/tests/test_mxacquisition.py @@ -175,9 +175,9 @@ def test_mxacquisition_methods(testdb): params = mxacquisition.get_data_collection_file_attachment_params() params["parentid"] = id1 - params[ - "file_full_path" - ] = "/dls/mx/data/mx12345/mx12345-6/processed/xia2_run/result.json" + params["file_full_path"] = ( + "/dls/mx/data/mx12345/mx12345-6/processed/xia2_run/result.json" + ) params["file_type"] = "log" dcfa_id = mxacquisition.upsert_data_collection_file_attachment( list(params.values()) diff --git a/tests/test_xtalimaging.py b/tests/test_xtalimaging.py index 874d7e5c..74bdabae 100644 --- a/tests/test_xtalimaging.py +++ b/tests/test_xtalimaging.py @@ -1,5 +1,6 @@ import time + def test_xtal_imaging(testdb): testdb.set_role("ispyb_import") xtalimaging = testdb.xtal_imaging