Remove six

The repo is now python 3 only, thus six is not required as requirement,
remove its usage.

Change-Id: I36f5a41490051edb827670b5be248c4363ff36b1
This commit is contained in:
Andreas Jaeger 2020-05-09 13:59:47 +02:00
parent bc26de5e53
commit 231d682761
5 changed files with 11 additions and 18 deletions

View File

@ -20,6 +20,7 @@ import contextlib
import itertools
import threading
import time
import queue
try:
import eventlet
@ -27,8 +28,6 @@ except ImportError:
eventlet = None
import memcache
from oslo_log import log
from six.moves import queue
from six.moves import zip
from oslo_cache._i18n import _
from oslo_cache import exception

View File

@ -21,7 +21,6 @@ from oslo_cache import core
from oslo_log import log
from oslo_utils import importutils
from oslo_utils import timeutils
import six
from oslo_cache._i18n import _
from oslo_cache import exception
@ -416,7 +415,7 @@ class MongoApi(object):
Refer to MongoDB documentation around TTL index for further details.
"""
indexes = collection.index_information()
for indx_name, index_data in six.iteritems(indexes):
for indx_name, index_data in indexes.items():
if all(k in index_data for k in ('key', 'expireAfterSeconds')):
existing_value = index_data['expireAfterSeconds']
fld_present = 'doc_date' in index_data['key'][0]
@ -439,7 +438,7 @@ class MongoApi(object):
def get_multi(self, keys):
db_results = self._get_results_as_dict(keys)
return {doc['_id']: doc['value'] for doc in six.itervalues(db_results)}
return {doc['_id']: doc['value'] for doc in db_results.values()}
def _get_results_as_dict(self, keys):
criteria = {'_id': {'$in': keys}}
@ -495,8 +494,7 @@ class MongoApi(object):
**self.meth_kwargs)
@six.add_metaclass(abc.ABCMeta)
class AbstractManipulator(object):
class AbstractManipulator(object, metaclass=abc.ABCMeta):
"""Abstract class with methods which need to be implemented for custom
manipulation.

View File

@ -18,8 +18,6 @@ import functools
from dogpile.cache import region as dp_region
from oslo_utils import uuidutils
import six
from six.moves import range
from oslo_cache.backends import mongo
from oslo_cache import core
@ -136,17 +134,17 @@ class MockCollection(object):
def _iter_documents(self, spec=None):
return (SON_MANIPULATOR.transform_outgoing(document, self) for
document in six.itervalues(self._documents)
document in self._documents.values()
if self._apply_filter(document, spec))
def _apply_filter(self, document, query):
for key, search in six.iteritems(query):
for key, search in query.items():
doc_val = document.get(key)
if isinstance(search, dict):
op_dict = {'$in': lambda dv, sv: dv in sv}
is_match = all(
op_str in op_dict and op_dict[op_str](doc_val, search_val)
for op_str, search_val in six.iteritems(search)
for op_str, search_val in search.items()
)
else:
is_match = doc_val == search
@ -187,7 +185,7 @@ class MockCollection(object):
def update(self, spec, document, upsert=False, **kwargs):
existing_docs = [doc for doc in six.itervalues(self._documents)
existing_docs = [doc for doc in self._documents.values()
if self._apply_filter(doc, spec)]
if existing_docs:
existing_doc = existing_docs[0] # should find only 1 match
@ -199,7 +197,7 @@ class MockCollection(object):
existing_doc = self._documents[self._insert(document)]
def _internalize_dict(self, d):
return {k: copy.deepcopy(v) for k, v in six.iteritems(d)}
return {k: copy.deepcopy(v) for k, v in d.items()}
def remove(self, spec_or_id=None, search_filter=None):
"""Remove objects matching spec_or_id from the collection."""

View File

@ -10,12 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import queue
import threading
import time
from unittest import mock
import six
from six.moves import queue
import testtools
from testtools import matchers
@ -141,7 +140,7 @@ class TestMemcacheClientOverrides(test_cache.BaseTestCase):
# get the genuine thread._local from MRO
thread_local = client_class.__mro__[2]
self.assertTrue(thread_local is threading.local)
for field in six.iterkeys(thread_local.__dict__):
for field in thread_local.__dict__.keys():
if field not in ('__dict__', '__weakref__'):
self.assertNotEqual(id(getattr(thread_local, field, None)),
id(getattr(client_class, field, None)))

View File

@ -3,7 +3,6 @@
# process, which may cause wedges in the gate later.
dogpile.cache>=0.6.2 # BSD
six>=1.11.0 # MIT
oslo.config>=5.2.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0
oslo.log>=3.36.0 # Apache-2.0