import re


def get_circuit_name(circuit_filename):
    """
    parse the circuit filename, and, assuming it follows a naming convention,
    return the name of the circuit and the number of inputs.
    If it doesn't follow the convention, just return the filename and 0.
    """
    filename_without_path = circuit_filename.split("/")[-1]
    match = re.search("circuit-([-_\w]+)-([\d]+).sheep",filename_without_path)
    if match:
        return match.groups()[0], int(match.groups()[1])
### some circuits (e.g. PIR) follow a different convention:
    match = re.search("circuit-([-_\w]+).sheep",filename_without_path)
    if match:
        return match.groups()[0], 0
### if we got to here, just return the filename
    return filename_without_path, 0