summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <bschubert15@bloomberg.net>2019-12-02 11:02:23 +0000
committerBenjamin Schubert <bschubert15@bloomberg.net>2019-12-02 11:02:23 +0000
commit069b110c866ecfd652a041d735ca6d261b8d41ba (patch)
tree8971bdb7d0c26ce7e5d2da65e705b1046c666603
parent05aaf3eadff2981fe3c16e6c3a808c37f0ca1187 (diff)
downloadbuildstream-069b110c866ecfd652a041d735ca6d261b8d41ba.tar.gz
lint: Remove unnecessary list comprehensions
Newer version of pylint detect when a comprehension would not be needed. Let's remove all the ones that are indeed extraneous
-rw-r--r--src/buildstream/_profile.py2
-rw-r--r--src/buildstream/_stream.py2
-rw-r--r--src/buildstream/element.py2
-rw-r--r--src/buildstream/source.py2
-rw-r--r--tests/frontend/workspace.py2
-rw-r--r--tests/remoteexecution/workspace.py2
6 files changed, 6 insertions, 6 deletions
diff --git a/src/buildstream/_profile.py b/src/buildstream/_profile.py
index fdde04ab7..b3182b630 100644
--- a/src/buildstream/_profile.py
+++ b/src/buildstream/_profile.py
@@ -118,7 +118,7 @@ class _Profiler:
self._valid_topics = False
if settings:
- self.enabled_topics = {topic for topic in settings.split(":")}
+ self.enabled_topics = set(settings.split(":"))
@contextlib.contextmanager
def profile(self, topic, key, message=None):
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 4b8409323..20e073110 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -678,7 +678,7 @@ class Stream:
continue
if isinstance(obj, ArtifactElement):
obj.name = ref
- files = [f for f in obj._walk_artifact_files()]
+ files = list(obj._walk_artifact_files())
elements_to_files[obj.name] = files
return elements_to_files
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index ffce257bf..7b96e8a8b 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -1965,7 +1965,7 @@ class Element(Plugin):
sandbox._set_mount_source(mount.path, mount.host_path)
if command:
- argv = [arg for arg in command]
+ argv = command
else:
argv = shell_command
diff --git a/src/buildstream/source.py b/src/buildstream/source.py
index dbe113409..f49cdb493 100644
--- a/src/buildstream/source.py
+++ b/src/buildstream/source.py
@@ -1004,7 +1004,7 @@ class Source(Plugin):
# If we're synthesising missing list entries, we know we're
# doing this for project.refs so synthesise empty dicts for the
# intervening entries too
- lpath = [step for step in path]
+ lpath = path.copy()
lpath.append("") # We know the last step will be a string key
for step, next_step in zip(lpath, lpath[1:]):
if type(step) is str: # pylint: disable=unidiomatic-typecheck
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index 80db8cc98..eabaca68c 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -42,7 +42,7 @@ from buildstream._workspaces import BST_WORKSPACE_FORMAT_VERSION
from tests.testutils import create_artifact_share, create_element_size, wait_for_cache_granularity
-repo_kinds = [(kind) for kind in ALL_REPO_KINDS]
+repo_kinds = ALL_REPO_KINDS
# Project directory
DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project",)
diff --git a/tests/remoteexecution/workspace.py b/tests/remoteexecution/workspace.py
index 4ac743490..83480b42e 100644
--- a/tests/remoteexecution/workspace.py
+++ b/tests/remoteexecution/workspace.py
@@ -91,7 +91,7 @@ def _get_mtimes(root):
def get_mtimes(root):
- return {k: v for (k, v) in set(_get_mtimes(root))}
+ return dict(set(_get_mtimes(root)))
def check_buildtree(