From b1690d6e5dace76fc794ddb91dfbb8067fd67caf Mon Sep 17 00:00:00 2001 From: Neil Vaytet Date: Thu, 31 Aug 2023 14:05:05 +0200 Subject: [PATCH 1/2] use str repr for param table html repr when __name__ does not exist --- src/sciline/param_table.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sciline/param_table.py b/src/sciline/param_table.py index 585f7e8e..98f2e26e 100644 --- a/src/sciline/param_table.py +++ b/src/sciline/param_table.py @@ -76,7 +76,10 @@ def __repr__(self) -> str: def _repr_html_(self) -> str: return ( f"" - + "".join(f"" for k in self._columns.keys()) + + "".join( + f"" + for k in self._columns.keys() + ) + "" + "".join( f"" + "".join(f"" for v in row) + "" From 344a1720bf63b9b5ae96d573938b0fda5ae74563 Mon Sep 17 00:00:00 2001 From: Neil Vaytet Date: Thu, 31 Aug 2023 15:43:31 +0200 Subject: [PATCH 2/2] improve string reprs --- src/sciline/param_table.py | 2 +- src/sciline/series.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sciline/param_table.py b/src/sciline/param_table.py index 98f2e26e..50ff35b9 100644 --- a/src/sciline/param_table.py +++ b/src/sciline/param_table.py @@ -71,7 +71,7 @@ def __len__(self) -> int: return self._columns.__len__() def __repr__(self) -> str: - return f"ParamTable(row_dim={self.row_dim}, columns={self._columns})" + return f"ParamTable(row_dim={self.row_dim.__name__}, columns={self._columns})" def _repr_html_(self) -> str: return ( diff --git a/src/sciline/series.py b/src/sciline/series.py index fb82ca0b..2b5b5607 100644 --- a/src/sciline/series.py +++ b/src/sciline/series.py @@ -43,7 +43,7 @@ def __getitem__(self, key: Key) -> Value: return self._map[key] def __repr__(self) -> str: - return f"Series(row_dim={self.row_dim}, {self._map})" + return f"Series(row_dim={self.row_dim.__name__}, {self._map})" def _repr_html_(self) -> str: return (
{self.row_dim.__name__}{k.__name__}{getattr(k, '__name__', str(k).split('.')[-1])}
{idx}{v}