defaultsob-0.3.0
توضیحات
A simple package to create data structures with defaultsob
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | defaultsob-0.3.0 |
| نام | defaultsob |
| نسخه کتابخانه | 0.3.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Hone Watson |
| ایمیل نویسنده | comments@hone.be |
| آدرس صفحه اصلی | https://github.com/honewatson/defaultsob |
| آدرس اینترنتی | https://pypi.org/project/defaultsob/ |
| مجوز | ISCL |
===============================
defaultsob
===============================
.. image:: https://img.shields.io/travis/honewatson/defaultsob.svg
:target: https://travis-ci.org/honewatson/defaultsob
.. image:: https://img.shields.io/pypi/v/defaultsob.svg
:target: https://pypi.python.org/pypi/defaultsob
A simple package to create data structures with defaults and strict limitations of attributes/properties.
* Free software: ISC license
* Documentation: https://defaultsob.readthedocs.org.
Features
--------
.. code-block:: python
class User(Defaults):
__slots__ = [
"name",
"description",
"an_attribte_with_no_default"
]
"""
usef will use the 'name' attribute
if the description attribute is not
set at the time of object creation
"""
description = usef('name')
user = User(name='Billy')
"""
.to_dict_clean method returns a
dictionary of attributes with values
"""
print(user.to_dict_clean())
{
"name": "Billy",
"description": "Billy"
}
user.description = "Something Else"
user.an_attribute_with_no_default = "Another"
print(user.to_dict_clean())
{
"name": "Billy",
"description": "Something Else"
"an_attribute_with_no_default": "Another"
}
user2 = User(name="Billy", description="The Kid")
print(user2.to_dict_clean())
{
"name": "Billy",
"description": "The Kid"
}
History
-------
0.1.0 (2015-01-11)
---------------------
* First release on PyPI.
نحوه نصب
نصب پکیج whl defaultsob-0.3.0:
pip install defaultsob-0.3.0.whl
نصب پکیج tar.gz defaultsob-0.3.0:
pip install defaultsob-0.3.0.tar.gz