From 82deb81c8a147cfd5cd7e22e7f69b1a81e78c896 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 18 Dec 2013 22:52:48 +0100 Subject: Reaktor: caps resolver is now pythonic --- Reaktor/TODO | 1 - Reaktor/commands/caps | 9 +-------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Reaktor/TODO b/Reaktor/TODO index 995db2af..8eb4073d 100644 --- a/Reaktor/TODO +++ b/Reaktor/TODO @@ -1,6 +1,5 @@ commands/caps: merge load_config with IRC/getconf.py commands/caps: generalize for UDP -commands/caps: replace map/filter with more pythonic way getconf: reload inotify diff --git a/Reaktor/commands/caps b/Reaktor/commands/caps index eb1d97a6..a9ce4519 100755 --- a/Reaktor/commands/caps +++ b/Reaktor/commands/caps @@ -8,12 +8,5 @@ def load_config(filename): file, pathname, description = imp.find_module(modname, [ dirname ]) return imp.load_module(modname, file, pathname, description) -def not_none(x): - return x != None - -def pluck(name): - return lambda x: name in x.keys() and x[name] or None - config = load_config(os.environ['config_filename']) - -print(' '.join(filter(not_none, map(pluck('capname'), config.irc_commands)))) +print(' '.join(filter(None,[ x.get('capname',None) for x in config.irc_commands]))) -- cgit v1.2.3