Add Flake8 comprehensions to pre-commit (#7235)

* ci(pre-commit): Add ``flake8-comprehensions`` to ``pre-commit`` (#7233)

* refactor: Fix ``flake8-comprehensions`` errors

* fix: Replace `map` with generator (#7233)

* fix: Cast `range` objects to `list`
This commit is contained in:
Caeden
2022-10-15 18:29:42 +01:00
committed by GitHub
parent 98a4c24878
commit a652905b60
20 changed files with 36 additions and 37 deletions

View File

@@ -8,7 +8,7 @@ def frac_knapsack(vl, wt, w, n):
240.0
"""
r = list(sorted(zip(vl, wt), key=lambda x: x[0] / x[1], reverse=True))
r = sorted(zip(vl, wt), key=lambda x: x[0] / x[1], reverse=True)
vl, wt = [i[0] for i in r], [i[1] for i in r]
acc = list(accumulate(wt))
k = bisect(acc, w)