# Path: libxyz/exceptions.py
# class XYZValueError(XYZError):
#     pass


from libxyz.exceptions import XYZValueError
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser Public License for more details.
# You should have received a copy of the GNU Lesser Public License
# along with XYZCommander. If not, see <http://www.gnu.org/licenses/>.


class Queue(list):
    """
    Fixed-sized list
    """

    def __init__(self, maxsize):
        super(Queue, self).__init__()

        self.maxsize = 0
        self.set_size(maxsize)

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    def set_size(self, size):
        """
        Set queue size
        """

        try:
            maxsize = int(size)

            assert maxsize >= 0
        except (ValueError, AssertionError):

# Path: libxyz/exceptions.py
# class XYZValueError(XYZError):
#     pass


# Path: libxyz/core/queue.py
from libxyz.exceptions import XYZValueError

# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser Public License for more details.
# You should have received a copy of the GNU Lesser Public License
# along with XYZCommander. If not, see <http://www.gnu.org/licenses/>.


class Queue(list):
    """
    Fixed-sized list
    """

    def __init__(self, maxsize):
        super(Queue, self).__init__()

        self.maxsize = 0
        self.set_size(maxsize)

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    def set_size(self, size):
        """
        Set queue size
        """

        try:
            maxsize = int(size)

            assert maxsize >= 0
        except (ValueError, AssertionError):

            raise XYZValueError(