Skip to content

Commit a60754b

Browse files
committed
add ingores
1 parent 9b2bda3 commit a60754b

File tree

17 files changed

+111
-108
lines changed

17 files changed

+111
-108
lines changed

python/dolfinx/fem/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import numpy as np
1111
import numpy.typing as npt
1212

13-
from dolfinx.cpp.fem import _IntegralType as IntegralType
13+
from dolfinx.cpp.fem import _IntegralType as IntegralType # type: ignore[attr-defined]
1414
from dolfinx.cpp.fem import build_sparsity_pattern as _build_sparsity_pattern
1515
from dolfinx.cpp.fem import compute_integration_domains as _compute_integration_domains
1616
from dolfinx.cpp.fem import create_interpolation_data as _create_interpolation_data
@@ -141,7 +141,7 @@ def discrete_curl(V0: FunctionSpace, V1: FunctionSpace) -> _MatrixCSR:
141141
Returns:
142142
Discrete curl operator.
143143
"""
144-
return _MatrixCSR(_discrete_curl(V0._cpp_object, V1._cpp_object))
144+
return _MatrixCSR(_discrete_curl(V0._cpp_object, V1._cpp_object)) # type: ignore[arg-type]
145145

146146

147147
def discrete_gradient(space0: FunctionSpace, space1: FunctionSpace) -> _MatrixCSR:
@@ -159,7 +159,7 @@ def discrete_gradient(space0: FunctionSpace, space1: FunctionSpace) -> _MatrixCS
159159
Returns:
160160
Discrete gradient operator.
161161
"""
162-
return _MatrixCSR(_discrete_gradient(space0._cpp_object, space1._cpp_object))
162+
return _MatrixCSR(_discrete_gradient(space0._cpp_object, space1._cpp_object)) # type: ignore[arg-type]
163163

164164

165165
def interpolation_matrix(space0: FunctionSpace, space1: FunctionSpace) -> _MatrixCSR:
@@ -176,7 +176,7 @@ def interpolation_matrix(space0: FunctionSpace, space1: FunctionSpace) -> _Matri
176176
The returned matrix is not finalised, i.e. ghost values are not
177177
accumulated.
178178
"""
179-
return _MatrixCSR(_interpolation_matrix(space0._cpp_object, space1._cpp_object))
179+
return _MatrixCSR(_interpolation_matrix(space0._cpp_object, space1._cpp_object)) # type: ignore[arg-type]
180180

181181

182182
def compute_integration_domains(

python/dolfinx/fem/assemble.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def assemble_scalar(
162162
"""
163163
constants = pack_constants(M) if constants is None else constants # type: ignore[assignment]
164164
coeffs = pack_coefficients(M) if coeffs is None else constants # type: ignore[assignment]
165-
return _cpp.fem.assemble_scalar(M._cpp_object, constants, coeffs)
165+
return _cpp.fem.assemble_scalar(M._cpp_object, constants, coeffs) # type: ignore[arg-type, return-value]
166166

167167

168168
# -- Vector assembly ------------------------------------------------------
@@ -246,7 +246,7 @@ def _assemble_vector_array(
246246
"""
247247
constants = pack_constants(L) if constants is None else constants # type: ignore[assignment]
248248
coeffs = pack_coefficients(L) if coeffs is None else coeffs # type: ignore[assignment]
249-
_cpp.fem.assemble_vector(b, L._cpp_object, constants, coeffs)
249+
_cpp.fem.assemble_vector(b, L._cpp_object, constants, coeffs) # type: ignore[arg-type]
250250
return b
251251

252252

@@ -325,15 +325,15 @@ def _assemble_matrix_csr(
325325
The returned matrix is not finalised, i.e. ghost values are not
326326
accumulated.
327327
"""
328-
bcs = [] if bcs is None else [bc._cpp_object for bc in bcs]
328+
bcs = [] if bcs is None else [bc._cpp_object for bc in bcs] # type: ignore[misc]
329329
constants = pack_constants(a) if constants is None else constants # type: ignore[assignment]
330330
coeffs = pack_coefficients(a) if coeffs is None else coeffs # type: ignore[assignment]
331-
_cpp.fem.assemble_matrix(A._cpp_object, a._cpp_object, constants, coeffs, bcs)
331+
_cpp.fem.assemble_matrix(A._cpp_object, a._cpp_object, constants, coeffs, bcs) # type: ignore[arg-type]
332332

333333
# If matrix is a 'diagonal'block, set diagonal entry for constrained
334334
# dofs
335335
if a.function_spaces[0] is a.function_spaces[1]:
336-
_cpp.fem.insert_diagonal(A._cpp_object, a.function_spaces[0], bcs, diag)
336+
_cpp.fem.insert_diagonal(A._cpp_object, a.function_spaces[0], bcs, diag) # type: ignore[call-overload]
337337
return A
338338

339339

@@ -455,7 +455,7 @@ def apply_lifting(
455455
)
456456
_a = [None if form is None else form._cpp_object for form in a]
457457
_bcs = [[bc._cpp_object for bc in bcs0] for bcs0 in bcs]
458-
_cpp.fem.apply_lifting(b, _a, constants, coeffs, _bcs, x0, alpha)
458+
_cpp.fem.apply_lifting(b, _a, constants, coeffs, _bcs, x0, alpha) # type: ignore[call-overload]
459459

460460

461461
def set_bc(

python/dolfinx/fem/bcs.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def locate_dofs_geometrical(
5252
return _cpp.fem.locate_dofs_geometrical(V._cpp_object, marker) # type: ignore
5353

5454
_V = [space._cpp_object for space in V] # type: ignore
55-
return _cpp.fem.locate_dofs_geometrical(_V, marker)
55+
return _cpp.fem.locate_dofs_geometrical(_V, marker) # type: ignore[arg-type, return-value]
5656

5757

5858
def locate_dofs_topological(
@@ -88,7 +88,7 @@ def locate_dofs_topological(
8888
return _cpp.fem.locate_dofs_topological(V._cpp_object, entity_dim, _entities, remote) # type: ignore
8989

9090
_V = [space._cpp_object for space in V] # type: ignore
91-
return _cpp.fem.locate_dofs_topological(_V, entity_dim, _entities, remote)
91+
return _cpp.fem.locate_dofs_topological(_V, entity_dim, _entities, remote) # type: ignore[arg-type, return-value]
9292

9393

9494
class DirichletBC:
@@ -122,12 +122,12 @@ class initialiser. This class is combined with different
122122
@property
123123
def g(self) -> Function | Constant | np.ndarray:
124124
"""The boundary condition value(s)."""
125-
return self._cpp_object.value
125+
return self._cpp_object.value # type: ignore[union-attr]
126126

127127
@property
128128
def function_space(self) -> dolfinx.fem.FunctionSpace:
129129
"""Function space on which the boundary condition is defined."""
130-
return self._cpp_object.function_space
130+
return self._cpp_object.function_space # type: ignore[union-attr]
131131

132132
def set(
133133
self, x: npt.NDArray, x0: npt.NDArray[np.int32] | None = None, alpha: float = 1
@@ -154,7 +154,7 @@ def set(
154154
not provided it is treated as zero.
155155
alpha: Scaling factor.
156156
"""
157-
self._cpp_object.set(x, x0, alpha)
157+
self._cpp_object.set(x, x0, alpha) # type: ignore[arg-type]
158158

159159
def dof_indices(self) -> tuple[npt.NDArray[np.int32], int]:
160160
"""Dof indices to which a Dirichlet condition is applied.
@@ -201,11 +201,11 @@ def dirichletbc(
201201
if np.issubdtype(dtype, np.float32):
202202
bctype = _cpp.fem.DirichletBC_float32
203203
elif np.issubdtype(dtype, np.float64):
204-
bctype = _cpp.fem.DirichletBC_float64
204+
bctype = _cpp.fem.DirichletBC_float64 # type: ignore[assignment]
205205
elif np.issubdtype(dtype, np.complex64):
206-
bctype = _cpp.fem.DirichletBC_complex64
206+
bctype = _cpp.fem.DirichletBC_complex64 # type: ignore[assignment]
207207
elif np.issubdtype(dtype, np.complex128):
208-
bctype = _cpp.fem.DirichletBC_complex128
208+
bctype = _cpp.fem.DirichletBC_complex128 # type: ignore[assignment]
209209
else:
210210
raise NotImplementedError(f"Type {value.dtype} not supported.")
211211
except AttributeError:
@@ -222,11 +222,11 @@ def dirichletbc(
222222

223223
if V is not None:
224224
try:
225-
bc = bctype(_value, dofs, V)
225+
bc = bctype(_value, dofs, V) # type: ignore[arg-type]
226226
except TypeError:
227-
bc = bctype(_value, dofs, V._cpp_object)
227+
bc = bctype(_value, dofs, V._cpp_object) # type: ignore[arg-type]
228228
else:
229-
bc = bctype(_value, dofs)
229+
bc = bctype(_value, dofs) # type: ignore[arg-type]
230230

231231
return DirichletBC(bc)
232232

python/dolfinx/fem/dofmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ def create_dofmaps(
8484
for ``elements[i]``.
8585
"""
8686
elements_cpp = [e._cpp_object for e in elements]
87-
cpp_dofmaps = _create_dofmaps(comm, topology._cpp_object, elements_cpp)
87+
cpp_dofmaps = _create_dofmaps(comm, topology._cpp_object, elements_cpp) # type: ignore[arg-type]
8888
return [DofMap(cpp_object) for cpp_object in cpp_dofmaps]

python/dolfinx/fem/element.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def push_forward(
7878
Returns:
7979
Physical coordinates of the points reference points ``X``.
8080
"""
81-
return self._cpp_object.push_forward(X, cell_geometry)
81+
return self._cpp_object.push_forward(X, cell_geometry) # type: ignore[arg-type, return-value]
8282

8383
def pull_back(
8484
self,
@@ -100,7 +100,7 @@ def pull_back(
100100
Returns:
101101
Reference coordinates of the physical points ``x``.
102102
"""
103-
return self._cpp_object.pull_back(x, cell_geometry)
103+
return self._cpp_object.pull_back(x, cell_geometry) # type: ignore[arg-type, return-value]
104104

105105
@property
106106
def variant(self) -> int:
@@ -146,7 +146,7 @@ def coordinate_element(
146146
raise RuntimeError("Unsupported dtype.")
147147

148148

149-
@coordinate_element.register(basix.finite_element.FiniteElement)
149+
@coordinate_element.register(basix.finite_element.FiniteElement) # type: ignore[misc]
150150
def _(e: basix.finite_element.FiniteElement):
151151
"""Create a Lagrange CoordinateElement from a Basix finite element.
152152
@@ -191,7 +191,7 @@ def __eq__(self, other):
191191
@property
192192
def dtype(self) -> np.dtype:
193193
"""Geometry type of the mesh that the space is defined on."""
194-
return self._cpp_object.dtype
194+
return self._cpp_object.dtype # type: ignore[return-value]
195195

196196
@property
197197
def basix_element(self) -> basix.finite_element.FiniteElement:
@@ -296,7 +296,7 @@ def T_apply(
296296
cells. Please see `basix.numba_helpers` for performant
297297
versions.
298298
"""
299-
self._cpp_object.T_apply(x, cell_permutations, dim)
299+
self._cpp_object.T_apply(x, cell_permutations, dim) # type: ignore[arg-type]
300300

301301
def Tt_apply(
302302
self, x: npt.NDArray[np.floating], cell_permutations: npt.NDArray[np.uint32], dim: int
@@ -310,7 +310,7 @@ def Tt_apply(
310310
cell_permutations: Permutation data for the cells
311311
dim: Number of columns in ``data``.
312312
"""
313-
self._cpp_object.Tt_apply(x, cell_permutations, dim)
313+
self._cpp_object.Tt_apply(x, cell_permutations, dim) # type: ignore[arg-type]
314314

315315
def Tt_inv_apply(
316316
self, x: npt.NDArray[np.floating], cell_permutations: npt.NDArray[np.uint32], dim: int
@@ -324,7 +324,7 @@ def Tt_inv_apply(
324324
cell_permutations: Permutation data for the cells
325325
dim: Number of columns in ``data``.
326326
"""
327-
self._cpp_object.Tt_inv_apply(x, cell_permutations, dim)
327+
self._cpp_object.Tt_inv_apply(x, cell_permutations, dim) # type: ignore[arg-type]
328328

329329

330330
def finiteelement(
@@ -343,7 +343,7 @@ def finiteelement(
343343
if np.issubdtype(FiniteElement_dtype, np.float32):
344344
CppElement = _cpp.fem.FiniteElement_float32
345345
elif np.issubdtype(FiniteElement_dtype, np.float64):
346-
CppElement = _cpp.fem.FiniteElement_float64
346+
CppElement = _cpp.fem.FiniteElement_float64 # type: ignore[assignment]
347347
else:
348348
raise ValueError(f"Unsupported dtype: {FiniteElement_dtype}")
349349

@@ -352,7 +352,7 @@ def finiteelement(
352352
finiteelement(cell_type, e, FiniteElement_dtype)._cpp_object # type: ignore
353353
for e in ufl_e.sub_elements
354354
]
355-
return FiniteElement(CppElement(elements))
355+
return FiniteElement(CppElement(elements)) # type: ignore[arg-type]
356356
elif ufl_e.is_quadrature:
357357
return FiniteElement(
358358
CppElement(

python/dolfinx/fem/forms.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def rank(self) -> int:
9696
@property
9797
def function_spaces(self) -> list[FunctionSpace]:
9898
"""Function spaces on which this form is defined."""
99-
return self._cpp_object.function_spaces
99+
return self._cpp_object.function_spaces # type: ignore[return-value]
100100

101101
@property
102102
def dtype(self) -> np.dtype:
@@ -222,13 +222,13 @@ def form_cpp_class(
222222
custom kernels using Numba or C.
223223
"""
224224
if np.issubdtype(dtype, np.float32):
225-
return _cpp.fem.Form_float32
225+
return _cpp.fem.Form_float32 # type: ignore[return-value]
226226
elif np.issubdtype(dtype, np.float64):
227-
return _cpp.fem.Form_float64
227+
return _cpp.fem.Form_float64 # type: ignore[return-value]
228228
elif np.issubdtype(dtype, np.complex64):
229-
return _cpp.fem.Form_complex64
229+
return _cpp.fem.Form_complex64 # type: ignore[return-value]
230230
elif np.issubdtype(dtype, np.complex128):
231-
return _cpp.fem.Form_complex128
231+
return _cpp.fem.Form_complex128 # type: ignore[return-value]
232232
else:
233233
raise NotImplementedError(f"Type {dtype} not supported.")
234234

@@ -313,7 +313,7 @@ def mixed_topology_form(
313313
V = [arg.ufl_function_space()._cpp_object for arg in form.arguments()]
314314

315315
# TODO coeffs, constants, subdomains, entity_maps
316-
f = ftype(
316+
f = ftype( # type: ignore[operator]
317317
[module.ffi.cast("uintptr_t", module.ffi.addressof(ufcx_form)) for ufcx_form in ufcx_forms],
318318
V,
319319
[],
@@ -588,13 +588,13 @@ def form_cpp_creator(
588588
custom kernels using Numba or C.
589589
"""
590590
if np.issubdtype(dtype, np.float32):
591-
return _cpp.fem.create_form_float32
591+
return _cpp.fem.create_form_float32 # type: ignore[return-value]
592592
elif np.issubdtype(dtype, np.float64):
593-
return _cpp.fem.create_form_float64
593+
return _cpp.fem.create_form_float64 # type: ignore[return-value]
594594
elif np.issubdtype(dtype, np.complex64):
595-
return _cpp.fem.create_form_complex64
595+
return _cpp.fem.create_form_complex64 # type: ignore[return-value]
596596
elif np.issubdtype(dtype, np.complex128):
597-
return _cpp.fem.create_form_complex128
597+
return _cpp.fem.create_form_complex128 # type: ignore[return-value]
598598
else:
599599
raise NotImplementedError(f"Type {dtype} not supported.")
600600

python/dolfinx/fem/function.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def _interpolate(u0):
469469
@_interpolate.register(Function)
470470
def _(u0: Function):
471471
"""Interpolate a fem.Function."""
472-
self._cpp_object.interpolate(u0._cpp_object, cells0, cells1)
472+
self._cpp_object.interpolate(u0._cpp_object, cells0, cells1) # type: ignore[arg-type]
473473

474474
@_interpolate.register(int)
475475
def _(u0_ptr: int):
@@ -503,7 +503,7 @@ def copy(self) -> Function:
503503
"""
504504
return Function(
505505
self.function_space,
506-
la.Vector(type(self.x._cpp_object)(self.x._cpp_object)),
506+
la.Vector(type(self.x._cpp_object)(self.x._cpp_object)), # type: ignore[arg-type]
507507
name=self.name,
508508
)
509509

@@ -637,9 +637,9 @@ def functionspace(
637637

638638
# Initialize the cpp.FunctionSpace
639639
try:
640-
cppV = _cpp.fem.FunctionSpace_float64(mesh._cpp_object, element._cpp_object, cpp_dofmap) # type: ignore
640+
cppV = _cpp.fem.FunctionSpace_float64(mesh._cpp_object, element._cpp_object, cpp_dofmap) # type: ignore[arg-type]
641641
except TypeError:
642-
cppV = _cpp.fem.FunctionSpace_float32(mesh._cpp_object, element._cpp_object, cpp_dofmap) # type: ignore
642+
cppV = _cpp.fem.FunctionSpace_float32(mesh._cpp_object, element._cpp_object, cpp_dofmap) # type: ignore[arg-type]
643643

644644
return FunctionSpace(mesh, ufl_e, cppV)
645645

python/dolfinx/fem/petsc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,10 @@ def _(
456456
raise ValueError(
457457
"Cannot have a entire {'row' if index == 0 else 'column'} of a full of None"
458458
)
459-
is0 = _cpp.la.petsc.create_index_sets(
459+
is0 = _cpp.la.petsc.create_index_sets( # type: ignore[attr-defined]
460460
[(Vsub.dofmaps(0).index_map, Vsub.dofmaps(0).index_map_bs) for Vsub in V[0]] # type: ignore[union-attr]
461461
)
462-
is1 = _cpp.la.petsc.create_index_sets(
462+
is1 = _cpp.la.petsc.create_index_sets( # type: ignore[attr-defined]
463463
[(Vsub.dofmaps(0).index_map, Vsub.dofmaps(0).index_map_bs) for Vsub in V[1]] # type: ignore[union-attr]
464464
)
465465

python/dolfinx/geometry.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def compute_collisions_trees(
164164
is ``(num_collisions, 2)``.
165165
166166
"""
167-
return _cpp.geometry.compute_collisions_trees(tree0._cpp_object, tree1._cpp_object)
167+
return _cpp.geometry.compute_collisions_trees(tree0._cpp_object, tree1._cpp_object) # type: ignore[arg-type]
168168

169169

170170
def compute_collisions_points(tree: BoundingBoxTree, x: npt.NDArray[np.floating]) -> AdjacencyList:
@@ -182,7 +182,7 @@ def compute_collisions_points(tree: BoundingBoxTree, x: npt.NDArray[np.floating]
182182
point.
183183
184184
"""
185-
return AdjacencyList(_cpp.geometry.compute_collisions_points(tree._cpp_object, x))
185+
return AdjacencyList(_cpp.geometry.compute_collisions_points(tree._cpp_object, x)) # type: ignore[arg-type]
186186

187187

188188
def compute_closest_entity(
@@ -207,7 +207,10 @@ def compute_closest_entity(
207207
208208
"""
209209
return _cpp.geometry.compute_closest_entity(
210-
tree._cpp_object, midpoint_tree._cpp_object, mesh._cpp_object, points
210+
tree._cpp_object,
211+
midpoint_tree._cpp_object,
212+
mesh._cpp_object,
213+
points, # type: ignore[arg-type]
211214
)
212215

213216

@@ -287,7 +290,7 @@ def compute_distance_gjk(
287290
if np.issubdtype(p.dtype, np.float32):
288291
return _cpp.geometry.compute_distance_gjk_float32(p, q)
289292
elif np.issubdtype(p.dtype, np.float64):
290-
return _cpp.geometry.compute_distance_gjk_float64(p, q)
293+
return _cpp.geometry.compute_distance_gjk_float64(p, q) # type: ignore[arg-type, return-value]
291294
raise RuntimeError("Invalid dtype in compute_distance_gjk")
292295

293296

@@ -315,7 +318,7 @@ def compute_distances_gjk(
315318
if np.issubdtype(q.dtype, np.float32):
316319
return _cpp.geometry.compute_distances_gjk_float32(bodies, q, num_threads)
317320
elif np.issubdtype(q.dtype, np.float64):
318-
return _cpp.geometry.compute_distances_gjk_float64(bodies, q, num_threads)
321+
return _cpp.geometry.compute_distances_gjk_float64(bodies, q, num_threads) # type: ignore[arg-type, return-value]
319322
raise RuntimeError("Invalid dtype in compute_distances_gjk")
320323

321324

0 commit comments

Comments
 (0)