From 2e1bfa950414ed41d47f09fe664f6f585b9c6632 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 01:10:26 +0100 Subject: [PATCH] ci: [pre-commit.ci] pre-commit autoupdate (#1064) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black-pre-commit-mirror: 23.12.1 → 24.1.1](https://github.com/psf/black-pre-commit-mirror/compare/23.12.1...24.1.1) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- package/PartSeg/_roi_mask/batch_proceed.py | 8 +++++--- package/PartSeg/common_backend/__init__.py | 1 + package/PartSeg/common_gui/advanced_tabs.py | 1 + package/PartSeg/common_gui/error_report.py | 1 + package/PartSeg/common_gui/label_create.py | 1 + package/PartSeg/common_gui/qt_console.py | 1 + package/PartSeg/common_gui/qt_modal.py | 1 + package/PartSeg/common_gui/universal_gui_part.py | 1 - package/PartSeg/plugins/old_partseg/old_partseg.py | 8 +++++--- package/PartSeg/state_store.py | 1 + package/PartSegCore/algorithm_describe_base.py | 14 ++++++++------ .../analysis/batch_processing/batch_backend.py | 1 + .../analysis/batch_processing/parallel_backend.py | 1 + package/PartSegCore/class_generator.py | 8 +++++--- package/PartSegCore/mask_partition_utils.py | 1 + package/PartSegCore/register.py | 1 + package/PartSegCore/segmentation/__init__.py | 1 + package/PartSegCore/segmentation/watershed.py | 1 + package/PartSegCore/sphinx/auto_parameters.py | 1 + 20 files changed, 38 insertions(+), 17 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fc10a5186..fa0ec69a2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ default_language_version: repos: - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.12.1 + rev: 24.1.1 hooks: - id: black pass_filenames: true diff --git a/package/PartSeg/_roi_mask/batch_proceed.py b/package/PartSeg/_roi_mask/batch_proceed.py index b52d55a61..26ed5db2e 100644 --- a/package/PartSeg/_roi_mask/batch_proceed.py +++ b/package/PartSeg/_roi_mask/batch_proceed.py @@ -80,9 +80,11 @@ def run_calculation(self): # noqa: PLR0912 # FIXME state2 = StackSettings.transform_state( project_tuple, segmentation.roi_info, - {i: segmentation.parameters for i in segmentation.roi_info.bound_info} - if segmentation.roi_info is not None - else {}, + ( + {i: segmentation.parameters for i in segmentation.roi_info.bound_info} + if segmentation.roi_info is not None + else {} + ), [], ) if isinstance(task.save_prefix, tuple): diff --git a/package/PartSeg/common_backend/__init__.py b/package/PartSeg/common_backend/__init__.py index a9aceb234..55a72f255 100644 --- a/package/PartSeg/common_backend/__init__.py +++ b/package/PartSeg/common_backend/__init__.py @@ -1,6 +1,7 @@ """ This module contains non gui Qt based components """ + import os.path from typing import TYPE_CHECKING diff --git a/package/PartSeg/common_gui/advanced_tabs.py b/package/PartSeg/common_gui/advanced_tabs.py index d7c0f6709..d60c3a3a6 100644 --- a/package/PartSeg/common_gui/advanced_tabs.py +++ b/package/PartSeg/common_gui/advanced_tabs.py @@ -2,6 +2,7 @@ This module contains base for the advanced window for PartSeg. At this moment controlling colormaps tabs and developer PartSegCore """ + import importlib import sys from contextlib import suppress diff --git a/package/PartSeg/common_gui/error_report.py b/package/PartSeg/common_gui/error_report.py index d56c7420e..9b76a3574 100644 --- a/package/PartSeg/common_gui/error_report.py +++ b/package/PartSeg/common_gui/error_report.py @@ -3,6 +3,7 @@ .. _sentry: https://sentry.io """ + import getpass import io import os diff --git a/package/PartSeg/common_gui/label_create.py b/package/PartSeg/common_gui/label_create.py index e478daad8..cc226eacf 100644 --- a/package/PartSeg/common_gui/label_create.py +++ b/package/PartSeg/common_gui/label_create.py @@ -1,6 +1,7 @@ """ This module contains widgets to create and manage labels scheme """ + import json import typing from copy import deepcopy diff --git a/package/PartSeg/common_gui/qt_console.py b/package/PartSeg/common_gui/qt_console.py index 9cc3c4b64..5465b48bb 100644 --- a/package/PartSeg/common_gui/qt_console.py +++ b/package/PartSeg/common_gui/qt_console.py @@ -1,6 +1,7 @@ """ Code from https://github.com/napari/napari-console """ + # pylint: disable=no-value-for-parameter,unexpected-keyword-arg import re import sys diff --git a/package/PartSeg/common_gui/qt_modal.py b/package/PartSeg/common_gui/qt_modal.py index 0ab34b1a0..ca4071afa 100644 --- a/package/PartSeg/common_gui/qt_modal.py +++ b/package/PartSeg/common_gui/qt_modal.py @@ -1,4 +1,5 @@ """from napari._qt.dialog.modal """ + from qtpy.QtCore import QPoint, QRect, Qt from qtpy.QtGui import QCursor, QGuiApplication, QKeyEvent from qtpy.QtWidgets import QDialog, QFrame, QVBoxLayout diff --git a/package/PartSeg/common_gui/universal_gui_part.py b/package/PartSeg/common_gui/universal_gui_part.py index 4de04142b..88bafcd70 100644 --- a/package/PartSeg/common_gui/universal_gui_part.py +++ b/package/PartSeg/common_gui/universal_gui_part.py @@ -2,7 +2,6 @@ This module contains simple, useful widgets which implementation is too short to create separated files for them """ - import math import typing import warnings diff --git a/package/PartSeg/plugins/old_partseg/old_partseg.py b/package/PartSeg/plugins/old_partseg/old_partseg.py index a4b2c2dd1..f1c2a2f31 100644 --- a/package/PartSeg/plugins/old_partseg/old_partseg.py +++ b/package/PartSeg/plugins/old_partseg/old_partseg.py @@ -45,9 +45,11 @@ def _load(cls, tar_file: tarfile.TarFile, file_path: str) -> ProjectTuple: "channel": 0, "minimum_size": algorithm_dict["minimum_size"], "threshold": {"name": "Manual", "values": {"threshold": algorithm_dict["threshold"]}}, - "noise_removal": {"name": "Gauss", "values": {"gauss_type": DimensionType.Layer, "radius": 1.0}} - if algorithm_dict["use_gauss"] - else {"name": "None", "values": {}}, + "noise_removal": ( + {"name": "Gauss", "values": {"gauss_type": DimensionType.Layer, "radius": 1.0}} + if algorithm_dict["use_gauss"] + else {"name": "None", "values": {}} + ), "side_connection": True, } diff --git a/package/PartSeg/state_store.py b/package/PartSeg/state_store.py index 848dd2c9f..e8ad6fdea 100644 --- a/package/PartSeg/state_store.py +++ b/package/PartSeg/state_store.py @@ -1,6 +1,7 @@ """ Module with default values of application state """ + import os import sys diff --git a/package/PartSegCore/algorithm_describe_base.py b/package/PartSegCore/algorithm_describe_base.py index 0064152d3..d0589fed7 100644 --- a/package/PartSegCore/algorithm_describe_base.py +++ b/package/PartSegCore/algorithm_describe_base.py @@ -191,12 +191,14 @@ def get_default_values(cls): if cls.__new_style__: return cls.__argument_class__() # pylint: disable=not-callable return { - el.name: { - "name": el.default_value, - "values": el.possible_values[el.default_value].get_default_values(), - } - if issubclass(el.value_type, AlgorithmDescribeBase) - else el.default_value + el.name: ( + { + "name": el.default_value, + "values": el.possible_values[el.default_value].get_default_values(), + } + if issubclass(el.value_type, AlgorithmDescribeBase) + else el.default_value + ) for el in cls.get_fields() if isinstance(el, AlgorithmProperty) } diff --git a/package/PartSegCore/analysis/batch_processing/batch_backend.py b/package/PartSegCore/analysis/batch_processing/batch_backend.py index b62b61d9a..4691228a9 100644 --- a/package/PartSegCore/analysis/batch_processing/batch_backend.py +++ b/package/PartSegCore/analysis/batch_processing/batch_backend.py @@ -20,6 +20,7 @@ } """ + import contextlib import json import logging diff --git a/package/PartSegCore/analysis/batch_processing/parallel_backend.py b/package/PartSegCore/analysis/batch_processing/parallel_backend.py index e066d8475..ba35572f2 100644 --- a/package/PartSegCore/analysis/batch_processing/parallel_backend.py +++ b/package/PartSegCore/analysis/batch_processing/parallel_backend.py @@ -14,6 +14,7 @@ } """ + import logging import multiprocessing import os diff --git a/package/PartSegCore/class_generator.py b/package/PartSegCore/class_generator.py index a04c32629..83b2c07cf 100644 --- a/package/PartSegCore/class_generator.py +++ b/package/PartSegCore/class_generator.py @@ -238,9 +238,11 @@ def _make_class(typename, types, defaults_dict, base_classes, readonly): del global_state[typename] signature = ", ".join( - f"{name_}: {translate_dict[type_]} = {pprint.pformat(defaults_dict[name_])}" - if name_ in defaults_dict - else f"{name_}: {translate_dict[type_]}" + ( + f"{name_}: {translate_dict[type_]} = {pprint.pformat(defaults_dict[name_])}" + if name_ in defaults_dict + else f"{name_}: {translate_dict[type_]}" + ) for name_, type_ in types.items() ) diff --git a/package/PartSegCore/mask_partition_utils.py b/package/PartSegCore/mask_partition_utils.py index 6c90a063e..55918d60e 100644 --- a/package/PartSegCore/mask_partition_utils.py +++ b/package/PartSegCore/mask_partition_utils.py @@ -8,6 +8,7 @@ Both class from this module are designed for spherical mask, but may be useful als for others. """ + import typing import numpy as np diff --git a/package/PartSegCore/register.py b/package/PartSegCore/register.py index 4d2b38b4e..e23d7185b 100644 --- a/package/PartSegCore/register.py +++ b/package/PartSegCore/register.py @@ -12,6 +12,7 @@ register_dict: holds information where register given operation type. Strongly suggest to use register function instead. """ + from enum import Enum from typing import Type diff --git a/package/PartSegCore/segmentation/__init__.py b/package/PartSegCore/segmentation/__init__.py index c839cffca..66ea9df0f 100644 --- a/package/PartSegCore/segmentation/__init__.py +++ b/package/PartSegCore/segmentation/__init__.py @@ -1,6 +1,7 @@ """ This module contains roi_extraction algorithms """ + import os import sys diff --git a/package/PartSegCore/segmentation/watershed.py b/package/PartSegCore/segmentation/watershed.py index a3d41bc30..26e85c24b 100644 --- a/package/PartSegCore/segmentation/watershed.py +++ b/package/PartSegCore/segmentation/watershed.py @@ -1,6 +1,7 @@ """ This module contains PartSeg wrappers for function for :py:mod:`..sprawl_utils.find_split`. """ + import warnings from abc import ABC from enum import Enum diff --git a/package/PartSegCore/sphinx/auto_parameters.py b/package/PartSegCore/sphinx/auto_parameters.py index 84ae4f3f4..041b46aea 100644 --- a/package/PartSegCore/sphinx/auto_parameters.py +++ b/package/PartSegCore/sphinx/auto_parameters.py @@ -1,6 +1,7 @@ """ This module contain utilities to document Register class. """ + import inspect from typing import Any, Dict