Skip to content

Commit

Permalink
Fix unused debug in chess.engine.run_in_background()
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Aug 2, 2023
1 parent e173243 commit 90eeeb0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions chess/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
EventLoopPolicy = asyncio.DefaultEventLoopPolicy


def run_in_background(coroutine: Callable[[concurrent.futures.Future[T]], Coroutine[Any, Any, None]], *, name: Optional[str] = None, debug: bool = False) -> T:
def run_in_background(coroutine: Callable[[concurrent.futures.Future[T]], Coroutine[Any, Any, None]], *, name: Optional[str] = None, debug: Optional[bool] = None) -> T:
"""
Runs ``coroutine(future)`` in a new event loop on a background thread.
Expand All @@ -60,7 +60,7 @@ def run_in_background(coroutine: Callable[[concurrent.futures.Future[T]], Corout

def background() -> None:
try:
asyncio.run(coroutine(future))
asyncio.run(coroutine(future), debug=debug)
future.cancel()
except Exception as exc:
future.set_exception(exc)
Expand Down Expand Up @@ -2894,7 +2894,7 @@ def _shutdown() -> None:
self.protocol.loop.call_soon_threadsafe(_shutdown)

@classmethod
def popen(cls, Protocol: Type[Protocol], command: Union[str, List[str]], *, timeout: Optional[float] = 10.0, debug: bool = False, setpgrp: bool = False, **popen_args: Any) -> SimpleEngine:
def popen(cls, Protocol: Type[Protocol], command: Union[str, List[str]], *, timeout: Optional[float] = 10.0, debug: Optional[bool] = None, setpgrp: bool = False, **popen_args: Any) -> SimpleEngine:
async def background(future: concurrent.futures.Future[SimpleEngine]) -> None:
transport, protocol = await Protocol.popen(command, setpgrp=setpgrp, **popen_args)
threading.current_thread().name = f"{cls.__name__} (pid={transport.get_pid()})"
Expand All @@ -2911,15 +2911,15 @@ async def background(future: concurrent.futures.Future[SimpleEngine]) -> None:
return run_in_background(background, name=f"{cls.__name__} (command={command!r})", debug=debug)

@classmethod
def popen_uci(cls, command: Union[str, List[str]], *, timeout: Optional[float] = 10.0, debug: bool = False, setpgrp: bool = False, **popen_args: Any) -> SimpleEngine:
def popen_uci(cls, command: Union[str, List[str]], *, timeout: Optional[float] = 10.0, debug: Optional[bool] = None, setpgrp: bool = False, **popen_args: Any) -> SimpleEngine:
"""
Spawns and initializes a UCI engine.
Returns a :class:`~chess.engine.SimpleEngine` instance.
"""
return cls.popen(UciProtocol, command, timeout=timeout, debug=debug, setpgrp=setpgrp, **popen_args)

@classmethod
def popen_xboard(cls, command: Union[str, List[str]], *, timeout: Optional[float] = 10.0, debug: bool = False, setpgrp: bool = False, **popen_args: Any) -> SimpleEngine:
def popen_xboard(cls, command: Union[str, List[str]], *, timeout: Optional[float] = 10.0, debug: Optional[bool] = None, setpgrp: bool = False, **popen_args: Any) -> SimpleEngine:
"""
Spawns and initializes an XBoard engine.
Returns a :class:`~chess.engine.SimpleEngine` instance.
Expand Down

0 comments on commit 90eeeb0

Please sign in to comment.