All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: selinux@tycho.nsa.gov
Subject: [PATCH 3/4] python/sepolicy: Use list instead of map
Date: Wed, 14 Feb 2018 10:53:36 +0100	[thread overview]
Message-ID: <20180214095337.1945-4-plautrba@redhat.com> (raw)
In-Reply-To: <20180214095337.1945-1-plautrba@redhat.com>

map() returns an iterator in python3, list in python2

Fixes:
File "/usr/lib/python3.6/site-packages/sepolicy/generate.py", line 114, in get_all_users
  users.remove("system_u")
AttributeError: 'map' object has no attribute 'remove'

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
 python/sepolicy/sepolicy/generate.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/sepolicy/sepolicy/generate.py b/python/sepolicy/sepolicy/generate.py
index d68f96ef..1b36eb6e 100644
--- a/python/sepolicy/sepolicy/generate.py
+++ b/python/sepolicy/sepolicy/generate.py
@@ -110,7 +110,7 @@ def get_all_ports():
 
 
 def get_all_users():
-    users = map(lambda x: x['name'], sepolicy.info(sepolicy.USER))
+    users = [x['name'] for x in sepolicy.info(sepolicy.USER)]
     users.remove("system_u")
     users.remove("root")
     users.sort()
-- 
2.16.1

  parent reply	other threads:[~2018-02-14  9:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-14  9:53 Update selinux-sepolgengui to be compatible with Gtk3, Python 3 Petr Lautrbach
2018-02-14  9:53 ` [PATCH 1/4] gui/polgengui.py: Fix sepolicy.generate import in polgengui.py Petr Lautrbach
2018-02-14  9:53 ` [PATCH 2/4] gui/polgengui.py: Convert polgen.glade to Builder format polgen.ui Petr Lautrbach
2018-02-14  9:53 ` Petr Lautrbach [this message]
2018-02-14  9:53 ` [PATCH 4/4] python/sepolicy: Do not use types.BooleanType Petr Lautrbach
2018-02-18 18:09 ` Update selinux-sepolgengui to be compatible with Gtk3, Python 3 Nicolas Iooss
2018-02-18 18:20   ` Nicolas Iooss
2018-02-22 15:31     ` Petr Lautrbach
2018-02-22 16:59       ` Petr Lautrbach
2018-02-22 19:09         ` Nicolas Iooss
2018-02-23 20:29           ` Stephen Smalley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180214095337.1945-4-plautrba@redhat.com \
    --to=plautrba@redhat.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.