diff --git a/.gitignore b/.gitignore index be42995..20908de 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ htmlcov/ cover/ .coverage .cache +.pytest_cache nosetests.xml coverage.xml cover/ diff --git a/.travis.yml b/.travis.yml index 8e839e3..acde10e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ matrix: install: - python setup.py install - - pip install pytest pytest-cov coverage six + - pip install pytest pytest-cov coverage script: - coverage run run_tests.py diff --git a/appveyor.yml b/appveyor.yml index c514f2e..12c23c7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,7 +20,7 @@ install: - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" # Install the build and runtime dependencies of the project. - - "pip install -v six nose pytest pytest-cov coverage" + - "pip install -v nose pytest pytest-cov coverage" # Install the generated wheel package to test it - "python setup.py install" diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 4adf9f5..cab179e 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -30,11 +30,9 @@ requirements: build: - python - setuptools - - six run: - python - - six test: # Python imports diff --git a/cycler.py b/cycler.py index 8400444..3b05dc1 100644 --- a/cycler.py +++ b/cycler.py @@ -43,11 +43,14 @@ from __future__ import (absolute_import, division, print_function, unicode_literals) -import six +import copy +from functools import reduce from itertools import product, cycle -from six.moves import zip, reduce from operator import mul, add -import copy +import sys + +if sys.version_info < (3,): + from itertools import izip as zip __version__ = '0.10.0' @@ -183,7 +186,6 @@ def change_key(self, old, new): def _compose(self): """ Compose the 'left' and 'right' components of this cycle - with the proper operation (zip or product as of now) """ for a, b in self._op(self._left, self._right): out = dict() @@ -220,8 +222,7 @@ def __getitem__(self, key): # TODO : maybe add numpy style fancy slicing if isinstance(key, slice): trans = self.by_key() - return reduce(add, (_cycler(k, v[key]) - for k, v in six.iteritems(trans))) + return reduce(add, (_cycler(k, v[key]) for k, v in trans.items())) else: raise ValueError("Can only use slices with Cycler.__getitem__") @@ -259,8 +260,7 @@ def __mul__(self, other): return Cycler(self, other, product) elif isinstance(other, int): trans = self.by_key() - return reduce(add, (_cycler(k, v*other) - for k, v in six.iteritems(trans))) + return reduce(add, (_cycler(k, v*other) for k, v in trans.items())) else: return NotImplemented @@ -396,7 +396,7 @@ def simplify(self): # I would believe that there is some performance implications trans = self.by_key() - return reduce(add, (_cycler(k, v) for k, v in six.iteritems(trans))) + return reduce(add, (_cycler(k, v) for k, v in trans.items())) def concat(self, other): """Concatenate this cycler and an other. @@ -523,7 +523,7 @@ def cycler(*args, **kwargs): "positional argument. Use keyword arguments instead.") if kwargs: - return reduce(add, (_cycler(k, v) for k, v in six.iteritems(kwargs))) + return reduce(add, (_cycler(k, v) for k, v in kwargs.items())) raise TypeError("Must have at least a positional OR keyword arguments") diff --git a/setup.py b/setup.py index 7f11538..fc2d777 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,6 @@ description='Composable style cycles', url='https://github.com/matplotlib/cycler', platforms='Cross platform (Linux, Mac OSX, Windows)', - install_requires=['six'], license="BSD", python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', classifiers=['Development Status :: 4 - Beta', diff --git a/test_cycler.py b/test_cycler.py index 52f65ec..50c17f0 100644 --- a/test_cycler.py +++ b/test_cycler.py @@ -1,12 +1,18 @@ from __future__ import (absolute_import, division, print_function) -import six -from six.moves import zip, range -from cycler import cycler, Cycler, concat -import pytest -from itertools import product, cycle, chain -from operator import add, iadd, mul, imul from collections import defaultdict +from operator import add, iadd, mul, imul +from itertools import product, cycle, chain +import sys + +import pytest + +from cycler import cycler, Cycler, concat + +if sys.version_info < (3,): + from itertools import izip as zip + range = xrange + str = unicode def _cycler_helper(c, length, keys, values): @@ -147,7 +153,7 @@ def test_fail_getime(): def _repr_tester_helper(rpr_func, cyc, target_repr): test_repr = getattr(cyc, rpr_func)() - assert six.text_type(test_repr) == six.text_type(target_repr) + assert str(test_repr) == str(target_repr) def test_repr():