From f2a10db0a590c6bb582ad4325557d6966edefdf9 Mon Sep 17 00:00:00 2001 From: Alexandre Detiste Date: Mon, 11 Nov 2024 17:23:43 +0100 Subject: [PATCH] remove Python2 support --- CONTRIBUTING.rst | 2 +- README.rst | 2 +- etcd3/client.py | 3 +-- etcd3/watch.py | 6 ++---- requirements/base.txt | 4 ---- tests/test_etcd3.py | 14 ++++---------- 6 files changed, 9 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 3f55e548..eae29ce1 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -101,7 +101,7 @@ Before you submit a pull request, check that it meets these guidelines: 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. -3. The pull request should work for Python 2.6, 2.7, 3.3, 3.4 and 3.5, and for PyPy. Check +3. The pull request should work for Python 3.3, 3.4 and 3.5, and for PyPy. Check https://travis-ci.org/kragniz/python-etcd3/pull_requests and make sure that the tests pass for all supported Python versions. diff --git a/README.rst b/README.rst index 945a3dd8..11d489d0 100644 --- a/README.rst +++ b/README.rst @@ -21,7 +21,7 @@ python-etcd3 :target: https://codecov.io/github/kragniz/python-etcd3?branch=master -Python client for the etcd API v3, supported under python 2.7, 3.4 and 3.5. +Python client for the etcd API v3, supported under python 3.4 and 3.5. **Warning: the API is mostly stable, but may change in the future** diff --git a/etcd3/client.py b/etcd3/client.py index 0dc94823..40b14a33 100644 --- a/etcd3/client.py +++ b/etcd3/client.py @@ -1,4 +1,5 @@ import functools +import queue import random import threading import time @@ -6,8 +7,6 @@ import grpc import grpc._channel -from six.moves import queue - import etcd3.etcdrpc as etcdrpc import etcd3.exceptions as exceptions import etcd3.leases as leases diff --git a/etcd3/watch.py b/etcd3/watch.py index 543b5b70..944a5250 100644 --- a/etcd3/watch.py +++ b/etcd3/watch.py @@ -1,11 +1,9 @@ import logging +import queue import threading import grpc -import six -from six.moves import queue - import etcd3.etcdrpc as etcdrpc import etcd3.events as events import etcd3.exceptions as exceptions @@ -154,7 +152,7 @@ def _run(self): self._request_queue.put(None) self._request_queue = queue.Queue(maxsize=10) - for callback in six.itervalues(callbacks): + for callback in callbacks.values(): _safe_callback(callback, callback_err) def _handle_response(self, rs): diff --git a/requirements/base.txt b/requirements/base.txt index 4a789a44..945e6371 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -9,7 +9,3 @@ grpcio==1.38.0 # via -r requirements/base.in protobuf==3.17.0 # via -r requirements/base.in -six==1.16.0 - # via - # grpcio - # protobuf diff --git a/tests/test_etcd3.py b/tests/test_etcd3.py index b3b068ed..a8752047 100644 --- a/tests/test_etcd3.py +++ b/tests/test_etcd3.py @@ -24,8 +24,7 @@ import pytest -import six -from six.moves.urllib.parse import urlparse +from urllib.parse import urlparse from tenacity import retry, stop_after_attempt, wait_fixed @@ -39,11 +38,6 @@ os.environ['ETCDCTL_API'] = '3' -if six.PY2: - int_types = (int, long) -else: - int_types = (int,) - # Don't set any deadline in Hypothesis settings.register_profile("default", deadline=None) @@ -836,8 +830,8 @@ def test_get_response(self, etcd): def test_lease_grant(self, etcd): lease = etcd.lease(1) - assert isinstance(lease.ttl, int_types) - assert isinstance(lease.id, int_types) + assert isinstance(lease.ttl, int) + assert isinstance(lease.id, int) def test_lease_revoke(self, etcd): lease = etcd.lease(1) @@ -880,7 +874,7 @@ def test_member_list(self, etcd): assert peer_url.startswith('http://') for client_url in member.client_urls: assert client_url.startswith('http://') - assert isinstance(member.id, int_types) is True + assert isinstance(member.id, int) is True def test_lock_acquire(self, etcd): lock = etcd.lock('lock-1', ttl=10)