Exemplo n.º 1
0
    def __repr__(self):
        cls_name = self.__class__.__name__
        parent_repr = super().__repr__()
        step_attrs = ["name", "n_outputs"]

        # Insert Step attributes into the parent repr
        # if the repr has the sklearn pattern
        sklearn_pattern = r"^" + cls_name + r"\((.*)\)$"
        match = re.search(sklearn_pattern, parent_repr, re.DOTALL)
        if match:
            parent_args = match.group(1)
            indentations = re.findall("[ \t]{2,}", parent_args)
            indent = min(indentations, key=len) if indentations else ""
            step_args = make_args_from_attrs(self, step_attrs)
            repr = "{}({},\n{}{})".format(cls_name, step_args, indent,
                                          parent_args)
            return repr

        else:
            return make_repr(self, step_attrs)
Exemplo n.º 2
0
 def __repr__(self):
     step_attrs = ["name"]
     return make_repr(self, step_attrs)
Exemplo n.º 3
0
 def __repr__(self):
     attrs = ["step", "port", "name"]
     return make_repr(self, attrs)