Skip to content

Commit 5019974

Browse files
committed
lint
1 parent a7700bb commit 5019974

File tree

3 files changed

+36
-38
lines changed

3 files changed

+36
-38
lines changed

firedrake/assemble.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,8 +1585,8 @@ def allocate(self):
15851585
appctx=self._appctx
15861586
)
15871587
return matrix.ImplicitMatrix(
1588-
self._form, ctx, self._bcs,
1589-
fc_params=self._form_compiler_params,
1588+
self._form, ctx, self._bcs,
1589+
fc_params=self._form_compiler_params,
15901590
options_prefix=self._options_prefix
15911591
)
15921592

firedrake/matrix.py

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
from __future__ import annotations
2-
from typing import Any, Iterable, Literal, TYPE_CHECKING
2+
from typing import Any, Iterable, TYPE_CHECKING
33
import itertools
44

55
if TYPE_CHECKING:
66
from firedrake.bcs import BCBase
77
from firedrake.matrix_free.operators import ImplicitMatrixContext
88
from firedrake.slate.slate import TensorBase
9-
9+
1010
import ufl
1111
from ufl.argument import BaseArgument
1212
from pyop2 import op2
1313
from pyop2.utils import as_tuple
1414
from firedrake.petsc import PETSc
1515

1616

17-
1817
class DummyOP2Mat:
1918
"""A hashable implementation of M.handle"""
2019
def __init__(self, handle):
@@ -24,11 +23,11 @@ def __init__(self, handle):
2423
class MatrixBase(ufl.Matrix):
2524

2625
def __init__(
27-
self,
28-
a: ufl.BaseForm | TensorBase | tuple[BaseArgument, BaseArgument],
29-
bcs: Iterable[BCBase] | None = None,
30-
fc_params: dict[str, Any] | None = None,
31-
):
26+
self,
27+
a: ufl.BaseForm | TensorBase | tuple[BaseArgument, BaseArgument],
28+
bcs: Iterable[BCBase] | None = None,
29+
fc_params: dict[str, Any] | None = None,
30+
):
3231
"""A representation of the linear operator associated with a bilinear form and bcs.
3332
Explicitly assembled matrices and matrix-free .matrix classes will derive from this.
3433
@@ -143,13 +142,13 @@ def zero(self):
143142
class Matrix(MatrixBase):
144143

145144
def __init__(
146-
self,
147-
a: ufl.BaseForm,
148-
mat: op2.Mat | PETSc.Mat,
149-
bcs: Iterable[BCBase] | None = None,
150-
fc_params: dict[str, Any] | None = None,
151-
options_prefix: str | None = None,
152-
):
145+
self,
146+
a: ufl.BaseForm,
147+
mat: op2.Mat | PETSc.Mat,
148+
bcs: Iterable[BCBase] | None = None,
149+
fc_params: dict[str, Any] | None = None,
150+
options_prefix: str | None = None,
151+
):
153152
"""A representation of an assembled bilinear form.
154153
155154
Parameters
@@ -187,15 +186,15 @@ def assemble(self):
187186
class ImplicitMatrix(MatrixBase):
188187

189188
def __init__(
190-
self,
191-
a: ufl.BaseForm,
192-
ctx: ImplicitMatrixContext,
193-
bcs: Iterable[BCBase] | None = None,
194-
fc_params: dict[str, Any] | None = None,
195-
options_prefix: str | None = None,
196-
):
197-
"""A representation of the action of bilinear form operating without
198-
explicitly assembling the associated matrix. This class wraps the
189+
self,
190+
a: ufl.BaseForm,
191+
ctx: ImplicitMatrixContext,
192+
bcs: Iterable[BCBase] | None = None,
193+
fc_params: dict[str, Any] | None = None,
194+
options_prefix: str | None = None,
195+
):
196+
"""A representation of the action of bilinear form operating without
197+
explicitly assembling the associated matrix. This class wraps the
199198
relevant information for Python PETSc matrix.
200199
201200
Parameters
@@ -236,12 +235,12 @@ def assemble(self):
236235
class AssembledMatrix(MatrixBase):
237236

238237
def __init__(
239-
self,
240-
args: tuple[BaseArgument, BaseArgument],
241-
petscmat: PETSc.Mat,
242-
bcs: Iterable[BCBase] | None = None,
243-
options_prefix: str | None = None,
244-
):
238+
self,
239+
args: tuple[BaseArgument, BaseArgument],
240+
petscmat: PETSc.Mat,
241+
bcs: Iterable[BCBase] | None = None,
242+
options_prefix: str | None = None,
243+
):
245244
"""A representation of a matrix that doesn't require knowing the underlying form.
246245
247246
Parameters

firedrake/matrix_free/operators.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,15 @@ class ImplicitMatrixContext(object):
6969
# (0,0) block of a 1x1 block matrix is on the diagonal).
7070
on_diag = True
7171

72-
7372
@PETSc.Log.EventDecorator()
7473
def __init__(
75-
self,
76-
a: ufl.BaseForm,
74+
self,
75+
a: ufl.BaseForm,
7776
row_bcs: Iterable[DirichletBC] | None = None,
7877
col_bcs: Iterable[DirichletBC] | None = None,
79-
fc_params : dict[str, Any] | None = None,
78+
fc_params: dict[str, Any] | None = None,
8079
appctx: dict[str, Any] | None = None
81-
):
80+
):
8281
"""This class gives the Python context for a PETSc Python matrix.
8382
8483
Parameters
@@ -97,7 +96,7 @@ def __init__(
9796
A dictionary of parameters to pass on to the form compiler.
9897
By default None.
9998
appctx
100-
Any extra user-supplied context, available to preconditioners
99+
Any extra user-supplied context, available to preconditioners
101100
and the like. By default None.
102101
"""
103102
from firedrake.assemble import get_assembler

0 commit comments

Comments
 (0)