summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-01-12 16:55:50 +0100
committerScott Moser <smoser@ubuntu.com>2012-01-12 16:55:50 +0100
commit121e17d15dcf311f8e629788d74df10f7c291676 (patch)
tree7539ebfbd59a271fdc50cdfdd3ddd78f1bfc2ca0 /cloudinit
parent38f913377554f27159171a505b5805ee2537a905 (diff)
downloadvyos-cloud-init-121e17d15dcf311f8e629788d74df10f7c291676.tar.gz
vyos-cloud-init-121e17d15dcf311f8e629788d74df10f7c291676.zip
[PATCH 11/13] Fix pylint warnings W0141 (used builtin function xyz)
From: Juerg Haefliger <juerg.haefliger@hp.com> Replace superseded builtin functions 'filter' and 'map' using list comprehension.
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/CloudConfig/cc_mounts.py2
-rw-r--r--cloudinit/DataSource.py4
-rw-r--r--cloudinit/__init__.py3
-rw-r--r--cloudinit/util.py4
4 files changed, 7 insertions, 6 deletions
diff --git a/cloudinit/CloudConfig/cc_mounts.py b/cloudinit/CloudConfig/cc_mounts.py
index 327b480f..a3036d5a 100644
--- a/cloudinit/CloudConfig/cc_mounts.py
+++ b/cloudinit/CloudConfig/cc_mounts.py
@@ -116,7 +116,7 @@ def handle(_name,cfg,cloud,log,_args):
# now, each entry in the cfgmnt list has all fstab values
# if the second field is None (not the string, the value) we skip it
- actlist = filter(lambda x: x[1] is not None, cfgmnt)
+ actlist = [x for x in cfgmnt if x[1] is not None]
if len(actlist) == 0: return
diff --git a/cloudinit/DataSource.py b/cloudinit/DataSource.py
index 623f96b6..ac79f757 100644
--- a/cloudinit/DataSource.py
+++ b/cloudinit/DataSource.py
@@ -199,8 +199,8 @@ def is_ipv4(instr):
return False
try:
- filter(lambda x: int(x) < 256 and x > 0, toks)
+ toks = [x for x in toks if (int(x) < 256 and int(x) > 0)]
except:
return False
- return True
+ return (len(toks) == 4)
diff --git a/cloudinit/__init__.py b/cloudinit/__init__.py
index 72d988d5..1bdeb7f4 100644
--- a/cloudinit/__init__.py
+++ b/cloudinit/__init__.py
@@ -191,7 +191,8 @@ class CloudInit:
cfglist=self.cfg['datasource_list']
dslist = list_sources(cfglist, self.ds_deps)
- dsnames = map(lambda f: f.__name__, dslist)
+ dsnames = [f.__name__ for f in dslist]
+
log.debug("searching for data source in %s" % dsnames)
for cls in dslist:
ds = cls.__name__
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 64007211..5bf8e8b2 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -292,10 +292,10 @@ def read_conf_d(confd):
confs = sorted(os.listdir(confd),reverse=True)
# remove anything not ending in '.cfg'
- confs = filter(lambda f: f.endswith(".cfg"), confs)
+ confs = [f for f in confs if f.endswith(".cfg")]
# remove anything not a file
- confs = filter(lambda f: os.path.isfile("%s/%s" % (confd,f)),confs)
+ confs = [f for f in confs if os.path.isfile("%s/%s" % (confd,f))]
cfg = { }
for conf in confs: