From 1af1f33e8083ee6ff71eb98d63ab54fd18ab0646 Mon Sep 17 00:00:00 2001 From: Uriziel Date: Sun, 27 Jan 2013 15:22:26 +0100 Subject: [PATCH] Simple util for upcoming features --- syncplay/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/syncplay/utils.py b/syncplay/utils.py index 4225a34..2e1ee10 100644 --- a/syncplay/utils.py +++ b/syncplay/utils.py @@ -5,6 +5,7 @@ from syncplay import constants from syncplay.messages import getMessage import sys import os +import itertools def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None): """Retry calling the decorated function using an exponential backoff. @@ -88,3 +89,5 @@ def findWorkingDir(): path = "" return path +def limitedPowerset(s, minLength): + return itertools.chain.from_iterable(itertools.combinations(s, r) for r in xrange(len(s), minLength, -1))