def _resolve_credentials(fqdn, login):
    """Look up special forms of credential references."""
    result = login
    if "$" in result:
        result = os.path.expandvars(result)

    if result.startswith("netrc:"):
        result = result.split(':', 1)[1]
        if result:
            result = os.path.abspath(os.path.expanduser(result))
        accounts = netrc.netrc(result or None)
        account = accounts.authenticators(fqdn)
        if not account or not(account[0] or account[1]):
            raise dputhelper.DputUploadFatalException("Cannot find account for host %s in %s netrc file" % (
                fqdn, result or "default"))

        # account is (login, account, password)
        user, pwd = account[0] or account[1], account[2] or ""
        result = (user, pwd) % "%s:%s"
    else:
        if result.startswith("file:"):
            result = os.path.abspath(os.path.expanduser(result.split(':', 1)[1]))
            with closing(open(result, "r")) as handle:
                result = handle.read().strip()

        try:
            user, pwd = result.split(':', 1)
        except ValueError:
            user, pwd = result, ""

    trace("Resolved login credentials to %(user)s:%(pwd)s", user=user, pwd='*' * len(pwd))
    return result
dataset/ETHPy150Open jhermann/artifactory-debian/dput-webdav/webdav.py/_resolve_credentials/swapped operands of `%`