Skip to content

Commit

Permalink
Cleaned up flakes
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Nov 13, 2017
1 parent 476fa9c commit c391e6d
Show file tree
Hide file tree
Showing 33 changed files with 39 additions and 70 deletions.
2 changes: 1 addition & 1 deletion holoviews/__init__.py
@@ -1,6 +1,6 @@

from __future__ import print_function, absolute_import
import os, sys, pydoc
import os, pydoc

import numpy as np # noqa (API import)
import param
Expand Down
2 changes: 1 addition & 1 deletion holoviews/core/data/__init__.py
Expand Up @@ -9,7 +9,7 @@
import param

from ..dimension import redim
from ..util import dimension_range, basestring
from ..util import dimension_range
from .interface import Interface, iloc, ndloc
from .array import ArrayInterface
from .dictionary import DictInterface
Expand Down
1 change: 0 additions & 1 deletion holoviews/core/data/dictionary.py
@@ -1,5 +1,4 @@
from collections import OrderedDict
from itertools import compress

try:
import itertools.izip as zip
Expand Down
3 changes: 1 addition & 2 deletions holoviews/core/data/multipath.py
Expand Up @@ -120,7 +120,7 @@ def select(cls, dataset, selection_mask=None, **selection):
"""
Applies selectiong on all the subpaths.
"""
if not self.dataset.data:
if not dataset.data:
return []
ds = cls._inner_dataset_template(dataset)
data = []
Expand Down Expand Up @@ -208,7 +208,6 @@ def values(cls, dataset, dimension, expanded, flat):
return np.array([])
values = []
ds = cls._inner_dataset_template(dataset)
didx = dataset.get_dimension_index(dimension)
for d in dataset.data:
ds.data = d
dvals = ds.interface.values(ds, dimension, expanded, flat)
Expand Down
3 changes: 1 addition & 2 deletions holoviews/core/element.py
@@ -1,4 +1,3 @@
import operator
from itertools import groupby
import numpy as np

Expand All @@ -10,7 +9,7 @@
from .overlay import Overlayable, NdOverlay, CompositeOverlay
from .spaces import HoloMap, GridSpace
from .tree import AttrTree
from .util import dimension_sort, get_param_values, unique_array
from .util import get_param_values


class Element(ViewableElement, Composable, Overlayable):
Expand Down
2 changes: 1 addition & 1 deletion holoviews/core/options.py
Expand Up @@ -874,7 +874,7 @@ def map(cls, obj, mode='data', backend=None):
Applies compositor operations to any HoloViews element or container
using the map method.
"""
from .overlay import Overlay, CompositeOverlay
from .overlay import CompositeOverlay
element_compositors = [c for c in cls.definitions if len(c._pattern_spec) == 1]
overlay_compositors = [c for c in cls.definitions if len(c._pattern_spec) > 1]
if overlay_compositors:
Expand Down
2 changes: 1 addition & 1 deletion holoviews/element/chart.py
Expand Up @@ -391,7 +391,7 @@ def stack(cls, areas):
method.
"""
if not len(areas):
return stacked
return areas
baseline = np.zeros(len(areas.values()[0]))
stacked = areas.clone(shared_data=False)
vdims = [areas.values()[0].vdims[0], 'Baseline']
Expand Down
2 changes: 1 addition & 1 deletion holoviews/element/path.py
Expand Up @@ -15,7 +15,7 @@

import param
from ..core import Dimension, Element2D, Dataset
from ..core.data import MultiInterface, ArrayInterface
from ..core.data import MultiInterface
from ..core.util import disable_constant


Expand Down
2 changes: 1 addition & 1 deletion holoviews/element/raster.py
Expand Up @@ -8,7 +8,7 @@
from ..core import Dimension, Element2D, Overlay, Dataset
from ..core.boundingregion import BoundingRegion, BoundingBox
from ..core.sheetcoords import SheetCoordinateSystem, Slice
from ..core.util import max_range, dimension_range, compute_density, datetime_types
from ..core.util import dimension_range, compute_density, datetime_types
from .chart import Curve
from .tabular import Table
from .util import compute_edges, compute_slice_bounds, categorical_aggregate2d
Expand Down
8 changes: 4 additions & 4 deletions holoviews/element/stats.py
Expand Up @@ -3,8 +3,8 @@

from ..core.dimension import Dimension, process_dimensions
from ..core.element import Element
from ..core.util import get_param_values
from .chart import Chart, Scatter
from ..core.util import get_param_values, OrderedDict
from .chart import Chart


class StatisticsElement(Chart):
Expand Down Expand Up @@ -72,10 +72,10 @@ def dframe(self, dimensions=None):
a DataFrame a copy is returned.
"""
if dimensions:
dimensions = [self.get_dimension(d, strict=True) for d in dimensions]
dimensions = [self.get_dimension(d, strict=True) for d in dimensions
if d in dimensions.kdims]
else:
dimensions = dimensions.kdims
dim = [dim.name for dim in dims if dim in dimensions.kdims]
return self.interface.dframe(self, dimensions)


Expand Down
1 change: 0 additions & 1 deletion holoviews/ipython/__init__.py
Expand Up @@ -15,7 +15,6 @@
from .magics import load_magics
from .display_hooks import display # noqa (API import)
from .display_hooks import set_display_hooks
from .widgets import RunProgress


AttrTree._disabled_prefixes = ['_repr_','_ipython_canary_method_should_not_exist']
Expand Down
11 changes: 2 additions & 9 deletions holoviews/operation/datashader.py
Expand Up @@ -14,12 +14,6 @@

ds_version = LooseVersion(ds.__version__)

from datashader.core import bypixel
from datashader.pandas import pandas_pipeline
from datashader.dask import dask_pipeline
from datashape.dispatch import dispatch
from datashape import discover as dsdiscover

try:
from datashader.bundling import (directly_connect_edges as connect_edges,
hammer_bundle)
Expand All @@ -28,12 +22,11 @@

from ..core import (Operation, Element, Dimension, NdOverlay,
CompositeOverlay, Dataset)
from ..core.data import PandasInterface, DaskInterface, XArrayInterface
from ..core.data import PandasInterface, XArrayInterface
from ..core.sheetcoords import BoundingBox
from ..core.util import get_param_values, basestring, datetime_types, dt_to_int
from ..element import Image, Path, Curve, Contours, RGB, Graph
from ..element import Image, Path, Curve, RGB, Graph
from ..streams import RangeXY, PlotSize
from ..plotting.util import fire


class ResamplingOperation(Operation):
Expand Down
2 changes: 1 addition & 1 deletion holoviews/operation/element.py
Expand Up @@ -12,7 +12,7 @@
from ..core import (Operation, NdOverlay, Overlay, GridMatrix,
HoloMap, Dataset, Element, Collator, Dimension)
from ..core.data import ArrayInterface, DictInterface
from ..core.util import (find_minmax, group_sanitizer, label_sanitizer, pd,
from ..core.util import (group_sanitizer, label_sanitizer, pd,
basestring, datetime_types)
from ..element.chart import Histogram, Scatter
from ..element.raster import Raster, Image, RGB, QuadMesh
Expand Down
4 changes: 1 addition & 3 deletions holoviews/operation/stats.py
Expand Up @@ -2,10 +2,8 @@
import numpy as np

from ..core import Dimension, Dataset, NdOverlay
from ..core.dimension import Dimension
from ..core.operation import Operation
from ..core.options import Compositor, Store, Options, StoreOptions
from ..core.util import basestring, find_minmax, cartesian_product
from ..core.util import basestring, cartesian_product
from ..element import (Curve, Area, Image, Distribution, Bivariate,
Contours, Polygons)

Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/__init__.py
Expand Up @@ -40,7 +40,7 @@
from .renderer import BokehRenderer
from .stats import DistributionPlot, BivariatePlot
from .tabular import TablePlot
from .util import bokeh_version
from .util import bokeh_version # noqa (API import)


Store.renderers['bokeh'] = BokehRenderer.instance()
Expand Down
1 change: 0 additions & 1 deletion holoviews/plotting/bokeh/callbacks.py
@@ -1,4 +1,3 @@
import datetime as dt
from collections import defaultdict

from bokeh.models import CustomJS, FactorRange, DatetimeAxis
Expand Down
9 changes: 4 additions & 5 deletions holoviews/plotting/bokeh/chart.py
Expand Up @@ -2,8 +2,8 @@

import numpy as np
import param
from bokeh.models import (DataRange1d, CategoricalColorMapper, CustomJS,
HoverTool, FactorRange, Whisker, Band, Range1d)
from bokeh.models import (CategoricalColorMapper, CustomJS, HoverTool,
FactorRange, Whisker, Band, Range1d)
from bokeh.models.tools import BoxSelectTool

from ...core import Dataset, OrderedDict
Expand All @@ -15,7 +15,6 @@
from ..util import compute_sizes, get_min_distance, dim_axis_label
from .element import (ElementPlot, ColorbarPlot, LegendPlot, CompositeElementPlot,
line_properties, fill_properties)
from .path import PathPlot, PolygonPlot
from .util import expand_batched_style, categorize_array, rgb2hex, mpl_to_bokeh


Expand Down Expand Up @@ -764,7 +763,7 @@ def _add_color_data(self, ds, ranges, style, cdim, data, mapping, factors, color
mapping.update(cmapping)
for k, cd in cdata.items():
if self.color_index is None and cd.dtype.kind in 'if':
cd = categorize_array(cd, color_dim)
cd = categorize_array(cd, cdim)
if k not in data or len(data[k]) != [len(data[key]) for key in data if key != k][0]:
data[k].append(cd)
else:
Expand Down Expand Up @@ -1038,7 +1037,7 @@ def get_data(self, element, ranges, style):
upper = min(q3 + 1.5*iqr, vals.max())
lower = max(q1 - 1.5*iqr, vals.min())
else:
qmin, q1, q2, q3, qmax = 0, 0, 0, 0, 0
q1, q2, q3 = 0, 0, 0
lower, upper = 0, 0
outliers = vals[(vals>upper) | (vals<lower)]
# Add to CDS data
Expand Down
4 changes: 1 addition & 3 deletions holoviews/plotting/bokeh/element.py
Expand Up @@ -19,7 +19,7 @@
LogColorMapper, ColorBar = None, None
from bokeh.plotting.helpers import _known_tools as known_tools

from ...core import Store, DynamicMap, CompositeOverlay, Element, Dimension
from ...core import DynamicMap, CompositeOverlay, Element, Dimension
from ...core.options import abbreviated_exception, SkipRendering
from ...core import util
from ...streams import Stream, Buffer
Expand Down Expand Up @@ -1298,7 +1298,6 @@ def _process_legend(self):
pos = self.legend_specs[pos]
else:
legend.location = pos
leg_opts = 'right'

legend.orientation = orientation

Expand All @@ -1319,7 +1318,6 @@ def _process_legend(self):
if self.multiple_legends:
plot.legend.pop(plot.legend.index(legend))
legend.plot = None
legends = []
properties = legend.properties_with_values(include_defaults=False)
legend_group = []
for item in legend.items:
Expand Down
8 changes: 3 additions & 5 deletions holoviews/plotting/bokeh/graphs.py
@@ -1,19 +1,17 @@
import param
import numpy as np

from bokeh.models import Range1d, Circle, MultiLine, HoverTool, ColumnDataSource
from bokeh.models import Range1d, HoverTool, ColumnDataSource

try:
from bokeh.models import (StaticLayoutProvider, GraphRenderer, NodesAndLinkedEdges,
from bokeh.models import (StaticLayoutProvider, NodesAndLinkedEdges,
EdgesAndLinkedNodes)
except:
pass

from ...core.options import abbreviated_exception, SkipRendering
from ...core.util import basestring, dimension_sanitizer
from .chart import ColorbarPlot, PointPlot
from .element import CompositeElementPlot, LegendPlot, line_properties, fill_properties, property_prefixes
from .util import mpl_to_bokeh
from .element import CompositeElementPlot, LegendPlot, line_properties, fill_properties


class GraphPlot(CompositeElementPlot, ColorbarPlot, LegendPlot):
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/path.py
Expand Up @@ -3,7 +3,7 @@
import param
import numpy as np

from bokeh.models import HoverTool, FactorRange
from bokeh.models import HoverTool

from ...core import util
from .element import ColorbarPlot, LegendPlot, line_properties, fill_properties
Expand Down
8 changes: 2 additions & 6 deletions holoviews/plotting/bokeh/plot.py
Expand Up @@ -7,9 +7,8 @@
from bokeh.models import (ColumnDataSource, Column, Row, Div)
from bokeh.models.widgets import Panel, Tabs

from ...core import (OrderedDict, CompositeOverlay, Store, GridMatrix,
AdjointLayout, NdLayout, Empty, GridSpace, HoloMap, Element)
from ...core.options import Compositor
from ...core import (OrderedDict, Store, GridMatrix, AdjointLayout,
NdLayout, Empty, GridSpace, HoloMap, Element)
from ...core.util import basestring, wrap_tuple, unique_iterator
from ...element import Histogram
from ..plot import (DimensionedPlot, GenericCompositePlot, GenericLayoutPlot,
Expand Down Expand Up @@ -652,7 +651,6 @@ def initialize_plot(self, plots=None, ranges=None):
plots = [[] for _ in range(self.rows)]
tab_titles = {}
insert_rows, insert_cols = [], []
adjoined = False
for r, c in self.coords:
subplot = self.subplots.get((r, c), None)
if subplot is not None:
Expand All @@ -663,7 +661,6 @@ def initialize_plot(self, plots=None, ranges=None):
# number of adjoined plots
offset = sum(r >= ir for ir in insert_rows)
if len(subplots) > 2:
adjoined = True
# Add pad column in this position
insert_cols.append(c)
if r not in insert_rows:
Expand All @@ -678,7 +675,6 @@ def initialize_plot(self, plots=None, ranges=None):
# Add top marginal
plots[r+offset-1] += [subplots.pop(-1), None]
elif len(subplots) > 1:
adjoined = True
# Add pad column in this position
insert_cols.append(c)
# Pad previous rows
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/raster.py
Expand Up @@ -3,7 +3,7 @@

from bokeh.models import HoverTool
from ...core.util import cartesian_product, is_nan, dimension_sanitizer
from ...element import Image, Raster
from ...element import Raster
from ..renderer import SkipRendering
from .element import ElementPlot, ColorbarPlot, line_properties, fill_properties

Expand Down
3 changes: 1 addition & 2 deletions holoviews/plotting/bokeh/renderer.py
Expand Up @@ -20,8 +20,7 @@
from .widgets import BokehScrubberWidget, BokehSelectionWidget, BokehServerWidgets
from .util import attach_periodic, compute_plot_size

from bokeh.io.notebook import (load_notebook, publish_display_data,
JS_MIME_TYPE, LOAD_MIME_TYPE, EXEC_MIME_TYPE)
from bokeh.io.notebook import load_notebook
from bokeh.protocol import Protocol
from bokeh.embed.notebook import encode_utf8, notebook_content

Expand Down
1 change: 0 additions & 1 deletion holoviews/plotting/bokeh/tabular.py
Expand Up @@ -2,7 +2,6 @@

import param

import numpy as np
from ...core import Dataset
from ...element import ItemTable
from ...streams import Buffer
Expand Down
5 changes: 2 additions & 3 deletions holoviews/plotting/bokeh/util.py
@@ -1,4 +1,4 @@
import itertools, inspect, re, time
import inspect, re, time
from distutils.version import LooseVersion
from collections import defaultdict
import datetime as dt
Expand All @@ -19,9 +19,8 @@
from bokeh.core.enums import Palette
from bokeh.core.json_encoder import serialize_json # noqa (API import)
from bokeh.core.properties import value
from bokeh.document import Document
from bokeh.layouts import WidgetBox, Row, Column
from bokeh.models import Model, HasProps, ToolbarBox, FactorRange, Range1d, Plot, Spacer, CustomJS
from bokeh.models import Model, ToolbarBox, FactorRange, Range1d, Plot, Spacer, CustomJS
from bokeh.models.widgets import DataTable, Tabs, Div
from bokeh.plotting import Figure

Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/mpl/chart.py
Expand Up @@ -15,7 +15,7 @@

from ...core import OrderedDict, Dimension, Store
from ...core.util import match_spec, unique_iterator, basestring, max_range
from ...element import Points, Raster, Polygons, HeatMap
from ...element import Raster
from ...operation import interpolate_curve
from ..util import compute_sizes, get_sideplot_ranges, get_min_distance
from .element import ElementPlot, ColorbarPlot, LegendPlot
Expand Down
3 changes: 1 addition & 2 deletions holoviews/plotting/mpl/path.py
@@ -1,10 +1,9 @@
from matplotlib.patches import Polygon
from matplotlib.collections import PolyCollection, LineCollection
import numpy as np
import param

from ...core import util
from .element import ElementPlot, ColorbarPlot
from .element import ColorbarPlot


class PathPlot(ColorbarPlot):
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/mpl/plot.py
Expand Up @@ -12,7 +12,7 @@
from ...core import (OrderedDict, HoloMap, AdjointLayout, NdLayout,
GridSpace, Element, CompositeOverlay, Empty,
Collator, GridMatrix, Layout)
from ...core.options import Store, Compositor, SkipRendering
from ...core.options import Store, SkipRendering
from ...core.util import int_to_roman, int_to_alpha, basestring
from ..plot import (DimensionedPlot, GenericLayoutPlot, GenericCompositePlot,
GenericElementPlot)
Expand Down

0 comments on commit c391e6d

Please sign in to comment.