{ "info": { "author": "Al Sweigart", "author_email": "al@inventwithpython.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: MacOS X", "Environment :: Win32 (MS Windows)", "Environment :: X11 Applications", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "PyInputPlus\n===========\n\nA Python 2 and 3 module to provide input()- and raw_input()-like functions with additional validation features, including:\n\n* Re-prompting the user if they enter invalid input.\n* Validating for numeric, boolean, date, time, or yes/no responses.\n* Timeouts or retry limits for user responses.\n* Specifying regexes for whitelists or blacklists of responses.\n* Specifying ranges for numeric inputs.\n* Presenting menus with bulleted, lettered, or numbered options.\n* Allowing case-sensitive or case-insensitive responses.\n\nInstallation\n------------\n\n pip install pyinputplus\n\nExample Usage\n-------------\n\n >>> import pyinputplus as pyip\n >>> result = pyip.inputStr()\n\n Blank values are not allowed.\n Hello\n >>> result\n 'Hello'\n\n >>> result = pyip.inputNum()\n forty two\n 'forty two' is not a number.\n 42\n >>> result\n 42\n\n >>> result = pyip.inputNum(min=4, max=6)\n 3\n Input must be at minimum 4.\n 7\n Input must be at maximum 6.\n 4\n >>> result\n 4\n\n >>> result = pyip.inputNum(greaterThan=4, lessThan=6)\n 4\n Input must be greater than 4.\n 4.1\n >>> result\n 4.1\n\n >>> result = pyip.inputStr('Favorite animal> ', blacklistRegexes=['moose'])\n Favorite animal> moose\n This response is invalid.\n Favorite animal> cat\n >>> result\n 'cat'\n\n >>> result = inputMenu(['dog', 'cat', 'moose'])\n Please select one of the following:\n * dog\n * cat\n * moose\n DoG\n >>> result\n 'dog'\n\n >>> result = inputMenu(['dog', 'cat', 'moose'], lettered=True, numbered=False)\n Please select one of the following:\n A. dog\n B. cat\n C. moose\n b\n >>> result\n 'cat'\n\nCommon Input Function Parameters\n--------------------------------\n\nAll input functions have the following parameters:\n\n* `prompt` (str): The text to display before each prompt for user input. Identical to the prompt argument for Python's `raw_input()` and `input()` functions. Default\n* `default` (str, None): A default value to use should the user time out or exceed the number of tries to enter valid input.\n* `blank` (bool): If `True`, blank strings will be allowed as valid user input.\n* `timeout` (int, float): The number of seconds since the first prompt for input after which a TimeoutException is raised the next time the user enters input.\n* `limit` (int): The number of tries the user has to enter valid input before the default value is returned.\n* `strip` (bool, str, None): If `True`, whitespace is stripped from `value`. If a str, the characters in it are stripped from value. If `None`, nothing is stripped. Defaults to `True`.\n* `whitelistRegexes` (Sequence, None): A sequence of regex str that will explicitly pass validation, even if they aren't numbers. Defaults to `None`.\n* `blacklistRegexes` (Sequence, None): A sequence of regex str or (regex_str, response_str) tuples that, if matched, will explicitly fail validation. Defaults to `None`.\n* `applyFunc` (Callable, None): An optional function that is passed the user's input, and returns the new value to use as the input.\n* `validationFunc` (Callable): A function that is passed the user's input value, which raises an exception if the input isn't valid. (The return value of this function is ignored.)\n* `postValidateApplyFunc` (Callable): An optional function that is passed the user's input after it has passed validation, and returns a transformed version for the input function to return.\n\nOther input functions may have additional parameters.\n\nInput Functions\n---------------\n\n* `inputStr()` - Accepts a string. Use this if you basically want Python's `input()` or `raw_input()`, but with PyInputPlus features such as whitelist/blacklist, timeouts, limits, etc.\n* `inputNum()` - Accepts a numeric number. Additionally has `min` and `max` parameters for inclusive bounds and `greaterThan` and `lessThan` parameters for exclusive bounds. Returns an int or float, not a str.\n* `inputInt()` - Accepts an integer number. Also has `min`/`max`/`greaterThan`/`lessThan` parameters. Returns an int, not a str.\n* `inputFloat()` - Accepts a floating-point number. Also has `min`/`max`/`greaterThan`/`lessThan` parameters. Returns a float, not a str.\n* `inputBool()` - Accepts a case-insensitive form of `'True'`, `'T'`, `'False'`, or `'F'` and returns a bool value.\n* `inputChoice()` - Accepts one of the strings in the list of strings passed for its `choices` parameter.\n* `inputMenu()` - Similar to `inputChoice()`, but will also present the choices in a menu with 1, 2, 3... or A, B, C... options if `numbered` or `lettered` are set to `True`.\n* `inputDate()` - Accepts a date typed in one of the `strftime` formats passed to the `formats` parameter. (This has several common formats by default.) Returns a `datetime.date` object.\n* `inputDatetime()` - Same as `inputDate()`, except it handles dates and times. (This has several common formats by default.) Returns a `datetime.datetime` object.\n* `inputTime()` - Same as `inputDate()`, except it handles times. (This has several common formats by default.) Returns a `datetime.time` object.\n* `inputYesNo()` - Accepts a case-insensitive form of `'Yes'`, `'Y'`, `'No'`, or `'N'` and returns `'yes'` or `'no'`.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/asweigart/pyinputplus", "keywords": "input validation text gui message box", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "PyInputPlus", "package_url": "https://pypi.org/project/PyInputPlus/", "platform": "", "project_url": "https://pypi.org/project/PyInputPlus/", "project_urls": { "Homepage": "https://github.com/asweigart/pyinputplus" }, "release_url": "https://pypi.org/project/PyInputPlus/0.2.7/", "requires_dist": null, "requires_python": "", "summary": "Provides more featureful versions of input() and raw_input().", "version": "0.2.7" }, "last_serial": 5520770, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "2fbb44eed9a218b7280d06d0a695ced0", "sha256": "14de75ee3a604c637a823b748e9222f79074b2efabbe1663a6e59803aa30d402" }, "downloads": -1, "filename": "PyInputPlus-0.1.0.tar.gz", "has_sig": false, "md5_digest": "2fbb44eed9a218b7280d06d0a695ced0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10566, "upload_time": "2018-08-13T20:18:33", "url": "https://files.pythonhosted.org/packages/f0/ba/abbb811bed650217fa6cb6c40e0e24536e3f18f7809fa2ae0605dacb22c4/PyInputPlus-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "ed3df38b766daf18b92914234070ae5d", "sha256": "c112b583417f965750caf68db5cec385dea91f35bb54f83d9d706436eac3556f" }, "downloads": -1, "filename": "PyInputPlus-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ed3df38b766daf18b92914234070ae5d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10613, "upload_time": "2018-08-16T00:22:27", "url": "https://files.pythonhosted.org/packages/22/25/025d776afd80b4f4ba63d267b2e8c302b44822a3caf9bf8f6e53aa016c5a/PyInputPlus-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "586e47ed5b71fd795d1970be1d189cb1", "sha256": "9ec4e333874d46413dc927249c95a1302ae08d6744cfac8cc866d0cae62b573f" }, "downloads": -1, "filename": "PyInputPlus-0.2.0.tar.gz", "has_sig": false, "md5_digest": "586e47ed5b71fd795d1970be1d189cb1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10478, "upload_time": "2018-09-14T18:59:41", "url": "https://files.pythonhosted.org/packages/7c/32/ff4fde1dd4f29898e00d4cb27072adc610f480c7037a756f3c763b3500c3/PyInputPlus-0.2.0.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "06cf7fb295feeeaa917a5787a5bc7841", "sha256": "de48520f48a7266f0c811fc3be97288061f22bc9ce527cde7d6bc6ec8587a4dc" }, "downloads": -1, "filename": "PyInputPlus-0.2.2.tar.gz", "has_sig": false, "md5_digest": "06cf7fb295feeeaa917a5787a5bc7841", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15110, "upload_time": "2018-10-08T22:10:16", "url": "https://files.pythonhosted.org/packages/9a/d9/0421d200f77e79921f3089bd89cbda5652ca17a9b5a4475913ac91f569c4/PyInputPlus-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "8c0dc9ba30b0ec6a68dcdd78dd728f7e", "sha256": "e7d75cba406b00467c5dc20c78bff08b3099816198ed3b090c2e9edaef98eb6c" }, "downloads": -1, "filename": "PyInputPlus-0.2.3.tar.gz", "has_sig": false, "md5_digest": "8c0dc9ba30b0ec6a68dcdd78dd728f7e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17164, "upload_time": "2019-02-05T03:09:02", "url": "https://files.pythonhosted.org/packages/9a/ef/51a6db27cbe3aab0dcec5a2d02243c6bf2af0321956f41c6be931cb24fc6/PyInputPlus-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "d606e36ddda716aa240ac04630850b8a", "sha256": "5e5c2b7c84e9845f4557b8af3146d719269fb8da230a2d57205a42c9a33ea12e" }, "downloads": -1, "filename": "PyInputPlus-0.2.4.tar.gz", "has_sig": false, "md5_digest": "d606e36ddda716aa240ac04630850b8a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17429, "upload_time": "2019-02-05T22:15:52", "url": "https://files.pythonhosted.org/packages/8c/69/f607a99e0bb1070d60019d774f616ca3775e91a96f669b2c1cde0a6ed36e/PyInputPlus-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "34d39c01853681724821b68f18cd8ce1", "sha256": "0df57201f3f9944071b0497f40416f5981a24dd818014be4d6a615a984128960" }, "downloads": -1, "filename": "PyInputPlus-0.2.5.tar.gz", "has_sig": false, "md5_digest": "34d39c01853681724821b68f18cd8ce1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17426, "upload_time": "2019-02-07T03:31:39", "url": "https://files.pythonhosted.org/packages/61/fb/4d89003a8c55dc5fb449d546f72097991d4e8f6d4682fb528951e2db19ca/PyInputPlus-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "485b23326fdafa4ad87c2c8cbacf27a3", "sha256": "cba628300c8bb99f7d2bfb4816e2717ade9df2dbc662965e2e8980bfda572725" }, "downloads": -1, "filename": "PyInputPlus-0.2.6.tar.gz", "has_sig": false, "md5_digest": "485b23326fdafa4ad87c2c8cbacf27a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18145, "upload_time": "2019-02-09T06:07:46", "url": "https://files.pythonhosted.org/packages/89/d2/7ffe1034d231af571e402da6a5e4e7c842a237beb027566fc6e713fc35cf/PyInputPlus-0.2.6.tar.gz" } ], "0.2.7": [ { "comment_text": "", "digests": { "md5": "d3a55b5c9eabf3f623d463f30767d881", "sha256": "97b6e2b0d0afa18b84d9d9baace25dc6748c84c573be904b1a6c263187a416a3" }, "downloads": -1, "filename": "PyInputPlus-0.2.7.tar.gz", "has_sig": false, "md5_digest": "d3a55b5c9eabf3f623d463f30767d881", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19753, "upload_time": "2019-07-12T00:07:45", "url": "https://files.pythonhosted.org/packages/1b/bc/dfc258639c2f129cd791700d773c0577fcb7af04d21db483a2c47a4ee573/PyInputPlus-0.2.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d3a55b5c9eabf3f623d463f30767d881", "sha256": "97b6e2b0d0afa18b84d9d9baace25dc6748c84c573be904b1a6c263187a416a3" }, "downloads": -1, "filename": "PyInputPlus-0.2.7.tar.gz", "has_sig": false, "md5_digest": "d3a55b5c9eabf3f623d463f30767d881", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19753, "upload_time": "2019-07-12T00:07:45", "url": "https://files.pythonhosted.org/packages/1b/bc/dfc258639c2f129cd791700d773c0577fcb7af04d21db483a2c47a4ee573/PyInputPlus-0.2.7.tar.gz" } ] }