Skip to content

Commit

Permalink
Merge pull request #545 from lgeiger/list-comprehensions
Browse files Browse the repository at this point in the history
Prefer list comprehensions over list.append()
  • Loading branch information
nicoddemus committed Jul 8, 2020
2 parents 59caed8 + 311cbfa commit f502131
Showing 1 changed file with 4 additions and 8 deletions.
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

0 comments on commit f502131

Please sign in to comment.