Skip to content

Commit 7773b0d

Browse files
committed
Upgrade Python syntax with pyupgrade --py36-plus
1 parent bd2442b commit 7773b0d

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

cycler.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
{'color': 'b', 'linestyle': '-.'}
4141
"""
4242

43-
from __future__ import (absolute_import, division, print_function,
44-
unicode_literals)
4543

4644
import copy
4745
from functools import reduce
@@ -107,7 +105,7 @@ def concat(left, right):
107105
return reduce(add, (_cycler(k, _l[k] + _r[k]) for k in left.keys))
108106

109107

110-
class Cycler(object):
108+
class Cycler:
111109
"""
112110
Composable cycles.
113111
@@ -231,7 +229,7 @@ def _from_iter(cls, label, itr):
231229
"""
232230
ret = cls(None)
233231
ret._left = list({label: v} for v in itr)
234-
ret._keys = set([label])
232+
ret._keys = {label}
235233
return ret
236234

237235
def __getitem__(self, key):
@@ -263,7 +261,7 @@ def __add__(self, other):
263261
"""
264262
if len(self) != len(other):
265263
raise ValueError("Can only add equal length cycles, "
266-
"not {0} and {1}".format(len(self), len(other)))
264+
"not {} and {}".format(len(self), len(other)))
267265
return Cycler(self, other, zip)
268266

269267
def __mul__(self, other):
@@ -347,7 +345,7 @@ def __repr__(self):
347345
if self._right is None:
348346
lab = self.keys.pop()
349347
itr = list(v[lab] for v in self)
350-
return "cycler({lab!r}, {itr!r})".format(lab=lab, itr=itr)
348+
return f"cycler({lab!r}, {itr!r})"
351349
else:
352350
op = op_map.get(self._op, '?')
353351
msg = "({left!r} {op} {right!r})"
@@ -358,11 +356,11 @@ def _repr_html_(self):
358356
output = "<table>"
359357
sorted_keys = sorted(self.keys, key=repr)
360358
for key in sorted_keys:
361-
output += "<th>{key!r}</th>".format(key=key)
359+
output += f"<th>{key!r}</th>"
362360
for d in iter(self):
363361
output += "<tr>"
364362
for k in sorted_keys:
365-
output += "<td>{val!r}</td>".format(val=d[k])
363+
output += f"<td>{d[k]!r}</td>"
366364
output += "</tr>"
367365
output += "</table>"
368366
return output

doc/source/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python3
2-
# -*- coding: utf-8 -*-
32
#
43
# cycler documentation build configuration file, created by
54
# sphinx-quickstart on Wed Jul 1 13:32:53 2015.

test_cycler.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import (absolute_import, division, print_function)
2-
31
from collections import defaultdict
42
from operator import add, iadd, mul, imul
53
from itertools import product, cycle, chain

0 commit comments

Comments
 (0)