Skip to content

Commit cd37bb3

Browse files
committed
misc: Fix some reprs
1 parent 2c1b089 commit cd37bb3

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

devito/operations/interpolators.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,12 @@ class WeightedInterpolator(GenericInterpolator):
220220
def __init__(self, sfunction):
221221
self.sfunction = sfunction
222222

223+
def __str__(self):
224+
return f'{self.__class__.__name__}({self.sfunction})'
225+
226+
def __repr__(self):
227+
return f'{self.__class__.__name__}({self.sfunction.name})'
228+
223229
@property
224230
def grid(self):
225231
return self.sfunction.grid

devito/tools/abc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __hash__(self):
3838
return hash((self.name, self.val))
3939

4040
def __str__(self):
41-
ret = self.name if self.val is None else f"{self.name}[{str(self.val)}]"
41+
ret = self.name if self.val is None else f"{self.name}({self.val!r})"
4242
return ret
4343

4444
__repr__ = __str__

devito/types/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def __init__(self, suffix=''):
107107
self.suffix = suffix
108108

109109
def __repr__(self):
110-
return f"Layer<{self.suffix}>"
110+
return f"HierarchyLayer({self.suffix!r})"
111111

112112
def __eq__(self, other):
113113
return (isinstance(other, HierarchyLayer) and

0 commit comments

Comments
 (0)