Skip to content

Commit 93c9c1b

Browse files
committed
Update pre-commit hooks
1 parent b2acfc7 commit 93c9c1b

File tree

7 files changed

+23
-24
lines changed

7 files changed

+23
-24
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ repos:
1616
args: [ --markdown-linebreak-ext=md ]
1717
exclude: '\.svg'
1818
- repo: https://github.com/kynan/nbstripout
19-
rev: 0.7.1
19+
rev: 0.8.1
2020
hooks:
2121
- id: nbstripout
2222
types: [ "jupyter" ]
2323
args: [ "--drop-empty-cells",
2424
"--extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm'" ]
2525
- repo: https://github.com/astral-sh/ruff-pre-commit
26-
rev: v0.8.0
26+
rev: v0.9.10
2727
hooks:
2828
- id: ruff
2929
args: [ --fix ]
3030
types_or: [ python, pyi, jupyter ]
3131
- id: ruff-format
3232
types_or: [ python, pyi ]
3333
- repo: https://github.com/codespell-project/codespell
34-
rev: v2.3.0
34+
rev: v2.4.1
3535
hooks:
3636
- id: codespell
3737
additional_dependencies:
@@ -47,7 +47,7 @@ repos:
4747
- id: rst-inline-touching-normal
4848
- id: text-unicode-replacement-char
4949
- repo: https://github.com/rhysd/actionlint
50-
rev: v1.7.3
50+
rev: v1.7.7
5151
hooks:
5252
- id: actionlint
5353
# Disable because of false-positive SC2046

src/scippneutron/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
import lazy_loader as lazy
2525

26-
submodules = ['atoms' 'chopper', 'io', 'conversion']
26+
submodules = ['atomschopper', 'io', 'conversion']
2727

2828
__getattr__, __dir__, __all__ = lazy.attach(
2929
__name__,

src/scippneutron/chopper/_svg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"""
2525
)
2626
_DISK_TEMPLATE = Template(
27-
'<path d="${path}" fill="#e0e0e0" ' 'stroke="#a0a0a0" stroke-width="2"/>'
27+
'<path d="${path}" fill="#e0e0e0" stroke="#a0a0a0" stroke-width="2"/>'
2828
)
2929
_EDGE_MARK_TEMPLATE = Template(
3030
'<path d="${path}" stroke="#707070" stroke-width="2" stroke-dasharray="5,5"/>'
@@ -48,7 +48,7 @@ def _rotation_arrow(*, image_size: int, clockwise: bool) -> str:
4848
# The arrow was drawn with Inkscape at an image size of 400.
4949
s = image_size / 400
5050
flip, shift = (-1, image_size) if clockwise else (1, 0)
51-
return f"""<g id="rotation-arrow" transform="matrix({flip*s},0,0,{s},{shift},20)">
51+
return f"""<g id="rotation-arrow" transform="matrix({flip * s},0,0,{s},{shift},20)">
5252
<path fill="#606060"
5353
d="m 190.46289,4.140625 c -19.2285,0.9736749 -38.20846,4.7790001 -56.32617,11.292969 l 0.89453,2.490234 C 152.90409,11.497902 171.62709,7.7437179 190.5957,6.7832031 Z"/>
5454
<path fill="#606060" stroke-linecap="round"
@@ -228,7 +228,7 @@ def trace_disk() -> tuple[list[str], list[tuple[str, dict[str, str]]]]:
228228
]
229229
if (beam_position := chopper.beam_position) is not None:
230230
elements.append(beam_pos(beam_position))
231-
elements.append(f'<circle cx="{image_size/2}" cy="{image_size/2}" r="5"/>')
231+
elements.append(f'<circle cx="{image_size / 2}" cy="{image_size / 2}" r="5"/>')
232232
return _CHOPPER_TEMPLATE.substitute(
233233
image_size=image_size, elements="\n".join(elements)
234234
)

src/scippneutron/chopper/filtering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def find_plateaus(
5353
"""
5454
if data.ndim != 1:
5555
raise NotImplementedError(
56-
"find_plateaus only supports 1-dimensional data, " f"got {data.ndim} dims"
56+
f"find_plateaus only supports 1-dimensional data, got {data.ndim} dims"
5757
)
5858
if not sc.issorted(data.coords[data.dim], data.dim, order="ascending"):
5959
raise sc.CoordError(

src/scippneutron/io/cif.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def __setitem__(self, name: str, value: sc.Variable) -> None:
571571
"""
572572
if value.ndim != 1:
573573
raise sc.DimensionError(
574-
"CIF loops can only contain 1d variables, got " f"{value.ndim} dims"
574+
f"CIF loops can only contain 1d variables, got {value.ndim} dims"
575575
)
576576
if self._columns:
577577
existing = next(iter(self._columns.values())).sizes
@@ -732,7 +732,7 @@ def write(self, f: TextIO) -> None:
732732
'ess',
733733
'isis',
734734
'j-parc',
735-
'lansce' 'sinq',
735+
'lanscesinq',
736736
'sns',
737737
}
738738

@@ -880,8 +880,7 @@ def _reduced_powder_coord(data) -> tuple[str, sc.Variable]:
880880
coord = data.coords[data.dim]
881881
if coord.unit != unit:
882882
raise sc.UnitError(
883-
f'Incorrect unit for powder coordinate {name}: {coord.unit} '
884-
f'expected {unit}'
883+
f'Incorrect unit for powder coordinate {name}: {coord.unit} expected {unit}'
885884
)
886885
return name, coord
887886

src/scippneutron/mantid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,11 @@ def _get_dtype_from_values(values, coerce_floats_to_ints):
435435
dtype = sc.DType.float64
436436
else:
437437
raise RuntimeError(
438-
"Cannot handle the dtype that this " "workspace has on Axis 1."
438+
"Cannot handle the dtype that this workspace has on Axis 1."
439439
)
440440
else:
441441
raise RuntimeError(
442-
"Axis 1 of this workspace has no values. " "Cannot determine dtype."
442+
"Axis 1 of this workspace has no values. Cannot determine dtype."
443443
)
444444
return dtype
445445

tests/mantid_test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,9 @@ def check_monitor_metadata(monitor):
311311
# no need for these, and it avoids duplication:
312312
assert 'detector_info' not in monitor.coords
313313
assert 'sample' not in monitor.coords
314-
assert (
315-
'SampleTemp' not in monitor.coords
316-
), "Expect run logs not be duplicated in monitor workspaces"
314+
assert 'SampleTemp' not in monitor.coords, (
315+
"Expect run logs not be duplicated in monitor workspaces"
316+
)
317317

318318
def test_Workspace2D_with_separate_monitors(self):
319319
from mantid.simpleapi import mtd
@@ -530,9 +530,9 @@ def test_convert_array_run_log(self):
530530
# Given a Mantid workspace with a run log
531531
target = mantid.CloneWorkspace(self.base_event_ws)
532532
log_name = "SampleTemp"
533-
assert target.run().hasProperty(
534-
log_name
535-
), f'Expected input workspace to have a {log_name} run log'
533+
assert target.run().hasProperty(log_name), (
534+
f'Expected input workspace to have a {log_name} run log'
535+
)
536536

537537
# When the workspace is converted to a scipp data array
538538
dg = scn.mantid.convert_EventWorkspace_to_data_group(target, False)
@@ -555,9 +555,9 @@ def test_convert_scalar_run_log(self):
555555
# Given a Mantid workspace with a run log
556556
target = mantid.CloneWorkspace(self.base_event_ws)
557557
log_name = "start_time"
558-
assert target.run().hasProperty(
559-
log_name
560-
), f'Expected input workspace to have a {log_name} run log'
558+
assert target.run().hasProperty(log_name), (
559+
f'Expected input workspace to have a {log_name} run log'
560+
)
561561

562562
# When the workspace is converted to a scipp data array
563563
dg = scn.mantid.convert_EventWorkspace_to_data_group(target, False)

0 commit comments

Comments
 (0)