(pieces, style)
return {"version": rendered, "full-revisionid": pieces["long"],
            "dirty": pieces["dirty"], "error": None,
            "date": pieces.get("date")}
Render the given version pieces into the requested style.
Render the given version pieces into the requested style.
Render the given version pieces into the requested style .
def render(pieces, style):
    """Render the given version pieces into the requested style."""
    if pieces["error"]:
        return {"version": "unknown",
                "full-revisionid": pieces.get("long"),
                "dirty": None,
                "error": pieces["error"],
                "date": None}

    if not style or style == "default":
        style = "pep440"  # the default

    if style == "pep440":
        rendered = render_pep440(pieces)
    elif style == "pep440-pre":
        rendered = render_pep440_pre(pieces)
    elif style == "pep440-post":
        rendered = render_pep440_post(pieces)
    elif style == "pep440-old":
        rendered = render_pep440_old(pieces)
    elif style == "git-describe":
        rendered = render_git_describe(pieces)
    elif style == "git-describe-long":
        rendered = render_git_describe_long(pieces)
    else:
        raise ValueError("unknown style '%s'" % style)

    return {"version": rendered, "full-revisionid": pieces["long"],
            "dirty": pieces["dirty"], "error": None,
            "date": pieces.get("date")}
def render ( pieces , style ) : if pieces [ "error" ] : return { "version" : "unknown" , "full-revisionid" : pieces . get ( "long" ) , "dirty" : None , "error" : pieces [ "error" ] , "date" : None } if not style or style == "default" : style = "pep440" # the default if style == "pep440" : rendered = render_pep440 ( pieces ) elif style == "pep440-pre" : rendered = render_pep440_pre ( pieces ) elif style == "pep440-post" : rendered = render_pep440_post ( pieces ) elif style == "pep440-old" : rendered = render_pep440_old ( pieces ) elif style == "git-describe" : rendered = render_git_describe ( pieces ) elif style == "git-describe-long" : rendered = render_git_describe_long ( pieces ) else : raise ValueError ( "unknown style '%s'" % style ) return { "version" : rendered , "full-revisionid" : pieces [ "long" ] , "dirty" : pieces [ "dirty" ] , "error" : None , "date" : pieces . get ( "date" ) }