Permalink
Browse files

support for python3

  • Loading branch information...
1 parent b7c5cae commit 4a389ec08110cfd4614ad49ddbfa35746c1bb6d7 @areski committed Apr 28, 2013
View
@@ -1,7 +1,7 @@
language: python
python:
- 2.7
-# - 3.3
+ - 3.3
install:
- python setup.py install
script:
View
@@ -59,10 +59,10 @@
type = "lineChart"
chart = lineChart(name=type, height=350, date=True, x_axis_date_format="%d %b %Y %H")
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
-xdata = range(nb_element)
-xdata = map(lambda x: start_time + x * 1000000000, xdata)
+xdata = list(range(nb_element))
+xdata = [start_time + x * 1000000000 for x in xdata]
ydata = [i + random.randint(1, 10) for i in range(nb_element)]
-ydata2 = map(lambda x: x * 2, ydata)
+ydata2 = [x * 2 for x in ydata]
#Configure a color for a specific serie
kwargs1 = {'color': 'green'}
@@ -83,13 +83,13 @@
chart = lineWithFocusChart(name=type, color_category='category20b', date=True, x_axis_date_format="%d %b %Y")
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
-xdata = range(nb_element)
-xdata = map(lambda x: start_time + x * 1000000000, xdata)
-ydata = [i + random.randint(-10, 10) for i in range(nb_element)]
+xdata = list(range(nb_element))
+xdata = [start_time + x * 1000000000 for x in xdata]
+ydata = [i + random.randint(-10, 10) for i in list(range(nb_element))]
-ydata2 = map(lambda x: x * 2, ydata)
-ydata3 = map(lambda x: x * 3, ydata)
-ydata4 = map(lambda x: x * 4, ydata)
+ydata2 = [x * 2 for x in ydata]
+ydata3 = [x * 3 for x in ydata]
+ydata4 = [x * 4 for x in ydata]
extra_serie = {"tooltip": {"y_start": "There is ", "y_end": " calls"},
"date_format": "%d %b %Y %I:%M:%S"}
@@ -109,10 +109,10 @@
chart = stackedAreaChart(name=type, height=350, date=True, x_axis_date_format="%d %b %Y %I")
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
-xdata = range(nb_element)
-xdata = map(lambda x: start_time + x * 1000000000, xdata)
-ydata = [i + random.randint(1, 10) for i in range(nb_element)]
-ydata2 = map(lambda x: x * 2, ydata)
+xdata = list(range(nb_element))
+xdata = [start_time + x * 1000000000 for x in xdata]
+ydata = [i + random.randint(1, 10) for i in list(range(nb_element))]
+ydata2 = [x * 2 for x in ydata]
extra_serie = {"tooltip": {"y_start": "There is ", "y_end": " calls"},
"date_format": "%d %b %Y %I:%M:%S %p"}
@@ -128,10 +128,10 @@
chart = linePlusBarChart(name=type, height=350, date=True, x_axis_date_format="%d %b %Y")
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
-xdata = range(nb_element)
-xdata = map(lambda x: start_time + x * 1000000000, xdata)
+xdata = list(range(nb_element))
+xdata = [start_time + x * 1000000000 for x in xdata]
ydata = [i + random.randint(1, 10) for i in range(nb_element)]
-ydata2 = [i + random.randint(1, 10) for i in reversed(range(nb_element))]
+ydata2 = [i + random.randint(1, 10) for i in reversed(list(range(nb_element)))]
kwargs = {}
kwargs['bar'] = True
extra_serie = {"tooltip": {"y_start": "$ ", "y_end": ""}}
@@ -148,10 +148,10 @@
chart = cumulativeLineChart(name=type, height=350, date=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
-xdata = range(nb_element)
-xdata = map(lambda x: start_time + x * 1000000000, xdata)
+xdata = list(range(nb_element))
+xdata = [start_time + x * 1000000000 for x in xdata]
ydata = [i + random.randint(1, 10) for i in range(nb_element)]
-ydata2 = map(lambda x: x * 2, ydata)
+ydata2 = [x * 2 for x in ydata]
extra_serie = {"tooltip": {"y_start": "", "y_end": " Calls"}}
chart.add_serie(name="Count", y=ydata, x=xdata, extra=extra_serie)
@@ -168,9 +168,9 @@
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
nb_element = 10
-xdata = range(nb_element)
+xdata = list(range(nb_element))
ydata = [random.randint(-10, 10) for i in range(nb_element)]
-ydata2 = map(lambda x: x * 2, ydata)
+ydata2 = [x * 2 for x in ydata]
extra_serie = {"tooltip": {"y_start": "", "y_end": " Calls"}}
chart.add_serie(name="Count", y=ydata, x=xdata, extra=extra_serie)
extra_serie = {"tooltip": {"y_start": "", "y_end": " Min"}}
@@ -185,9 +185,9 @@
chart = multiBarChart(name=type, height=350)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
nb_element = 10
-xdata = range(nb_element)
+xdata = list(range(nb_element))
ydata = [random.randint(1, 10) for i in range(nb_element)]
-ydata2 = map(lambda x: x * 2, ydata)
+ydata2 = [x * 2 for x in ydata]
extra_serie = {"tooltip": {"y_start": "", "y_end": " call"}}
chart.add_serie(name="Count", y=ydata, x=xdata, extra=extra_serie)
@@ -204,8 +204,8 @@
nb_element = 50
xdata = [i + random.randint(1, 10) for i in range(nb_element)]
ydata = [i * random.randint(1, 10) for i in range(nb_element)]
-ydata2 = map(lambda x: x * 2, ydata)
-ydata3 = map(lambda x: x * 5, ydata)
+ydata2 = [x * 2 for x in ydata]
+ydata3 = [x * 5 for x in ydata]
kwargs1 = {'shape': 'circle'}
kwargs2 = {'shape': 'cross'}
@@ -25,13 +25,13 @@
chart = lineWithFocusChart(name=type, color_category='category20b', date=True, x_axis_date_format="%d %b %Y %H")
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
-xdata = range(nb_element)
-xdata = map(lambda x: start_time + x * 1000000000, xdata)
+xdata = list(range(nb_element))
+xdata = [start_time + x * 1000000000 for x in xdata]
ydata = [i + random.randint(-10, 10) for i in range(nb_element)]
-ydata2 = map(lambda x: x * 2, ydata)
-ydata3 = map(lambda x: x * 3, ydata)
-ydata4 = map(lambda x: x * 4, ydata)
+ydata2 = [x * 2 for x in ydata]
+ydata3 = [x * 3 for x in ydata]
+ydata4 = [x * 4 for x in ydata]
extra_serie = {"tooltip": {"y_start": "There is ", "y_end": " calls"},
"date_format": "%d %b %Y %H:%M:%S %p"}
@@ -19,9 +19,9 @@
chart = multiBarChart(name=type, height=350)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
nb_element = 10
-xdata = range(nb_element)
+xdata = list(range(nb_element))
ydata = [random.randint(1, 10) for i in range(nb_element)]
-ydata2 = map(lambda x: x * 2, ydata)
+ydata2 = [x * 2 for x in ydata]
extra_serie = {"tooltip": {"y_start": "", "y_end": " call"}}
chart.add_serie(name="Count", y=ydata, x=xdata, extra=extra_serie)
@@ -20,9 +20,9 @@
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
nb_element = 10
-xdata = range(nb_element)
+xdata = list(range(nb_element))
ydata = [random.randint(-10, 10) for i in range(nb_element)]
-ydata2 = map(lambda x: x * 2, ydata)
+ydata2 = [x * 2 for x in ydata]
extra_serie = {"tooltip": {"y_start": "", "y_end": " Calls"}}
chart.add_serie(name="Count", y=ydata, x=xdata, extra=extra_serie)
extra_serie = {"tooltip": {"y_start": "", "y_end": " Min"}}
View
@@ -21,8 +21,8 @@
nb_element = 50
xdata = [i + random.randint(1, 10) for i in range(nb_element)]
ydata = [i * random.randint(1, 10) for i in range(nb_element)]
-ydata2 = map(lambda x: x * 2, ydata)
-ydata3 = map(lambda x: x * 5, ydata)
+ydata2 = [x * 2 for x in ydata]
+ydata3 = [x * 5 for x in ydata]
kwargs1 = {'shape': 'circle'}
kwargs2 = {'shape': 'cross'}
View
@@ -345,9 +345,9 @@ def buildjschart(self):
.tickFormat(function(d) { return '$' + d3.format(',.2f')(d) });
"""
if self.model != 'pieChart':
- for axis_name, a in self.axislist.iteritems():
+ for axis_name, a in list(self.axislist.items()):
self.jschart += stab(2) + "chart.%s\n" % axis_name
- for attr, value in a.iteritems():
+ for attr, value in list(a.items()):
self.jschart += stab(3) + ".%s(%s);\n" % (attr, value)
if self.width:
View
@@ -12,16 +12,16 @@
__version__ = '0.3.6'
-from lineChart import lineChart
-from pieChart import pieChart
-from lineWithFocusChart import lineWithFocusChart
-from stackedAreaChart import stackedAreaChart
-from multiBarHorizontalChart import multiBarHorizontalChart
-from linePlusBarChart import linePlusBarChart
-from cumulativeLineChart import cumulativeLineChart
-from scatterChart import scatterChart
-from discreteBarChart import discreteBarChart
-from multiBarChart import multiBarChart
+from .lineChart import lineChart
+from .pieChart import pieChart
+from .lineWithFocusChart import lineWithFocusChart
+from .stackedAreaChart import stackedAreaChart
+from .multiBarHorizontalChart import multiBarHorizontalChart
+from .linePlusBarChart import linePlusBarChart
+from .cumulativeLineChart import cumulativeLineChart
+from .scatterChart import scatterChart
+from .discreteBarChart import discreteBarChart
+from .multiBarChart import multiBarChart
class lineChart(lineChart):
@@ -9,7 +9,7 @@
Project location : https://github.com/areski/python-nvd3
"""
-from NVD3Chart import NVD3Chart
+from .NVD3Chart import NVD3Chart
class cumulativeLineChart(NVD3Chart):
View
@@ -9,7 +9,7 @@
Project location : https://github.com/areski/python-nvd3
"""
-from NVD3Chart import NVD3Chart
+from .NVD3Chart import NVD3Chart
class discreteBarChart(NVD3Chart):
View
@@ -9,7 +9,7 @@
Project location : https://github.com/areski/python-nvd3
"""
-from NVD3Chart import NVD3Chart
+from .NVD3Chart import NVD3Chart
class lineChart(NVD3Chart):
View
@@ -9,7 +9,7 @@
Project location : https://github.com/areski/python-nvd3
"""
-from NVD3Chart import NVD3Chart
+from .NVD3Chart import NVD3Chart
class linePlusBarChart(NVD3Chart):
@@ -9,7 +9,7 @@
Project location : https://github.com/areski/python-nvd3
"""
-from NVD3Chart import NVD3Chart
+from .NVD3Chart import NVD3Chart
class lineWithFocusChart(NVD3Chart):
View
@@ -9,7 +9,7 @@
Project location : https://github.com/areski/python-nvd3
"""
-from NVD3Chart import NVD3Chart
+from .NVD3Chart import NVD3Chart
class multiBarChart(NVD3Chart):
@@ -9,7 +9,7 @@
Project location : https://github.com/areski/python-nvd3
"""
-from NVD3Chart import NVD3Chart
+from .NVD3Chart import NVD3Chart
class multiBarHorizontalChart(NVD3Chart):
View
@@ -9,7 +9,7 @@
Project location : https://github.com/areski/python-nvd3
"""
-from NVD3Chart import NVD3Chart, stab
+from .NVD3Chart import NVD3Chart, stab
class pieChart(NVD3Chart):
View
@@ -9,7 +9,7 @@
Project location : https://github.com/areski/python-nvd3
"""
-from NVD3Chart import NVD3Chart, stab
+from .NVD3Chart import NVD3Chart, stab
class scatterChart(NVD3Chart):
View
@@ -9,7 +9,7 @@
Project location : https://github.com/areski/python-nvd3
"""
-from NVD3Chart import NVD3Chart
+from .NVD3Chart import NVD3Chart
class stackedAreaChart(NVD3Chart):
View
@@ -1,15 +1,13 @@
+#! /usr/bin/env python
+# coding=utf-8
+
import os
import codecs
-import sys
from setuptools import setup, find_packages
from fnmatch import fnmatchcase
from distutils.util import convert_path
-def read(*parts):
- return codecs.open(os.path.join(os.path.dirname(__file__), *parts)).read()
-
-
def get_version():
f = open('nvd3/__init__.py')
try:
@@ -76,9 +74,7 @@ def find_package_data(where='.', package='',
if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()):
bad_name = True
if show_ignored:
- print >> sys.stderr, (
- "Directory %s ignored by pattern %s"
- % (fn, pattern))
+ print ("Directory %s ignored by pattern %s" % (fn, pattern))
break
if bad_name:
continue
@@ -97,20 +93,21 @@ def find_package_data(where='.', package='',
if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()):
bad_name = True
if show_ignored:
- print >> sys.stderr, (
- "File %s ignored by pattern %s"
+ print ("File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out
+long_description = codecs.open("README.rst", "r", "utf-8").read()
+
setup(
name='python-nvd3',
version=get_version(),
description="Python NVD3",
- long_description=read('README.rst'),
+ long_description=long_description,
keywords='plot, graph, nvd3, d3',
author='Belaid Arezqui',
author_email='areski@gmail.com',
@@ -138,6 +135,10 @@ def find_package_data(where='.', package='',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.3',
'Topic :: Multimedia :: Graphics :: Presentation',
'Topic :: Software Development :: Libraries :: Python Modules',
],

0 comments on commit 4a389ec

Please sign in to comment.