# Path: lems/base/base.py
# class LEMSBase(object):
#     """
#     Base object for PyLEMS.
#     """
# 
#     def copy(self):
#         return copy.deepcopy(self)
# 
#     def toxml(self):
#         return ""
# 
# Path: lems/base/errors.py
# class StackError(LEMSError):
#     """
#     Exception class to signal errors in the Stack class.
#     """
# 
#     pass


from lems.base.base import LEMSBase
from lems.base.errors import StackError
    def pop(self):
        """
        Pops a value off the top of the stack.

        :return: Value popped off the stack.
        :rtype: *

        :raises StackError: Raised when there is a stack underflow.
        """

        if self.stack:
            val = self.stack[0]
            self.stack = self.stack[1:]
            return val
        else:
            raise StackError("Stack empty")

    def top(self):
        """
        Returns the value off the top of the stack without popping.

        :return: Value on the top of the stack.
        :rtype: *

        :raises StackError: Raised when there is a stack underflow.
        """

        if self.stack:
            return self.stack[0]
        else:

# Path: lems/base/base.py
# class LEMSBase(object):
#     """
#     Base object for PyLEMS.
#     """
# 
#     def copy(self):
#         return copy.deepcopy(self)
# 
#     def toxml(self):
#         return ""
# 
# Path: lems/base/errors.py
# class StackError(LEMSError):
#     """
#     Exception class to signal errors in the Stack class.
#     """
# 
#     pass


# Path: lems/base/stack.py
from lems.base.base import LEMSBase
from lems.base.errors import StackError

    def pop(self):
        """
        Pops a value off the top of the stack.

        :return: Value popped off the stack.
        :rtype: *

        :raises StackError: Raised when there is a stack underflow.
        """

        if self.stack:
            val = self.stack[0]
            self.stack = self.stack[1:]
            return val
        else:
            raise StackError("Stack empty")

    def top(self):
        """
        Returns the value off the top of the stack without popping.

        :return: Value on the top of the stack.
        :rtype: *

        :raises StackError: Raised when there is a stack underflow.
        """

        if self.stack:
            return self.stack[0]
        else:

            raise StackError("Stack empty")