# Path: sc2/data.py

# 
# Path: sc2/player.py
# class Computer(AbstractPlayer):
#     def __init__(self, race, difficulty=Difficulty.Easy):
#         super().__init__(PlayerType.Computer, race, difficulty=difficulty)
# 
#     def __str__(self):
#         return f"Computer({self.race}, {self.difficulty})"


import sys
import aiohttp
import asyncio
import logging
from s2clientprotocol import sc2api_pb2 as sc_pb
from .data import Status
from .player import Computer


logger = logging.getLogger(__name__)




class ProtocolError(Exception):
    @property
    def is_game_over_error(self) -> bool:
        return self.args[0] in [
            "['Game has already ended']",
            "['Not supported if game has already ended']",
        ]


class ConnectionAlreadyClosed(ProtocolError):
    pass


class Protocol:
    def __init__(self, ws):
        assert ws
        self._ws = ws
        self._status = None

    async def __request(self, request):
        logger.debug(f"Sending request: {request !r}")

# Path: sc2/data.py

# 
# Path: sc2/player.py
# class Computer(AbstractPlayer):
#     def __init__(self, race, difficulty=Difficulty.Easy):
#         super().__init__(PlayerType.Computer, race, difficulty=difficulty)
# 
#     def __str__(self):
#         return f"Computer({self.race}, {self.difficulty})"


# Path: sc2/protocol.py
import sys
import aiohttp
import asyncio
import logging
from s2clientprotocol import sc2api_pb2 as sc_pb
from .data import Status
from .player import Computer



logger = logging.getLogger(__name__)




class ProtocolError(Exception):
    @property
    def is_game_over_error(self) -> bool:
        return self.args[0] in [
            "['Game has already ended']",
            "['Not supported if game has already ended']",
        ]


class ConnectionAlreadyClosed(ProtocolError):
    pass


class Protocol:
    def __init__(self, ws):
        assert ws
        self._ws = ws
        self._status = None

    async def __request(self, request):
        logger.debug(f"Sending request: {request !r}")

        try: