Simple util for upcoming features

This commit is contained in:
Uriziel 2013-01-27 15:22:26 +01:00
parent f28e1db324
commit 1af1f33e80

View File

@ -5,6 +5,7 @@ from syncplay import constants
from syncplay.messages import getMessage from syncplay.messages import getMessage
import sys import sys
import os import os
import itertools
def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None): def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
"""Retry calling the decorated function using an exponential backoff. """Retry calling the decorated function using an exponential backoff.
@ -88,3 +89,5 @@ def findWorkingDir():
path = "" path = ""
return path return path
def limitedPowerset(s, minLength):
return itertools.chain.from_iterable(itertools.combinations(s, r) for r in xrange(len(s), minLength, -1))