# Path: anchorhub/exceptions/validationexception.py
# class ValidationException(Exception):
#     def __init__(self, *args, **kwargs):
#         Exception.__init__(self, *args, **kwargs)
# 
# Path: anchorhub/util/hasattrs.py
# def hasattrs(object, *names):
#     """
#     Takes in an object and a variable length amount of named attributes,
#     and checks to see if the object has each property. If any of the
#     attributes are missing, this returns false.
# 
#     :param object: an object that may or may not contain the listed attributes
#     :param names: a variable amount of attribute names to check for
#     :return: True if the object contains each named attribute, false otherwise
#     """
#     for name in names:
#         if not hasattr(object, name):
#             return False
#     return True


import os.path as path
from anchorhub.exceptions.validationexception import ValidationException
from anchorhub.util.hasattrs import hasattrs

def _validate(opts):
    """
    Runs validation functions on a namespace containing the attributes
    'overwrite' (boolean), 'input' (string), and 'output' (string).

    :param opts: a namespace containing the attributes 'overwrite', 'input',
        and 'output'
    :raises ValidationException: if opts fails any of the validations
    :return: True if opts passes the validations
    """
    validate_overwrite_different_input_output(opts)
    return True


def validate_overwrite_different_input_output(opts):
    """
    Make sure that if overwrite is set to False, the input and output folders
    are not set to the same location.

    :param opts: a namespace containing the attributes 'overwrite', 'input',
        and 'output'
    :raises ValidationException: if 'input' and 'output' point to the same
        directory and 'overwrite' is set to False
    :return: True if 'overwrite' is set to True, or 'input'/'output' are
        separate directories
    """
    if opts.overwrite or path.abspath(opts.input) != path.abspath(opts.output):
        return True
    else:

# Path: anchorhub/exceptions/validationexception.py
# class ValidationException(Exception):
#     def __init__(self, *args, **kwargs):
#         Exception.__init__(self, *args, **kwargs)
# 
# Path: anchorhub/util/hasattrs.py
# def hasattrs(object, *names):
#     """
#     Takes in an object and a variable length amount of named attributes,
#     and checks to see if the object has each property. If any of the
#     attributes are missing, this returns false.
# 
#     :param object: an object that may or may not contain the listed attributes
#     :param names: a variable amount of attribute names to check for
#     :return: True if the object contains each named attribute, false otherwise
#     """
#     for name in names:
#         if not hasattr(object, name):
#             return False
#     return True


# Path: anchorhub/validation/validate_overwrite.py
import os.path as path
from anchorhub.exceptions.validationexception import ValidationException
from anchorhub.util.hasattrs import hasattrs


def _validate(opts):
    """
    Runs validation functions on a namespace containing the attributes
    'overwrite' (boolean), 'input' (string), and 'output' (string).

    :param opts: a namespace containing the attributes 'overwrite', 'input',
        and 'output'
    :raises ValidationException: if opts fails any of the validations
    :return: True if opts passes the validations
    """
    validate_overwrite_different_input_output(opts)
    return True


def validate_overwrite_different_input_output(opts):
    """
    Make sure that if overwrite is set to False, the input and output folders
    are not set to the same location.

    :param opts: a namespace containing the attributes 'overwrite', 'input',
        and 'output'
    :raises ValidationException: if 'input' and 'output' point to the same
        directory and 'overwrite' is set to False
    :return: True if 'overwrite' is set to True, or 'input'/'output' are
        separate directories
    """
    if opts.overwrite or path.abspath(opts.input) != path.abspath(opts.output):
        return True
    else:

        raise ValidationException("Input and output directories are the same, "