# Path: anchorhub/exceptions/validationexception.py
# class ValidationException(Exception):
#     def __init__(self, *args, **kwargs):
#         Exception.__init__(self, *args, **kwargs)


import sys
import anchorhub.messages as messages
from anchorhub.exceptions.validationexception import ValidationException
"""
Validations for anchors and tags found during collection.
"""




def validate(anchors, duplicate_tags, opts):
    """
    Client facing validate function. Runs _validate() and returns True if
    anchors and duplicate_tags pass all validations. Handles exceptions
    automatically if _validate() throws any and exits the program.

    :param anchors: Dictionary mapping string file path keys to dictionary
        values. The inner dictionaries map string AnchorHub tags to generated
        anchor values
    :param duplicate_tags: Dictionary mapping string file path keys to a list of
        tuples. The tuples contain the following information, in order:

        1. The string AnchorHub tag that was repeated
        2. The line in the file that the duplicate was found, as a number
        3. The string generated anchor that first used the repeated tag
    :param opts: Namespace containing AnchorHub options, usually created by
        command line arguments
    :return: True if the anchors pass all validation tests
    """
    try:
        return _validate(anchors, duplicate_tags, opts)

# Path: anchorhub/exceptions/validationexception.py
# class ValidationException(Exception):
#     def __init__(self, *args, **kwargs):
#         Exception.__init__(self, *args, **kwargs)


# Path: anchorhub/validation/validate_anchors.py
import sys
import anchorhub.messages as messages
from anchorhub.exceptions.validationexception import ValidationException

"""
Validations for anchors and tags found during collection.
"""




def validate(anchors, duplicate_tags, opts):
    """
    Client facing validate function. Runs _validate() and returns True if
    anchors and duplicate_tags pass all validations. Handles exceptions
    automatically if _validate() throws any and exits the program.

    :param anchors: Dictionary mapping string file path keys to dictionary
        values. The inner dictionaries map string AnchorHub tags to generated
        anchor values
    :param duplicate_tags: Dictionary mapping string file path keys to a list of
        tuples. The tuples contain the following information, in order:

        1. The string AnchorHub tag that was repeated
        2. The line in the file that the duplicate was found, as a number
        3. The string generated anchor that first used the repeated tag
    :param opts: Namespace containing AnchorHub options, usually created by
        command line arguments
    :return: True if the anchors pass all validation tests
    """
    try:
        return _validate(anchors, duplicate_tags, opts)

    except ValidationException as e: