From a698c23caea6120cfc1607c2c019e949b80f862b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 2 Apr 2011 11:40:28 -0400 Subject: [PATCH] Fixed some import errors and name errors on Python 3 --- svg/charts/plot.py | 10 ++++++++-- svg/charts/time_series.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/svg/charts/plot.py b/svg/charts/plot.py index 19affc8..07cc80e 100644 --- a/svg/charts/plot.py +++ b/svg/charts/plot.py @@ -1,15 +1,21 @@ #!/usr/bin/env python +import sys from itertools import izip, count, chain from lxml import etree from svg.charts.graph import Graph -from util import float_range +from .util import float_range def get_pairs(i): i = iter(i) while True: yield i.next(), i.next() - + +# I'm not sure how this is more beautiful than ugly. +if sys.version >= '3': + def apply(func): + return func() + class Plot(Graph): """=== For creating SVG plots of scalar data diff --git a/svg/charts/time_series.py b/svg/charts/time_series.py index b8513fa..0afeeac 100644 --- a/svg/charts/time_series.py +++ b/svg/charts/time_series.py @@ -8,7 +8,7 @@ from dateutil.relativedelta import relativedelta from time import mktime import datetime fromtimestamp = datetime.datetime.fromtimestamp -from util import float_range +from .util import float_range class Plot(svg.charts.plot.Plot): """=== For creating SVG plots of scalar temporal data