Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ on:
jobs:
test:
name: "Python ${{ matrix.python-version }} ${{ matrix.name-suffix }}"
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

strategy:
matrix:
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10-dev"]

steps:
- uses: actions/checkout@v2
Expand Down
14 changes: 8 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# AppVeyor.com is a Continuous Integration service to build and run tests under
# Windows

image: Visual Studio 2019

environment:
matrix:
- PYTHON: "C:\\Python27"
- PYTHON: "C:\\Python27-x64"
- PYTHON: "C:\\Python34"
- PYTHON: "C:\\Python34-x64"
- PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python37"
- PYTHON: "C:\\Python37-x64"
- PYTHON: "C:\\Python38"
- PYTHON: "C:\\Python38-x64"
- PYTHON: "C:\\Python39"
- PYTHON: "C:\\Python39-x64"

install:
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
Expand Down
18 changes: 6 additions & 12 deletions cycler.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,11 @@
{'color': 'b', 'linestyle': '-.'}
"""

from __future__ import (absolute_import, division, print_function,
unicode_literals)

import copy
from functools import reduce
from itertools import product, cycle
from operator import mul, add
import sys

if sys.version_info < (3,):
from itertools import izip as zip

__version__ = '0.10.0'

Expand Down Expand Up @@ -107,7 +101,7 @@ def concat(left, right):
return reduce(add, (_cycler(k, _l[k] + _r[k]) for k in left.keys))


class Cycler(object):
class Cycler:
"""
Composable cycles.

Expand Down Expand Up @@ -231,7 +225,7 @@ def _from_iter(cls, label, itr):
"""
ret = cls(None)
ret._left = list({label: v} for v in itr)
ret._keys = set([label])
ret._keys = {label}
return ret

def __getitem__(self, key):
Expand Down Expand Up @@ -263,7 +257,7 @@ def __add__(self, other):
"""
if len(self) != len(other):
raise ValueError("Can only add equal length cycles, "
"not {0} and {1}".format(len(self), len(other)))
"not {} and {}".format(len(self), len(other)))
return Cycler(self, other, zip)

def __mul__(self, other):
Expand Down Expand Up @@ -347,7 +341,7 @@ def __repr__(self):
if self._right is None:
lab = self.keys.pop()
itr = list(v[lab] for v in self)
return "cycler({lab!r}, {itr!r})".format(lab=lab, itr=itr)
return f"cycler({lab!r}, {itr!r})"
else:
op = op_map.get(self._op, '?')
msg = "({left!r} {op} {right!r})"
Expand All @@ -358,11 +352,11 @@ def _repr_html_(self):
output = "<table>"
sorted_keys = sorted(self.keys, key=repr)
for key in sorted_keys:
output += "<th>{key!r}</th>".format(key=key)
output += f"<th>{key!r}</th>"
for d in iter(self):
output += "<tr>"
for k in sorted_keys:
output += "<td>{val!r}</td>".format(val=d[k])
output += f"<td>{d[k]!r}</td>"
output += "</tr>"
output += "</table>"
return output
Expand Down
3 changes: 1 addition & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# cycler documentation build configuration file, created by
# sphinx-quickstart on Wed Jul 1 13:32:53 2015.
Expand Down Expand Up @@ -273,7 +272,7 @@
# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False

intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),
intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
'matplotlb': ('https://matplotlib.org', None)}

# ################ numpydoc config ####################
Expand Down
13 changes: 7 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
py_modules=['cycler'],
description='Composable style cycles',
url='https://github.com/matplotlib/cycler',
platforms='Cross platform (Linux, Mac OSX, Windows)',
platforms='Cross platform (Linux, macOS, Windows)',
license="BSD",
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
python_requires='>=3.6',
classifiers=['License :: OSI Approved :: BSD License',
'Development Status :: 4 - Beta',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3 :: Only',
],
keywords='cycle kwargs',
)
8 changes: 0 additions & 8 deletions test_cycler.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
from __future__ import (absolute_import, division, print_function)

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 # noqa
str = unicode # noqa


def _cycler_helper(c, length, keys, values):
assert len(c) == length
Expand Down