Skip to content

Commit

Permalink
Drop 2.6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Sep 5, 2016
1 parent 4ff6deb commit f4c2808
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 1 addition & 10 deletions pygal/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 4 additions & 8 deletions pygal/graph/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,10 @@ def _plot(self):
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
Expand Down
4 changes: 2 additions & 2 deletions pygal/graph/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

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

Expand Down Expand Up @@ -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


Expand Down
7 changes: 2 additions & 5 deletions pygal/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down

0 comments on commit f4c2808

Please sign in to comment.