bin/badge-create.py
def make_paths(image_src_dir, badge_dst_dir, kind, username):
    """Create, check, and return the paths used by handlers."""

    # Badge type is recognized.
    assert kind in badge.BADGE_KINDS, \
           "Unknown kind of badge {0}".format(kind)

    # Output directory.
    assert badge_dst_dir, \
           "Badge sub-directory not provided"
    assert os.path.isdir(badge_dst_dir), \
           "Badge destination directory {0} does not exist".format(badge_dst_dir)

    # Badge image source.
    assert os.path.isdir(image_src_dir), \
           "Image source directory {0} not found".format(image_src_dir)
    image_src_path = os.path.join(image_src_dir, "{0}.png".format(kind))
    assert os.path.isfile(image_src_path), \
           "No such image file {0}".format(image_src_path)

    # Badge image destination.
    image_dst_path = os.path.join(badge_dst_dir, "{0}{1}.png".format(kind, username))
    assert not os.path.isfile(image_dst_path), \
           "Output image {0} already exists".format(image_dst_path)

    # JSON file.
    json_dst_path = os.path.join(badge_dst_dir, "{0}/{1}.json".format(kind, username))
    assert not os.path.isfile(json_dst_path), \
           "JSON file {0} already exists".format(json_dst_path)

    # Report.
    return image_src_path, image_dst_path, json_dst_path
Create, check, and return the paths used by handlers.
Create, check, and return the paths used by handlers.
Create check and return the paths used by handlers .
def make_paths(image_src_dir, badge_dst_dir, kind, username):
    assert kind in badge.BADGE_KINDS, \
           "Unknown kind of badge {0}".format(kind)
    assert badge_dst_dir, \
           "Badge sub-directory not provided"
    assert os.path.isdir(badge_dst_dir), \
           "Badge destination directory {0} does not exist".format(badge_dst_dir)
    assert os.path.isdir(image_src_dir), \
           "Image source directory {0} not found".format(image_src_dir)
    image_src_path = os.path.join(image_src_dir, "{0}.png".format(kind))
    assert os.path.isfile(image_src_path), \
           "No such image file {0}".format(image_src_path)
    image_dst_path = os.path.join(badge_dst_dir, "{0}{1}.png".format(kind, username))
    assert not os.path.isfile(image_dst_path), \
           "Output image {0} already exists".format(image_dst_path)
    json_dst_path = os.path.join(badge_dst_dir, "{0}/{1}.json".format(kind, username))
    assert not os.path.isfile(json_dst_path), \
           "JSON file {0} already exists".format(json_dst_path)
    return image_src_path, image_dst_path, json_dst_path
def make_paths ( image_src_dir , badge_dst_dir , kind , username ) : assert kind in badge . BADGE_KINDS , "Unknown kind of badge {0}" . format ( kind ) assert badge_dst_dir , "Badge sub-directory not provided" assert os . path . isdir ( badge_dst_dir ) , "Badge destination directory {0} does not exist" . format ( badge_dst_dir ) assert os . path . isdir ( image_src_dir ) , "Image source directory {0} not found" . format ( image_src_dir ) image_src_path = os . path . join ( image_src_dir , "{0}.png" . format ( kind ) ) assert os . path . isfile ( image_src_path ) , "No such image file {0}" . format ( image_src_path ) image_dst_path = os . path . join ( badge_dst_dir , "{0}{1}.png" . format ( kind , username ) ) assert not os . path . isfile ( image_dst_path ) , "Output image {0} already exists" . format ( image_dst_path ) json_dst_path = os . path . join ( badge_dst_dir , "{0}/{1}.json" . format ( kind , username ) ) assert not os . path . isfile ( json_dst_path ) , "JSON file {0} already exists" . format ( json_dst_path ) return image_src_path , image_dst_path , json_dst_path
Create, check, and return the paths used by handlers.
Create check and return the paths used by handlers .
"""Create, check, and return the paths used by handlers.""" # Badge type is recognized. # Output directory. # Badge image source. # Badge image destination. # JSON file. # Report.
image_src_dir
badge_dst_dir
kind
username