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
Hashes for true_or_false-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa8007d2f15382b805d698918f7fecfd1b5e843a93cbfecf499c8bed46c303cf |
|
MD5 | 207b59817b09f1958290f8d08ab6ef2f |
|
BLAKE2b-256 | c326b96f248fa1192c2ee0851edcfe62705c0de5eab5e77ea698a96aba74c7ff |