Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(6)  |  Derive(0)  |  Import(1)
Validation functions. Parse a list of comma-separated intervals
in the form ((every)? INTERVAL for INTERVAL)|INTERVAL into a list
of interval lengths in seconds.

        def _parseIntervalList(s):
    """Validation functions. Parse a list of comma-separated intervals
       in the form ((every)? INTERVAL for INTERVAL)|INTERVAL into a list
       of interval lengths in seconds."""
    items = s.strip().lower().split(",")
    ilist = []
    for item in items:
        item = item.strip()
        if stringContains(item, " for "):
            if item.startswith("every "):
                item = item[6:]
            interval, duration = item.split(" for ", 1)
            interval = int(_parseInterval(interval))
            duration = int(_parseInterval(duration))
            if interval < 1:
                raise ConfigError("Repeated interval too small in %s"%s)

            ilist += [interval] * ceilDiv(duration, interval)
        elif item.startswith("every "):
            raise ConfigError(
                "Bad syntax on interval %s. (Did you mean %s for X days?)",
                item, item)
        else:
            interval = int(_parseInterval(item))
            ilist.append(interval)
    return ilist
        


src/m/i/mixminion-HEAD/lib/mixminion/test.py   mixminion(Download)
        self.assertEquals(C._parseSize("12.3M"), long(12.3*(1<<20L)))
        # IntervalList
        self.assertEquals(C._parseIntervalList(" 5 sec, 1 min, 2 hours"),
                          [ 5, 60, 7200 ])
        self.assertEquals([5,5,5,5,5,5, 8*3600,8*3600,8*3600,8*3600,],
              C._parseIntervalList("5 sec for 30 sec, 8 hours for 1.3 days"))
        self.assertEquals([60], C._parseIntervalList("1 min for 1 min"))
        self.assertEquals([60,60], C._parseIntervalList("1 min for 1.5 min"))
        self.assertEquals([60,60],
               C._parseIntervalList("EVERY  1 min for 1.5 min"))

src/m/i/mixminion-HEAD/lib/mixminion/testSupport.py   mixminion(Download)
import mixminion.Common
from mixminion.Common import waitForChildren, ceilDiv, createPrivateDir, LOG
from mixminion.Config import _parseBoolean, _parseIntervalList, ConfigError
 
from mixminion.server.Modules import DELIVER_FAIL_NORETRY, DELIVER_FAIL_RETRY,\