diff options
author | Craig Rodrigues <rodrigc@FreeBSD.org> | 2017-03-11 21:03:23 (GMT) |
---|---|---|
committer | Craig Rodrigues <rodrigc@FreeBSD.org> | 2017-03-11 21:03:23 (GMT) |
commit | 4da977010029bbe4d94e5c6ad8db10f62cab6276 (patch) | |
tree | 8757cec005be0367866f27f1a9265adbf5def009 /src | |
parent | bf3e197e213e45b5c5966b70f186f2fc6b0ecfa2 (diff) | |
download | SCons-4da977010029bbe4d94e5c6ad8db10f62cab6276.zip SCons-4da977010029bbe4d94e5c6ad8db10f62cab6276.tar.gz SCons-4da977010029bbe4d94e5c6ad8db10f62cab6276.tar.bz2 |
Replace list(filter()) with list comprehension.
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Action.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/Dir.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Script/Interactive.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Script/Main.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/dvipdf.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/packaging/__init__.py | 4 | ||||
-rw-r--r-- | src/test_aegistests.py | 2 |
7 files changed, 8 insertions, 8 deletions
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index eb215fd..be70293 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -778,7 +778,7 @@ class CommandAction(_ActionAction): _ActionAction.__init__(self, **kw) if is_List(cmd): - if list(filter(is_List, cmd)): + if [c for c in cmd if is_List(c)]: raise TypeError("CommandAction should be given only " \ "a single command") self.cmd_list = cmd diff --git a/src/engine/SCons/Scanner/Dir.py b/src/engine/SCons/Scanner/Dir.py index cbfb6fb..3b33fe5 100644 --- a/src/engine/SCons/Scanner/Dir.py +++ b/src/engine/SCons/Scanner/Dir.py @@ -27,7 +27,7 @@ import SCons.Scanner def only_dirs(nodes): is_Dir = lambda n: isinstance(n.disambiguate(), SCons.Node.FS.Dir) - return list(filter(is_Dir, nodes)) + return [node for node in nodes if is_Dir(node)] def DirScanner(**kw): """Return a prototype Scanner instance for scanning diff --git a/src/engine/SCons/Script/Interactive.py b/src/engine/SCons/Script/Interactive.py index 3c3d23a..cf6e247 100644 --- a/src/engine/SCons/Script/Interactive.py +++ b/src/engine/SCons/Script/Interactive.py @@ -222,7 +222,7 @@ class SConsInteractiveCmd(cmd.Cmd): def get_unseen_children(node, parent, seen_nodes=seen_nodes): def is_unseen(node, seen_nodes=seen_nodes): return node not in seen_nodes - return list(filter(is_unseen, node.children(scan=1))) + return [child for child in node.children(scan=1) if is_unseen(child)] def add_to_seen_nodes(node, parent, seen_nodes=seen_nodes): seen_nodes[node] = 1 diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index b82b6a5..aea6bea 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -1168,7 +1168,7 @@ def _build_targets(fs, options, targets, target_top): # or not a file, so go ahead and keep it as a default # target and let the engine sort it out: return 1 - d = list(filter(check_dir, SCons.Script.DEFAULT_TARGETS)) + d = [tgt for tgt in SCons.Script.DEFAULT_TARGETS if check_dir(tgt)] SCons.Script.DEFAULT_TARGETS[:] = d target_top = None lookup_top = None diff --git a/src/engine/SCons/Tool/dvipdf.py b/src/engine/SCons/Tool/dvipdf.py index 374b9c5..f1e9513 100644 --- a/src/engine/SCons/Tool/dvipdf.py +++ b/src/engine/SCons/Tool/dvipdf.py @@ -87,7 +87,7 @@ def PDFEmitter(target, source, env): """ def strip_suffixes(n): return not SCons.Util.splitext(str(n))[1] in ['.aux', '.log'] - source = list(filter(strip_suffixes, source)) + source = [src for src in source if strip_suffixes(src)] return (target, source) def generate(env): diff --git a/src/engine/SCons/Tool/packaging/__init__.py b/src/engine/SCons/Tool/packaging/__init__.py index 1727938..8aa4787 100644 --- a/src/engine/SCons/Tool/packaging/__init__.py +++ b/src/engine/SCons/Tool/packaging/__init__.py @@ -233,7 +233,7 @@ def copy_attr(f1, f2): """ copyit = lambda x: not hasattr(f2, x) and x[:10] == 'PACKAGING_' if f1._tags: - pattrs = list(filter(copyit, f1._tags)) + pattrs = [tag for tag in f1._tags if copyit(tag)] for attr in pattrs: f2.Tag(attr, f1.GetTag(attr)) @@ -288,7 +288,7 @@ def stripinstallbuilder(target, source, env): (file.builder.name=="InstallBuilder" or\ file.builder.name=="InstallAsBuilder")) - if len(list(filter(has_no_install_location, source))): + if len([src for src in source if has_no_install_location(src)]): warn(Warning, "there are files to package which have no\ InstallBuilder attached, this might lead to irreproducible packages") diff --git a/src/test_aegistests.py b/src/test_aegistests.py index 67b0e3f..57adc1d 100644 --- a/src/test_aegistests.py +++ b/src/test_aegistests.py @@ -65,7 +65,7 @@ re3 = re.compile(r' test/.*\.py') def filename_is_a_test(x): return re1.search(x) or re2.search(x) or re3.search(x) -test_files = list(filter(filename_is_a_test, sources)) +test_files = [file for file in sources if filename_is_a_test(file)] if test_files: sys.stderr.write("Found the following files with test names not marked as Aegis tests:\n") |