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.2.tar.gz
.
File metadata
- Download URL: true_or_false-0.1.2.tar.gz
- Upload date:
- Size: 2.7 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 | 2d947eac6ba0da04e6820ba8b4b2e0d4240e9482f8001a774b26dba13c39e1a7 |
|
MD5 | e8184dbcfadd6f20f9817378da1caf76 |
|
BLAKE2b-256 | e0f868f64a6a62b4e342c854eea69ff66a7a95fe7f36c0c8a2f233b07ff35c2b |
File details
Details for the file true_or_false-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: true_or_false-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.2 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 | a1dc7925e9ff15d4bf4697f7778d64d230e8ae2a6372be8aa653668e90725899 |
|
MD5 | 5eaa4aa61f1ae4fe995df89ea84b42a7 |
|
BLAKE2b-256 | 7636bf17a194012f99d686080a77cd2d72150a7eb74270fb2e609e7e02054535 |