CLN: Lint for lists instead of generators in built-in Python functions
State: closed

- [x] tests passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

Continuation of #18276 plus a lint check for list comprehension in built-in Python functions. The grep will only catch list comprehensions on single lines though. I'm all ears for greps that can catch multi-line list comprehensions or a better grep in general. 

Labels:
name: Code Style
description: Code style, linting, code_checks
name: Clean

Comments:
~~I am not exactly sure why cython won't let me compile either:~~

~~`_str_reso_map = dict((v, k) for k, v in _reso_str_map.items())`~~

~~or~~

~~` _freq_reso_map = dict((v, k) for k, v in _reso_freq_map.items())`~~


~~in `resolution.pyx` when `_reso_str_map` and `_reso_freq_map` are defined a few lines above them. It will compile if I pass in the list comprehension though.~~

When I changed the dict function call to `{}`, cython compiled successfully. 

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=h1) Report
> Merging [#18335](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/cfad581e9a6d35c7d05d2b1f34e4a19f7ee15cc6?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `96%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18335/graphs/tree.svg?src=pr&token=eZ4WkYLtcO&height=150&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18335      +/-   ##
==========================================
- Coverage   91.38%   91.36%   -0.02%     
==========================================
  Files         164      164              
  Lines       49790    49790              
==========================================
- Hits        45501    45492       -9     
- Misses       4289     4298       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.17% <88%> (ø)` | :arrow_up: |
| #single | `39.49% <42%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/clipboards.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2lvL2NsaXBib2FyZHMucHk=) | `100% <ø> (ø)` | :arrow_up: |
| [pandas/plotting/\_core.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb3JlLnB5) | `82.45% <0%> (ø)` | :arrow_up: |
| [pandas/tseries/holiday.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvaG9saWRheS5weQ==) | `93.1% <100%> (ø)` | :arrow_up: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `65.25% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexing.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhpbmcucHk=) | `92.8% <100%> (ø)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `95.73% <100%> (ø)` | :arrow_up: |
| [pandas/core/sparse/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2ZyYW1lLnB5) | `94.78% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `92.85% <100%> (ø)` | :arrow_up: |
| [pandas/io/sql.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2lvL3NxbC5weQ==) | `94.8% <100%> (ø)` | :arrow_up: |
| [pandas/core/internals.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzLnB5) | `94.54% <100%> (ø)` | :arrow_up: |
| ... and [15 more](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=footer). Last update [cfad581...c91410f](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=h1) Report
> Merging [#18335](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/1798c9df8144890f9d9b74cca9f3134ea523b201?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `96%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18335/graphs/tree.svg?height=150&src=pr&token=eZ4WkYLtcO&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18335      +/-   ##
==========================================
- Coverage   91.36%   91.34%   -0.02%     
==========================================
  Files         164      164              
  Lines       49790    49790              
==========================================
- Hits        45489    45480       -9     
- Misses       4301     4310       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.14% <88%> (ø)` | :arrow_up: |
| #single | `39.53% <42%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/clipboards.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2lvL2NsaXBib2FyZHMucHk=) | `100% <ø> (ø)` | :arrow_up: |
| [pandas/plotting/\_core.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb3JlLnB5) | `82.45% <0%> (ø)` | :arrow_up: |
| [pandas/tseries/holiday.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvaG9saWRheS5weQ==) | `93.1% <100%> (ø)` | :arrow_up: |
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.59% <100%> (ø)` | :arrow_up: |
| [pandas/stats/moments.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL3N0YXRzL21vbWVudHMucHk=) | `71.19% <100%> (ø)` | :arrow_up: |
| [pandas/io/sql.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2lvL3NxbC5weQ==) | `94.8% <100%> (ø)` | :arrow_up: |
| [pandas/core/sparse/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2ZyYW1lLnB5) | `94.78% <100%> (ø)` | :arrow_up: |
| [pandas/core/reshape/concat.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9jb25jYXQucHk=) | `97.58% <100%> (ø)` | :arrow_up: |
| [pandas/core/panelnd.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcGFuZWxuZC5weQ==) | `98.21% <100%> (ø)` | :arrow_up: |
| [pandas/core/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tbW9uLnB5) | `93% <100%> (ø)` | :arrow_up: |
| ... and [15 more](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=footer). Last update [1798c9d...3572626](https://codecov.io/gh/pandas-dev/pandas/pull/18335?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

can you rebase
Rebased. I can create a follow up issue/PR to replace instances of `set(foo for foo in iterator)` with `{foo for foo in iterator}`  where appropriate (likewise for lists and dicts)
thanks!