# Path: gtool/core/types/core.py
# class FunctionType(object):
#     """
#     Use as the base class for method plugins
#     """
# 
#     @abstractmethod
#     def __init__(self, obj, config=str(), defer=False):
#         """
#         Based class for method plugins
# 
#         :param obj: the DynamicType Object that the function will operate one
#         :param config: instructions on how the plugin should work. May be a list, dict or string
#         """
# 
#         self.targetobject = obj
#         self.config = config
#         self.computable = False
#         self.__result__ = None
#         self.__context__ = obj.__context__
#         self.__defer__ = defer
# 
#     # TODO implement an  attribute getter for method plugins
#     def __getname__(self, attrname, nativetypes = [], singletononly=False):
#         raise NotImplemented
# 
#     @abstractmethod
#     def compute(self):
#         """
#         processes any instructions in config, determine if required input exists.
#         If required input exists, sets self.computable to true, computes and stores result
#         :return:  None
#         """
#         # process config or do something
# 
#         if True: #determine if result can be computed
#             self.computable = True
# 
#         if self.computable:
#             self.__result__ = 'some result' #set result
#             raise NotImplemented('compute must be overridden')
#         else:
#             pass
#             # if not computable don't set result
#         #TODO look at returning True or False is compute completes
# 
#     @property
#     def context(self):
#         return self.__context__
# 
#     def result(self, force=False):
# 
#         if not self.__defer__ or force:
#             self.compute() #TODO look at making this an if statement
#             return self.__result__
#         else:
#             raise NotComputed('Computation deferred')
# 
#     def __repr__(self):
#         return '<%s>:()' % (self.__class__, self.config)
# 
#     def __str__(self):
#         self.compute() #TODO look at making this an if statement
#         return self.__result__
# 
# Path: gtool/core/utils/misc.py
# def striptoclassname(fullclassstring):
#     return '{0}'.format(fullclassstring)[7:-2].split('.')[-1]


from gtool.core.types.core import FunctionType
from gtool.core.utils.misc import striptoclassname
import pyparsing as p
                                 'only works on singleton attributes' % striptoclassname(type(self.targetobject)))

            return _ret

        attrexpr = (p.Literal('@') | p.Literal('!')).suppress() + p.Word(p.alphanums)
        slicestartexpr = p.Literal('[').suppress() + p.Optional(p.Word(p.nums))
        sliceendexpr = p.Optional(p.Word(p.nums)) + p.Literal(']').suppress()

        sliceexpr = attrexpr.setResultsName('attribute') + \
                    slicestartexpr.setResultsName('start') + \
                    p.Suppress(p.Literal(':')) + \
                    sliceendexpr.setResultsName('end')

        parseresult = sliceexpr.parseString(self.config)


        _attrname = parseresult.get('attribute', None)[0]
        _slicestart = parseresult.get('start', None)
        _sliceend = parseresult.get('end', None)

        if isinstance(_slicestart, p.ParseResults) and len(_slicestart) > 0:
            self.slicestart = int(_slicestart[0]) if len(_slicestart[0]) > 0 else None

        if isinstance(_sliceend, p.ParseResults) and len(_sliceend) > 0:
            self.sliceend = int(_sliceend[0]) if len(_sliceend[0]) > 0 else None

        if _attrname is None:
            raise ValueError('The configuration string provided to the Slice method '
                             'plugin in user defined class %s does not contain an '
                             'identifiable attribute. Please provide a configuration '

# Path: gtool/core/types/core.py
# class FunctionType(object):
#     """
#     Use as the base class for method plugins
#     """
# 
#     @abstractmethod
#     def __init__(self, obj, config=str(), defer=False):
#         """
#         Based class for method plugins
# 
#         :param obj: the DynamicType Object that the function will operate one
#         :param config: instructions on how the plugin should work. May be a list, dict or string
#         """
# 
#         self.targetobject = obj
#         self.config = config
#         self.computable = False
#         self.__result__ = None
#         self.__context__ = obj.__context__
#         self.__defer__ = defer
# 
#     # TODO implement an  attribute getter for method plugins
#     def __getname__(self, attrname, nativetypes = [], singletononly=False):
#         raise NotImplemented
# 
#     @abstractmethod
#     def compute(self):
#         """
#         processes any instructions in config, determine if required input exists.
#         If required input exists, sets self.computable to true, computes and stores result
#         :return:  None
#         """
#         # process config or do something
# 
#         if True: #determine if result can be computed
#             self.computable = True
# 
#         if self.computable:
#             self.__result__ = 'some result' #set result
#             raise NotImplemented('compute must be overridden')
#         else:
#             pass
#             # if not computable don't set result
#         #TODO look at returning True or False is compute completes
# 
#     @property
#     def context(self):
#         return self.__context__
# 
#     def result(self, force=False):
# 
#         if not self.__defer__ or force:
#             self.compute() #TODO look at making this an if statement
#             return self.__result__
#         else:
#             raise NotComputed('Computation deferred')
# 
#     def __repr__(self):
#         return '<%s>:()' % (self.__class__, self.config)
# 
#     def __str__(self):
#         self.compute() #TODO look at making this an if statement
#         return self.__result__
# 
# Path: gtool/core/utils/misc.py
# def striptoclassname(fullclassstring):
#     return '{0}'.format(fullclassstring)[7:-2].split('.')[-1]


# Path: gtool/plugins/slice.py
from gtool.core.types.core import FunctionType
from gtool.core.utils.misc import striptoclassname
import pyparsing as p

                                 'only works on singleton attributes' % striptoclassname(type(self.targetobject)))

            return _ret

        attrexpr = (p.Literal('@') | p.Literal('!')).suppress() + p.Word(p.alphanums)
        slicestartexpr = p.Literal('[').suppress() + p.Optional(p.Word(p.nums))
        sliceendexpr = p.Optional(p.Word(p.nums)) + p.Literal(']').suppress()

        sliceexpr = attrexpr.setResultsName('attribute') + \
                    slicestartexpr.setResultsName('start') + \
                    p.Suppress(p.Literal(':')) + \
                    sliceendexpr.setResultsName('end')

        parseresult = sliceexpr.parseString(self.config)


        _attrname = parseresult.get('attribute', None)[0]
        _slicestart = parseresult.get('start', None)
        _sliceend = parseresult.get('end', None)

        if isinstance(_slicestart, p.ParseResults) and len(_slicestart) > 0:
            self.slicestart = int(_slicestart[0]) if len(_slicestart[0]) > 0 else None

        if isinstance(_sliceend, p.ParseResults) and len(_sliceend) > 0:
            self.sliceend = int(_sliceend[0]) if len(_sliceend[0]) > 0 else None

        if _attrname is None:
            raise ValueError('The configuration string provided to the Slice method '
                             'plugin in user defined class %s does not contain an '
                             'identifiable attribute. Please provide a configuration '

                             'string in the form of \'@attribute[#:#]\'' % striptoclassname(type(self.targetobject)))