diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-08-31 09:37:14 -0700 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2021-08-31 16:28:54 -0400 |
commit | 278942a44703aff6b643426b09a9012460719622 (patch) | |
tree | 5019a9ba34a83ad5cef34efc8325955f05b9cef3 /mesonbuild/rewriter.py | |
parent | 1fc3d8608d9d278c9faf8ccf6aecf33cc7e92c26 (diff) | |
download | meson-278942a44703aff6b643426b09a9012460719622.zip meson-278942a44703aff6b643426b09a9012460719622.tar.gz meson-278942a44703aff6b643426b09a9012460719622.tar.bz2 |
pylint: enable consider-iterating-dictionary
This didn't actually catch what it's supposed to, which is cases of:
```python
for x in dict.keys():
y = dict[x]
```
But it did catch one unnecessary use of keys(), and one case where we
were doing something in an inefficient way. I've rewritten:
```python
if name.value in [x.value for x in self.kwargs.keys() if isinstance(x, IdNode)]:
```
as
``python
if any((isinstance(x, IdNode) and name.value == x.value) for x in self.kwargs):
```
Which avoids doing two iterations, one to build the list, and a
second to do a search for name.value in said list, which does a single
short circuiting walk, as any returns as soon as one check returns True.
Diffstat (limited to 'mesonbuild/rewriter.py')
0 files changed, 0 insertions, 0 deletions