summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--taskflow/atom.py5
-rw-r--r--taskflow/types/sets.py12
-rw-r--r--taskflow/utils/iter_utils.py6
3 files changed, 8 insertions, 15 deletions
diff --git a/taskflow/atom.py b/taskflow/atom.py
index f356247..6e41204 100644
--- a/taskflow/atom.py
+++ b/taskflow/atom.py
@@ -17,6 +17,7 @@
import abc
import collections
+from collections import abc as cabc
import itertools
from oslo_utils import reflection
@@ -28,8 +29,8 @@ from taskflow.utils import misc
# Helper types tuples...
-_sequence_types = (list, tuple, collections.Sequence)
-_set_types = (set, collections.Set)
+_sequence_types = (list, tuple, cabc.Sequence)
+_set_types = (set, cabc.Set)
# the default list of revert arguments to ignore when deriving
# revert argument mapping from the revert method signature
diff --git a/taskflow/types/sets.py b/taskflow/types/sets.py
index 95da1d9..bbd988d 100644
--- a/taskflow/types/sets.py
+++ b/taskflow/types/sets.py
@@ -15,16 +15,8 @@
# under the License.
import collections
-
-# TODO(smcginnis) update this once six has support for collections.abc
-# (https://github.com/benjaminp/six/pull/241) or clean up once we drop py2.7.
-try:
- from collections.abc import Hashable
- from collections.abc import Set
-except ImportError:
- from collections import Hashable
- from collections import Set
-
+from collections.abc import Hashable
+from collections.abc import Set
import itertools
import six
diff --git a/taskflow/utils/iter_utils.py b/taskflow/utils/iter_utils.py
index d35fe16..8591d23 100644
--- a/taskflow/utils/iter_utils.py
+++ b/taskflow/utils/iter_utils.py
@@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import collections
+from collections import abc
import itertools
import six
@@ -25,7 +25,7 @@ def _ensure_iterable(func):
@six.wraps(func)
def wrapper(it, *args, **kwargs):
- if not isinstance(it, collections.Iterable):
+ if not isinstance(it, abc.Iterable):
raise ValueError("Iterable expected, but '%s' is not"
" iterable" % it)
return func(it, *args, **kwargs)
@@ -109,7 +109,7 @@ def unique_seen(its, seen_selector=None):
all_its = list(its)
for it in all_its:
- if not isinstance(it, collections.Iterable):
+ if not isinstance(it, abc.Iterable):
raise ValueError("Iterable expected, but '%s' is"
" not iterable" % it)
return _gen_it(all_its)