Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #125

Merged
merged 3 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
args: [--maxkb=32000]
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.4.2
hooks:
- id: black
args: ['--line-length=120']
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
args: ['--max-line-length=120']
Expand Down
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Purpose: A Python script holding the configuration of the project. Contains the project
name and release information as well as some extra configuration keys.
"""

import os
import sys
import versioningit
Expand Down
1 change: 1 addition & 0 deletions src/shiver/configuration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Module to load the the settings from SHOME/.shiver/configuration.ini file
Will fall back to a default"""

import os
import shutil

Expand Down
7 changes: 4 additions & 3 deletions src/shiver/models/convert_dgs_to_single_mde.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The Shiver ConvertDGSToSingleMDE mantid algorithm"""

# pylint: disable=no-name-in-module
import numpy
from mantid.simpleapi import (
Expand Down Expand Up @@ -229,9 +230,9 @@ def validateInputs(self):
if len(tib) != 2:
raise ValueError("length is not 2")
except ValueError:
issues[
"TimeIndependentBackground"
] = "This must be either 'Default' or two numbers separated by a comma"
issues["TimeIndependentBackground"] = (
"This must be either 'Default' or two numbers separated by a comma"
)
ad_dims = self.getPropertyValue("AdditionalDimensions")
if ad_dims:
ad_dims = ad_dims.split(",")
Expand Down
1 change: 1 addition & 0 deletions src/shiver/models/corrections.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model for Corrections tab"""

# pylint: disable=no-name-in-module
import time
from typing import Tuple
Expand Down
1 change: 1 addition & 0 deletions src/shiver/models/generate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model for the Generate tab"""

import ast
from pathlib import Path
from mantid.api import ( # pylint: disable=no-name-in-module
Expand Down
13 changes: 7 additions & 6 deletions src/shiver/models/generate_dgs_mde.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The Shiver GenerateDGSMDE mantid algorithm"""

# pylint: disable=no-name-in-module
import json
import numpy
Expand Down Expand Up @@ -187,9 +188,9 @@ def validateInputs(self):
if len(tib) != 2:
raise ValueError("length is not 2")
except ValueError:
issues[
"TimeIndependentBackground"
] = "This must be either 'Default' or two numbers separated by a comma"
issues["TimeIndependentBackground"] = (
"This must be either 'Default' or two numbers separated by a comma"
)
ad_dims = self.getPropertyValue("AdditionalDimensions")
if ad_dims:
ad_dims = ad_dims.split(",")
Expand All @@ -206,9 +207,9 @@ def validateInputs(self):
self.getProperty("Type").value == "Background (minimized by angle and energy)"
and self.getProperty("DetectorGroupingFile").value == ""
):
issues[
"DetectorGroupingFile"
] = "A grouping file is required when for 'Background (minimized by angle and energy)'"
issues["DetectorGroupingFile"] = (
"A grouping file is required when for 'Background (minimized by angle and energy)'"
)

return issues

Expand Down
1 change: 1 addition & 0 deletions src/shiver/models/help.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" single help module """

import webbrowser
from shiver.configuration import get_data

Expand Down
1 change: 1 addition & 0 deletions src/shiver/models/histogram.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model for the Histogram tab"""

import time
import os.path
from typing import Tuple
Expand Down
1 change: 1 addition & 0 deletions src/shiver/models/makeslice.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The Shiver MakeSlice mantid algorithm"""

# pylint: disable=no-name-in-module

from mantid.api import (
Expand Down
1 change: 1 addition & 0 deletions src/shiver/models/makeslices.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The Shiver MakeSFCorrectedSlices mantid algorithm"""

# pylint: disable=no-name-in-module

from mantid.api import (
Expand Down
1 change: 1 addition & 0 deletions src/shiver/models/polarized.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model for the Sample Parameters dialog"""

# pylint: disable=no-name-in-module
from mantid.simpleapi import mtd, AddSampleLog
from mantid.kernel import Logger
Expand Down
1 change: 1 addition & 0 deletions src/shiver/models/sample.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model for the Sample Parameters dialog"""

import numpy

# pylint: disable=no-name-in-module
Expand Down
1 change: 1 addition & 0 deletions src/shiver/presenters/generate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Presenter for the Generate tab"""

import json

CONFIG_TEMPLATE = """#!/usr/bin/env python
Expand Down
1 change: 1 addition & 0 deletions src/shiver/presenters/histogram.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Presenter for the Histogram tab"""

import os
from qtpy.QtWidgets import QWidget
from shiver.views.corrections import Corrections
Expand Down
1 change: 1 addition & 0 deletions src/shiver/presenters/sample.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Presenter for the Sample Parameters dialog"""

from copy import deepcopy


Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/advanced_options.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt QDialog for Sample Parameters"""

import re

from qtpy import QtGui
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/corrections.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt widget for the correction tab"""

# pylint: disable=no-name-in-module
from qtpy.QtWidgets import (
QWidget,
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt widget for the raw data selection"""

import os
import glob

Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/generate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt widget for the histogram tab"""

import re
import os
import itertools
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/histogram.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt widget for the histogram tab"""

from qtpy.QtWidgets import QWidget, QHBoxLayout, QErrorMessage, QMessageBox
from qtpy.QtCore import Signal

Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/histogram_parameters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt QGroupBox for the histogram parameters"""

import numpy
from qtpy import QtGui
from qtpy.QtWidgets import (
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/invalid_styles.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CSS styles invalid fields"""

INVALID_QLINEEDIT = """
QLineEdit {
border-color: red;
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/loading_buttons.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt widget for the histogram tab"""

import importlib
import os
from qtpy.QtWidgets import (
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/oncat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt widget for the OnCat widget in General tab."""

import os
import json
import oauthlib
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/plots.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions to plot histograms"""

import matplotlib.pyplot as plt
from mantidqt.widgets.sliceviewer.presenters.presenter import SliceViewer
from mantidqt.plotting.functions import manage_workspace_names, plot_md_ws_from_names
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/polarized_options.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt QDialog for Sample Parameters"""

from qtpy import QtGui
from qtpy.QtWidgets import (
QWidget,
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/reduction_parameters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt widget for the Reduction Parameters section"""

from qtpy import QtGui
from qtpy.QtWidgets import (
QWidget,
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/refine_ub.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""View for the Refine UB widget"""

import types
from qtpy.QtWidgets import (
QWidget,
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/sample.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt QDialog for Sample Parameters"""

from qtpy import QtGui
from qtpy.QtWidgets import (
QWidget,
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/workspace_icons.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt widget for the workspace icons"""

from qtpy.QtWidgets import QLabel, QWidget, QFormLayout
from qtpy.QtCore import QSize
from qtpy.QtGui import QIcon, QPixmap
Expand Down
1 change: 1 addition & 0 deletions src/shiver/views/workspace_tables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyQt widget for the histogram tab input workspaces"""

from functools import partial
from enum import Enum
from qtpy.QtWidgets import (
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""pytest config"""

import os
from configparser import ConfigParser

Expand Down
1 change: 1 addition & 0 deletions tests/models/test_configuration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for Configuration mechanism"""

import os
from configparser import ConfigParser
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/models/test_gather_history.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for histogram model."""

import os
import pytest

Expand Down
1 change: 1 addition & 0 deletions tests/models/test_generatemde.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the ConvertDGSToSingleMDE algorithm"""

import os
from pytest import approx, raises
from mantid.kernel import amend_config
Expand Down
1 change: 1 addition & 0 deletions tests/models/test_histogram_saving.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the histogram workspace saving"""

# pylint: disable=too-many-lines
import os
import ast
Expand Down
1 change: 1 addition & 0 deletions tests/models/test_load.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the file loading part of the HistogramModel"""

import time
import os
from mantid.simpleapi import ( # pylint: disable=no-name-in-module
Expand Down
1 change: 1 addition & 0 deletions tests/models/test_makeslice.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the MakeSlice algorithm"""

import os
from pytest import approx
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/models/test_makeslices.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the MakeSlice algorithm"""

import os
from pytest import raises, approx
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/models/test_plot_display_name.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the plot title creation part of the HistogramModel"""

# pylint: disable=no-name-in-module
from mantid.simpleapi import (
mtd,
Expand Down
1 change: 1 addition & 0 deletions tests/models/test_sample_parameters_buttons_actions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""tests for Sample Parameters dialog: button actions"""

import os
from pytest import approx

Expand Down
1 change: 1 addition & 0 deletions tests/models/test_sample_parameters_invalid_inputs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""tests for Sample Parameters dialog: inputs"""

import os

# pylint: disable=no-name-in-module
Expand Down
1 change: 1 addition & 0 deletions tests/models/test_show_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for printing the version"""

import sys
from pytest import raises
from shiver.shiver import gui
Expand Down
1 change: 1 addition & 0 deletions tests/models/test_symmetry_operations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the file loading part of the HistogramModel"""

from shiver.models.histogram import HistogramModel


Expand Down
1 change: 1 addition & 0 deletions tests/models/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for shiver.models.utils"""

from shiver.models.utils import flatten_list


Expand Down
1 change: 1 addition & 0 deletions tests/views/test_advanced_options_inputs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""UI tests for Reduction Parameters widget: input values"""

import re
from functools import partial
from qtpy import QtCore
Expand Down
1 change: 1 addition & 0 deletions tests/views/test_correction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""UI tests for the corrections table"""

# pylint: disable=no-name-in-module
import os
import re
Expand Down
1 change: 1 addition & 0 deletions tests/views/test_dimensions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""UI tests for HistogramParameter button"""

import re
from qtpy import QtCore

Expand Down
1 change: 1 addition & 0 deletions tests/views/test_generate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the generate view."""

import re
import os
from qtpy import QtCore
Expand Down
1 change: 1 addition & 0 deletions tests/views/test_histogram.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""UI test for the histogram tab"""

import os
from functools import partial
import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/views/test_loading_buttons.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""UI tests for LoadingButtons widget"""

import functools
from qtpy import QtCore, QtWidgets
from shiver.views.loading_buttons import LoadingButtons
Expand Down
1 change: 1 addition & 0 deletions tests/views/test_mainwindow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""UI tests for the application"""

from shiver import Shiver, __version__


Expand Down
1 change: 1 addition & 0 deletions tests/views/test_mde_workspaces.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""UI tests for the MDE list tables"""

import enum
import os
from functools import partial
Expand Down
1 change: 1 addition & 0 deletions tests/views/test_mdh_workspaces.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""UI tests for the MDH list tables"""

from functools import partial
import pytest
from qtpy.QtWidgets import QApplication, QMenu, QFileDialog, QLineEdit
Expand Down
1 change: 1 addition & 0 deletions tests/views/test_minimize_background.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for the BackgroundMinimization widget"""

import os
import re
from qtpy import QtCore, QtWidgets
Expand Down
Loading
Loading