Skip to content

Commit

Permalink
Fix license header whitespaces, drop pycodestyle E linting
Browse files Browse the repository at this point in the history
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
  • Loading branch information
hakonanes committed Jan 1, 2025
1 parent 0f7020e commit 7ab68b6
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 32 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/perhaps_make_tagged_release_draft.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2019-2024 The kikuchipy developers
#
# Copyright 2019-2025 the kikuchipy developers
#
# This file is part of kikuchipy.
#
Expand All @@ -13,7 +14,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with kikuchipy. If not, see <http://www.gnu.org/licenses/>.
# along with kikuchipy. If not, see <http://www.gnu.org/licenses/>.#

import re

Expand Down Expand Up @@ -45,10 +46,12 @@
elif line.startswith(pypi_version):
changelog_end = i - 1
with open("release_part_in_changelog.rst", mode="w") as f:
# fmt: off
f.write(
"kikuchipy is an open-source Python library for processing, simulating and indexing of electron backscatter diffraction (EBSD) patterns.\n\n"
f"See below, the `changelog <https://kikuchipy.org/en/stable/changelog.html>`_ or the `GitHub changelog <https://github.com/pyxem/kikuchipy/compare/v{pypi_version}...v{branch_version}>`_ for all updates from the previous release.\n\n"
)
# fmt: on
for line in content[changelog_start:changelog_end]:
f.write(line)

Expand Down
4 changes: 2 additions & 2 deletions .license.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ the Free Software Foundation, either version 3 of the License, or

${projectname} is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with ${projectname}. If not, see <http://www.gnu.org/licenses/>.
along with ${projectname}. If not, see <http://www.gnu.org/licenses/>.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
##
## kikuchipy is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with kikuchipy. If not, see <http://www.gnu.org/licenses/>.##
## along with kikuchipy. If not, see <http://www.gnu.org/licenses/>.##
repos:
# https://docs.astral.sh/ruff/configuration
- repo: https://github.com/astral-sh/ruff-pre-commit
Expand All @@ -30,7 +30,7 @@ repos:
files: \.ipynb
args: [--line-length=77]
- repo: https://github.com/johann-petrak/licenseheaders.git
rev: 'v0.8.8'
rev: v0.8.8
hooks:
- id: licenseheaders
args: ["-t", ".license.tmpl", "-cy", "-n", "kikuchipy", "-f"]
Expand Down
20 changes: 8 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,17 @@ filterwarnings = [
"ignore:Unable to import recommended hash 'siphash24.siphash13'",
]

[tool.isort]
profile = "black"
filter_files = true
force_sort_within_sections = true

# https://docs.astral.sh/ruff/configuration
[tool.ruff.lint]
exclude = ["*.ipynb"]
select = [
# Pyflakes
"F",
# Pycodestyle
"E",
"W",
# isort
"I"
"F", # Pyflakes
"W", # Pycodestyle
"I", # isort
]
# https://docs.astral.sh/ruff/settings/#lintisort
[tool.ruff.lint.isort]
force-sort-within-sections = true

[tool.ruff.format]
exclude = ["*.ipynb"]
10 changes: 6 additions & 4 deletions tests/test_detectors/test_ebsd_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
#
# kikuchipy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with kikuchipy. If not, see <http://www.gnu.org/licenses/>.#
# along with kikuchipy. If not, see <http://www.gnu.org/licenses/>.#

from copy import deepcopy

Expand Down Expand Up @@ -231,7 +231,8 @@ def test_gnomonic_scale(self, pc1, shape, desired_x_scale, desired_y_scale):
assert np.allclose(detector.y_scale, desired_y_scale, atol=1e-6)

@pytest.mark.parametrize(
"tilt, azimuthal, twist, sample_tilt, expected_angle, expected_axis, expected_rotation",
"tilt, azimuthal, twist, sample_tilt, expected_angle, expected_axis, "
"expected_rotation",
[
(
0,
Expand Down Expand Up @@ -1220,7 +1221,8 @@ def test_get_indexer(self):

class TestSaveLoadDetector:
@pytest.mark.parametrize(
"nav_shape, shape, convention, sample_tilt, tilt, px_size, binning, azimuthal, twist",
"nav_shape, shape, convention, sample_tilt, tilt, px_size, binning, azimuthal, "
"twist",
[
((3, 4), (10, 20), "bruker", 70, 0, 70, 1, 0, 0),
((1, 5), (5, 5), "tsl", 69.5, 3.14, 57.2, 2, 3.7, 0.003),
Expand Down
8 changes: 5 additions & 3 deletions tests/test_io/test_nordif_calibration_patterns.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2019-2024 The kikuchipy developers
#
# Copyright 2019-2025 the kikuchipy developers
#
# This file is part of kikuchipy.
#
Expand All @@ -13,7 +14,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with kikuchipy. If not, see <http://www.gnu.org/licenses/>.
# along with kikuchipy. If not, see <http://www.gnu.org/licenses/>.#

from matplotlib.pyplot import imread
import numpy as np
Expand Down Expand Up @@ -86,7 +87,8 @@ def test_logs_incorrect_shapes(self, caplog, nordif_path):
[
"Could not read area (electron image) shape",
"Could not read area ROI 'Top'",
"Number of samples (3, 3) differs from the one calculated from area/ROI shapes (4, 4)",
"Number of samples (3, 3) differs from the one calculated from area/ROI"
" shapes (4, 4)",
"No area image found",
],
):
Expand Down
17 changes: 11 additions & 6 deletions tests/test_signals/test_ebsd_hough_indexing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2019-2024 The kikuchipy developers
#
# Copyright 2019-2025 the kikuchipy developers
#
# This file is part of kikuchipy.
#
Expand All @@ -13,7 +14,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with kikuchipy. If not, see <http://www.gnu.org/licenses/>.
# along with kikuchipy. If not, see <http://www.gnu.org/licenses/>.#

from diffpy.structure import Lattice, Structure
from diffsims.crystallography import ReciprocalLatticeVector
Expand Down Expand Up @@ -52,10 +53,12 @@ def test_hough_indexing_print_information(self):
)
info_list = info.split("\n")
# fmt: off
assert info_list[0] == "Hough indexing with PyEBSDIndex information:"
assert info_list[0] == "Hough indexing with PyEBSDIndex information:"
assert info_list[1][:12] == " PyOpenCL: "
assert info_list[2] == " Projection center (Bruker, mean): (0.4251, 0.2134, 0.5007)"
assert info_list[3] == " Indexing 9 pattern(s) in 3 chunk(s)"
assert info_list[2] == (
" Projection center (Bruker, mean): (0.4251, 0.2134, 0.5007)"
)
assert info_list[3] == " Indexing 9 pattern(s) in 3 chunk(s)"
# fmt: on

det_pc_mean = det.deepcopy()
Expand Down Expand Up @@ -170,7 +173,9 @@ def test_indexer_is_compatible_with_signal(self):
assert not _indexer_is_compatible_with_kikuchipy(indexer, (60, 60), 8)
with pytest.raises(
ValueError,
match=r"`indexer.PC` must be an array of shape \(3,\) or \(8, 3\), but was ",
match=(
r"`indexer.PC` must be an array of shape \(3,\) or \(8, 3\), but was "
),
):
_indexer_is_compatible_with_kikuchipy(
indexer, (60, 60), 8, raise_if_not=True
Expand Down

0 comments on commit 7ab68b6

Please sign in to comment.