Skip to content

Commit

Permalink
Fixed flakes
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jul 21, 2019
1 parent a3a3e99 commit 72b1bac
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 39 deletions.
16 changes: 0 additions & 16 deletions holoviews/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1403,22 +1403,6 @@ def get_spec(obj):
obj.group, obj.label)


def find_file(folder, filename):
"""
Find a file given folder and filename. If the filename can be
resolved directly returns otherwise walks the supplied folder.
"""
matches = []
if os.path.isabs(filename) and os.path.isfile(filename):
return filename
for root, _, filenames in os.walk(folder):
for fn in fnmatch.filter(filenames, filename):
matches.append(os.path.join(root, fn))
if not matches:
raise IOError('File %s could not be found' % filename)
return matches[-1]


def is_dataframe(data):
"""
Checks whether the supplied data is of DataFrame type.
Expand Down
9 changes: 4 additions & 5 deletions holoviews/plotting/bokeh/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import base64
import logging
import signal
from io import BytesIO

import param
Expand All @@ -13,18 +12,18 @@
from bokeh.core.validation.warnings import EMPTY_LAYOUT, MISSING_RENDERERS
from bokeh.document import Document
from bokeh.embed.notebook import encode_utf8, notebook_content
from bokeh.io import curdoc, show as bkshow
from bokeh.io import curdoc
from bokeh.io.notebook import load_notebook
from bokeh.models import Model
from bokeh.protocol import Protocol
from bokeh.resources import CDN, INLINE
from bokeh.themes.theme import Theme
from panel.pane import HoloViews
from panel.pane import HoloViews, Viewable

from ...core import Store, HoloMap
from ..plot import Plot, GenericElementPlot
from ..plot import Plot
from ..renderer import Renderer, MIME_TYPES, HTML_TAGS
from .util import attach_periodic, compute_plot_size, bokeh_version, silence_warnings
from .util import compute_plot_size, silence_warnings


NOTEBOOK_DIV = """
Expand Down
9 changes: 5 additions & 4 deletions holoviews/plotting/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""
from __future__ import unicode_literals

import os, base64
import base64
from io import BytesIO
try:
from StringIO import StringIO
Expand All @@ -20,7 +20,7 @@

from ..core.io import Exporter
from ..core.options import Store, StoreOptions, SkipRendering, Compositor
from ..core.util import find_file, unicode, unbound_dimensions, basestring
from ..core.util import unicode, unbound_dimensions
from .. import Layout, HoloMap, AdjointLayout, DynamicMap

from . import Plot
Expand Down Expand Up @@ -218,7 +218,8 @@ def _validate(self, obj, fmt, **kwargs):
holomap_formats = self.mode_formats['holomap'][self.mode]

if fmt in ['auto', None]:
if any(len(o) > 1 or isinstance(o, DynamicMap) for o in obj.traverse(lambda x: x, HoloMap)):
if any(len(o) > 1 or (isinstance(o, DynamicMap) and unbound_dimensions(o)
for o in obj.traverse(lambda x: x, HoloMap)):
fmt = holomap_formats[0] if self.holomap == 'auto' else self.holomap
else:
fmt = fig_formats[0] if self.fig == 'auto' else self.fig
Expand Down Expand Up @@ -374,7 +375,7 @@ def export_widgets(self_or_cls, obj, filename, fmt=None, template=None,
if fmt not in self_or_cls.widgets+['auto', None]:
raise ValueError("Renderer.export_widget may only export "
"registered widget types.")
self.get_widget(obj, fmt).save(filename)
self_or_cls.get_widget(obj, fmt).save(filename)


@classmethod
Expand Down
14 changes: 0 additions & 14 deletions holoviews/plotting/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,20 +482,6 @@ def initialize_unbounded(obj, dimensions, key):
pass


def save_frames(obj, filename, fmt=None, backend=None, options=None):
"""
Utility to export object to files frame by frame, numbered individually.
Will use default backend and figure format by default.
"""
backend = Store.current_backend if backend is None else backend
renderer = Store.renderers[backend]
fmt = renderer.params('fig').objects[0] if fmt is None else fmt
plot = renderer.get_plot(obj)
for i in range(len(plot)):
plot.update(i)
renderer.save(plot, '%s_%s' % (filename, i), fmt=fmt, options=options)


def dynamic_update(plot, subplot, key, overlay, items):
"""
Given a plot, subplot and dynamically generated (Nd)Overlay
Expand Down

0 comments on commit 72b1bac

Please sign in to comment.