Skip to content

Commit 3328a5c

Browse files
authored
Merge pull request #2051 from tseaver/drop-py26
Drop support for Python 2.6.
2 parents 6749237 + 28c6fdd commit 3328a5c

File tree

10 files changed

+11
-88
lines changed

10 files changed

+11
-88
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ install:
66
- pip install --upgrade tox
77

88
script:
9-
- tox -e py26
109
- tox -e py27
1110
- tox -e py34
1211
- tox -e lint

CONTRIBUTING.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ In order to add a feature to ``gcloud-python``:
8181
- The feature must be documented in both the API and narrative
8282
documentation (in ``docs/``).
8383

84-
- The feature must work fully on the following CPython versions: 2.6,
85-
and 2.7 on both UNIX and Windows.
84+
- The feature must work fully on the following CPython versions: 2.7,
85+
3.4, and 3.5 on both UNIX and Windows.
8686

8787
- The feature must not add unnecessary dependencies (where
8888
"unnecessary" is of course subjective, but new dependencies should
@@ -357,12 +357,10 @@ Supported Python Versions
357357

358358
We support:
359359

360-
- `Python 2.6`_
361360
- `Python 2.7`_
362361
- `Python 3.4`_
363362
- `Python 3.5`_
364363

365-
.. _Python 2.6: https://docs.python.org/2.6/
366364
.. _Python 2.7: https://docs.python.org/2.7/
367365
.. _Python 3.4: https://docs.python.org/3.4/
368366
.. _Python 3.5: https://docs.python.org/3.5/
@@ -378,7 +376,7 @@ and lack of continuous integration `support`_.
378376
.. _decreased usage: https://caremad.io/2013/10/a-look-at-pypi-downloads/
379377
.. _support: http://blog.travis-ci.com/2013-11-18-upcoming-build-environment-updates/
380378

381-
We may `drop 2.6`_ as a supported version as well since Python 2.6 is no
379+
We have `dropped 2.6`_ as a supported version as well since Python 2.6 is no
382380
longer supported by the core development team.
383381

384382
We also explicitly decided to support Python 3 beginning with version
@@ -392,7 +390,7 @@ We also explicitly decided to support Python 3 beginning with version
392390
.. _prominent: https://docs.djangoproject.com/en/1.9/faq/install/#what-python-version-can-i-use-with-django
393391
.. _projects: http://flask.pocoo.org/docs/0.10/python3/
394392
.. _Unicode literal support: https://www.python.org/dev/peps/pep-0414/
395-
.. _drop 2.6: https://github.com/GoogleCloudPlatform/gcloud-python/issues/995
393+
.. _dropped 2.6: https://github.com/GoogleCloudPlatform/gcloud-python/issues/995
396394

397395
Versioning
398396
----------

gcloud/_helpers.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import os
2323
import re
2424
import socket
25-
import sys
2625
from threading import local as Local
2726

2827
from google.protobuf import timestamp_pb2
@@ -336,36 +335,6 @@ def _millis_from_datetime(value):
336335
return _millis(value)
337336

338337

339-
def _total_seconds_backport(offset):
340-
"""Backport of timedelta.total_seconds() from python 2.7+.
341-
342-
:type offset: :class:`datetime.timedelta`
343-
:param offset: A timedelta object.
344-
345-
:rtype: int
346-
:returns: The total seconds (including microseconds) in the
347-
duration.
348-
"""
349-
seconds = offset.days * 24 * 60 * 60 + offset.seconds
350-
return seconds + offset.microseconds * 1e-6
351-
352-
353-
def _total_seconds(offset):
354-
"""Version independent total seconds for a time delta.
355-
356-
:type offset: :class:`datetime.timedelta`
357-
:param offset: A timedelta object.
358-
359-
:rtype: int
360-
:returns: The total seconds (including microseconds) in the
361-
duration.
362-
"""
363-
if sys.version_info[:2] < (2, 7): # pragma: NO COVER Python 2.6
364-
return _total_seconds_backport(offset)
365-
else:
366-
return offset.total_seconds()
367-
368-
369338
def _rfc3339_to_datetime(dt_str):
370339
"""Convert a microsecond-precision timetamp to a native datetime.
371340

gcloud/bigtable/column_family.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
from google.protobuf import duration_pb2
2121

22-
from gcloud._helpers import _total_seconds
2322
from gcloud.bigtable._generated import (
2423
table_pb2 as table_v2_pb2)
2524
from gcloud.bigtable._generated import (
@@ -40,7 +39,7 @@ def _timedelta_to_duration_pb(timedelta_val):
4039
:rtype: :class:`google.protobuf.duration_pb2.Duration`
4140
:returns: A duration object equivalent to the time delta.
4241
"""
43-
seconds_decimal = _total_seconds(timedelta_val)
42+
seconds_decimal = timedelta_val.total_seconds()
4443
# Truncate the parts other than the integer.
4544
seconds = int(seconds_decimal)
4645
if seconds_decimal < 0:

gcloud/bigtable/happybase/table.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from gcloud._helpers import _datetime_from_microseconds
2424
from gcloud._helpers import _microseconds_from_datetime
2525
from gcloud._helpers import _to_bytes
26-
from gcloud._helpers import _total_seconds
2726
from gcloud.bigtable.column_family import GCRuleIntersection
2827
from gcloud.bigtable.column_family import MaxAgeGCRule
2928
from gcloud.bigtable.column_family import MaxVersionsGCRule
@@ -653,7 +652,7 @@ def _gc_rule_to_dict(gc_rule):
653652
if gc_rule is None:
654653
result = {}
655654
elif isinstance(gc_rule, MaxAgeGCRule):
656-
result = {'time_to_live': _total_seconds(gc_rule.max_age)}
655+
result = {'time_to_live': gc_rule.max_age.total_seconds()}
657656
elif isinstance(gc_rule, MaxVersionsGCRule):
658657
result = {'max_versions': gc_rule.max_num_versions}
659658
elif isinstance(gc_rule, GCRuleIntersection):

gcloud/error_reporting/client.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,10 @@ def _send_error_report(self, message,
171171
if http_context:
172172
http_context_dict = http_context.__dict__
173173
# strip out None values
174-
# once py26 support is dropped this can use dict comprehension
175-
payload['context']['httpContext'] = dict(
176-
(k, v) for (k, v) in six.iteritems(http_context_dict)
177-
if v is not None
178-
)
174+
payload['context']['httpContext'] = {
175+
key: value for key, value in six.iteritems(http_context_dict)
176+
if value is not None
177+
}
179178

180179
if user:
181180
payload['context']['user'] = user

gcloud/exceptions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ class GCloudError(Exception):
3636
"""
3737

3838
def __init__(self, message, errors=()):
39-
super(GCloudError, self).__init__()
40-
# suppress deprecation warning under 2.6.x
39+
super(GCloudError, self).__init__(message)
4140
self.message = message
4241
self._errors = errors
4342

gcloud/test__helpers.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -494,34 +494,6 @@ def test_it(self):
494494
self.assertEqual(self._callFUT(NOW_MICROS), NOW)
495495

496496

497-
class Test__total_seconds_backport(unittest2.TestCase):
498-
499-
def _callFUT(self, *args, **kwargs):
500-
from gcloud._helpers import _total_seconds_backport
501-
return _total_seconds_backport(*args, **kwargs)
502-
503-
def test_it(self):
504-
import datetime
505-
offset = datetime.timedelta(seconds=3,
506-
microseconds=140000)
507-
result = self._callFUT(offset)
508-
self.assertEqual(result, 3.14)
509-
510-
511-
class Test__total_seconds(unittest2.TestCase):
512-
513-
def _callFUT(self, *args, **kwargs):
514-
from gcloud._helpers import _total_seconds
515-
return _total_seconds(*args, **kwargs)
516-
517-
def test_it(self):
518-
import datetime
519-
offset = datetime.timedelta(seconds=1,
520-
microseconds=414000)
521-
result = self._callFUT(offset)
522-
self.assertEqual(result, 1.414)
523-
524-
525497
class Test__rfc3339_to_datetime(unittest2.TestCase):
526498

527499
def _callFUT(self, dt_str):

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
'License :: OSI Approved :: Apache Software License',
5454
'Operating System :: OS Independent',
5555
'Programming Language :: Python :: 2',
56-
'Programming Language :: Python :: 2.6',
5756
'Programming Language :: Python :: 2.7',
5857
'Programming Language :: Python :: 3',
5958
'Programming Language :: Python :: 3.4',

tox.ini

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ deps =
3939
{[testing]deps}
4040
{[grpc]deps}
4141

42-
[testenv:py26]
43-
basepython =
44-
python2.6
45-
deps =
46-
{[testing]deps}
47-
# ordereddict needed for google.protobuf, which doesn't declare it.
48-
ordereddict
49-
setenv =
50-
PYTHONPATH = {toxinidir}/_testing
51-
5242
[testenv:py27-pandas]
5343
basepython =
5444
python2.7

0 commit comments

Comments
 (0)