dfault-1.0.5
توضیحات
A simple lightweight class that allows the user to fallback on default values
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | dfault-1.0.5 |
| نام | dfault |
| نسخه کتابخانه | 1.0.5 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Joey Sham |
| ایمیل نویسنده | sham.joey@gmail.com |
| آدرس صفحه اصلی | http://www.joeyism.com |
| آدرس اینترنتی | https://pypi.org/project/dfault/ |
| مجوز | - |
Dfault
======
A simple lightweight class that allows the user to fallback on default
values
Installation
------------
.. code:: bash
pip3 install --user dfault
Usage
-----
Basic Example
~~~~~~~~~~~~~
.. code:: python
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
~~~~~~~~~~~
.. code:: python
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
نحوه نصب
نصب پکیج whl dfault-1.0.5:
pip install dfault-1.0.5.whl
نصب پکیج tar.gz dfault-1.0.5:
pip install dfault-1.0.5.tar.gz