ProjectName
ProjectName and Description
"优雅的if-else替换"
优化并美观你的if-else
探索本项目的文档 »
查看Demo
·
报告Bug
·
提出新特性
目录
文件目录说明
conditionevaluatortool
├── /conditionevaluator/
│ ├── __init__.py
│ ├── conditionevaluator.py
├── /test/
│ ├── __init__.py
│ ├── test.py
├── README.md
└── setup.py
上手指南
环境要求
- Python 3.7.0
安装依赖包
- pip install conditionevaluator
使用步骤
1.在需要做多条件判断的函数中引入装饰器
import conditionevaluator
@conditionevaluator
def doorType(door):
"""
条件1
:param door: 门类型 2 --> 双开门
:return: bool
"""
return "门类型错误"
2.其他函数调用
@doorType.register(1)
def params_door_type_1(door):
"""
条件1
:param door:
:return: False
"""
count = 1
return count
@doorType.register(2)
def params_door_type_2(door):
"""
条件2
:param door:
:return: True
"""
count = 2
return count
3.测试
if __name__ == '__main__':
print(params_door_type_2(1))
# 结果输出
>>> 2
使用到的框架
暂无
版本控制
该项目使用Git进行版本管理。您可以在repository参看当前可用版本。
作者
cywhat
- 🔗个人博客
鸣谢
Metadata
Release files for conditionevaluator 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| conditionevaluator-1.0.1.tar.gz | 4.1 kB | Details |
Release files / conditionevaluator-1.0.1.tar.gz
| Download URL | conditionevaluator-1.0.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ffd59b24fdae40f67dd2bbe653363952614542408af6a8d4a442c9874b43d7e
|
|
BLAKE2b-256 checksum How to use checksums |
1ea2f1b303dc1841b3dac56c0fde85377e98ec0a7d8c5bd9df72821dc5522543
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.0
|