def parse_cron_tuple(cron_tuple):
    """Parses (hour,minute,second) or (hour,minute) or (hour) cron
    scheduling defintions into kwargs dictionary
    """
    if type(cron_tuple) is not tuple:
        raise Exception('Given cron format is not tuple: {0}'
                        .format(cron_tuple))
    kwargs = {}
    l = len(cron_tuple)

    if l > 0:
        kwargs['hour'] = cron_tuple[0]
    if l > 1:
        kwargs['minute'] = cron_tuple[1]
    if l > 2:
        kwargs['second'] = cron_tuple[2]
    return kwargs
dataset/ETHPy150Open ahmetalpbalkan/personal-dashboard/taskhost.py/parse_cron_tuple/original