yesnopy- a package by Arnav N
Simpilfies vailidating user input and return True/False based on a list of expected inputs. Also accounts for extra whitespace and capitalisation
Installation
pip install yesnopy
Usage
from yesnopy import yesnopy as yn
if yn.returnDecision(inputMessage="", forceValidInput=False, defaultValue=False):
doSomething()
# Or just RD (if you prefer concise notation)
if yn.RD(inputMessage="", forceValidInput=False, defaultValue=False):
doSomething()
inputMessage [STRING]: what to display when asking a question
forceVaildInput [BOOL]: Keep asking until user inputs valid input?
defaultValue [ANY]: If all else fails what should the function return? (can be string, number etc...)
userWantsCake = yn.returnDecision(inputMessage="Do you want cake? ", True)
if userWantsCake:
print("Returned True")
else:
print("Returned False")
Do you want cake? gibB432ish
Do you want cake? asdbajksdf
Do you want cake? yeah
Returned True
Do you want cake? gibB432ish
Do you want cake? asdbajksdf
Do you want cake? nah
Returned False
Example of using default:
userWantsCake = yn.returnDecision("Do you want cake? ", False, "ERROR")
if userWantsCake:
print("Returned True")
elif not userWantsCake:
print("Returned False")
elif userWantsCake=="ERROR":
print("Something went wrong...")
Do you want cake? I dont know?
Something went wrong...
Please do note: if forceValidInput is set to True the program will continue until it can output a True or a False value, hence defaultValue will not be returned
All possible inputs
yesnopy accepts a wide range of inputs, all of them are listed here:
WILL RETURN TRUE:
y, yes, 1, true, yep, all right, alright, very well, of course, by all means, sure, certainly, absolutely, indeed, affirmative, agreed, roger, aye, aye aye, yeah, yah, yep, yup, uh-huh, okay, ok, okey-dokey, okey-doke, achcha, righto, righty-ho, surely
WILL RETURN FALSE:
n, no, 0, nope, false, not, no indeed, absolutely not, most certainly not, of course not, under no circumstances, by no means, not at all, negative, never, not really, no thanks, nae, nope, nah, not on your life, no way, no fear, not on your nelly, no siree, naw
Websites
Homepage >> https://github.com/AN1001/yesnopy Bug Tracker >> https://github.com/AN1001/yesnopy/issues
License
MIT
Metadata
Release files for yesnopy 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yesnopy-0.0.3.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yesnopy-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.6 kB
Release files / yesnopy-0.0.3.tar.gz
| Download URL | yesnopy-0.0.3.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3fb2ea02bee0c85bfe19df09af980d4bccf6fd332adb9cb4c85c71abd88443ec
|
|
BLAKE2b-256 checksum How to use checksums |
95e4d69915687004047ffe5e09f4c09c2f9f24915fffd219eead5ed0380c5234
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.0
|
Release files / yesnopy-0.0.3-py3-none-any.whl
| Download URL | yesnopy-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc097e3e4b5bffa26950c8032468e874835cfa634d985f32b01cff06c8660777
|
|
BLAKE2b-256 checksum How to use checksums |
0364ec63a8d677f47fddea6a279fbea20e9bb0a101a9af983ef000f4c642eeb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.0
|