

def Q(*predicates, **query):
    '\n    Handles situations where :class:`hunter.Query` objects (or other callables) are passed in as positional arguments.\n    Conveniently converts that to an :class:`hunter.And` predicate.\n    '
    optional_actions = query.pop('actions', [])
    if ('action' in query):
        optional_actions.append(query.pop('action'))
    for p in query:
        if (not callable(p)):
            raise TypeError('Predicate {0!r} is not callable.'.format(p))
    for a in optional_actions:
        if (not callable(a)):
            raise TypeError('Action {0!r} is not callable.'.format(a))
    if predicates:
        predicates = tuple(((p() if (inspect.isclass(p) and issubclass(p, Action)) else p) for p in predicates))
        if any((isinstance(p, CodePrinter) for p in predicates)):
            if (CodePrinter in optional_actions):
                optional_actions.remove(CodePrinter)
        if query:
            predicates += (Query(**query),)
        result = And(*predicates)
    else:
        result = Query(**query)
    if optional_actions:
        result = When(result, *optional_actions)
    return result

dataset/ETHPy150Open ionelmc/python-hunter/src/hunter/__init__.py Q/VarMisuse@53/137 `predicates`->`query`