Did I find the right examples for you? yes no

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
Parse the given string into a list of ``timedelta`` instances.
    

        def parse_deltas(delta_string):
    """Parse the given string into a list of ``timedelta`` instances.
    """
    if delta_string is None:
        return None

    deltas = []
    for item in delta_string.split(' '):
        item = item.strip()
        if not item:
            continue
        try:
            deltas.append(str_to_timedelta(item))
        except ValueError, e:
            raise ConfigError('Not a valid delta: %s' % e)

    if deltas and len(deltas) < 2:
        raise ConfigError('At least two deltas are required')

    return deltas
        


src/t/a/tarsnapper-HEAD/src/tarsnapper/test.py   tarsnapper(Download)
from datetime import datetime
from expire import expire as default_expire_func
from config import parse_deltas
 
 
    def __init__(self, deltas, expire_func=default_expire_func):
        if isinstance(deltas, basestring):
            deltas = parse_deltas(deltas)
        self.deltas = deltas
        self.expire_func = expire_func

src/t/a/tarsnapper-0.2.1/src/tarsnapper/test.py   tarsnapper(Download)
from datetime import datetime
from expire import expire as default_expire_func
from config import parse_deltas
 
 
    def __init__(self, deltas, expire_func=default_expire_func):
        if isinstance(deltas, basestring):
            deltas = parse_deltas(deltas)
        self.deltas = deltas
        self.expire_func = expire_func