diff --git a/.travis.yml b/.travis.yml index e138e04..1a28d29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: python python: - - 2.6 - 2.7 - 3.3 - 3.4 - 3.5 + - nightly # - pypy Disabled for pypy < 2.6.0 install: diff --git a/docs/installing.rst b/docs/installing.rst index 83c2325..0593513 100644 --- a/docs/installing.rst +++ b/docs/installing.rst @@ -2,7 +2,7 @@ Installing ========== -pygal is available for python 2.6, 2.7 and 3.2, 3.3, 3.4 and pypy. +pygal is available for python 2.7 and 3.2, 3.3, 3.4, 3.5 and pypy. PyPI diff --git a/pygal/_compat.py b/pygal/_compat.py index 9e76b6a..b67ab15 100644 --- a/pygal/_compat.py +++ b/pygal/_compat.py @@ -69,15 +69,6 @@ def u(s): return s.decode('utf-8') return s - -def total_seconds(td): - """Backport of `timedelta.total_second` function for python 2.6""" - if sys.version_info[:2] == (2, 6): - return ( - (td.days * 86400 + td.seconds) * 10 ** 6 + td.microseconds - ) / 10 ** 6 - return td.total_seconds() - try: from datetime import timezone utc = timezone.utc @@ -103,7 +94,7 @@ def timestamp(x): if hasattr(x, 'timestamp'): return x.timestamp() else: - return total_seconds(x - datetime(1970, 1, 1, tzinfo=utc)) + return (x - datetime(1970, 1, 1, tzinfo=utc)).total_seconds() try: from urllib import quote_plus diff --git a/pygal/graph/map.py b/pygal/graph/map.py index 22e66d9..1a1405a 100644 --- a/pygal/graph/map.py +++ b/pygal/graph/map.py @@ -82,14 +82,10 @@ class BaseMap(Graph): else: ratio = .3 + .7 * (value - min_) / (max_ - min_) - try: - areae = map.findall( - ".//*[@class='%s%s %s map-element']" % ( - self.area_prefix, area_code, - self.kind)) - except SyntaxError: - # Python 2.6 (you'd better install lxml) - raise ImportError('lxml is required under python 2.6') + areae = map.findall( + ".//*[@class='%s%s %s map-element']" % ( + self.area_prefix, area_code, + self.kind)) if not areae: continue diff --git a/pygal/graph/time.py b/pygal/graph/time.py index 941b810..10b6ee9 100644 --- a/pygal/graph/time.py +++ b/pygal/graph/time.py @@ -24,7 +24,7 @@ into float for xy plot and back to their type for display from datetime import date, datetime, time, timedelta -from pygal._compat import is_str, timestamp, total_seconds +from pygal._compat import is_str, timestamp from pygal.adapters import positive from pygal.graph.xy import XY @@ -60,7 +60,7 @@ def time_to_datetime(x): def timedelta_to_seconds(x): """Convert a timedelta into an amount of seconds""" if isinstance(x, timedelta): - return total_seconds(x) + return x.total_seconds() return x diff --git a/pygal/test/conftest.py b/pygal/test/conftest.py index e6f08f4..66d22eb 100644 --- a/pygal/test/conftest.py +++ b/pygal/test/conftest.py @@ -37,14 +37,11 @@ def etreefx(request): def pytest_generate_tests(metafunc): """Generate the tests for etree and lxml""" - if etree._lxml_etree and sys.version_info[:2] != (2, 6): + if etree._lxml_etree: metafunc.fixturenames.append('etreefx') metafunc.parametrize('etreefx', ['lxml', 'etree'], indirect=True) - if sys.version_info[:2] != (2, 6) and not hasattr( - sys, 'pypy_version_info'): - if not etree._lxml_etree: - raise ImportError('lxml is required under python 2.6') + if not hasattr(sys, 'pypy_version_info'): etree.to_lxml() if hasattr(sys, 'pypy_version_info'):