Skip to content

Commit

Permalink
Prefer list comprehensions over list.append()
Browse files Browse the repository at this point in the history
  • Loading branch information
lgeiger committed Jun 20, 2020
1 parent 59caed8 commit 311cbfa
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/xdist/workermanage.py
Original file line number Diff line number Diff line change
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 311cbfa

Please sign in to comment.