empower-0.2.1
توضیحات
Goodbye Inheritance
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | empower-0.2.1 |
| نام | empower |
| نسخه کتابخانه | 0.2.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | ZhengYu, Xu |
| ایمیل نویسنده | zen-xu@outlook.com |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/empower/ |
| مجوز | Apache-2.0 |
# empower
Goodbye Inheritance!!!
## Install
```python
pip install empower
```
## Usage
You have a `Duck` class without any methods.
```python
# mod/__init__.py
class Duck:
...
```
You define a trait `Fly` for `Duck`
```python
# mod/fly.py
from empower import impl, Trait
from . import Duck
@impl(Duck)
class Fly(Trait):
def fly(self):
return "fly"
```
And you define another trait `Run` for `Duck`
```python
# mod/run.py
from empower import impl, Trait
from . import Duck
@impl(Duck)
class Run(Trait):
def run(self):
return "run"
```
Now you can add empower `Duck`
```python
# main.py
from mod import Duck
from empower import use
duck = Duck()
use("mod.fly") # load fly trait
use("mod.run") # load run trait
assert duck.fly() == "fly"
assert duck.run() == "run"
```
نیازمندی
| مقدار | نام |
|---|---|
| >=1.11,<2.0 | wrapt |
| >=7.1.3,<8.0.0 | pytest |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7,<4.0 | Python |
نحوه نصب
نصب پکیج whl empower-0.2.1:
pip install empower-0.2.1.whl
نصب پکیج tar.gz empower-0.2.1:
pip install empower-0.2.1.tar.gz