Skip to content

Commit

Permalink
Merge pull request #1051 from ioam/help_url_fix
Browse files Browse the repository at this point in the history
Fixed broken URL in help output
  • Loading branch information
philippjfr authored Jan 16, 2017
2 parents 4deedc8 + d1e98ff commit a026702
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
6 changes: 4 additions & 2 deletions holoviews/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from .operation import ElementOperation, MapOperation, TreeOperation # noqa (API import)
from .element import * # noqa (API import)
from . import util # noqa (API import)
from .element import __all__ as elements_list

# Surpress warnings generated by NumPy in matplotlib
# Expected to be fixed in next matplotlib release
Expand Down Expand Up @@ -60,7 +61,7 @@ def __call__(self, *args, **opts):
pass


def help(obj, visualization=True, ansi=True, backend='matplotlib',
def help(obj, visualization=True, ansi=True, backend=None,
recursive=False, pattern=None):
"""
Extended version of the built-in help that supports parameterized
Expand All @@ -72,8 +73,9 @@ def help(obj, visualization=True, ansi=True, backend='matplotlib',
If ansi is set to False, all ANSI color
codes are stripped out.
"""
backend = backend if backend else Store.current_backend
info = Store.info(obj, ansi=ansi, backend=backend, visualization=visualization,
recursive=recursive, pattern=pattern)
recursive=recursive, pattern=pattern, elements=elements_list)

msg = ( "\nTo view the visualization options applicable to this "
"object or class, use:\n\n"
Expand Down
5 changes: 3 additions & 2 deletions holoviews/core/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ def dumps(cls, obj, protocol=0):

@classmethod
def info(cls, obj, ansi=True, backend='matplotlib', visualization=True,
recursive=False, pattern=None):
recursive=False, pattern=None, elements=[]):
"""
Show information about a particular object or component class
including the applicable style and plot options. Returns None if
Expand All @@ -934,7 +934,8 @@ def info(cls, obj, ansi=True, backend='matplotlib', visualization=True,
info = None
if parameterized_object or parameterized_class:
info = InfoPrinter.info(obj, ansi=ansi, backend=backend,
visualization=visualization, pattern=pattern)
visualization=visualization,
pattern=pattern, elements=elements)

if parameterized_object and recursive:
hierarchy = obj.traverse(lambda x: type(x))
Expand Down
12 changes: 8 additions & 4 deletions holoviews/core/pprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class InfoPrinter(object):
ansi_escape = re.compile(r'\x1b[^m]*m')
ppager = ParamPager()
store = None
elements = []

@classmethod
def get_parameter_info(cls, obj, ansi=False, show_values=True,
Expand Down Expand Up @@ -126,11 +127,13 @@ def highlight(cls, pattern, string):


@classmethod
def info(cls, obj, ansi=False, backend='matplotlib', visualization=True, pattern=None):
def info(cls, obj, ansi=False, backend='matplotlib', visualization=True,
pattern=None, elements=[]):
"""
Show information about an object in the given category. ANSI
color codes may be enabled or disabled.
"""
cls.elements = elements
ansi_escape = re.compile(r'\x1b[^m]*m')

isclass = isinstance(obj, type)
Expand Down Expand Up @@ -212,11 +215,12 @@ def target_info(cls, obj, ansi=False):
@classmethod
def object_info(cls, obj, name, ansi=False):
element = not getattr(obj, '_deep_indexable', False)
url = ('https://ioam.github.io/holoviews/Tutorials/Elements.html#{obj}'
if element else 'https://ioam.github.io/holoviews/Tutorials/Containers.html#{obj}')
url = ('http://holoviews.org/Tutorials/Elements.html#{obj}'
if element else 'http://holoviews.org/Tutorials/Containers.html#{obj}')
link = url.format(obj=name)

msg = ("\nOnline example: {link}"
link = None if element and (name not in cls.elements) else link
msg = ("\nOnline example: {link}" if link else ''
+ "\nHelp for the data object: holoviews.help({obj})"
+ " or holoviews.help(<{lower}_instance>)")

Expand Down
2 changes: 1 addition & 1 deletion holoviews/element/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ def vectorfield(self, kdims=None, vdims=None, mdims=None, **kwargs):

def public(obj):
if not isinstance(obj, type): return False
return issubclass(obj, ViewableElement)
return issubclass(obj, Element)

__all__ = list(set([_k for _k, _v in locals().items() if public(_v)]))
3 changes: 2 additions & 1 deletion holoviews/plotting/mpl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from ...core import Layout, NdOverlay, Collator, GridMatrix
from ...core.options import Cycle, Palette, Options
from ...core.overlay import NdOverlay, Overlay
from ...element import * # noqa (API import)
from ..plot import PlotSelector
from .annotation import * # noqa (API import)
Expand Down Expand Up @@ -108,7 +109,7 @@ def grid_selector(grid):
VectorField: VectorFieldPlot,
ErrorBars: ErrorPlot,
Spread: SpreadPlot,
Spikes: SpikesPlot,
Spikes: SpikesPlot,
BoxWhisker: BoxPlot,
Area: AreaPlot,

Expand Down

0 comments on commit a026702

Please sign in to comment.