From d8b9e59fc1279edd436d8ab325aa4609996bcb2a Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 16 Feb 2024 13:11:08 -0600 Subject: [PATCH] Resolve flake8-comprehensions violations --- src/rosdep2/platforms/osx.py | 2 +- src/rosdep2/sources_list.py | 2 +- test/test_rosdep_sources_list.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rosdep2/platforms/osx.py b/src/rosdep2/platforms/osx.py index aadcb46c8..e789dc9c7 100644 --- a/src/rosdep2/platforms/osx.py +++ b/src/rosdep2/platforms/osx.py @@ -303,7 +303,7 @@ def handle_options(options): # make sure options is a list of list of strings try: - valid = all([isinstance(x, _basestring) for option in options for x in option]) + valid = all(isinstance(x, _basestring) for option in options for x in option) except Exception as e: raise InvalidData("Invalid list of options '%s', error: %s" % (options, e)) else: diff --git a/src/rosdep2/sources_list.py b/src/rosdep2/sources_list.py index 9299f5363..b94964523 100644 --- a/src/rosdep2/sources_list.py +++ b/src/rosdep2/sources_list.py @@ -637,7 +637,7 @@ def get_view_dependencies(self, view_name): if view_name != SourcesListLoader.ALL_VIEW_KEY: # if the view_name matches one of our sources, return # empty list as none of our sources has deps. - if any([x for x in self.sources if view_name == x.url]): + if any(x for x in self.sources if view_name == x.url): return [] # not one of our views, so it depends on everything we provide diff --git a/test/test_rosdep_sources_list.py b/test/test_rosdep_sources_list.py index dff036a4d..91cc6c401 100644 --- a/test/test_rosdep_sources_list.py +++ b/test/test_rosdep_sources_list.py @@ -434,7 +434,7 @@ def test_SourcesListLoader_create_default(): loader = SourcesListLoader.create_default(matcher, sources_cache_dir=tempdir) assert loader.sources sources0 = loader.sources - assert not any([s for s in loader.sources if not matcher.matches(s)]) + assert not any(s for s in loader.sources if not matcher.matches(s)) loader = SourcesListLoader.create_default(matcher, sources_cache_dir=tempdir) assert sources0 == loader.sources @@ -445,7 +445,7 @@ def test_SourcesListLoader_create_default(): assert loader2.sources # - should have filtered down to python-only assert sources0 != loader2.sources - assert not any([s for s in loader2.sources if not matcher2.matches(s)]) + assert not any(s for s in loader2.sources if not matcher2.matches(s)) # test API