Skip to main content

Save time by automatically checking user decision input

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yesnopy-0.0.3.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yesnopy-0.0.3-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file yesnopy-0.0.3.tar.gz.

File metadata

  • Download URL: yesnopy-0.0.3.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.0

File hashes

Hashes for yesnopy-0.0.3.tar.gz
Algorithm Hash digest
SHA256 3fb2ea02bee0c85bfe19df09af980d4bccf6fd332adb9cb4c85c71abd88443ec
MD5 2f73930e4f3e096e7cf97b836787c827
BLAKE2b-256 95e4d69915687004047ffe5e09f4c09c2f9f24915fffd219eead5ed0380c5234

See more details on using hashes here.

File details

Details for the file yesnopy-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: yesnopy-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.0

File hashes

Hashes for yesnopy-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cc097e3e4b5bffa26950c8032468e874835cfa634d985f32b01cff06c8660777
MD5 53829ec5fae9672775badcf7858ab15e
BLAKE2b-256 0364ec63a8d677f47fddea6a279fbea20e9bb0a101a9af983ef000f4c642eeb2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page