Ejemplo n.º 1
0
def confirm(destname):
    """Ask whether destination name should be overwrited."""
    while True:
        try:
            return yesno(input("File '{}' already exist. Overwrite? [yn] ".format(destname)))
        except ValueError:
            continue
Ejemplo n.º 2
0
def yesno_type(string):
    """Interpret argument as a "yes" or a "no".

    Raise `argparse.ArgumentTypeError` if string cannot be analysed.
    """
    try:
        return yesno(string)
    except ValueError as error:
        raise argparse.ArgumentTypeError(str(error))
Ejemplo n.º 3
0
def yesno_type(string):
    """Interpret argument as a "yes" or a "no".

    Raise `argparse.ArgumentTypeError` if string cannot be analysed.
    """
    try:
        return yesno(string)
    except ValueError as error:
        raise argparse.ArgumentTypeError(str(error))
Ejemplo n.º 4
0
def confirm(destname):
    """Ask whether destination name should be overwrited."""
    while True:
        try:
            return yesno(
                input("File '{}' already exist. Overwrite? [yn] ".format(
                    destname)))
        except ValueError:
            continue