Skip to content

Commit

Permalink
fix meta
Browse files Browse the repository at this point in the history
  • Loading branch information
fkiraly committed Apr 26, 2023
1 parent 3efdea3 commit f6b582f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions skbase/base/_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
from inspect import isclass
from typing import TYPE_CHECKING, Any, Dict, List, Sequence, Tuple, Union, overload

from sklearn.utils._estimator_html_repr import _VisualBlock

from skbase.base._base import BaseEstimator, BaseObject
from skbase.base._pretty_printing._object_html_repr import _VisualBlock
from skbase.utils._iter import _format_seq_to_str, make_strings_unique
from skbase.validate import is_named_object_tuple

Expand Down Expand Up @@ -657,8 +656,9 @@ def concat(x, y):
def _sk_visual_block_(self):
"""Logic to help render meta estimator as visual HTML block."""
# Use tag interface that will be available when mixin is used
named_object_attr = self.get_tag("named_object_parameters") # type: ignore
named_objects = getattr(self, named_object_attr)
named_object_attr_name = self.get_tag("named_object_parameters") # type: ignore
named_object_attr = getattr(self, named_object_attr_name)
named_objects = self._coerce_to_named_object_tuples(named_object_attr)
_, objs = self._get_names_and_objects(named_objects)

def _get_name(name, obj):
Expand All @@ -667,7 +667,7 @@ def _get_name(name, obj):
# Is an estimator
return f"{name}: {obj.__class__.__name__}"

names = [_get_name(name, est) for name, est in self.steps]
names = [_get_name(name, est) for name, est in named_objects]
name_details = [str(obj) for obj in objs]
return _VisualBlock(
"serial",
Expand Down
4 changes: 2 additions & 2 deletions skbase/base/_pretty_printing/_object_html_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import html
import uuid
from contextlib import closing, suppress
from contextlib import closing
from io import StringIO
from string import Template

Expand Down Expand Up @@ -91,7 +91,7 @@ def _write_label_html(

def _get_visual_block(base_object):
"""Generate information about how to display a BaseObject."""
with suppress(AttributeError):
if hasattr(base_object, "_sk_visual_block_"):
return base_object._sk_visual_block_()

if isinstance(base_object, str):
Expand Down

0 comments on commit f6b582f

Please sign in to comment.