def freeze(h, output_yaml, resolve, groups):
    """Output installed packages."""
    if not groups:
        groups = filter(lambda group: not group.lower().startswith("bower"),
                        h.requirements.keys())
    else:
        groups = [text_type.strip(group) for group in groups.split(",")]

    if output_yaml:
        for requirements in h.requirements.values():
            for requirement in requirements:
                if resolve and not requirement.version:
                    requirement.load_installed_version()
        click.echo(h.requirements.yaml)
    else:
        for group in groups:
            if not h.requirements[group]:
                continue
            click.echo("# {}".format(group))
            for requirement in h.requirements[group]:
                if resolve and not requirement.version:
                    requirement.load_installed_version()
                click.echo(str(requirement))
def _add_implementor(rpc_code, blocking, fn):

    # Validate the argument types.
    if type(rpc_code) is not int:
        raise TypeError("Expected int, got %r instead" % type(rpc_code))
    if type(blocking) is not bool:
        raise TypeError("Expected bool, got %r instead" % type(blocking))
    if not callable(fn):
        raise TypeError("Expected callable, got %r instead" % type(fn))

    # Validate the RPC code.
    if rpc_code in rpcMap:
        try:
            msg = "Duplicated RPC implementors for code %d: %s and %s"
            msg %= (rpc_code, rpcMap[rpc_code][0].__name__, fn.__name__)
        except Exception:
            msg = "Duplicated RPC implementors for code: %d" % rpc_code
        raise SyntaxError(msg)

    # TODO: use introspection to validate the function signature

    # Register the implementor.
    rpcMap[rpc_code] = (fn, blocking)

    # Return the implementor. No wrapping is needed! :)
    return fn