Mercurial > p > roundup > code
comparison roundup/admin.py @ 6001:3719b01cbe9e
BANDIT reports assert. Replace assert with raise.
Assert used but it can be removed from optimized code.
The check looks like it is required. So raise an AssertionFailure.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 26 Dec 2019 21:17:48 -0500 |
| parents | 33a7b10618a6 |
| children | d25638d1826c |
comparison
equal
deleted
inserted
replaced
| 6000:6c3826600610 | 6001:3719b01cbe9e |
|---|---|
| 1226 exp = cl.export_list(propnames, nodeid) | 1226 exp = cl.export_list(propnames, nodeid) |
| 1227 lensum = sum ([len (repr_export(node[p])) for p in propnames]) | 1227 lensum = sum ([len (repr_export(node[p])) for p in propnames]) |
| 1228 # for a safe upper bound of field length we add | 1228 # for a safe upper bound of field length we add |
| 1229 # difference between CSV len and sum of all field lengths | 1229 # difference between CSV len and sum of all field lengths |
| 1230 d = sum ([len(x) for x in exp]) - lensum | 1230 d = sum ([len(x) for x in exp]) - lensum |
| 1231 assert (d > 0) | 1231 if not d > 0: |
| 1232 raise AssertionError("Bad assertion d > 0") | |
| 1232 for p in propnames: | 1233 for p in propnames: |
| 1233 ll = len(repr_export(node[p])) + d | 1234 ll = len(repr_export(node[p])) + d |
| 1234 if ll > max_len: | 1235 if ll > max_len: |
| 1235 max_len = ll | 1236 max_len = ll |
| 1236 writer.writerow(exp) | 1237 writer.writerow(exp) |
