Skip to content

Commit 57e5d2d

Browse files
committed
lint
1 parent 9ea8a44 commit 57e5d2d

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,12 +1,12 @@
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
@@ -15,7 +15,6 @@
1515
from firedrake.petsc import PETSc
1616

1717

18-
1918
class DummyOP2Mat:
2019
"""A hashable implementation of M.handle"""
2120
def __init__(self, handle):
@@ -25,11 +24,11 @@ def __init__(self, handle):
2524
class MatrixBase(ufl.Matrix):
2625

2726
def __init__(
28-
self,
29-
a: ufl.BaseForm | TensorBase | tuple[BaseArgument, BaseArgument],
30-
bcs: Iterable[BCBase] | None = None,
31-
fc_params: dict[str, Any] | None = None,
32-
):
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+
):
3332
"""A representation of the linear operator associated with a bilinear form and bcs.
3433
Explicitly assembled matrices and matrix-free .matrix classes will derive from this.
3534
@@ -145,13 +144,13 @@ def zero(self):
145144
class Matrix(MatrixBase):
146145

147146
def __init__(
148-
self,
149-
a: ufl.BaseForm,
150-
mat: op2.Mat | PETSc.Mat,
151-
bcs: Iterable[BCBase] | None = None,
152-
fc_params: dict[str, Any] | None = None,
153-
options_prefix: str | None = None,
154-
):
147+
self,
148+
a: ufl.BaseForm,
149+
mat: op2.Mat | PETSc.Mat,
150+
bcs: Iterable[BCBase] | None = None,
151+
fc_params: dict[str, Any] | None = None,
152+
options_prefix: str | None = None,
153+
):
155154
"""A representation of an assembled bilinear form.
156155
157156
Parameters
@@ -189,15 +188,15 @@ def assemble(self):
189188
class ImplicitMatrix(MatrixBase):
190189

191190
def __init__(
192-
self,
193-
a: ufl.BaseForm,
194-
ctx: ImplicitMatrixContext,
195-
bcs: Iterable[BCBase] | None = None,
196-
fc_params: dict[str, Any] | None = None,
197-
options_prefix: str | None = None,
198-
):
199-
"""A representation of the action of bilinear form operating without
200-
explicitly assembling the associated matrix. This class wraps the
191+
self,
192+
a: ufl.BaseForm,
193+
ctx: ImplicitMatrixContext,
194+
bcs: Iterable[BCBase] | None = None,
195+
fc_params: dict[str, Any] | None = None,
196+
options_prefix: str | None = None,
197+
):
198+
"""A representation of the action of bilinear form operating without
199+
explicitly assembling the associated matrix. This class wraps the
201200
relevant information for Python PETSc matrix.
202201
203202
Parameters
@@ -238,12 +237,12 @@ def assemble(self):
238237
class AssembledMatrix(MatrixBase):
239238

240239
def __init__(
241-
self,
242-
args: tuple[BaseArgument, BaseArgument],
243-
petscmat: PETSc.Mat,
244-
bcs: Iterable[BCBase] | None = None,
245-
options_prefix: str | None = None,
246-
):
240+
self,
241+
args: tuple[BaseArgument, BaseArgument],
242+
petscmat: PETSc.Mat,
243+
bcs: Iterable[BCBase] | None = None,
244+
options_prefix: str | None = None,
245+
):
247246
"""A representation of a matrix that doesn't require knowing the underlying form.
248247
249248
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)