diff options
author | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2021-05-03 01:40:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-02 15:40:05 -0700 |
commit | df79a6390f6d0531f6411f745d0ccd2c3d674883 (patch) | |
tree | 182575a9f279d791c9a3f724ed8373c750cb49bd /perf/solve_poly.py | |
parent | bb73791b59f74b6621a87036c14a6be6a23e0e55 (diff) | |
download | python-coveragepy-git-df79a6390f6d0531f6411f745d0ccd2c3d674883.tar.gz |
refactor: remove redundant Python 2 code (#1155)
* Remove Python 2 code
* Upgrade Python syntax with pyupgrade
* Upgrade Python syntax with pyupgrade --py3-plus
* Upgrade Python syntax with pyupgrade --py36-plus
* Remove unused imports
Diffstat (limited to 'perf/solve_poly.py')
-rw-r--r-- | perf/solve_poly.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/perf/solve_poly.py b/perf/solve_poly.py index 66231725..083dc544 100644 --- a/perf/solve_poly.py +++ b/perf/solve_poly.py @@ -10,7 +10,6 @@ import attr import itertools import numpy import scipy.optimize -import sys def f(*args, simplify=False): @@ -207,7 +206,7 @@ for row in INPUT.splitlines(): #print('\n'.join(str(t) for t in inputs_outputs.items())) def calc_poly_coeff(poly, coefficients): - c_tuples = list(((c,) for c in coefficients)) + c_tuples = list((c,) for c in coefficients) poly = list(f(*poly)) poly = list(a + b for a, b in zip(c_tuples, poly)) multiplied = list(m(*t) for t in poly) @@ -241,7 +240,7 @@ with open('results', 'w') as f: coefficients = [int(round(x)) for x in c.x] terms = [''.join(t) for t in poly.terms] - message = "{}' = ".format(name) + message = f"{name}' = " message += ' + '.join("{}{}".format(coeff if coeff != 1 else '', term) for coeff, term in reversed(list(zip(coefficients, terms))) if coeff != 0) print(message) f.write(message) |