From 81a14c2894d0c724c8561a265cc960d519818267 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Wed, 13 Feb 2019 10:55:47 +0100 Subject: [PATCH] Fix repr of ImmutableCuttingRecord to actually cut the underscore fields --- python/dune/codegen/sumfact/accumulation.py | 3 --- python/dune/codegen/sumfact/basis.py | 6 ------ python/dune/codegen/sumfact/geometry.py | 6 ------ python/dune/codegen/tools.py | 3 +++ 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/python/dune/codegen/sumfact/accumulation.py b/python/dune/codegen/sumfact/accumulation.py index e0a11c14..ae4a7630 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 b9466e26..c9b75eb4 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 90023037..d37558f5 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 3374cc71..0726adc8 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("_"))) -- GitLab