Adapt calls to map() to the fact it returns an iterator in Python 3 when
necessary. This was produced by running futurize's stage2
lib2to3.fixes.fix_map, with manual clean up to remove unecessary list
wrapping and simplify the code.
Details
Diff Detail
- Build Status
Buildable 38342 Build 38341: arc lint + arc unit
Event Timeline
lnt/external/stats/stats.py | ||
---|---|---|
1568–1571 | These do not seem to be used later in the function, how can I check if these are global variables? | |
lnt/server/db/migrate.py | ||
83 | Indeed, https://docs.python.org/3/reference/simple_stmts.html#grammar-token-assignment-stmt says: Assignment of an object to a target list, optionally enclosed in parentheses or square brackets, is recursively defined as follows.
| |
lnt/testing/__init__.py | ||
383 ↗ | (On Diff #221301) | Undoing useless change I made just before committing https://reviews.llvm.org/D65751 |
lnt/external/stats/stats.py | ||
---|---|---|
1568–1571 | tmp is consumed twice immediately below, so the list application would still be appropriate if we aren't removing this block altogether. | |
1568–1571 |
| |
1574 | Drive by: |
lnt/external/stats/stats.py | ||
---|---|---|
1574 | Hmm, since we need a list anyway, maybe: for list in lists: alldata.extend(list) I don't know enough about the way the implementation works to know that the chain version would be handled as well. |
Remove unused variables defined from calling map rather than fixing map call
lnt/external/stats/stats.py | ||
---|---|---|
1568–1571 | Yes but map accepts an iterable so if the only uses are below (as the name tmp would imply) that change should be fine. I grepped LNT around for vars and means and couldn't find use elsewhere and git history isn't very informative. I've thus decided to remove the entire block. |
LGTM with comments on further changes that could be made.
lnt/external/stats/pstat.py | ||
---|---|---|
965 | Not the subject of this patch, but the cmp might be a problem. | |
1025 | Ditto. | |
lnt/external/stats/stats.py | ||
1265 | Another opportunity to do clean-up in another patch. It seems this is some attempt to preallocate n (and it happens in a few other places), but I haven't found anything that indicates that this isn't just dead code. | |
1568–1571 | I agree with the removal of the block. On the now-moot point (in case it comes up in the future), by "consume" I did mean destructively consume. That is: tmp = map(str, [0, 1]) a = list(tmp) b = list(tmp) # Empty list! |
max(map(lambda item: len(makestr(item)), items))?