diff --git a/python/dune/codegen/sumfact/accumulation.py b/python/dune/codegen/sumfact/accumulation.py index e0a11c144678771bf74ecafddfb0b7e34355648e..ae4a763063f0dc25303fc517356b58b02551eebc 100644 --- a/python/dune/codegen/sumfact/accumulation.py +++ b/python/dune/codegen/sumfact/accumulation.py @@ -127,9 +127,6 @@ class AccumulationOutput(SumfactKernelInterfaceBase, ImmutableCuttingRecord): _permuted_matrix_sequence=matrix_sequence, ) - def __repr__(self): - return ImmutableCuttingRecord.__repr__(self) - def get_keyword_arguments(self): """Get dictionary of keyword arguments needed to initialize this class diff --git a/python/dune/codegen/sumfact/basis.py b/python/dune/codegen/sumfact/basis.py index b9466e260776fbef31cab9252fbb0c203569a6f5..c9b75eb445af01e9420e850650b12054dd0115f3 100644 --- a/python/dune/codegen/sumfact/basis.py +++ b/python/dune/codegen/sumfact/basis.py @@ -264,12 +264,6 @@ class LFSSumfactKernelInput(SumfactKernelInterfaceBase, ImmutableCuttingRecord): _permuted_matrix_sequence=matrix_sequence, ) - def __repr__(self): - return ImmutableCuttingRecord.__repr__(self) - - def __str__(self): - return repr(self) - def get_keyword_arguments(self): """Get dictionary of keyword arguments needed to initialize this class diff --git a/python/dune/codegen/sumfact/geometry.py b/python/dune/codegen/sumfact/geometry.py index 900230374f84d1ad3fcd59145d3408bb1fe487f5..d37558f5c40f42355b5fa99ed9a4ea25ab7ade28 100644 --- a/python/dune/codegen/sumfact/geometry.py +++ b/python/dune/codegen/sumfact/geometry.py @@ -369,12 +369,6 @@ class GeoCornersInput(SumfactKernelInterfaceBase, ImmutableCuttingRecord): _permuted_matrix_sequence=matrix_sequence, ) - def __repr__(self): - return ImmutableCuttingRecord.__repr__(self) - - def __str__(self): - return repr(self) - def get_keyword_arguments(self): """Get dictionary of keyword arguments needed to initialize this class diff --git a/python/dune/codegen/tools.py b/python/dune/codegen/tools.py index 3374cc71e6fb992ea9525c3ead52cd723558807d..0726adc8ff612825e1270f41ee95f2943e04738f 100644 --- a/python/dune/codegen/tools.py +++ b/python/dune/codegen/tools.py @@ -12,6 +12,9 @@ class ImmutableCuttingRecord(pytools.ImmutableRecord): A record implementation that drops fields starting with an underscore from hash and equality computation """ + def __repr__(self): + return "{}({})".format(type(self), ",".join(repr(getattr(self, f)) for f in self.__class__.fields if not f.startswith("_"))) + def __hash__(self): return hash((type(self),) + tuple(getattr(self, field) for field in self.__class__.fields if not field.startswith("_")))