Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 24 additions & 48 deletions .basedpyright/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -33593,6 +33593,14 @@
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
"startColumn": 12,
"endColumn": 17,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
Expand Down Expand Up @@ -36485,38 +36493,6 @@
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
"startColumn": 8,
"endColumn": 31,
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
"startColumn": 8,
"endColumn": 31,
"lineCount": 1
}
},
{
"code": "reportOptionalSubscript",
"range": {
"startColumn": 27,
"endColumn": 48,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 27,
"endColumn": 57,
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
Expand Down Expand Up @@ -36549,22 +36525,6 @@
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
"startColumn": 40,
"endColumn": 63,
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
"startColumn": 40,
"endColumn": 63,
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
Expand Down Expand Up @@ -54381,6 +54341,22 @@
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 19,
"endColumn": 37,
"lineCount": 1
}
},
{
"code": "reportUnknownMemberType",
"range": {
"startColumn": 19,
"endColumn": 36,
"lineCount": 1
}
},
{
"code": "reportAny",
"range": {
Expand Down
28 changes: 21 additions & 7 deletions sumpy/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,20 @@ class Kernel(ABC):
def is_complex_valued(self) -> bool:
"""A boolean flag indicating whether this kernel is complex valued."""

@override
def __repr__(self) -> str:
from dataclasses import fields

args: list[str] = []
for f in fields(self):
value = getattr(self, f.name)
if isinstance(value, prim.ExpressionNode):
args.append(f"{f.name}={value}")
else:
args.append(f"{f.name}={value!r}")

return f"{type(self).__name__}({', '.join(args)})"

def get_base_kernel(self) -> Kernel:
"""
:returns: the kernel being wrapped by this one, or else *self*.
Expand Down Expand Up @@ -381,7 +395,7 @@ def get_source_args(self) -> Sequence[KernelArgument]:
# }}}


@dataclass(frozen=True)
@dataclass(frozen=True, repr=False)
class ExpressionKernel(Kernel, ABC):
r"""
.. autoattribute:: expression
Expand Down Expand Up @@ -561,7 +575,7 @@ def get_pde_as_diff_op(self) -> LinearPDESystemOperator:
return laplacian(laplacian(w))


@dataclass(frozen=True)
@dataclass(frozen=True, repr=False)
class HelmholtzKernel(ExpressionKernel):
"""
.. autoattribute:: helmholtz_k_name
Expand Down Expand Up @@ -642,7 +656,7 @@ def get_pde_as_diff_op(self) -> LinearPDESystemOperator:
return laplacian(w) + k**2 * w


@dataclass(frozen=True)
@dataclass(frozen=True, repr=False)
class YukawaKernel(ExpressionKernel):
"""
.. autoattribute:: yukawa_lambda_name
Expand Down Expand Up @@ -729,7 +743,7 @@ def get_pde_as_diff_op(self) -> LinearPDESystemOperator:
return laplacian(w) - lam**2 * w


@dataclass(frozen=True)
@dataclass(frozen=True, repr=False)
class ElasticityKernel(ExpressionKernel):
"""
.. autoattribute:: icomp
Expand Down Expand Up @@ -858,7 +872,7 @@ def get_pde_as_diff_op(self) -> LinearPDESystemOperator:
return laplacian(laplacian(w))


@dataclass(frozen=True)
@dataclass(frozen=True, repr=False)
class StokesletKernel(ElasticityKernel):
"""
.. autoattribute:: icomp
Expand Down Expand Up @@ -898,7 +912,7 @@ def __str__(self) -> str:
f"({self.viscosity_mu}, {self.poisson_ratio})")


@dataclass(frozen=True)
@dataclass(frozen=True, repr=False)
class StressletKernel(ExpressionKernel):
"""
.. autoattribute:: icomp
Expand Down Expand Up @@ -981,7 +995,7 @@ def get_pde_as_diff_op(self) -> LinearPDESystemOperator:
return laplacian(laplacian(w))


@dataclass(frozen=True)
@dataclass(frozen=True, repr=False)
class LineOfCompressionKernel(ExpressionKernel):
"""A kernel for the line of compression or dilatation of constant strength
along the axis "axis" from zero to negative infinity.
Expand Down
Loading