面向切面编程
项目描述
# 建议
[面向切面编程](https://en.wikipedia.org/wiki/Aspect-oriented_programming)
## TODO
1. 修复星号导入
1. 补丁已导入的对象 (`patch_project`)
## 使用方法
```python
import aop
def multiply(context)
print(context.args)
print(context.kwargs)
yield
context.result *= 100
aop.register(
handler=multiply,
modules=aop.match(equals='math'),
targets=aop.match(regexp='(sin|cos)')
)
```
Ok, let's check
```python
In [2]: import math
In [3]: math.cos(0)
(0,)
{}
Out[3]: 100.0
```
[面向切面编程](https://en.wikipedia.org/wiki/Aspect-oriented_programming)
## TODO
1. 修复星号导入
1. 补丁已导入的对象 (`patch_project`)
## 使用方法
```python
import aop
def multiply(context)
print(context.args)
print(context.kwargs)
yield
context.result *= 100
aop.register(
handler=multiply,
modules=aop.match(equals='math'),
targets=aop.match(regexp='(sin|cos)')
)
```
Ok, let's check
```python
In [2]: import math
In [3]: math.cos(0)
(0,)
{}
Out[3]: 100.0
```
项目详情
关闭
aop-0.2.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 2bb26687689e115307fc06264867528181798d5d00982412e1aeb1f387159ac4 |
|
MD5 | c8ff428684a7818253f7e841c8831305 |
|
BLAKE2b-256 | d452535986e3568ac6f14737e272b65d7eae99beb586bf1b88457ef805df34fc |