diff --git a/param/parameterized.py b/param/parameterized.py index 696263cd2..695f8d12b 100644 --- a/param/parameterized.py +++ b/param/parameterized.py @@ -2400,9 +2400,55 @@ def type_script_repr(type_,imports,prefix,settings): dbprint_prefix=None +def name_if_set(parameterized): + """Return the name of this Parameterized if explicitly set to other than the default""" + class_name = parameterized.__class__.__name__ + default_name = re.match('^'+class_name+'[0-9]+$', parameterized.name) + return '' if default_name else parameterized.name - +def _get_param_repr(key, val, p, truncate=40): + """HTML representation for a single Parameter object and its value""" + if hasattr(val, "_repr_html_"): + try: + value = val._repr_html_(open=False) + except: + value = val._repr_html_() + else: + rep = repr(val) + value = (rep[:truncate] + '..') if len(rep) > truncate else rep + + constant = 'C' if p.constant else 'V' + readonly = 'RO' if p.readonly else 'RW' + allow_None = ' AN' if hasattr(p, 'allow_None') and p.allow_None else '' + mode = '%s %s%s' % (constant, readonly, allow_None) + + return f'
Name | Type | Bounds | Mode | Value |
---|