inputvalidate


Nameinputvalidate JSON
Version 0.1.8 PyPI version JSON
download
home_page
SummaryA Python Library with various functions to validate user input
upload_time2024-01-12 10:41:09
maintainer
docs_urlNone
author
requires_python>=3.6
licenseMIT License Copyright (c) 2023 calvin4370 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords user input validation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # inputvalidate


<!-- Badges -->
[![PyPI - Downloads](https://img.shields.io/pypi/dm/inputvalidate?label=PyPi%20downloads)](https://pypi.org/project/inputvalidate/)
[![PyPI - Version](https://img.shields.io/pypi/v/inputvalidate)](https://pypi.org/project/inputvalidate/)
<!--tests passing-->
<!--sponser me-->
<!--another badge-->

Do you always find yourself having to write extra code every project to validate the input given by users? Then use inputvalidate -
a Python package containing various functions to validate user input.

Calvin Chan  calvinchan4370z@gmail.com  MIT License

</br>

# Example Usage
Code:
```python
from inputvalidate import get_int

user_age = get_int('Your age (0-99 yrs): ', min=0, max=99)
print(f'You are {user_age} years old.')
```
Terminal:
```
Your age (0-99 yrs): twelve
Your age (0-99 yrs): 20.5
Your age (0-99 yrs): -2
Your age (0-99 yrs): 16
You are 16 years old.
$ |
```

</br>

<!-- # Documentation -->

# Functions
<!-- <button>Open all</button> -->
<!-- get_int -->
## get_int

```python
get_int(prompt, **kwargs)
```
Prompts user for an input, expecting an int. Repeats until an int is properly inputted, then returns the int.

### *kwargs:*
- **min**: Set min value acceptable
- **max**: Set max value acceptable


<!-- get_float -->
## get_float

```python
get_float(prompt, **kwargs)
```
Prompts user for an input, expecting a float. Repeats until a number is properly inputted, then returns the input as a float.

### *kwargs:*
- **min**: Set min value acceptable
- **max**: Set max value acceptable


<!-- get_number -->
## get_number

```python
get_number(prompt, **kwargs)
```
Prompts user for a number. Repeats until a number is properly inputted, then returns the input as an int/float, depending on what was inputted.

### *kwargs:*
- **min**: Set min value acceptable
- **max**: Set max value acceptable


<!-- get_string -->
## get_string

```python
get_string(prompt, **kwargs)
```
Prompts user for an input, expecting a string. Repeats until an string is properly inputted, then returns the string

### *kwargs:*
- **min**: Set min length acceptable
- **max**: Set max length acceptable
- **nospace**: Set to True if input must contain no spaces. Default: False


<!-- get_bool -->
## get_bool

```python
get_bool(prompt)
```
Prompts user for a True/False answer. Repeats until user inputs True or False, ignoring caps, then returns True or False


<!-- get_yesno -->
## get_yesno

```python
get_yesno(prompt)
```
Prompts user for a yes/no answer. Repeats until the first letter of the input is y/n, ignoring caps, then returns 'y' / 'n'

### *Aliases*:
- get_yn


<!-- get_tf -->
## get_tf

```python
get_tf(prompt)
```
Prompts user for a t/f answer. Repeats until the first letter of the input is t/f, ignoring caps, then returns 't' / 'f'


<!-- get_word -->
## get_word

```python
get_word(prompt)
```
Prompts user for a single word of only alphabet letters. Repeats until a word is properly inputted, then returns the word as a string


<!-- get_char -->
## get_char

```python
get_char(prompt)
```
Prompts user for a single ASCII character. Repeats until a character is properly inputted, then returns the char as a string

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "inputvalidate",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "User Input Validation",
    "author": "",
    "author_email": "Calvin Chan <calvinchan4370z@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/97/e0/4c4a13c2d29c94a7ed48c4d52907036d3bd83c52f1ba247a21cce8e3a587/inputvalidate-0.1.8.tar.gz",
    "platform": null,
    "description": "# inputvalidate\r\n\r\n\r\n<!-- Badges -->\r\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/inputvalidate?label=PyPi%20downloads)](https://pypi.org/project/inputvalidate/)\r\n[![PyPI - Version](https://img.shields.io/pypi/v/inputvalidate)](https://pypi.org/project/inputvalidate/)\r\n<!--tests passing-->\r\n<!--sponser me-->\r\n<!--another badge-->\r\n\r\nDo you always find yourself having to write extra code every project to validate the input given by users? Then use inputvalidate -\r\na Python package containing various functions to validate user input.\r\n\r\nCalvin Chan  calvinchan4370z@gmail.com  MIT License\r\n\r\n</br>\r\n\r\n# Example Usage\r\nCode:\r\n```python\r\nfrom inputvalidate import get_int\r\n\r\nuser_age = get_int('Your age (0-99 yrs): ', min=0, max=99)\r\nprint(f'You are {user_age} years old.')\r\n```\r\nTerminal:\r\n```\r\nYour age (0-99 yrs): twelve\r\nYour age (0-99 yrs): 20.5\r\nYour age (0-99 yrs): -2\r\nYour age (0-99 yrs): 16\r\nYou are 16 years old.\r\n$ |\r\n```\r\n\r\n</br>\r\n\r\n<!-- # Documentation -->\r\n\r\n# Functions\r\n<!-- <button>Open all</button> -->\r\n<!-- get_int -->\r\n## get_int\r\n\r\n```python\r\nget_int(prompt, **kwargs)\r\n```\r\nPrompts user for an input, expecting an int. Repeats until an int is properly inputted, then returns the int.\r\n\r\n### *kwargs:*\r\n- **min**: Set min value acceptable\r\n- **max**: Set max value acceptable\r\n\r\n\r\n<!-- get_float -->\r\n## get_float\r\n\r\n```python\r\nget_float(prompt, **kwargs)\r\n```\r\nPrompts user for an input, expecting a float. Repeats until a number is properly inputted, then returns the input as a float.\r\n\r\n### *kwargs:*\r\n- **min**: Set min value acceptable\r\n- **max**: Set max value acceptable\r\n\r\n\r\n<!-- get_number -->\r\n## get_number\r\n\r\n```python\r\nget_number(prompt, **kwargs)\r\n```\r\nPrompts user for a number. Repeats until a number is properly inputted, then returns the input as an int/float, depending on what was inputted.\r\n\r\n### *kwargs:*\r\n- **min**: Set min value acceptable\r\n- **max**: Set max value acceptable\r\n\r\n\r\n<!-- get_string -->\r\n## get_string\r\n\r\n```python\r\nget_string(prompt, **kwargs)\r\n```\r\nPrompts user for an input, expecting a string. Repeats until an string is properly inputted, then returns the string\r\n\r\n### *kwargs:*\r\n- **min**: Set min length acceptable\r\n- **max**: Set max length acceptable\r\n- **nospace**: Set to True if input must contain no spaces. Default: False\r\n\r\n\r\n<!-- get_bool -->\r\n## get_bool\r\n\r\n```python\r\nget_bool(prompt)\r\n```\r\nPrompts user for a True/False answer. Repeats until user inputs True or False, ignoring caps, then returns True or False\r\n\r\n\r\n<!-- get_yesno -->\r\n## get_yesno\r\n\r\n```python\r\nget_yesno(prompt)\r\n```\r\nPrompts user for a yes/no answer. Repeats until the first letter of the input is y/n, ignoring caps, then returns 'y' / 'n'\r\n\r\n### *Aliases*:\r\n- get_yn\r\n\r\n\r\n<!-- get_tf -->\r\n## get_tf\r\n\r\n```python\r\nget_tf(prompt)\r\n```\r\nPrompts user for a t/f answer. Repeats until the first letter of the input is t/f, ignoring caps, then returns 't' / 'f'\r\n\r\n\r\n<!-- get_word -->\r\n## get_word\r\n\r\n```python\r\nget_word(prompt)\r\n```\r\nPrompts user for a single word of only alphabet letters. Repeats until a word is properly inputted, then returns the word as a string\r\n\r\n\r\n<!-- get_char -->\r\n## get_char\r\n\r\n```python\r\nget_char(prompt)\r\n```\r\nPrompts user for a single ASCII character. Repeats until a character is properly inputted, then returns the char as a string\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 calvin4370  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A Python Library with various functions to validate user input",
    "version": "0.1.8",
    "project_urls": {
        "Changelog": "https://github.com/calvin4370/inputvalidate/CHANGELOG.md",
        "GitHub": "https://github.com/calvin4370/inputvalidate",
        "Homepage": "https://github.com/calvin4370/inputvalidate",
        "Issues": "https://github.com/calvin4370/inputvalidate/issues"
    },
    "split_keywords": [
        "user",
        "input",
        "validation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e51f51d4f93b744fb69b3ab1a50af1fc5894583f7aa6e016e3b66db5752dca00",
                "md5": "7e599a5f63d06561c91fafd02f23b2e8",
                "sha256": "1fa00b5921c4d71d00ba0d03396a2ffc4f79fef10ed8ea0d4e4c7213d638f85a"
            },
            "downloads": -1,
            "filename": "inputvalidate-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7e599a5f63d06561c91fafd02f23b2e8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6291,
            "upload_time": "2024-01-12T10:41:07",
            "upload_time_iso_8601": "2024-01-12T10:41:07.109604Z",
            "url": "https://files.pythonhosted.org/packages/e5/1f/51d4f93b744fb69b3ab1a50af1fc5894583f7aa6e016e3b66db5752dca00/inputvalidate-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "97e04c4a13c2d29c94a7ed48c4d52907036d3bd83c52f1ba247a21cce8e3a587",
                "md5": "c01579c82864c066b41961551a0e5d90",
                "sha256": "b4ea41200a065d546ea8d92c2107579c3944f858cba948392959a075c29002ce"
            },
            "downloads": -1,
            "filename": "inputvalidate-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "c01579c82864c066b41961551a0e5d90",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6387,
            "upload_time": "2024-01-12T10:41:09",
            "upload_time_iso_8601": "2024-01-12T10:41:09.354257Z",
            "url": "https://files.pythonhosted.org/packages/97/e0/4c4a13c2d29c94a7ed48c4d52907036d3bd83c52f1ba247a21cce8e3a587/inputvalidate-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-12 10:41:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "calvin4370",
    "github_project": "inputvalidate",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "inputvalidate"
}
        
Elapsed time: 0.16332s