Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer list comprehensions over list.append() #545

Merged
merged 1 commit into from Jul 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/xdist/workermanage.py
Expand Up @@ -63,10 +63,7 @@ def rsync_roots(self, gateway):
def setup_nodes(self, putevent):
self.config.hook.pytest_xdist_setupnodes(config=self.config, specs=self.specs)
self.trace("setting up nodes")
nodes = []
for spec in self.specs:
nodes.append(self.setup_node(spec, putevent))
return nodes
return [self.setup_node(spec, putevent) for spec in self.specs]

def setup_node(self, spec, putevent):
gw = self.group.makegateway(spec)
Expand Down Expand Up @@ -158,11 +155,10 @@ class HostRSync(execnet.RSync):

def __init__(self, sourcedir, *args, **kwargs):
self._synced = {}
self._ignores = []
ignores = kwargs.pop("ignores", None) or []
for x in ignores:
x = getattr(x, "strpath", x)
self._ignores.append(re.compile(fnmatch.translate(x)))
self._ignores = [
re.compile(fnmatch.translate(getattr(x, "strpath", x))) for x in ignores
]
super(HostRSync, self).__init__(sourcedir=sourcedir, **kwargs)

def filter(self, path):
Expand Down