1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

🐛 Fix cycles being 1 by default

This commit is contained in:
Steffo 2021-04-14 01:58:43 +02:00
parent 885f439356
commit a1c7ed84ab
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -6,7 +6,7 @@ from __future__ import annotations
import royalnet.royaltyping as t import royalnet.royaltyping as t
import logging import logging
import asyncio import math
import royalnet.engineer as engi import royalnet.engineer as engi
import click import click
import datetime import datetime
@ -27,13 +27,13 @@ class ConsolePDAImplementation(engi.ConversationListImplementation):
def namespace(self): def namespace(self):
return "console" return "console"
async def run(self, cycles: t.Union[bool, int] = True) -> t.NoReturn: async def run(self, cycles: int = math.inf) -> t.NoReturn:
""" """
Run the main loop of the :class:`.ConsolePDA` for ``cycles`` cycles, or unlimited cycles if the parameter is Run the main loop of the :class:`.ConsolePDA` for ``cycles`` cycles, or unlimited cycles if the parameter is
:data:`True`. :data:`True`.
""" """
while cycles: while cycles > 0:
message = click.prompt("", type=str, prompt_suffix=">>> ", show_default=False) message = click.prompt("", type=str, prompt_suffix=">>> ", show_default=False)
log.debug(f"Received a new input: {message!r}") log.debug(f"Received a new input: {message!r}")