Skip to main content

Provides fallback for operations in python

Project description

pyfallback

Install

pip install fallback

Usage

from pyfallback import Fallback

json = {
    'attr-1': 'value-1',
}
json = Fallback(json, fallback="default")

# fallback
json["attr-1"].get()  # "value1"
json["attr-2"].get()  # "default"

# chaining
json["attr-1"].split('-')[0].get()  # "value"

# see tests/test_fallback.py for more example 

Contributing

Just submit a pull request :D
Note: this project uses poetry and pyenv

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

pyfallback-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

pyfallback-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyfallback-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.9 Windows/10

File hashes

Hashes for pyfallback-0.1.0.tar.gz
Algorithm Hash digest
SHA256 19172d17a43cbadd725e6e133c4bd4802ccf5132bf1becb14031b0b116765729
MD5 f5142b2ce5749716f06b4778ae6fd3f7
BLAKE2b-256 ed68d2b6fdf546c86c4026f92bd6027945fb3e67aba3f805f5e9603ed92f9d7d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyfallback-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.9 Windows/10

File hashes

Hashes for pyfallback-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b83a08240f91bdbd3c4799ec2a3217579d3f0a7fa8b437ad860848e84a1c7883
MD5 bf96536f032f2d020909153eaba0b7c5
BLAKE2b-256 f1addcd478fdd41dae9441ec30220ecb49f68b0cdc11b04ac0ba5b076b524bf4

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