diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d3529f09..20456fc53 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v4.6.0" + rev: "v5.0.0" hooks: - id: check-case-conflict - id: check-executables-have-shebangs @@ -22,7 +22,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: "24.4.2" + rev: "24.10.0" hooks: - id: black-jupyter args: ["--line-length", "100"] @@ -34,7 +34,7 @@ repos: additional_dependencies: [black==23.3.0] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.5.0" + rev: "v0.6.9" hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -87,7 +87,7 @@ repos: ] - repo: https://github.com/pre-commit/mirrors-clang-format - rev: "v18.1.8" + rev: "v19.1.1" hooks: - id: clang-format types_or: [c++, c, cuda] diff --git a/src/pyg4ometry/pycgal_old/algo.cxx b/src/pyg4ometry/pycgal_old/algo.cxx index 9c2e5ea37..e3a225712 100644 --- a/src/pyg4ometry/pycgal_old/algo.cxx +++ b/src/pyg4ometry/pycgal_old/algo.cxx @@ -557,12 +557,12 @@ PYBIND11_MODULE(algo, m) { .def(py::init()) .def(py::init()) .def("add_vertex", &SurfaceMesh::add_vertex) - .def("add_face", (std::size_t(SurfaceMesh::*)(std::size_t, std::size_t, - std::size_t)) & - SurfaceMesh::add_face) - .def("add_face", (std::size_t(SurfaceMesh::*)(std::size_t, std::size_t, - std::size_t, std::size_t)) & - SurfaceMesh::add_face) + .def("add_face", + (std::size_t(SurfaceMesh::*)(std::size_t, std::size_t, + std::size_t))&SurfaceMesh::add_face) + .def("add_face", + (std::size_t(SurfaceMesh::*)(std::size_t, std::size_t, std::size_t, + std::size_t))&SurfaceMesh::add_face) .def("translate", &SurfaceMesh::translate) .def("transform", &SurfaceMesh::transform) .def("union", &SurfaceMesh::unioN) diff --git a/src/pyg4ometry/pycsg/core.c b/src/pyg4ometry/pycsg/core.c index 6f888ea47..0bc2614d5 100644 --- a/src/pyg4ometry/pycsg/core.c +++ b/src/pyg4ometry/pycsg/core.c @@ -27,7 +27,7 @@ END: Cython Metadata */ #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof -#define offsetof(type, member) ((size_t) & ((type *)0)->member) +#define offsetof(type, member) ((size_t)&((type *)0)->member) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall @@ -819,7 +819,9 @@ static CYTHON_INLINE float __PYX_NAN() { (void)__pyx_clineno; \ } #define __PYX_ERR(f_index, lineno, Ln_error) \ - { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + { \ + __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; \ + } #ifndef __PYX_EXTERN_C #ifdef __cplusplus diff --git a/src/pyg4ometry/pycsg/geom.c b/src/pyg4ometry/pycsg/geom.c index 8904ee55b..e0e06f568 100644 --- a/src/pyg4ometry/pycsg/geom.c +++ b/src/pyg4ometry/pycsg/geom.c @@ -27,7 +27,7 @@ END: Cython Metadata */ #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof -#define offsetof(type, member) ((size_t) & ((type *)0)->member) +#define offsetof(type, member) ((size_t)&((type *)0)->member) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall @@ -819,7 +819,9 @@ static CYTHON_INLINE float __PYX_NAN() { (void)__pyx_clineno; \ } #define __PYX_ERR(f_index, lineno, Ln_error) \ - { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + { \ + __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; \ + } #ifndef __PYX_EXTERN_C #ifdef __cplusplus diff --git a/tests/geant4/fixture_geant4solids.py b/tests/geant4/fixture_geant4solids.py index af3c80030..8a18e39e6 100644 --- a/tests/geant4/fixture_geant4solids.py +++ b/tests/geant4/fixture_geant4solids.py @@ -3,12 +3,12 @@ import pyg4ometry.gdml as _gd -@pytest.fixture() +@pytest.fixture def registry(): return _g4.Registry() -@pytest.fixture() +@pytest.fixture def two_materials(registry): def _two_materials(nist_materials=False): if nist_materials: @@ -23,7 +23,7 @@ def _two_materials(nist_materials=False): return _two_materials -@pytest.fixture() +@pytest.fixture def geant4_world(registry): wx = _gd.Constant("wx", "100", registry, True) wy = _gd.Constant("wy", "100", registry, True) @@ -34,7 +34,7 @@ def geant4_world(registry): return ws -@pytest.fixture() +@pytest.fixture def geant4_box(registry): bx = _gd.Constant("bx", "10", registry, True) by = _gd.Constant("by", "10", registry, True) @@ -45,7 +45,7 @@ def geant4_box(registry): return bs -@pytest.fixture() +@pytest.fixture def geant4_tubs(registry): trmin = _gd.Constant("trmin", "2.5", registry, True) trmax = _gd.Constant("trmax", "10.0", registry, True) @@ -63,7 +63,7 @@ def geant4_tubs(registry): return ts -@pytest.fixture() +@pytest.fixture def geant4_cuttubs(registry): ctrmin = _gd.Constant("trmin", "2.5", registry, True) ctrmax = _gd.Constant("trmax", "10.0", registry, True) @@ -94,7 +94,7 @@ def geant4_cuttubs(registry): return cts -@pytest.fixture() +@pytest.fixture def geant4_cons(registry): crmin1 = _gd.Constant("crmin1", "6", registry, True) crmax1 = _gd.Constant("crmax1", "20", registry, True) @@ -124,7 +124,7 @@ def geant4_cons(registry): return cs -@pytest.fixture() +@pytest.fixture def geant4_para(registry): px = _gd.Constant("px", "10", registry, True) py = _gd.Constant("py", "20", registry, True) @@ -142,7 +142,7 @@ def geant4_para(registry): return ps -@pytest.fixture() +@pytest.fixture def geant4_trd(registry): tx1 = _gd.Constant("tx1", "20", registry, True) ty1 = _gd.Constant("ty1", "25", registry, True) @@ -155,7 +155,7 @@ def geant4_trd(registry): return ts -@pytest.fixture() +@pytest.fixture def geant4_trap(registry): tx1 = _gd.Constant("tx1", "5", registry, True) tx2 = _gd.Constant("tx2", "5", registry, True) @@ -198,7 +198,7 @@ def geant4_trap(registry): return ts -@pytest.fixture() +@pytest.fixture def geant4_sphere(registry): srmin = _gd.Constant("rmin", "8", registry, True) srmax = _gd.Constant("rmax", "10", registry, True) @@ -225,7 +225,7 @@ def geant4_sphere(registry): return ss -@pytest.fixture() +@pytest.fixture def geant4_structure(): def _geant4_structure(solid, registry, two_materials, geant4_world): wl = _g4.LogicalVolume(geant4_world, two_materials()["wm"], "wl", registry)