Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various unicode fixes for dimensions, Tables and widgets #352

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion holoviews/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import print_function, absolute_import
from __future__ import unicode_literals, division, absolute_import, print_function

import os, sys, re, pydoc

import numpy as np # pyflakes:ignore (API import)
Expand Down
2 changes: 2 additions & 0 deletions holoviews/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

from .boundingregion import * # pyflakes:ignore (API import)
from .data import * # pyflakes:ignore (API import)
from .dimension import * # pyflakes:ignore (API import)
Expand Down
2 changes: 2 additions & 0 deletions holoviews/core/boundingregion.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

File originally part of the Topographica project.
"""
from __future__ import unicode_literals, division, absolute_import, print_function

### JABALERT: The aarect information should probably be rewritten in
### matrix notation, not list notation, so that it can be scaled,
### translated, etc. easily.
Expand Down
1 change: 1 addition & 0 deletions holoviews/core/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
The data module provides utility classes to interface with various data
backends.
"""
from __future__ import unicode_literals, division, absolute_import, print_function

import sys
from distutils.version import LooseVersion
Expand Down
5 changes: 4 additions & 1 deletion holoviews/core/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
axis or map dimension. Also supplies the Dimensioned abstract
baseclass for classes that accept Dimension values.
"""
from __future__ import unicode_literals, division, absolute_import, print_function

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we might need this anywhere else in HoloViews?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not a bad idea to add some of the __future__ imports everywhere including division, print_function and this one.

import re
from operator import itemgetter

Expand All @@ -11,7 +13,8 @@

from ..core.util import (basestring, sanitize_identifier,
group_sanitizer, label_sanitizer, max_range,
find_range, dimension_sanitizer, OrderedDict)
find_range, dimension_sanitizer, safe_unicode,
OrderedDict)
from .options import Store, StoreOptions
from .pprint import PrettyPrinter

Expand Down
4 changes: 3 additions & 1 deletion holoviews/core/element.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from __future__ import unicode_literals, division, absolute_import, print_function

import operator
from itertools import groupby, cycle
from numbers import Number
import numpy as np

import numpy as np
import param

from .dimension import Dimension, Dimensioned, ViewableElement
Expand Down
2 changes: 1 addition & 1 deletion holoviews/core/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
objects for a report then generating a PDF or collecting
HoloViews objects to dump to HDF5.
"""
from __future__ import absolute_import
from __future__ import unicode_literals, division, absolute_import, print_function

import re, os, time, string, zipfile, tarfile, shutil, itertools, pickle
from collections import defaultdict
Expand Down
1 change: 1 addition & 0 deletions holoviews/core/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
AdjointLayout allows one or two Views to be ajoined to a primary View
to act as supplementary elements.
"""
from __future__ import unicode_literals, division, absolute_import, print_function

from functools import reduce
from itertools import chain
Expand Down
1 change: 1 addition & 0 deletions holoviews/core/ndmapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
map types. The former class only allows indexing whereas the latter
also enables slicing over multiple dimension ranges.
"""
from __future__ import unicode_literals, division, absolute_import, print_function

from collections import Sequence
from itertools import cycle
Expand Down
2 changes: 2 additions & 0 deletions holoviews/core/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
extension together.

"""
from __future__ import unicode_literals, division, absolute_import, print_function

import pickle
from contextlib import contextmanager

Expand Down
1 change: 1 addition & 0 deletions holoviews/core/overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Also supplies ViewMap which is the primary multi-dimensional Map type
for indexing, slicing and animating collections of Views.
"""
from __future__ import unicode_literals, division, absolute_import, print_function

from functools import reduce
import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions holoviews/core/spaces.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

from numbers import Number
import itertools
import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions holoviews/core/util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

import os, sys, warnings, operator
import numbers
import itertools
Expand Down
2 changes: 2 additions & 0 deletions holoviews/element/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

from ..core import ViewableElement
from .annotation import * # pyflakes:ignore (API import)
from .chart import * # pyflakes:ignore (API import)
Expand Down
3 changes: 2 additions & 1 deletion holoviews/element/annotation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
from __future__ import unicode_literals, division, absolute_import, print_function

import numpy as np
import param

from ..core import Dimension, Element2D
Expand Down
3 changes: 2 additions & 1 deletion holoviews/element/chart.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
from __future__ import unicode_literals, division, absolute_import, print_function

import numpy as np
import param

from ..core import util
Expand Down
2 changes: 2 additions & 0 deletions holoviews/element/chart3d.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

import param

from ..core import Dimension, Element3D
Expand Down
2 changes: 2 additions & 0 deletions holoviews/element/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
thus would not supply any information regarding *why* two elements are
considered different.
"""
from __future__ import unicode_literals, division, absolute_import, print_function

import numpy as np
from unittest.util import safe_repr
from unittest import TestCase
Expand Down
3 changes: 3 additions & 0 deletions holoviews/element/raster.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from __future__ import unicode_literals, division, absolute_import, print_function

import warnings
from operator import itemgetter
from itertools import product

import numpy as np
import colorsys
import param
Expand Down
6 changes: 4 additions & 2 deletions holoviews/element/tabular.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import numpy as np
from __future__ import unicode_literals, division, absolute_import, print_function

import numpy as np
import param

from ..core import (OrderedDict, Dimension, Element, Columns,
Tabular, NdElement, HoloMap)
from ..core.util import safe_unicode


class ItemTable(Element):
Expand Down Expand Up @@ -102,7 +104,7 @@ def pprint_cell(self, row, col):
elif row >= self.rows:
raise Exception("Maximum row index is %d" % self.rows-1)
elif col == 0:
return str(self.dimensions('value')[row])
return safe_unicode(self.dimensions('value')[row])
else:
dim = self.get_dimension(row)
heading = self.vdims[row]
Expand Down
2 changes: 2 additions & 0 deletions holoviews/element/util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

import numpy as np

try:
Expand Down
2 changes: 2 additions & 0 deletions holoviews/interface/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

from ..core import Dimensioned, AttrTree

try:
Expand Down
3 changes: 2 additions & 1 deletion holoviews/interface/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
AttributeTree, Collector and related classes offer optional functionality
for holding and collecting DataView objects.
"""
from __future__ import unicode_literals, division, absolute_import, print_function

import uuid

import numpy as np

import param

from ..core import Dimension, ViewableElement, UniformNdMapping,\
Expand Down
3 changes: 1 addition & 2 deletions holoviews/interface/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
provides methods to apply operations to the underlying data and
convert it to standard HoloViews View types.
"""

from __future__ import absolute_import
from __future__ import unicode_literals, division, absolute_import, print_function

import numpy as np

Expand Down
4 changes: 1 addition & 3 deletions holoviews/interface/seaborn.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
of Seaborn plot types including time series, kernel density
estimates, distributions and regression plots.
"""

from __future__ import absolute_import
from __future__ import unicode_literals, division, absolute_import, print_function

import numpy as np

import param

from ..core import Dimension, NdMapping, Element2D, HoloMap
Expand Down
2 changes: 2 additions & 0 deletions holoviews/ipython/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

import os
import base64
from unittest import SkipTest
Expand Down
4 changes: 2 additions & 2 deletions holoviews/ipython/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Implements NotebookArchive used to automatically capture notebook data
and export it to disk via the display hooks.
"""
from __future__ import unicode_literals, division, absolute_import, print_function

import time, sys, os, traceback
import io
import time, sys, os, traceback, io

from IPython import version_info
from IPython.display import Javascript, display
Expand Down
4 changes: 3 additions & 1 deletion holoviews/ipython/display_hooks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Definition and registration of display hooks for the IPython Notebook.
"""
from __future__ import unicode_literals, division, absolute_import, print_function

from functools import wraps
import sys, traceback, inspect, io

Expand All @@ -13,9 +15,9 @@
HoloMap, AdjointLayout, NdLayout, GridSpace, Layout,
CompositeOverlay, DynamicMap)
from ..core.traversal import unique_dimkeys, bijective
from .archive import notebook_archive
from .magics import OutputMagic, OptsMagic

from .archive import notebook_archive
# To assist with debugging of display hooks
FULL_TRACEBACK = None
ABBREVIATE_TRACEBACKS = True
Expand Down
2 changes: 2 additions & 0 deletions holoviews/ipython/magics.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

import time
from collections import defaultdict

Expand Down
7 changes: 5 additions & 2 deletions holoviews/ipython/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
Pyparsing is required by matplotlib and will therefore be available if
HoloViews is being used in conjunction with matplotlib.
"""
import param
from __future__ import unicode_literals, division, absolute_import, print_function

from itertools import groupby

import param
import pyparsing as pp

from holoviews.core.options import Options
from ..core.options import Options
from ..operation import Compositor

ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
Expand Down
2 changes: 2 additions & 0 deletions holoviews/ipython/widgets.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

import sys, math, time
from unittest import SkipTest

Expand Down
2 changes: 2 additions & 0 deletions holoviews/operation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

from ..core.operation import ElementOperation, MapOperation, TreeOperation # pyflakes:ignore (API import)
from ..core.options import Compositor

Expand Down
2 changes: 1 addition & 1 deletion holoviews/operation/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Collection of either extremely generic or simple ElementOperation
examples.
"""
from __future__ import unicode_literals, division, absolute_import, print_function

import numpy as np

import param
from param import _is_number

Expand Down
2 changes: 2 additions & 0 deletions holoviews/operation/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
normalizations result in transformations to the stored data within
each element.
"""
from __future__ import unicode_literals, division, absolute_import, print_function

import param

from ..core.operation import ElementOperation
from ..element import Raster
from ..core import Overlay
Expand Down
1 change: 1 addition & 0 deletions holoviews/plotting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
This file defines the HTML tags used to wrap renderered output for
display in the IPython Notebook (optional).
"""
from __future__ import unicode_literals, division, absolute_import, print_function

from ..core.options import Cycle
from .plot import Plot
Expand Down
2 changes: 2 additions & 0 deletions holoviews/plotting/bokeh/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

from ...core import (Store, Overlay, NdOverlay, Layout, AdjointLayout,
GridSpace, NdElement, Columns, GridMatrix, NdLayout)
from ...element import (Curve, Points, Scatter, Image, Raster, Path,
Expand Down
2 changes: 2 additions & 0 deletions holoviews/plotting/bokeh/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

from collections import defaultdict

import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions holoviews/plotting/bokeh/chart.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

import numpy as np
from bokeh.models import Circle
import param
Expand Down
7 changes: 4 additions & 3 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
from __future__ import unicode_literals, division, absolute_import, print_function

from io import BytesIO
from distutils.version import LooseVersion

import param
import numpy as np
import bokeh
import bokeh.plotting
from bokeh.models import Range, HoverTool, Renderer
from bokeh.models.tickers import Ticker, BasicTicker, FixedTicker
from bokeh.models.widgets import Panel, Tabs
from distutils.version import LooseVersion

try:
from bokeh import mpl
except ImportError:
mpl = None
import param

from ...core import Store, HoloMap, Overlay, CompositeOverlay
from ...core import util
Expand Down
2 changes: 2 additions & 0 deletions holoviews/plotting/bokeh/path.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals, division, absolute_import, print_function

import numpy as np

from .element import ElementPlot, line_properties, fill_properties
Expand Down
5 changes: 3 additions & 2 deletions holoviews/plotting/bokeh/plot.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import unicode_literals, division, absolute_import, print_function

from itertools import groupby
import numpy as np

import param

import numpy as np
from bokeh.io import gridplot, vplot, hplot
from bokeh.models import ColumnDataSource, VBox, HBox, GridPlot as BokehGridPlot
from bokeh.models.widgets import Panel, Tabs, DataTable
Expand Down
Loading