diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2014-05-30 16:12:38 +0200 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2014-05-30 16:14:33 +0200 |
commit | 64dccfab85f9d583cbd32a0120f8e750b23c5290 (patch) | |
tree | ddb40d37bb617074399aad6a156a98a8e692777a /utils.py | |
parent | 6ffbfd7521b6796488b27aa7d82765b8a7346692 (diff) | |
download | clufter-64dccfab85f9d583cbd32a0120f8e750b23c5290.tar.gz clufter-64dccfab85f9d583cbd32a0120f8e750b23c5290.tar.xz clufter-64dccfab85f9d583cbd32a0120f8e750b23c5290.zip |
format: refactor out some tuplist-realated normalizations
...to utils.py
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -13,6 +13,10 @@ tuplist = lambda x: isinstance(x, (tuple, list)) # turn args into tuple unless single tuplist arg args2sgpl = \ lambda x=(), *y: x if not y and tuplist(x) else (x, ) + y +args2combsgpl = arg2wrapped = \ + lambda x=(), *y: x if not y and tuplist(x) and len(x) > 1 else (x, ) + y +args2unwrapped = \ + lambda x=None, *y: x if not y else (x, ) + y # turn args into tuple unconditionally args2tuple = lambda *args: tuple(args) any2iter = \ |