|
43 | 43 |
|
44 | 44 | from __future__ import annotations |
45 | 45 |
|
46 | | -from collections.abc import Hashable, Iterable, Callable |
| 46 | +from collections.abc import Hashable, Iterable |
47 | 47 | import copy |
48 | 48 | from functools import reduce |
49 | 49 | from itertools import product, cycle |
@@ -201,15 +201,11 @@ def change_key(self, old: K, new: K) -> None: |
201 | 201 | return |
202 | 202 | if new in self._keys: |
203 | 203 | raise ValueError( |
204 | | - "Can't replace {old} with {new}, {new} is already a key".format( |
205 | | - old=old, new=new |
206 | | - ) |
| 204 | + f"Can't replace {old} with {new}, {new} is already a key" |
207 | 205 | ) |
208 | 206 | if old not in self._keys: |
209 | 207 | raise KeyError( |
210 | | - "Can't replace {old} with {new}, {old} is not a key".format( |
211 | | - old=old, new=new |
212 | | - ) |
| 208 | + f"Can't replace {old} with {new}, {old} is not a key" |
213 | 209 | ) |
214 | 210 |
|
215 | 211 | self._keys.remove(old) |
@@ -310,7 +306,9 @@ def __mul__(self, other: Cycler[K, V] | int) -> Cycler[K, V]: |
310 | 306 | return Cycler(self, other, product) |
311 | 307 | elif isinstance(other, int): |
312 | 308 | trans = self.by_key() |
313 | | - return reduce(add, (_cycler(k, v * other) for k, v in trans.items())) |
| 309 | + return reduce( |
| 310 | + add, (_cycler(k, v * other) for k, v in trans.items()) |
| 311 | + ) |
314 | 312 | else: |
315 | 313 | return NotImplemented |
316 | 314 |
|
|
0 commit comments