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 38420 Build 38419: arc lint + arc unit
Event Timeline
lnt/external/stats/pstat.py | ||
---|---|---|
514 | max(map(lambda item: len(makestr(item)), items))? | |
lnt/external/stats/stats.py | ||
1633 | See above. | |
lnt/lnttool/main.py | ||
173 ↗ | (On Diff #220975) | I believe the change to this line is not necessary. |
lnt/server/db/migrate.py | ||
83 ↗ | (On Diff #220975) | The unpacking works fine without the change even with Python 3. |
lnt/external/stats/stats.py | ||
---|---|---|
1569–1573 | 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 ↗ | (On Diff #220975) | 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 | Undoing useless change I made just before committing https://reviews.llvm.org/D65751 |
lnt/external/stats/stats.py | ||
---|---|---|
1569 | tmp is consumed twice immediately below, so the list application would still be appropriate if we aren't removing this block altogether. | |
1569–1573 |
| |
1575 | Drive by: |
lnt/external/stats/stats.py | ||
---|---|---|
1575 | 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 | ||
---|---|---|
1569 | 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 | ||
1266 | 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. | |
1569 | 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))?