[elbe-devel] [PATCH 16/25] py3: remove usage of lambda
Torben Hohn
torben.hohn at linutronix.de
Fri Dec 15 17:53:22 CET 2017
On Mon, Dec 11, 2017 at 10:11:10AM +0100, Manuel Traut wrote:
> lambda behaves differently in py3 and py2
>
> Signed-off-by: Manuel Traut <manut at linutronix.de>
Reviewed-by: Torben Hohn <torben.hohn 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
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
--
Mit freundlichen Grüßen
Torben Hohn
Linutronix GmbH
Standort: Bremen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
Firmensitz / Registered Office: D-88690 Uhldingen, Bahnhofstr. 3
Registergericht / Local District Court: Amtsgericht Freiburg i. Br.; HRB
Nr. / Trade register no.: 700 806
Geschäftsführer / Managing Directors: Heinz Egger, Thomas Gleixner
Eine Bitte von uns: Sollten Sie diese E-Mail irrtümlich erhalten haben,
benachrichtigen Sie uns in diesem Falle bitte sobald wie es Ihnen
möglich ist, durch Antwort-Mail. Vielen Dank!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20171215/c296feb2/attachment.sig>
More information about the elbe-devel
mailing list