# ProjectName
ProjectName and Description
<!-- PROJECT SHIELDS -->
[![Contributors][contributors-cywhat]][contributors-url]
[![Forks][forks-cywhat]][forks-url]
[![Stargazers][stars-cywhat]][stars-url]
[![Issues][issues-cywhat]][issues-url]
[![MIT License][license-cywhat]][license-url]
<!-- PROJECT LOGO -->
<br />
<p align="center">
<a href="https://github.com/chaoyangya/conditionevaluator/">
<img src="images/logo.png" alt="Logo" width="80" height="80">
</a>
<h3 align="center">"优雅的if-else替换"</h3>
<p align="center">
优化并美观你的if-else
<br />
<a href="https://github.com/chaoyangya/conditionevaluator"><strong>探索本项目的文档 »</strong></a>
<br />
<br />
<a href="https://github.com/chaoyangya/conditionevaluator">查看Demo</a>
·
<a href="https://github.com/chaoyangya/conditionevaluator/issues">报告Bug</a>
·
<a href="https://github.com/chaoyangya/conditionevaluator/issues">提出新特性</a>
</p>
</p>
## 目录
- [文件目录说明](#文件目录说明)
- [上手指南](#上手指南)
- [环境要求](#环境要求)
- [安装依赖包](#安装依赖包)
- [1.在需要做多条件判断的函数中引入装饰器](#1.在需要做多条件判断的函数中引入装饰器)
- [2.其他函数调用](#2.其他函数调用)
- [3.测试](#3.测试)
- [使用到的框架](#使用到的框架)
- [版本控制](#版本控制)
- [作者](#作者)
- [鸣谢](#鸣谢)
### 文件目录说明
```
conditionevaluatortool
├── /conditionevaluator/
│ ├── __init__.py
│ ├── conditionevaluator.py
├── /test/
│ ├── __init__.py
│ ├── test.py
├── README.md
└── setup.py
```
### 上手指南
###### 环境要求
1. Python 3.7.0
###### 安装依赖包
1. pip install conditionevaluator
###### 使用步骤
###### 1.在需要做多条件判断的函数中引入装饰器
```python
import conditionevaluator
@conditionevaluator
def doorType(door):
"""
条件1
:param door: 门类型 2 --> 双开门
:return: bool
"""
return "门类型错误"
```
###### 2.其他函数调用
```python
@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.测试
```python
if __name__ == '__main__':
print(params_door_type_2(1))
# 结果输出
>>> 2
```
### 使用到的框架
暂无
### 版本控制
该项目使用Git进行版本管理。您可以在repository参看当前可用版本。
### 作者
cywhat
[![blog][contributors-cywhat]][blog-url]
- 🔗[个人博客](https://cywhat.cn)
### 鸣谢
- [GitHub Emoji Cheat Sheet](https://www.webpagefx.com/tools/emoji-cheat-sheet)
- [Img Shields](https://shields.io)
- [Choose an Open Source License](https://choosealicense.com)
- [GitHub Pages](https://pages.github.com)
- [edgedb](https://github.com/edgedb/edgedb)
<!-- links -->
[your-project-path]:chaoyangya/conditionevaluator
[contributors-cywhat]: https://img.shields.io/github/contributors/chaoyangya/conditionevaluator.svg?style=flat-square
[contributors-url]: https://github.com/chaoyangya/conditionevaluator/graphs/contributors
[forks-cywhat]: https://img.shields.io/github/forks/chaoyangya/conditionevaluator.svg?style=flat-square
[forks-url]: https://github.com/chaoyangya/conditionevaluator/network/members
[stars-cywhat]: https://img.shields.io/github/stars/chaoyangya/conditionevaluator.svg?style=flat-square
[stars-url]: https://github.com/chaoyangya/conditionevaluator/stargazers
[issues-cywhat]: https://img.shields.io/github/issues/chaoyangya/conditionevaluator.svg?style=flat-square
[issues-url]: https://img.shields.io/github/issues/chaoyangya/conditionevaluator.svg
[license-cywhat]: https://img.shields.io/github/license/chaoyangya/conditionevaluator.svg?style=flat-square
[license-url]: https://github.com/chaoyangya/conditionevaluator/blob/master/LICENSE.txt
[blog-url]:https://cywhat.cn
Raw data
{
"_id": null,
"home_page": "https://github.com/chaoyangya/conditionevaluator",
"name": "conditionevaluator",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "conditionevaluator,conditionevaluator_python",
"author": "cy what",
"author_email": "45204307@qq.com",
"download_url": "https://files.pythonhosted.org/packages/1e/a2/f1b303dc1841b3dac56c0fde85377e98ec0a7d8c5bd9df72821dc5522543/conditionevaluator-1.0.1.tar.gz",
"platform": null,
"description": "# ProjectName\n\nProjectName and Description\n\n<!-- PROJECT SHIELDS -->\n\n[![Contributors][contributors-cywhat]][contributors-url]\n[![Forks][forks-cywhat]][forks-url]\n[![Stargazers][stars-cywhat]][stars-url]\n[![Issues][issues-cywhat]][issues-url]\n[![MIT License][license-cywhat]][license-url]\n\n<!-- PROJECT LOGO -->\n<br />\n\n<p align=\"center\">\n <a href=\"https://github.com/chaoyangya/conditionevaluator/\">\n <img src=\"images/logo.png\" alt=\"Logo\" width=\"80\" height=\"80\">\n </a>\n\n<h3 align=\"center\">\"\u4f18\u96c5\u7684if-else\u66ff\u6362\"</h3>\n <p align=\"center\">\n \u4f18\u5316\u5e76\u7f8e\u89c2\u4f60\u7684if-else\n <br />\n <a href=\"https://github.com/chaoyangya/conditionevaluator\"><strong>\u63a2\u7d22\u672c\u9879\u76ee\u7684\u6587\u6863 \u00bb</strong></a>\n <br />\n <br />\n <a href=\"https://github.com/chaoyangya/conditionevaluator\">\u67e5\u770bDemo</a>\n \u00b7\n <a href=\"https://github.com/chaoyangya/conditionevaluator/issues\">\u62a5\u544aBug</a>\n \u00b7\n <a href=\"https://github.com/chaoyangya/conditionevaluator/issues\">\u63d0\u51fa\u65b0\u7279\u6027</a>\n </p>\n\n</p>\n\n## \u76ee\u5f55\n\n- [\u6587\u4ef6\u76ee\u5f55\u8bf4\u660e](#\u6587\u4ef6\u76ee\u5f55\u8bf4\u660e)\n- [\u4e0a\u624b\u6307\u5357](#\u4e0a\u624b\u6307\u5357)\n - [\u73af\u5883\u8981\u6c42](#\u73af\u5883\u8981\u6c42)\n - [\u5b89\u88c5\u4f9d\u8d56\u5305](#\u5b89\u88c5\u4f9d\u8d56\u5305)\n - [1.\u5728\u9700\u8981\u505a\u591a\u6761\u4ef6\u5224\u65ad\u7684\u51fd\u6570\u4e2d\u5f15\u5165\u88c5\u9970\u5668](#1.\u5728\u9700\u8981\u505a\u591a\u6761\u4ef6\u5224\u65ad\u7684\u51fd\u6570\u4e2d\u5f15\u5165\u88c5\u9970\u5668)\n - [2.\u5176\u4ed6\u51fd\u6570\u8c03\u7528](#2.\u5176\u4ed6\u51fd\u6570\u8c03\u7528)\n - [3.\u6d4b\u8bd5](#3.\u6d4b\u8bd5)\n- [\u4f7f\u7528\u5230\u7684\u6846\u67b6](#\u4f7f\u7528\u5230\u7684\u6846\u67b6)\n- [\u7248\u672c\u63a7\u5236](#\u7248\u672c\u63a7\u5236)\n- [\u4f5c\u8005](#\u4f5c\u8005)\n- [\u9e23\u8c22](#\u9e23\u8c22)\n\n### \u6587\u4ef6\u76ee\u5f55\u8bf4\u660e\n\n```\nconditionevaluatortool \n\u251c\u2500\u2500 /conditionevaluator/\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 conditionevaluator.py\n\u251c\u2500\u2500 /test/\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 test.py\n\u251c\u2500\u2500 README.md\n\u2514\u2500\u2500 setup.py\n\n```\n\n### \u4e0a\u624b\u6307\u5357\n\n###### \u73af\u5883\u8981\u6c42\n\n1. Python 3.7.0\n\n###### \u5b89\u88c5\u4f9d\u8d56\u5305\n\n1. pip install conditionevaluator\n\n###### \u4f7f\u7528\u6b65\u9aa4\n\n###### 1.\u5728\u9700\u8981\u505a\u591a\u6761\u4ef6\u5224\u65ad\u7684\u51fd\u6570\u4e2d\u5f15\u5165\u88c5\u9970\u5668\n\n```python\nimport conditionevaluator\n\n\n@conditionevaluator\ndef doorType(door):\n \"\"\"\n \u6761\u4ef61\n :param door: \u95e8\u7c7b\u578b 2 --> \u53cc\u5f00\u95e8\n :return: bool\n \"\"\"\n return \"\u95e8\u7c7b\u578b\u9519\u8bef\"\n```\n\n###### 2.\u5176\u4ed6\u51fd\u6570\u8c03\u7528\n\n```python\n@doorType.register(1)\ndef params_door_type_1(door):\n \"\"\"\n \u6761\u4ef61\n :param door:\n :return: False\n \"\"\"\n count = 1\n return count\n\n\n@doorType.register(2)\ndef params_door_type_2(door):\n \"\"\"\n \u6761\u4ef62\n :param door:\n :return: True\n \"\"\"\n count = 2\n return count\n```\n\n###### 3.\u6d4b\u8bd5\n\n```python\nif __name__ == '__main__':\n print(params_door_type_2(1))\n\n# \u7ed3\u679c\u8f93\u51fa\n>>> 2\n```\n\n\n### \u4f7f\u7528\u5230\u7684\u6846\u67b6\n\n\u6682\u65e0\n\n\n### \u7248\u672c\u63a7\u5236\n\n\u8be5\u9879\u76ee\u4f7f\u7528Git\u8fdb\u884c\u7248\u672c\u7ba1\u7406\u3002\u60a8\u53ef\u4ee5\u5728repository\u53c2\u770b\u5f53\u524d\u53ef\u7528\u7248\u672c\u3002\n\n### \u4f5c\u8005\n\ncywhat\n\n\n[![blog][contributors-cywhat]][blog-url]\n\n- \ud83d\udd17[\u4e2a\u4eba\u535a\u5ba2](https://cywhat.cn)\n\n### \u9e23\u8c22\n\n- [GitHub Emoji Cheat Sheet](https://www.webpagefx.com/tools/emoji-cheat-sheet)\n- [Img Shields](https://shields.io)\n- [Choose an Open Source License](https://choosealicense.com)\n- [GitHub Pages](https://pages.github.com)\n- [edgedb](https://github.com/edgedb/edgedb)\n\n<!-- links -->\n\n[your-project-path]:chaoyangya/conditionevaluator\n\n[contributors-cywhat]: https://img.shields.io/github/contributors/chaoyangya/conditionevaluator.svg?style=flat-square\n\n[contributors-url]: https://github.com/chaoyangya/conditionevaluator/graphs/contributors\n\n[forks-cywhat]: https://img.shields.io/github/forks/chaoyangya/conditionevaluator.svg?style=flat-square\n\n[forks-url]: https://github.com/chaoyangya/conditionevaluator/network/members\n\n[stars-cywhat]: https://img.shields.io/github/stars/chaoyangya/conditionevaluator.svg?style=flat-square\n\n[stars-url]: https://github.com/chaoyangya/conditionevaluator/stargazers\n\n[issues-cywhat]: https://img.shields.io/github/issues/chaoyangya/conditionevaluator.svg?style=flat-square\n\n[issues-url]: https://img.shields.io/github/issues/chaoyangya/conditionevaluator.svg\n\n[license-cywhat]: https://img.shields.io/github/license/chaoyangya/conditionevaluator.svg?style=flat-square\n\n[license-url]: https://github.com/chaoyangya/conditionevaluator/blob/master/LICENSE.txt\n\n[blog-url]:https://cywhat.cn",
"bugtrack_url": null,
"license": "conditionevaluator",
"summary": "Package of modules that encapsulate the if else multi-condition judgment",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/chaoyangya/conditionevaluator"
},
"split_keywords": [
"conditionevaluator",
"conditionevaluator_python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1ea2f1b303dc1841b3dac56c0fde85377e98ec0a7d8c5bd9df72821dc5522543",
"md5": "f99f34f12c9c962afab276122e5d5ef4",
"sha256": "4ffd59b24fdae40f67dd2bbe653363952614542408af6a8d4a442c9874b43d7e"
},
"downloads": -1,
"filename": "conditionevaluator-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "f99f34f12c9c962afab276122e5d5ef4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4115,
"upload_time": "2023-05-25T09:34:10",
"upload_time_iso_8601": "2023-05-25T09:34:10.535516Z",
"url": "https://files.pythonhosted.org/packages/1e/a2/f1b303dc1841b3dac56c0fde85377e98ec0a7d8c5bd9df72821dc5522543/conditionevaluator-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-25 09:34:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "chaoyangya",
"github_project": "conditionevaluator",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "conditionevaluator"
}