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/backend/xcodebackend.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/backend/xcodebackend.py')
-rw-r--r-- | mesonbuild/backend/xcodebackend.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index 01053c1..b1a8956 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -1282,7 +1282,7 @@ class XCodeBackend(backends.Backend): def generate_pbx_sources_build_phase(self, objects_dict): - for name in self.source_phase.keys(): + for name in self.source_phase: phase_dict = PbxDict() t = self.build_targets[name] objects_dict.add_item(t.buildphasemap[name], phase_dict, 'Sources') |