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.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

true_or_false-0.1.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: true_or_false-0.1.0.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-40-generic

File hashes

Hashes for true_or_false-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3f7cada4012d46b17a6609d54979973bcfacfd631393850c294d1ef8a5a9540b
MD5 7dc2bd6e94b2a239954ee55f8d14b832
BLAKE2b-256 8a4ca7c625dbe7c86f0db153297091f1d32f409464332bb1bebbd2e6c3196325

See more details on using hashes here.

File details

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

File metadata

  • Download URL: true_or_false-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.10 Linux/5.11.0-40-generic

File hashes

Hashes for true_or_false-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b0078de531870f57be56ac63fb523091f7bb1b938d98220805bdfaf32aed2cb
MD5 ff4db818d044a626319533a675a64d11
BLAKE2b-256 2b6d1dcb955481970ba36cda1b1a6a1cbc60a7a79df008d3d5d90123ce929068

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