[elbe-devel] [PATCH 16/25] py3: remove usage of lambda
Manuel Traut
manut at linutronix.de
Mon Dec 11 10:11:10 CET 2017
lambda behaves differently in py3 and py2
Signed-off-by: Manuel Traut <manut at linutronix.de>
---
elbepack/filesystem.py | 2 +-
elbepack/pkgutils.py | 4 ++--
elbepack/xmldefaults.py | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
index 63dd8953..47533f9a 100644
--- a/elbepack/filesystem.py
+++ b/elbepack/filesystem.py
@@ -98,7 +98,7 @@ class Filesystem(object):
def listdir(self, path='', ignore=[], skiplinks=False):
retval = [os.path.join(self.path, path, x) for x in os.listdir( self.fname(path) ) if not x in ignore]
if skiplinks:
- retval = filter(lambda x: (not os.path.islink(x)) and os.path.isdir(x), retval)
+ retval = [x for x in retval if (not os.path.islink(x)) and os.path.isdir(x)]
return retval
diff --git a/elbepack/pkgutils.py b/elbepack/pkgutils.py
index 32000f00..e8288941 100644
--- a/elbepack/pkgutils.py
+++ b/elbepack/pkgutils.py
@@ -93,8 +93,8 @@ def get_url ( arch, suite, target_pkg, mirror, comp='main' ):
packages = urlopen(pack_url, None, 10)
packages = packages.readlines()
- packages = filter( lambda x: x.startswith( "Filename" ), packages )
- packages = filter( lambda x: x.find( target_pkg ) != -1, packages )
+ packages = [x for x in packages if x.startswith( "Filename" )]
+ packages = [x for x in packages if x.find( target_pkg ) != -1]
tmp = packages.pop()
urla = tmp.split()
diff --git a/elbepack/xmldefaults.py b/elbepack/xmldefaults.py
index f9cd0069..56a1f95a 100644
--- a/elbepack/xmldefaults.py
+++ b/elbepack/xmldefaults.py
@@ -176,7 +176,7 @@ def get_random_mac():
binaddr = [random.randint(0,255) for i in range(6) ]
binaddr[0] &= 0xfe
binaddr[0] |= 0x02
- s = map( lambda x: "%02x" % x, binaddr )
+ s = ["%02x" % x for x in binaddr]
return ':'.join (s)
--
2.15.1
More information about the elbe-devel
mailing list