# Path: nappingcat/util.py
# def _resolve_name(name, package, level):
# def import_class_from_module(name):
# 
# Path: nappingcat/exceptions.py
# class NappingCatUnhandled(NappingCatException):
#     pass
# 
# class NappingCatBadPatterns(NappingCatBadConfig):
#     pass


from nappingcat.util import import_module 
from nappingcat.exceptions import NappingCatUnhandled, NappingCatBadPatterns
import re
            self.module = import_module(self.path)

    def match(self, command):
        for regex, target in self.map:
            match = re.search(regex, command)
            if match:
                new_cmd = command.replace(command[match.start():match.end()], '')
                results = None
                if isinstance(target, CommandPatterns):
                    try:
                        results = target.match(new_cmd)
                    except NappingCatUnhandled:
                        pass
                elif isinstance(target, str):
                    results = getattr(self.module, target), match
                elif hasattr(target, '__call__'):
                    results = target, match
                else:
                    raise NappingCatBadPatterns("Target of %s is not a patterns instance, string, or callable." % command)
                if results is not None:
                    return results
        raise NappingCatUnhandled("This cat doesn't understand %s." % command)

    def __add__(self, patterns):
        if not isinstance(patterns, CommandPatterns):
            raise TypeError("You can only add CommandPatterns to an existing patterns object.")
        map = self.map + [(r'^', patterns)]
        return CommandPatterns(self.path, map)

def include(path):

# Path: nappingcat/util.py
# def _resolve_name(name, package, level):
# def import_class_from_module(name):
# 
# Path: nappingcat/exceptions.py
# class NappingCatUnhandled(NappingCatException):
#     pass
# 
# class NappingCatBadPatterns(NappingCatBadConfig):
#     pass


# Path: nappingcat/patterns.py
from nappingcat.util import import_module 
from nappingcat.exceptions import NappingCatUnhandled, NappingCatBadPatterns
import re

            self.module = import_module(self.path)

    def match(self, command):
        for regex, target in self.map:
            match = re.search(regex, command)
            if match:
                new_cmd = command.replace(command[match.start():match.end()], '')
                results = None
                if isinstance(target, CommandPatterns):
                    try:
                        results = target.match(new_cmd)
                    except NappingCatUnhandled:
                        pass
                elif isinstance(target, str):
                    results = getattr(self.module, target), match
                elif hasattr(target, '__call__'):
                    results = target, match
                else:
                    raise NappingCatBadPatterns("Target of %s is not a patterns instance, string, or callable." % command)
                if results is not None:
                    return results
        raise NappingCatUnhandled("This cat doesn't understand %s." % command)

    def __add__(self, patterns):
        if not isinstance(patterns, CommandPatterns):
            raise TypeError("You can only add CommandPatterns to an existing patterns object.")
        map = self.map + [(r'^', patterns)]
        return CommandPatterns(self.path, map)

def include(path):

    router_module = import_module(path)