From a1c7ed84abbefff07113230fed47abf092283739 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 14 Apr 2021 01:58:43 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20cycles=20being=201=20by=20?= =?UTF-8?q?default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- royalnet_console/pda.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/royalnet_console/pda.py b/royalnet_console/pda.py index 819142b6..e418343b 100644 --- a/royalnet_console/pda.py +++ b/royalnet_console/pda.py @@ -6,7 +6,7 @@ from __future__ import annotations import royalnet.royaltyping as t import logging -import asyncio +import math import royalnet.engineer as engi import click import datetime @@ -27,13 +27,13 @@ class ConsolePDAImplementation(engi.ConversationListImplementation): def namespace(self): 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 :data:`True`. """ - while cycles: + while cycles > 0: message = click.prompt("", type=str, prompt_suffix=">>> ", show_default=False) log.debug(f"Received a new input: {message!r}")