A simple lightweight class that allows the user to fallback on default values
Installation
pip3 install --user dfault
Usage
Basic Example
from dfault.objects import Dfault
expected_values = {
"search_engine": "duckduckgo",
"website": "http://www.duckduckgo.com"
}
d = Dfault(expected_values)
d.get("search_engine", "google") # returns "duckduckgo" as the value exists
d.get("favourite_team", "leafs") # returns "leafs" as there are no values for "favourite_team"
With Config
import configparser
from dfault.objects import Dfault
config = configparser.ConfigParser()
# .config:
# [USER]
# team=leafs
#
config.read(".config")
default_config = config["user"]
d = Dfault(default_config)
d.get("team", "raptors") # returns "leafs" as the value exiss in the config
d.get("username", "joeyism") # returns "joeyism" as there is no "username" value in the config file
Versions
1.0.x
bug fixes
1.0.0
First Publish
Metadata
Release files for dfault 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dfault-1.0.5-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Release files / dfault-1.0.5-py2.py3-none-any.whl
| Download URL | dfault-1.0.5-py2.py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1b7250aac5754a07c27d4830c846b8a673c749e7e6eb8ff1fd4403c63f877fb0
|
|
BLAKE2b-256 checksum How to use checksums |
2efb6822b849f6a4bcc0bf3be0fd6427b3054602063bac990f9f51e648fce957
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |