# Path: picraft/exc.py
# class CommandError(ConnectionError):
#     "Exception raised when a network command fails"
# 
# class NoResponse(ConnectionError):
#     "Exception raised when a network command expects a response but gets none"
# 
# class BatchStarted(ConnectionError):
#     "Exception raised when a batch is started before a prior one is complete"
# 
# class BatchNotStarted(ConnectionError):
#     "Exception raised when a batch is terminated when none has been started"
# 
# class ConnectionClosed(ConnectionError):
#     "Exception raised when an operation is attempted against a closed connection"


import socket
import logging
import select
import threading
from .exc import (
        CommandError,
        NoResponse,
        BatchStarted,
        BatchNotStarted,
        ConnectionClosed,
        )
            self._server_version = 'minecraft-pi'
        else:
            raise CommandError('unexpected response to foo() test: %s' %
                    test_result)
        self.ignore_errors = ignore_errors

    def __repr__(self):
        host, port = self._socket.getpeername()
        return '<Connection host="%s", port=%d, server_version="%s">' % (
                host, port, self._server_version)

    @property
    def server_version(self):
        """
        Returns an object (currently just a string) representing the version
        of the Minecraft server we're talking to. Presently this is just
        ``'minecraft-pi'`` or ``'raspberry-juice'``.
        """
        return self._server_version

    def close(self):
        """
        Closes the connection.

        This method can be used to close down the connection to the game
        server. After this method is called, any further requests will raise a
        :exc:`~picraft.exc.ConnectionClosed` exception.
        """
        try:
            self.batch_forget()

# Path: picraft/exc.py
# class CommandError(ConnectionError):
#     "Exception raised when a network command fails"
# 
# class NoResponse(ConnectionError):
#     "Exception raised when a network command expects a response but gets none"
# 
# class BatchStarted(ConnectionError):
#     "Exception raised when a batch is started before a prior one is complete"
# 
# class BatchNotStarted(ConnectionError):
#     "Exception raised when a batch is terminated when none has been started"
# 
# class ConnectionClosed(ConnectionError):
#     "Exception raised when an operation is attempted against a closed connection"


# Path: picraft/connection.py
import socket
import logging
import select
import threading
from .exc import (
        CommandError,
        NoResponse,
        BatchStarted,
        BatchNotStarted,
        ConnectionClosed,
        )

            self._server_version = 'minecraft-pi'
        else:
            raise CommandError('unexpected response to foo() test: %s' %
                    test_result)
        self.ignore_errors = ignore_errors

    def __repr__(self):
        host, port = self._socket.getpeername()
        return '<Connection host="%s", port=%d, server_version="%s">' % (
                host, port, self._server_version)

    @property
    def server_version(self):
        """
        Returns an object (currently just a string) representing the version
        of the Minecraft server we're talking to. Presently this is just
        ``'minecraft-pi'`` or ``'raspberry-juice'``.
        """
        return self._server_version

    def close(self):
        """
        Closes the connection.

        This method can be used to close down the connection to the game
        server. After this method is called, any further requests will raise a
        :exc:`~picraft.exc.ConnectionClosed` exception.
        """
        try:
            self.batch_forget()

        except BatchNotStarted: