From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A34A9138334 for ; Sat, 7 Jul 2018 05:23:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2E658E0B0E; Sat, 7 Jul 2018 05:23:55 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id EB6E8E0AFB for ; Sat, 7 Jul 2018 05:23:53 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A6771335C8B for ; Sat, 7 Jul 2018 05:23:51 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 29550363 for ; Sat, 7 Jul 2018 05:23:50 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1530940931.0a745d03d5dbfd1b6e31db92a5ce55aa33084c7a.dolsen@gentoo> Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/ X-VCS-Repository: proj/gentoo-keys X-VCS-Files: gkeys/gkeys/utils.py X-VCS-Directories: gkeys/gkeys/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 0a745d03d5dbfd1b6e31db92a5ce55aa33084c7a X-VCS-Branch: master Date: Sat, 7 Jul 2018 05:23:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d447bb53-7222-4154-bfdb-67f074a5a12b X-Archives-Hash: e631e5649a95a6e8c043b12014b77ea8 commit: 0a745d03d5dbfd1b6e31db92a5ce55aa33084c7a Author: Brian Dolbec gentoo org> AuthorDate: Mon Jul 2 21:40:21 2018 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Sat Jul 7 05:22:11 2018 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=0a745d03 gkeys/utils.py: Add get_ack function Signed-off-by: Brian Dolbec gentoo.org> gkeys/gkeys/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gkeys/gkeys/utils.py b/gkeys/gkeys/utils.py index 64f11aa..f08acc1 100644 --- a/gkeys/gkeys/utils.py +++ b/gkeys/gkeys/utils.py @@ -39,6 +39,8 @@ try: except AttributeError: StringTypes = [str] +Y_N = ("y", "yes", "n", "no") + def encoder(text, _encoding_): return codecs.encode(text, _encoding_, 'replace') @@ -161,6 +163,13 @@ def path(path_elements): return pathname +def get_ack(prompt_msg, accepted=Y_N): + ack = None + while ack not in accepted: + ack = py_input(prompt_msg).lower() + return ack + + if __name__ == '__main__': import doctest doctest.testmod(sys.modules[__name__])