Skip to main content

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

true_or_false-0.1.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

true_or_false-0.1.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file true_or_false-0.1.1.tar.gz.

File metadata

  • Download URL: true_or_false-0.1.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.10 Linux/5.11.0-41-generic

File hashes

Hashes for true_or_false-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b9cfc20b5e5692550f5649199a0f3e12863553f47f1d3d7cfcc556c6e7b3a369
MD5 0459b85703ed7f5c2bb1c0c141fc303d
BLAKE2b-256 413730566477f19ffa9dc5204d185304aa55aa13a50954a7fad316e5a7ce96a6

See more details on using hashes here.

File details

Details for the file true_or_false-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: true_or_false-0.1.1-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.11.0-41-generic

File hashes

Hashes for true_or_false-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 221744351be991ab697cfcb5316f5f672bec06609d2004300e805137a041bacd
MD5 f685caa57b5dc7e356e4e14fa7ac0f12
BLAKE2b-256 386ab376a452a3becc68c192981d744c4b854075cd397950aa22d5951a293489

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page