A simple python module to determine whether an input is True or False.
Project description
true_or_false
A simple python funciton to determine whether an input is True or False
Determine (educated guess) whether an input value is True or False. Input can be a bool, dict, int or str. This is useful for determining the value of a parameter as passed in via environment variable, cli, config file or plain python code.
Examples of True values: str: ['true', 't', '1', 'yes', 'y', 't', 'oui'] bool: True dict: {'a': 1} # any non empty dictionary list: [0] # any list not zero length
Examples of False values: str FALSES = ['false', 'f', '0', 'no', 'n', 'non'] bool: False dict: {} # empty dictionary list: [] # empty list
Installation
pip install true-or-false
Usage
from true_or_false import true_or_false
b = true_or_false(1)
print(b)
>> True
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
Built Distribution
File details
Details for the file true_or_false-0.1.3.tar.gz
.
File metadata
- Download URL: true_or_false-0.1.3.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.8.10 Linux/5.15.0-58-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c493f535e3367a1ba0f3b0c7266c79c1a92ba146469b52a887a67faff1b35959 |
|
MD5 | c7b99ef8ed29d07ccae830f8a5cdaf21 |
|
BLAKE2b-256 | 54266f1a9290ab133ada245143e2812be5398ad938dcfe73019995953c4986dc |
File details
Details for the file true_or_false-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: true_or_false-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.8.10 Linux/5.15.0-58-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 677e3917084247b01f8ffbbf6ce8dde4273dd0b8684f4f4c61e8c0c54d42720b |
|
MD5 | 0aa72eb71ff48afe74715399576a4d23 |
|
BLAKE2b-256 | 1cc8a4a8d50d4779b757fd7d15803a7cf0465db54aed1e52c20acd0291db0d0b |