# Path: openelex/tasks/validate.py
# def run_validation(state, validators):
#     passed = []
#     failed = []
#     print()
#     for validator in validators:
#         try:
#             validator()
#             passed.append(validator.__name__)
#         except Exception as e:
#             failed.append("Error: %s - %s - %s" %
#                           (state.upper(), validator.__name__, e))
# 
#     print("\n\nVALIDATION RESULTS")
#     print("Passed: %s" % len(passed))
#     print("Failed: %s" % len(failed))
#     for fail in failed:
#         print("\t%s" % fail)
#     print()
# 
# Path: openelex/tasks/utils.py
# def load_module(state, mod_list=[]):
#     """Dynamically load modules for states
# 
#     USAGE
# 
#        mod = load_module(state, ['datasource', 'loader'])
#        mod.datasource.Datasource()
# 
#     """
#     return __import__('openelex.us.%s' % state.lower(), fromlist=mod_list)
# 
# def split_args(raw_args, separator=','):
#     """Helper for parsing command-line options"""
#     return [func_name.strip() for func_name in raw_args.split(separator)]


import sys
import click
from .validate import run_validation
from .utils import load_module, split_args
    transforms = state_mod.transform.registry.all(state)
    print("\n%s transforms, in order of execution:\n" % state.upper())
    for transform in transforms:
        print("* %s" % transform)
        validators = transform.validators

        if validators:
            print()
            print(" Validators:")
            for name in list(validators.keys()):
                print("    * %s" % name)


class IncludeExcludeError(Exception):
    """
    Error raised when user specifies both an inclusion and exclusion list of
    transforms.
    """
    pass


def _select_transforms(state, include=None, exclude=None, raw=False):
    """
    Select transforms to run or reverse based on state and a list of transform
    names to include or exclude.
    """
    if include and exclude:
        raise IncludeExcludeError("You can not use both include and exclude flags!")

    # Iniitialize transforms for the state in global registry

# Path: openelex/tasks/validate.py
# def run_validation(state, validators):
#     passed = []
#     failed = []
#     print()
#     for validator in validators:
#         try:
#             validator()
#             passed.append(validator.__name__)
#         except Exception as e:
#             failed.append("Error: %s - %s - %s" %
#                           (state.upper(), validator.__name__, e))
# 
#     print("\n\nVALIDATION RESULTS")
#     print("Passed: %s" % len(passed))
#     print("Failed: %s" % len(failed))
#     for fail in failed:
#         print("\t%s" % fail)
#     print()
# 
# Path: openelex/tasks/utils.py
# def load_module(state, mod_list=[]):
#     """Dynamically load modules for states
# 
#     USAGE
# 
#        mod = load_module(state, ['datasource', 'loader'])
#        mod.datasource.Datasource()
# 
#     """
#     return __import__('openelex.us.%s' % state.lower(), fromlist=mod_list)
# 
# def split_args(raw_args, separator=','):
#     """Helper for parsing command-line options"""
#     return [func_name.strip() for func_name in raw_args.split(separator)]


# Path: openelex/tasks/transform.py
import sys
import click
from .validate import run_validation
from .utils import load_module, split_args

    transforms = state_mod.transform.registry.all(state)
    print("\n%s transforms, in order of execution:\n" % state.upper())
    for transform in transforms:
        print("* %s" % transform)
        validators = transform.validators

        if validators:
            print()
            print(" Validators:")
            for name in list(validators.keys()):
                print("    * %s" % name)


class IncludeExcludeError(Exception):
    """
    Error raised when user specifies both an inclusion and exclusion list of
    transforms.
    """
    pass


def _select_transforms(state, include=None, exclude=None, raw=False):
    """
    Select transforms to run or reverse based on state and a list of transform
    names to include or exclude.
    """
    if include and exclude:
        raise IncludeExcludeError("You can not use both include and exclude flags!")

    # Iniitialize transforms for the state in global registry

    state_mod = load_module(state, ['transform'])