def _valid_install(queue, is_down=None, is_triggered=None, user=None,
                   group=None, mode=None, item_user=None, item_group=None,
                   item_mode=None):
    dirs = os.listdir(os.path.join(_c.FSQ_ROOT, queue))
    seen = []
    allowed = set([ _c.FSQ_FAIL, _c.FSQ_TMP, _c.FSQ_DONE, _c.FSQ_QUEUE, ])
    if is_down:
        allowed = allowed|set([ _c.FSQ_DOWN, ])
    if is_triggered:
        allowed = allowed|set([ _c.FSQ_TRIGGER, ])
    for d in dirs:
        if d in allowed:
            seen.append(d)
            t_path = os.path.join(_c.FSQ_ROOT, queue, d)
            st = os.stat(t_path)
            # tests for directory install
            if d not in ( _c.FSQ_DOWN, _c.FSQ_TRIGGER ):
                if _c.FSQ_QUEUE_USER != ORIG_QUEUE_UG[0]:
                    user = 1
                if _c.FSQ_QUEUE_GROUP != ORIG_QUEUE_UG[1]:
                    group = 1
                test_type_own_mode(st, t_path, 'd',
                                   user if user is None else UID,
                                   group if group is None else GID, mode)
            else:
                f_type = 'f'
                # is it a FIFO (man 2 stat)
                if d == _c.FSQ_TRIGGER:
                    f_type = 'p'
                if _c.FSQ_ITEM_USER != ORIG_ITEM_UG[0]:
                    user = 1
                if _c.FSQ_ITEM_GROUP != ORIG_ITEM_UG[1]:
                    group = 1
                test_type_own_mode(st, t_path, f_type,
                    item_user if item_user is None else UID,
                    item_group if item_group is None else GID, item_mode)
        else:
            raise ValueError('illegal entry: {0}; install failed'.format(d))
    if len(set(seen)^allowed):
        raise ValueError('missing entries: {0}; install'\
                         ' failed'.format(set(seen)^allowed))
    return True
dataset/ETHPy150Open axialmarket/fsq/fsq/tests/install.py/_valid_install/original