# Path: mcm/comparators.py
# def get_comparator(path):
#     if path.type == 'single':
#         return SingleElementComparator()
#     elif path.type == 'ordered':
#         return OrderedComparator()
#     elif path.type == 'uniquekey':
#         return UniqueKeyComparator(keys=path.keys)
# 
# Path: mcm/exceptions.py
# class ReadError(Exception):
#     '''
#     Exception raised when reading from master or slave occured.
#     '''
# 
# Path: mcm/librouteros/exceptions.py
# class ConnError( LibError ):
#     '''
#     Connection related errors.
#     '''


from types import MethodType
from logging import getLogger
from mcm.comparators import get_comparator
from mcm.exceptions import ReadError
from mcm.librouteros.exceptions import ConnError
# -*- coding: UTF-8 -*-



logger = getLogger('mcm.' + __name__)


class CmdPathConfigurator:


    def __init__(self, configurator, path, comparator, addfunc, setfunc, delfunc):
        self.configurator = configurator
        self.path = path
        self.comparator = comparator
        self.ADD = MethodType( addfunc, self )
        self.DEL = MethodType( delfunc, self )
        self.SET = MethodType( setfunc, self )


    @classmethod
    def with_ensure(cls, configurator, path):
        comparator = get_comparator(path=path)
        return cls(configurator=configurator, path=path, comparator=comparator,
                addfunc=real_action, setfunc=real_action, delfunc=no_action)

    @classmethod
    def with_exact(cls, configurator, path):

# Path: mcm/comparators.py
# def get_comparator(path):
#     if path.type == 'single':
#         return SingleElementComparator()
#     elif path.type == 'ordered':
#         return OrderedComparator()
#     elif path.type == 'uniquekey':
#         return UniqueKeyComparator(keys=path.keys)
# 
# Path: mcm/exceptions.py
# class ReadError(Exception):
#     '''
#     Exception raised when reading from master or slave occured.
#     '''
# 
# Path: mcm/librouteros/exceptions.py
# class ConnError( LibError ):
#     '''
#     Connection related errors.
#     '''


# Path: mcm/configurators.py
from types import MethodType
from logging import getLogger
from mcm.comparators import get_comparator
from mcm.exceptions import ReadError
from mcm.librouteros.exceptions import ConnError

# -*- coding: UTF-8 -*-



logger = getLogger('mcm.' + __name__)


class CmdPathConfigurator:


    def __init__(self, configurator, path, comparator, addfunc, setfunc, delfunc):
        self.configurator = configurator
        self.path = path
        self.comparator = comparator
        self.ADD = MethodType( addfunc, self )
        self.DEL = MethodType( delfunc, self )
        self.SET = MethodType( setfunc, self )


    @classmethod
    def with_ensure(cls, configurator, path):
        comparator = get_comparator(path=path)
        return cls(configurator=configurator, path=path, comparator=comparator,
                addfunc=real_action, setfunc=real_action, delfunc=no_action)

    @classmethod
    def with_exact(cls, configurator, path):

        comparator = get_comparator(path=path)