diff --git a/pyrefly-baseline.json b/pyrefly-baseline.json index c125aa579..e18e66889 100644 --- a/pyrefly-baseline.json +++ b/pyrefly-baseline.json @@ -28,97 +28,6 @@ "concise_description": "Object of class `NoneType` has no attribute `scatter`", "severity": "error" }, - { - "column": 9, - "path": "python/basix/ufl.py", - "name": "bad-override", - "concise_description": "Class member `_BasixElement.get_tensor_product_representation` overrides parent class `_ElementBase` in an inconsistent manner", - "severity": "error" - }, - { - "column": 13, - "path": "python/basix/ufl.py", - "name": "unbound-name", - "concise_description": "`e` may be uninitialized", - "severity": "error" - }, - { - "column": 14, - "path": "test/test_bernstein.py", - "name": "unbound-name", - "concise_description": "`derivs` may be uninitialized", - "severity": "error" - }, - { - "column": 46, - "path": "test/test_continuity.py", - "name": "unsupported-operation", - "concise_description": "`-` is not supported between `dict[Unknown, int]` and `dict[Unknown, int]`", - "severity": "error" - }, - { - "column": 29, - "path": "test/test_continuity.py", - "name": "unsupported-operation", - "concise_description": "`-` is not supported between `dict[Unknown, int]` and `dict[Unknown, int]`", - "severity": "error" - }, - { - "column": 50, - "path": "test/test_continuity.py", - "name": "unsupported-operation", - "concise_description": "`-` is not supported between `dict[Unknown, int]` and `dict[Unknown, int]`", - "severity": "error" - }, - { - "column": 28, - "path": "test/test_continuity.py", - "name": "unsupported-operation", - "concise_description": "`+` is not supported between `dict[Unknown, int]` and `dict[Unknown, int]`", - "severity": "error" - }, - { - "column": 37, - "path": "test/test_continuity.py", - "name": "unsupported-operation", - "concise_description": "`+` is not supported between `dict[Unknown, int]` and `dict[Unknown, int]`", - "severity": "error" - }, - { - "column": 29, - "path": "test/test_continuity.py", - "name": "unsupported-operation", - "concise_description": "`-` is not supported between `dict[Unknown, int]` and `dict[Unknown, int]`", - "severity": "error" - }, - { - "column": 50, - "path": "test/test_continuity.py", - "name": "unsupported-operation", - "concise_description": "`-` is not supported between `dict[Unknown, int]` and `dict[Unknown, int]`", - "severity": "error" - }, - { - "column": 44, - "path": "test/test_interpolation_between_elements.py", - "name": "unbound-name", - "concise_description": "`p_family` may be uninitialized", - "severity": "error" - }, - { - "column": 28, - "path": "test/test_mappings.py", - "name": "unbound-name", - "concise_description": "`points` may be uninitialized", - "severity": "error" - }, - { - "column": 47, - "path": "test/test_mappings.py", - "name": "unbound-name", - "concise_description": "`physical_vs` may be uninitialized", - "severity": "error" - }, { "column": 32, "path": "test/test_polynomials.py", @@ -139,20 +48,6 @@ "name": "bad-argument-type", "concise_description": "Argument `Buffer | _NestedSequence[bytes | complex | str] | _NestedSequence[_SupportsArray[dtype]] | _SupportsArray[dtype] | bytes | complex | str` is not assignable to parameter `iter2` with type `Iterable[@_]` in function `zip.__new__`", "severity": "error" - }, - { - "column": 41, - "path": "test/test_tensor_products.py", - "name": "unbound-name", - "concise_description": "`values2` may be uninitialized", - "severity": "error" - }, - { - "column": 64, - "path": "test/test_version.py", - "name": "missing-attribute", - "concise_description": "No attribute `_basixcpp` in module `basix`", - "severity": "error" } ] } \ No newline at end of file diff --git a/python/basix/ufl.py b/python/basix/ufl.py index 840362dbd..741faf7c0 100644 --- a/python/basix/ufl.py +++ b/python/basix/ufl.py @@ -319,7 +319,9 @@ def basix_sobolev_space(self) -> _basix.SobolevSpace: def dtype(self) -> _npt.DTypeLike: """Element float type.""" - def get_tensor_product_representation(self): + def get_tensor_product_representation( + self, + ) -> list[list[_basix.finite_element.FiniteElement]] | None: """Get the element's tensor product factorisation.""" return None @@ -1687,7 +1689,7 @@ def enriched_element( if e.map_type != map_type: raise ValueError("Enriched elements on different map types not supported.") - dtype = e.dtype + dtype = elements[0].dtype hcd = min(e.embedded_subdegree for e in elements) hd = max(e.embedded_superdegree for e in elements) ss = _basix.sobolev_spaces.intersection([e.basix_sobolev_space for e in elements]) diff --git a/test/test_bernstein.py b/test/test_bernstein.py index d56c5a9da..8a6169552 100644 --- a/test/test_bernstein.py +++ b/test/test_bernstein.py @@ -163,6 +163,8 @@ def test_element(celltype, degree): derivs = [(0,), (1,), (2,), (3,)] elif celltype == basix.CellType.triangle: derivs = [(n - i, i) for n in range(4) for i in range(n + 1)] + else: + raise NotImplementedError for k in derivs: wsym = np.zeros_like(wtab[0]) diff --git a/test/test_continuity.py b/test/test_continuity.py index 386215b86..e81010fb1 100644 --- a/test/test_continuity.py +++ b/test/test_continuity.py @@ -71,16 +71,16 @@ def test_continuity_interval_facet(degree, element, variant): pytest.skip() facets = [ - [ + ( np.array([0, 0]), np.array([1, 0]), {basix.CellType.triangle: 2, basix.CellType.quadrilateral: 0}, - ], - [ + ), + ( np.array([0, 0]), np.array([0, 1]), {basix.CellType.triangle: 1, basix.CellType.quadrilateral: 1}, - ], + ), ] for start, end, cellmap in facets: @@ -112,24 +112,24 @@ def test_continuity_triangle_facet(degree, element, variant): pytest.skip() facets = [ - [ + ( np.array([0, 0, 0]), np.array([1, 0, 0]), np.array([0, 1, 0]), {basix.CellType.tetrahedron: 3, basix.CellType.prism: 0}, - ], - [ + ), + ( np.array([0, 0, 0]), np.array([1, 0, 0]), np.array([0, 0, 1]), {basix.CellType.tetrahedron: 2, basix.CellType.pyramid: 1}, - ], - [ + ), + ( np.array([0, 0, 0]), np.array([0, 1, 0]), np.array([0, 0, 1]), {basix.CellType.tetrahedron: 1, basix.CellType.pyramid: 2}, - ], + ), ] for v0, v1, v2, cellmap in facets: @@ -164,27 +164,27 @@ def test_continuity_quadrilateral_facet(degree, element, variant): pytest.skip() facets = [ - [ + ( np.array([0, 0, 0]), np.array([1, 0, 0]), np.array([0, 1, 0]), np.array([1, 1, 0]), {basix.CellType.hexahedron: 0, basix.CellType.pyramid: 0}, - ], - [ + ), + ( np.array([0, 0, 0]), np.array([1, 0, 0]), np.array([0, 0, 1]), np.array([1, 0, 1]), {basix.CellType.hexahedron: 1, basix.CellType.prism: 1}, - ], - [ + ), + ( np.array([0, 0, 0]), np.array([0, 1, 0]), np.array([0, 0, 1]), np.array([0, 1, 1]), {basix.CellType.hexahedron: 2, basix.CellType.prism: 2}, - ], + ), ] for v0, v1, v2, v3, cellmap in facets: diff --git a/test/test_interpolation_between_elements.py b/test/test_interpolation_between_elements.py index 153ef77b8..fff1c3659 100644 --- a/test/test_interpolation_between_elements.py +++ b/test/test_interpolation_between_elements.py @@ -246,6 +246,8 @@ def test_degree_bounds(cell_type, degree, element_type, element_args): p_family = basix.ElementFamily.P elif element.polyset_type == basix.PolysetType.macroedge: p_family = basix.ElementFamily.iso + else: + raise NotImplementedError if element.embedded_superdegree >= 0: # The element being tested should be a subset of this Lagrange space diff --git a/test/test_mappings.py b/test/test_mappings.py index 021dfd936..3137f2063 100644 --- a/test/test_mappings.py +++ b/test/test_mappings.py @@ -36,6 +36,8 @@ def run_map_test(e, J, detJ, K, reference_value_size, physical_value_size): for k in range(N + 1 - i - j) ] ) + else: + raise NotImplementedError values = e.tabulate(0, points)[0] _J = np.array([J for p in points]) @@ -78,6 +80,8 @@ def test_mappings_2d_to_3d(element_type, element_args): physical_vs = 3 elif e.value_size == 4: physical_vs = 9 + else: + raise NotImplementedError run_map_test(e, J, detJ, K, e.value_size, physical_vs) diff --git a/test/test_tensor_products.py b/test/test_tensor_products.py index 3fc3d55a9..dcf49fb07 100644 --- a/test/test_tensor_products.py +++ b/test/test_tensor_products.py @@ -57,7 +57,7 @@ def test_tensor_product_factorisation(cell_type, degree, element_type, element_a e.tabulate(d, p.reshape(1, -1))[d, 0, :, 0] for e, p, d in zip(fs, point, ds) ] values2 = tensor_product(*evals) - assert np.allclose(values1, values2) + assert np.allclose(values1, values2) @pytest.mark.parametrize("degree", range(1, 9)) diff --git a/test/test_version.py b/test/test_version.py index 160d9328f..6a6afc7f1 100644 --- a/test/test_version.py +++ b/test/test_version.py @@ -7,6 +7,7 @@ import pytest import basix +import basix._basixcpp def is_canonical(version):